(declare (block) (standard-bindings) (extended-bindings))
(begin
  (define std/srfi/158#any
    (lambda (_pred551_ _ls552_)
      (if (null? (cdr _ls552_))
          (_pred551_ (car _ls552_))
          ((lambda (_x554_)
             (if _x554_ _x554_ (std/srfi/158#any _pred551_ (cdr _ls552_))))
           (_pred551_ (car _ls552_))))))
  (define std/srfi/158#list->bytevector
    (lambda (_list542_)
      (let ((_vec544_ (make-u8vector (length _list542_) '0)))
        (let _loop546_ ((_i548_ '0) (_list549_ _list542_))
          (if (null? _list549_)
              _vec544_
              (begin
                (u8vector-set! _vec544_ _i548_ (car _list549_))
                (_loop546_ (+ _i548_ '1) (cdr _list549_))))))))
  (define std/srfi/158#circular-generator
    (lambda _args535_
      (let ((_base-args537_ _args535_))
        (lambda ()
          (if (null? _args535_) (set! _args535_ _base-args537_) '#!void)
          (let ((_next540_ (car _args535_)))
            (set! _args535_ (cdr _args535_))
            _next540_)))))
  (define std/srfi/158#gflatten
    (lambda (_gen528_)
      (let ((_state530_ '()))
        (lambda ()
          (if (null? _state530_) (set! _state530_ (_gen528_)) '#!void)
          (if (eof-object? _state530_)
              _state530_
              (let ((_obj533_ (car _state530_)))
                (set! _state530_ (cdr _state530_))
                _obj533_))))))
  (define std/srfi/158#ggroup__1
    (lambda (_gen524_ _k525_ _padding526_)
      (std/srfi/158#padded-ggroup
       (std/srfi/158#simple-ggroup _gen524_ _k525_)
       _k525_
       _padding526_)))
  (define std/srfi/158#ggroup
    (lambda _g4155_
      (let ((_g4154_ (let () (declare (not safe)) (##length _g4155_))))
        (cond ((let () (declare (not safe)) (##fx= _g4154_ 2))
               (apply std/srfi/158#simple-ggroup _g4155_))
              ((let () (declare (not safe)) (##fx= _g4154_ 3))
               (apply std/srfi/158#ggroup__1 _g4155_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/158#ggroup
                _g4155_))))))
  (define std/srfi/158#simple-ggroup
    (lambda (_gen511_ _k512_)
      (lambda ()
        (let _loop515_ ((_item517_ (_gen511_))
                        (_result518_ '())
                        (_count519_ (- _k512_ '1)))
          (if (eof-object? _item517_)
              (if (null? _result518_) _item517_ (reverse _result518_))
              (if (= _count519_ '0)
                  (reverse (cons _item517_ _result518_))
                  (_loop515_
                   (_gen511_)
                   (cons _item517_ _result518_)
                   (- _count519_ '1))))))))
  (define std/srfi/158#padded-ggroup
    (lambda (_gen502_ _k503_ _padding504_)
      (lambda ()
        (let ((_item507_ (_gen502_)))
          (if (eof-object? _item507_)
              _item507_
              (let ((_len509_ (length _item507_)))
                (if (= _len509_ _k503_)
                    _item507_
                    (append _item507_
                            (make-list
                             (- _k503_ _len509_)
                             _padding504_)))))))))
  (define std/srfi/158#gmerge__0
    (lambda (_<473_) (error '"wrong number of arguments for gmerge")))
  (define std/srfi/158#gmerge__1 (lambda (_<475_ _gen476_) _gen476_))
  (define std/srfi/158#gmerge__2
    (lambda (_<478_ _genleft479_ _genright480_)
      (let ((_left482_ (_genleft479_)) (_right483_ (_genright480_)))
        (lambda ()
          (if (and (eof-object? _left482_) (eof-object? _right483_))
              _left482_
              (if (eof-object? _left482_)
                  (let ((_obj486_ _right483_))
                    (set! _right483_ (_genright480_))
                    _obj486_)
                  (if (eof-object? _right483_)
                      (let ((_obj488_ _left482_))
                        (set! _left482_ (_genleft479_))
                        _obj488_)
                      (if (_<478_ _right483_ _left482_)
                          (let ((_obj490_ _right483_))
                            (set! _right483_ (_genright480_))
                            _obj490_)
                          (let ((_obj492_ _left482_))
                            (set! _left482_ (_genleft479_))
                            _obj492_)))))))))
  (define std/srfi/158#gmerge__3
    (lambda (_<494_ . _gens495_)
      (apply std/srfi/158#gmerge
             _<494_
             (let _loop497_ ((_gens499_ _gens495_) (_gs500_ '()))
               (if (null? _gens499_)
                   (reverse _gs500_)
                   (if (null? (cdr _gens499_))
                       (reverse (cons (car _gens499_) _gs500_))
                       (_loop497_
                        (cddr _gens499_)
                        (cons (std/srfi/158#gmerge__2
                               _<494_
                               (car _gens499_)
                               (cadr _gens499_))
                              _gs500_))))))))
  (define std/srfi/158#gmerge
    (lambda _g4157_
      (let ((_g4156_ (let () (declare (not safe)) (##length _g4157_))))
        (cond ((let () (declare (not safe)) (##fx= _g4156_ 1))
               (apply std/srfi/158#gmerge__0 _g4157_))
              ((let () (declare (not safe)) (##fx= _g4156_ 2))
               (apply std/srfi/158#gmerge__1 _g4157_))
              ((let () (declare (not safe)) (##fx= _g4156_ 3))
               (apply std/srfi/158#gmerge__2 _g4157_))
              ((let () (declare (not safe)) (##fx>= _g4156_ 1))
               (apply std/srfi/158#gmerge__3 _g4157_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/158#gmerge
                _g4157_))))))
  (define std/srfi/158#gmap__0
    (lambda (_proc457_) (error '"wrong number of arguments for gmap")))
  (define std/srfi/158#gmap__1
    (lambda (_proc459_ _gen460_)
      (lambda ()
        (let ((_item463_ (_gen460_)))
          (if (eof-object? _item463_) _item463_ (_proc459_ _item463_))))))
  (define std/srfi/158#gmap__2
    (lambda (_proc465_ . _gens466_)
      (lambda ()
        (let ((_items471_ (map (lambda (_x469_) (_x469_)) _gens466_)))
          (if (std/srfi/158#any eof-object? _items471_)
              (eof-object)
              (apply _proc465_ _items471_))))))
  (define std/srfi/158#gmap
    (lambda _g4159_
      (let ((_g4158_ (let () (declare (not safe)) (##length _g4159_))))
        (cond ((let () (declare (not safe)) (##fx= _g4158_ 1))
               (apply std/srfi/158#gmap__0 _g4159_))
              ((let () (declare (not safe)) (##fx= _g4158_ 2))
               (apply std/srfi/158#gmap__1 _g4159_))
              ((let () (declare (not safe)) (##fx>= _g4158_ 1))
               (apply std/srfi/158#gmap__2 _g4159_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/srfi/158#gmap
                _g4159_))))))
  (define std/srfi/158#gstate-filter
    (lambda (_proc443_ _seed444_ _gen445_)
      (let ((_state447_ _seed444_))
        (lambda ()
          (let _loop450_ ((_item452_ (_gen445_)))
            (if (eof-object? _item452_)
                _item452_
                (let ((_g4160_ (_proc443_ _item452_ _state447_)))
                  (begin
                    (let ((_g4161_ (let ()
                                     (declare (not safe))
                                     (if (##values? _g4160_)
                                         (##vector-length _g4160_)
                                         1))))
                      (if (not (let () (declare (not safe)) (##fx= _g4161_ 2)))
                          (error "Context expects 2 values" _g4161_)))
                    (let ((_yes454_
                           (let ()
                             (declare (not safe))
                             (##vector-ref _g4160_ 0)))
                          (_newstate455_
                           (let ()
                             (declare (not safe))
                             (##vector-ref _g4160_ 1))))
                      (begin
                        (set! _state447_ _newstate455_)
                        (if _yes454_
                            _item452_
                            (_loop450_ (_gen445_)))))))))))))
  (define std/srfi/158#generator-map->list
    (lambda (_f432_ . _gs433_)
      (let _loop435_ ((_result437_ '()))
        (let ((_vs441_ (map (lambda (_g439_) (_g439_)) _gs433_)))
          (if (std/srfi/158#any eof-object? _vs441_)
              (reverse _result437_)
              (_loop435_ (cons (apply _f432_ _vs441_) _result437_)))))))
  (define std/srfi/158#make-accumulator
    (lambda (_kons424_ _knil425_ _finalize426_)
      (let ((_state428_ _knil425_))
        (lambda (_obj430_)
          (if (eof-object? _obj430_)
              (_finalize426_ _state428_)
              (set! _state428_ (_kons424_ _obj430_ _state428_)))))))
  (define std/srfi/158#count-accumulator
    (lambda ()
      (std/srfi/158#make-accumulator
       (lambda (_obj419_ _state420_) (+ '1 _state420_))
       '0
       (lambda (_x422_) _x422_))))
  (define std/srfi/158#list-accumulator
    (lambda () (std/srfi/158#make-accumulator cons '() reverse)))
  (define std/srfi/158#reverse-list-accumulator
    (lambda ()
      (std/srfi/158#make-accumulator cons '() (lambda (_x415_) _x415_))))
  (define std/srfi/158#vector-accumulator
    (lambda ()
      (std/srfi/158#make-accumulator
       cons
       '()
       (lambda (_x412_) (list->vector (reverse _x412_))))))
  (define std/srfi/158#reverse-vector-accumulator
    (lambda () (std/srfi/158#make-accumulator cons '() list->vector)))
  (define std/srfi/158#vector-accumulator!
    (lambda (_vec405_ _at406_)
      (lambda (_obj408_)
        (if (eof-object? _obj408_)
            _vec405_
            (begin
              (vector-set! _vec405_ _at406_ _obj408_)
              (set! _at406_ (+ _at406_ '1)))))))
  (define std/srfi/158#bytevector-accumulator
    (lambda ()
      (std/srfi/158#make-accumulator
       cons
       '()
       (lambda (_x403_) (std/srfi/158#list->bytevector (reverse _x403_))))))
  (define std/srfi/158#bytevector-accumulator!
    (lambda (_bytevec397_ _at398_)
      (lambda (_obj400_)
        (if (eof-object? _obj400_)
            _bytevec397_
            (begin
              (u8vector-set! _bytevec397_ _at398_ _obj400_)
              (set! _at398_ (+ _at398_ '1)))))))
  (define std/srfi/158#string-accumulator
    (lambda ()
      (std/srfi/158#make-accumulator
       cons
       '()
       (lambda (_lst395_) (list->string (reverse _lst395_))))))
  (define std/srfi/158#sum-accumulator
    (lambda () (std/srfi/158#make-accumulator + '0 (lambda (_x392_) _x392_))))
  (define std/srfi/158#product-accumulator
    (lambda () (std/srfi/158#make-accumulator * '1 (lambda (_x389_) _x389_)))))
