(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/amb#amb-exhausted (lambda () (error '"AMB tree exhausted")))
  (define std/amb#amb-fail (make-parameter std/amb#amb-exhausted))
  (define std/amb#amb-do
    (lambda (_thunks992_)
      (let ((_fail994_ (std/amb#amb-fail)))
        (call-with-current-continuation
         (lambda (_return996_)
           (let _loop998_ ((_rest1000_ (std/misc/shuffle#shuffle _thunks992_)))
             (let* ((_rest10011009_ _rest1000_)
                    (_else10031017_
                     (lambda () (std/amb#amb-fail _fail994_) (_fail994_)))
                    (_K10051024_
                     (lambda (_rest1020_ _thunk1021_)
                       (std/amb#amb-fail (lambda () (_loop998_ _rest1020_)))
                       (_return996_ (_thunk1021_)))))
               (if (let () (declare (not safe)) (##pair? _rest10011009_))
                   (let ((_hd10061027_
                          (let () (declare (not safe)) (##car _rest10011009_)))
                         (_tl10071029_
                          (let ()
                            (declare (not safe))
                            (##cdr _rest10011009_))))
                     (let* ((_thunk1032_ _hd10061027_)
                            (_rest1034_ _tl10071029_))
                       (_K10051024_ _rest1034_ _thunk1032_)))
                   (_else10031017_)))))))))
  (define std/amb#amb-do-find__%
    (lambda (_thunk973_ _failure974_)
      (call-with-current-continuation
       (lambda (_return976_)
         (let ((_fail979_ (lambda () (_return976_ (_failure974_)))))
           (call-with-parameters
            (lambda () (_thunk973_))
            std/amb#amb-fail
            _fail979_))))))
  (define std/amb#amb-do-find__0
    (lambda (_thunk985_)
      (let ((_failure987_ std/amb#amb-exhausted))
        (std/amb#amb-do-find__% _thunk985_ _failure987_))))
  (define std/amb#amb-do-find
    (lambda _g4735_
      (let ((_g4734_ (let () (declare (not safe)) (##length _g4735_))))
        (cond ((let () (declare (not safe)) (##fx= _g4734_ 1))
               (apply std/amb#amb-do-find__0 _g4735_))
              ((let () (declare (not safe)) (##fx= _g4734_ 2))
               (apply std/amb#amb-do-find__% _g4735_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/amb#amb-do-find
                _g4735_))))))
  (define std/amb#amb-do-collect
    (lambda (_thunk955_)
      (let ((_fail957_ '#f))
        (dynamic-wind
         (lambda () (set! _fail957_ (std/amb#amb-fail)))
         (lambda ()
           (call-with-current-continuation
            (lambda (_return961_)
              (let* ((_root963_ (cons '#f '())) (_hd965_ _root963_))
                (std/amb#amb-fail (lambda () (_return961_ (cdr _root963_))))
                (let ((_tl969_ (cons (_thunk955_) '())))
                  (set-cdr! _hd965_ _tl969_)
                  (set! _hd965_ _tl969_))
                ((std/amb#amb-fail))))))
         (lambda () (std/amb#amb-fail _fail957_)))))))
