(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/misc/barrier#barrier::t
    (make-struct-type
     'std/misc/barrier#barrier::t
     '#f
     '5
     'barrier
     '((final: . #t))
     ':init!
     '(mx cv count limit exn)))
  (define std/misc/barrier#barrier?
    (make-struct-predicate std/misc/barrier#barrier::t))
  (define std/misc/barrier#make-barrier
    (lambda _$args784_
      (apply make-struct-instance std/misc/barrier#barrier::t _$args784_)))
  (define std/misc/barrier#barrier-mx
    (make-struct-field-accessor std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#barrier-cv
    (make-struct-field-accessor std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#barrier-count
    (make-struct-field-accessor std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#barrier-limit
    (make-struct-field-accessor std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#barrier-exn
    (make-struct-field-accessor std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#barrier-mx-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#barrier-cv-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#barrier-count-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#barrier-limit-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#barrier-exn-set!
    (make-struct-field-mutator std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#&barrier-mx
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#&barrier-cv
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#&barrier-count
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#&barrier-limit
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#&barrier-exn
    (make-struct-field-unchecked-accessor std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#&barrier-mx-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '0))
  (define std/misc/barrier#&barrier-cv-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '1))
  (define std/misc/barrier#&barrier-count-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '2))
  (define std/misc/barrier#&barrier-limit-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '3))
  (define std/misc/barrier#&barrier-exn-set!
    (make-struct-field-unchecked-mutator std/misc/barrier#barrier::t '4))
  (define std/misc/barrier#barrier:::init!
    (lambda (_self781_ _limit782_)
      (if (and (fixnum? _limit782_)
               (let () (declare (not safe)) (##fx>= _limit782_ '0)))
          '#!void
          (error '"Invalid argument; expected positive fixnum" _limit782_))
      (if (let ((__tmp4384
                 (let () (declare (not safe)) (##vector-length _self781_))))
            (declare (not safe))
            (##fx< '4 __tmp4384))
          (begin
            (let ((__tmp4385 (make-mutex 'barrier)))
              (declare (not safe))
              (##vector-set! _self781_ '1 __tmp4385))
            (let ((__tmp4386 (make-condition-variable 'barrier)))
              (declare (not safe))
              (##vector-set! _self781_ '2 __tmp4386))
            (let () (declare (not safe)) (##vector-set! _self781_ '3 '0))
            (let ()
              (declare (not safe))
              (##vector-set! _self781_ '4 _limit782_)))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self781_))))
  (bind-method!
   std/misc/barrier#barrier::t
   ':init!
   std/misc/barrier#barrier:::init!
   '#f)
  (define std/misc/barrier#barrier-wait!
    (lambda (_b607_)
      (let* ((_b608617_ _b607_)
             (_E610621_ (lambda () (error '"No clause matching" _b608617_)))
             (_K611638_
              (lambda (_limit624_ _cv625_ _mx626_)
                (let _lp628_ ()
                  (mutex-lock! _mx626_)
                  (let* ((_count631_
                          (let ()
                            (declare (not safe))
                            (##unchecked-structure-ref
                             _b607_
                             '3
                             std/misc/barrier#barrier::t
                             '#f)))
                         (_$e633_ (let ()
                                    (declare (not safe))
                                    (##unchecked-structure-ref
                                     _b607_
                                     '5
                                     std/misc/barrier#barrier::t
                                     '#f))))
                    (if _$e633_
                        ((lambda (_exn636_)
                           (mutex-unlock! _mx626_)
                           (raise _exn636_))
                         _$e633_)
                        (if (let ()
                              (declare (not safe))
                              (##fx< _count631_ _limit624_))
                            (begin (mutex-unlock! _mx626_ _cv625_) (_lp628_))
                            (begin (mutex-unlock! _mx626_) '#!void))))))))
        (if (let ()
              (declare (not safe))
              (##structure-direct-instance-of?
               _b608617_
               'std/misc/barrier#barrier::t))
            (let* ((_e612641_
                    (let () (declare (not safe)) (##vector-ref _b608617_ '1)))
                   (_mx644_ _e612641_)
                   (_e613646_
                    (let () (declare (not safe)) (##vector-ref _b608617_ '2)))
                   (_cv649_ _e613646_)
                   (_e614651_
                    (let () (declare (not safe)) (##vector-ref _b608617_ '3)))
                   (_e615654_
                    (let () (declare (not safe)) (##vector-ref _b608617_ '4)))
                   (_limit657_ _e615654_))
              (_K611638_ _limit657_ _cv649_ _mx644_))
            (_E610621_)))))
  (define std/misc/barrier#barrier-post!
    (lambda (_b560_)
      (let* ((_b561570_ _b560_)
             (_E563574_ (lambda () (error '"No clause matching" _b561570_)))
             (_K564586_
              (lambda (_limit577_ _cv578_ _mx579_)
                (mutex-lock! _mx579_)
                (let* ((_count581_
                        (let ()
                          (declare (not safe))
                          (##unchecked-structure-ref
                           _b560_
                           '3
                           std/misc/barrier#barrier::t
                           '#f)))
                       (_count+1583_
                        (let () (declare (not safe)) (##fx+ _count581_ '1))))
                  (let ()
                    (declare (not safe))
                    (##unchecked-structure-set!
                     _b560_
                     _count+1583_
                     '3
                     std/misc/barrier#barrier::t
                     '#f))
                  (if (let ()
                        (declare (not safe))
                        (##fx< _count+1583_ _limit577_))
                      '#!void
                      (condition-variable-broadcast! _cv578_))
                  (mutex-unlock! _mx579_)))))
        (if (let ()
              (declare (not safe))
              (##structure-direct-instance-of?
               _b561570_
               'std/misc/barrier#barrier::t))
            (let* ((_e565589_
                    (let () (declare (not safe)) (##vector-ref _b561570_ '1)))
                   (_mx592_ _e565589_)
                   (_e566594_
                    (let () (declare (not safe)) (##vector-ref _b561570_ '2)))
                   (_cv597_ _e566594_)
                   (_e567599_
                    (let () (declare (not safe)) (##vector-ref _b561570_ '3)))
                   (_e568602_
                    (let () (declare (not safe)) (##vector-ref _b561570_ '4)))
                   (_limit605_ _e568602_))
              (_K564586_ _limit605_ _cv597_ _mx592_))
            (_E563574_)))))
  (define std/misc/barrier#barrier-error!
    (lambda (_b528_ _exn529_)
      (let* ((_b530537_ _b528_)
             (_E532541_ (lambda () (error '"No clause matching" _b530537_)))
             (_K533547_
              (lambda (_cv544_ _mx545_)
                (mutex-lock! _mx545_)
                (if (let ()
                      (declare (not safe))
                      (##unchecked-structure-ref
                       _b528_
                       '5
                       std/misc/barrier#barrier::t
                       '#f))
                    '#!void
                    (let ()
                      (declare (not safe))
                      (##unchecked-structure-set!
                       _b528_
                       _exn529_
                       '5
                       std/misc/barrier#barrier::t
                       '#f)))
                (condition-variable-broadcast! _cv544_)
                (mutex-unlock! _mx545_))))
        (if (let ()
              (declare (not safe))
              (##structure-direct-instance-of?
               _b530537_
               'std/misc/barrier#barrier::t))
            (let* ((_e534550_
                    (let () (declare (not safe)) (##vector-ref _b530537_ '1)))
                   (_mx553_ _e534550_)
                   (_e535555_
                    (let () (declare (not safe)) (##vector-ref _b530537_ '2)))
                   (_cv558_ _e535555_))
              (_K533547_ _cv558_ _mx553_))
            (_E532541_))))))
