(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/misc/completion#completion::t
    (make-struct-type
     'std/misc/completion#completion::t
     '#f
     '5
     'completion
     '((final: . #t))
     ':init!
     '(mx cv ready? val exn)))
  (define std/misc/completion#completion?
    (make-struct-predicate std/misc/completion#completion::t))
  (define std/misc/completion#make-completion
    (lambda _$args856_
      (apply make-struct-instance
             std/misc/completion#completion::t
             _$args856_)))
  (define std/misc/completion#completion-mx
    (make-struct-field-accessor std/misc/completion#completion::t '0))
  (define std/misc/completion#completion-cv
    (make-struct-field-accessor std/misc/completion#completion::t '1))
  (define std/misc/completion#completion-ready?
    (make-struct-field-accessor std/misc/completion#completion::t '2))
  (define std/misc/completion#completion-val
    (make-struct-field-accessor std/misc/completion#completion::t '3))
  (define std/misc/completion#completion-exn
    (make-struct-field-accessor std/misc/completion#completion::t '4))
  (define std/misc/completion#completion-mx-set!
    (make-struct-field-mutator std/misc/completion#completion::t '0))
  (define std/misc/completion#completion-cv-set!
    (make-struct-field-mutator std/misc/completion#completion::t '1))
  (define std/misc/completion#completion-ready?-set!
    (make-struct-field-mutator std/misc/completion#completion::t '2))
  (define std/misc/completion#completion-val-set!
    (make-struct-field-mutator std/misc/completion#completion::t '3))
  (define std/misc/completion#completion-exn-set!
    (make-struct-field-mutator std/misc/completion#completion::t '4))
  (define std/misc/completion#&completion-mx
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '0))
  (define std/misc/completion#&completion-cv
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '1))
  (define std/misc/completion#&completion-ready?
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '2))
  (define std/misc/completion#&completion-val
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '3))
  (define std/misc/completion#&completion-exn
    (make-struct-field-unchecked-accessor
     std/misc/completion#completion::t
     '4))
  (define std/misc/completion#&completion-mx-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '0))
  (define std/misc/completion#&completion-cv-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '1))
  (define std/misc/completion#&completion-ready?-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '2))
  (define std/misc/completion#&completion-val-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '3))
  (define std/misc/completion#&completion-exn-set!
    (make-struct-field-unchecked-mutator std/misc/completion#completion::t '4))
  (define std/misc/completion#completion:::init!
    (lambda (_self854_)
      (if (let ((__tmp4456
                 (let () (declare (not safe)) (##vector-length _self854_))))
            (declare (not safe))
            (##fx< '2 __tmp4456))
          (begin
            (let ((__tmp4457 (make-mutex 'completion)))
              (declare (not safe))
              (##vector-set! _self854_ '1 __tmp4457))
            (let ((__tmp4458 (make-condition-variable 'completion)))
              (declare (not safe))
              (##vector-set! _self854_ '2 __tmp4458)))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self854_))))
  (bind-method!
   std/misc/completion#completion::t
   ':init!
   std/misc/completion#completion:::init!
   '#f)
  (define std/misc/completion#completion-wait!
    (lambda (_compl695_)
      (let* ((_compl696703_ _compl695_)
             (_E698707_
              (lambda () (error '"No clause matching" _compl696703_)))
             (_K699719_
              (lambda (_cv710_ _mx711_)
                (let _lp713_ ()
                  (mutex-lock! _mx711_)
                  (if (let ()
                        (declare (not safe))
                        (##unchecked-structure-ref
                         _compl695_
                         '3
                         std/misc/completion#completion::t
                         '#f))
                      (begin
                        (mutex-unlock! _mx711_)
                        (let ((_$e716_ (let ()
                                         (declare (not safe))
                                         (##unchecked-structure-ref
                                          _compl695_
                                          '5
                                          std/misc/completion#completion::t
                                          '#f))))
                          (if _$e716_
                              (raise _$e716_)
                              (let ()
                                (declare (not safe))
                                (##unchecked-structure-ref
                                 _compl695_
                                 '4
                                 std/misc/completion#completion::t
                                 '#f)))))
                      (begin (mutex-unlock! _mx711_ _cv710_) (_lp713_)))))))
        (if (let ()
              (declare (not safe))
              (##structure-direct-instance-of?
               _compl696703_
               'std/misc/completion#completion::t))
            (let* ((_e700722_
                    (let ()
                      (declare (not safe))
                      (##vector-ref _compl696703_ '1)))
                   (_mx725_ _e700722_)
                   (_e701727_
                    (let ()
                      (declare (not safe))
                      (##vector-ref _compl696703_ '2)))
                   (_cv730_ _e701727_))
              (_K699719_ _cv730_ _mx725_))
            (_E698707_)))))
  (define std/misc/completion#completion-post!
    (lambda (_compl661_ _val662_)
      (let* ((_compl663670_ _compl661_)
             (_E665674_
              (lambda () (error '"No clause matching" _compl663670_)))
             (_K666682_
              (lambda (_cv677_ _mx679_)
                (mutex-lock! _mx679_)
                (if (let ()
                      (declare (not safe))
                      (##unchecked-structure-ref
                       _compl661_
                       '3
                       std/misc/completion#completion::t
                       '#f))
                    (begin
                      (mutex-unlock! _mx679_)
                      (error '"Completion has already been posted" _compl661_))
                    (begin
                      (let ()
                        (declare (not safe))
                        (##unchecked-structure-set!
                         _compl661_
                         _val662_
                         '4
                         std/misc/completion#completion::t
                         '#f))
                      (let ()
                        (declare (not safe))
                        (##unchecked-structure-set!
                         _compl661_
                         '#t
                         '3
                         std/misc/completion#completion::t
                         '#f))
                      (mutex-unlock! _mx679_)
                      (condition-variable-broadcast! _cv677_)
                      '#!void)))))
        (if (let ()
              (declare (not safe))
              (##structure-direct-instance-of?
               _compl663670_
               'std/misc/completion#completion::t))
            (let* ((_e667685_
                    (let ()
                      (declare (not safe))
                      (##vector-ref _compl663670_ '1)))
                   (_mx688_ _e667685_)
                   (_e668690_
                    (let ()
                      (declare (not safe))
                      (##vector-ref _compl663670_ '2)))
                   (_cv693_ _e668690_))
              (_K666682_ _cv693_ _mx688_))
            (_E665674_)))))
  (define std/misc/completion#completion-error!
    (lambda (_compl627_ _exn628_)
      (let* ((_compl629636_ _compl627_)
             (_E631640_
              (lambda () (error '"No clause matching" _compl629636_)))
             (_K632648_
              (lambda (_cv643_ _mx645_)
                (mutex-lock! _mx645_)
                (if (let ()
                      (declare (not safe))
                      (##unchecked-structure-ref
                       _compl627_
                       '3
                       std/misc/completion#completion::t
                       '#f))
                    (begin
                      (mutex-unlock! _mx645_)
                      (error '"Completion has already been posted" _compl627_))
                    (begin
                      (let ()
                        (declare (not safe))
                        (##unchecked-structure-set!
                         _compl627_
                         _exn628_
                         '5
                         std/misc/completion#completion::t
                         '#f))
                      (let ()
                        (declare (not safe))
                        (##unchecked-structure-set!
                         _compl627_
                         '#t
                         '3
                         std/misc/completion#completion::t
                         '#f))
                      (mutex-unlock! _mx645_)
                      (condition-variable-broadcast! _cv643_)
                      '#!void)))))
        (if (let ()
              (declare (not safe))
              (##structure-direct-instance-of?
               _compl629636_
               'std/misc/completion#completion::t))
            (let* ((_e633651_
                    (let ()
                      (declare (not safe))
                      (##vector-ref _compl629636_ '1)))
                   (_mx654_ _e633651_)
                   (_e634656_
                    (let ()
                      (declare (not safe))
                      (##vector-ref _compl629636_ '2)))
                   (_cv659_ _e634656_))
              (_K632648_ _cv659_ _mx654_))
            (_E631640_))))))
