(declare (block) (standard-bindings) (extended-bindings))
(begin
  (declare (not safe))
  (define std/net/bio/file#file-input-buffer::t
    (make-struct-type
     'std/net/bio/file#file-input-buffer::t
     std/net/bio/input#input-buffer::t
     '1
     'file-input-buffer
     '((final: . #t))
     '#f
     '(fd)))
  (define std/net/bio/file#file-input-buffer?
    (make-struct-predicate std/net/bio/file#file-input-buffer::t))
  (define std/net/bio/file#make-file-input-buffer
    (lambda _$args566_
      (apply make-struct-instance
             std/net/bio/file#file-input-buffer::t
             _$args566_)))
  (define std/net/bio/file#file-input-buffer-fd
    (make-struct-field-accessor std/net/bio/file#file-input-buffer::t '0))
  (define std/net/bio/file#file-input-buffer-fd-set!
    (make-struct-field-mutator std/net/bio/file#file-input-buffer::t '0))
  (define std/net/bio/file#&file-input-buffer-fd
    (make-struct-field-unchecked-accessor
     std/net/bio/file#file-input-buffer::t
     '0))
  (define std/net/bio/file#&file-input-buffer-fd-set!
    (make-struct-field-unchecked-mutator
     std/net/bio/file#file-input-buffer::t
     '0))
  (define std/net/bio/file#open-file-input-buffer__%
    (lambda (_path553_ _bufsz554_)
      (std/net/bio/file#open-fd-input-buffer__%
       (std/os/fdio#open__0 _path553_ std/os/fcntl#O_RDONLY)
       _bufsz554_)))
  (define std/net/bio/file#open-file-input-buffer__0
    (lambda (_path559_)
      (let ((_bufsz561_ '4096))
        (std/net/bio/file#open-file-input-buffer__% _path559_ _bufsz561_))))
  (define std/net/bio/file#open-file-input-buffer
    (lambda _g4206_
      (let ((_g4205_ (##length _g4206_)))
        (cond ((##fx= _g4205_ 1)
               (apply std/net/bio/file#open-file-input-buffer__0 _g4206_))
              ((##fx= _g4205_ 2)
               (apply std/net/bio/file#open-file-input-buffer__% _g4206_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/net/bio/file#open-file-input-buffer
                _g4206_))))))
  (define std/net/bio/file#open-fd-input-buffer__%
    (lambda (_fd539_ _bufsz540_)
      (##structure
       std/net/bio/file#file-input-buffer::t
       (make-u8vector _bufsz540_)
       '0
       '0
       std/net/bio/file#file-input-fill!
       std/net/bio/file#file-input-read
       _fd539_)))
  (define std/net/bio/file#open-fd-input-buffer__0
    (lambda (_fd545_)
      (let ((_bufsz547_ '4096))
        (std/net/bio/file#open-fd-input-buffer__% _fd545_ _bufsz547_))))
  (define std/net/bio/file#open-fd-input-buffer
    (lambda _g4208_
      (let ((_g4207_ (##length _g4208_)))
        (cond ((##fx= _g4207_ 1)
               (apply std/net/bio/file#open-fd-input-buffer__0 _g4208_))
              ((##fx= _g4207_ 2)
               (apply std/net/bio/file#open-fd-input-buffer__% _g4208_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/net/bio/file#open-fd-input-buffer
                _g4208_))))))
  (define std/net/bio/file#close-file-input-buffer
    (lambda (_buf529_)
      (let ((_$e531_ (##unchecked-structure-ref
                      _buf529_
                      '6
                      std/net/bio/file#file-input-buffer::t
                      '#f)))
        (if _$e531_
            ((lambda (_fd534_)
               (std/os/fdio#close _fd534_)
               (##unchecked-structure-set!
                _buf529_
                '#f
                '6
                std/net/bio/file#file-input-buffer::t
                '#f)
               (##unchecked-structure-set!
                _buf529_
                (lambda _g4209_ '0)
                '4
                std/net/bio/input#input-buffer::t
                '#f)
               (##unchecked-structure-set!
                _buf529_
                (lambda _g4210_ '0)
                '5
                std/net/bio/input#input-buffer::t
                '#f))
             _$e531_)
            '#!void))))
  (define std/net/bio/file#file-input-fill!
    (lambda (_buf510_ _need511_)
      (let ((_bytes513_
             (##unchecked-structure-ref
              _buf510_
              '1
              std/net/bio/input#input-buffer::t
              '#f))
            (_rlo514_
             (##unchecked-structure-ref
              _buf510_
              '2
              std/net/bio/input#input-buffer::t
              '#f))
            (_rhi515_
             (##unchecked-structure-ref
              _buf510_
              '3
              std/net/bio/input#input-buffer::t
              '#f)))
        (if (##fx> _rlo514_ '0)
            (if (##fx= _rlo514_ _rhi515_)
                (begin
                  (##unchecked-structure-set!
                   _buf510_
                   '0
                   '2
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (##unchecked-structure-set!
                   _buf510_
                   '0
                   '3
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (std/net/bio/file#file-input-fill! _buf510_ _need511_))
                (begin
                  (##subu8vector-move!
                   _bytes513_
                   _rlo514_
                   _rhi515_
                   _bytes513_
                   '0)
                  (##unchecked-structure-set!
                   _buf510_
                   '0
                   '2
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (##unchecked-structure-set!
                   _buf510_
                   (##fx- _rhi515_ _rlo514_)
                   '3
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (std/net/bio/file#file-input-fill! _buf510_ _need511_)))
            (let ((_fd517_ (##unchecked-structure-ref
                            _buf510_
                            '6
                            std/net/bio/file#file-input-buffer::t
                            '#f)))
              (let _lp519_ ((_rhi521_ _rhi515_)
                            (_want522_ (##fx- _need511_ _rhi515_))
                            (_count523_ '0))
                (let ((_rd525_ (std/os/fdio#fdread__%
                                _fd517_
                                _bytes513_
                                _rhi521_
                                (##u8vector-length _bytes513_))))
                  (if _rd525_
                      (let ((_rhi+rd527_ (##fx+ _rhi521_ _rd525_)))
                        (##unchecked-structure-set!
                         _buf510_
                         _rhi+rd527_
                         '3
                         std/net/bio/input#input-buffer::t
                         '#f)
                        (if (##fx< _rd525_ _want522_)
                            (if (##fx> _rd525_ '0)
                                (_lp519_ _rhi+rd527_
                                         (##fx- _want522_ _rd525_)
                                         (##fx+ _count523_ _rd525_))
                                _count523_)
                            (##fx+ _count523_ _rd525_)))
                      (begin
                        (if (std/os/fd#fd? _fd517_)
                            (##wait-for-io! (std/os/fd#fd-io-in _fd517_) '#t)
                            '#!void)
                        (_lp519_ _rhi521_ _want522_ _count523_))))))))))
  (define std/net/bio/file#file-input-read
    (lambda (_bytes496_ _start497_ _end498_ _buf499_)
      (let ((_fd501_ (##unchecked-structure-ref
                      _buf499_
                      '6
                      std/net/bio/file#file-input-buffer::t
                      '#f)))
        (let _lp503_ ((_count505_ '0) (_start506_ _start497_))
          (if (##fx>= _start506_ _end498_)
              _count505_
              (let ((_r508_ (std/os/fdio#fdread__%
                             _fd501_
                             _bytes496_
                             _start506_
                             _end498_)))
                (if (not _r508_)
                    (begin
                      (if (std/os/fd#fd? _fd501_)
                          (##wait-for-io! (std/os/fd#fd-io-in _fd501_) '#t)
                          '#!void)
                      (_lp503_ _count505_ _start506_))
                    (if (##fxzero? _r508_)
                        _count505_
                        (_lp503_ (##fx+ _count505_ _r508_)
                                 (##fx+ _start506_ _r508_))))))))))
  (define std/net/bio/file#file-output-buffer::t
    (make-struct-type
     'std/net/bio/file#file-output-buffer::t
     std/net/bio/output#output-buffer::t
     '1
     'file-output-buffer
     '((final: . #t))
     '#f
     '(fd)))
  (define std/net/bio/file#file-output-buffer?
    (make-struct-predicate std/net/bio/file#file-output-buffer::t))
  (define std/net/bio/file#make-file-output-buffer
    (lambda _$args493_
      (apply make-struct-instance
             std/net/bio/file#file-output-buffer::t
             _$args493_)))
  (define std/net/bio/file#file-output-buffer-fd
    (make-struct-field-accessor std/net/bio/file#file-output-buffer::t '0))
  (define std/net/bio/file#file-output-buffer-fd-set!
    (make-struct-field-mutator std/net/bio/file#file-output-buffer::t '0))
  (define std/net/bio/file#&file-output-buffer-fd
    (make-struct-field-unchecked-accessor
     std/net/bio/file#file-output-buffer::t
     '0))
  (define std/net/bio/file#&file-output-buffer-fd-set!
    (make-struct-field-unchecked-mutator
     std/net/bio/file#file-output-buffer::t
     '0))
  (define std/net/bio/file#open-file-output-buffer__%__%
    (lambda (__447450_ _flags444452_ _mode445454_ _path456_ _bufsz457_)
      (let* ((_flags459_
              (if (eq? _flags444452_ absent-value)
                  (fxior std/os/fcntl#O_WRONLY
                         std/os/fcntl#O_CREAT
                         std/os/fcntl#O_EXCL)
                  _flags444452_))
             (_mode461_
              (if (eq? _mode445454_ absent-value) '384 _mode445454_)))
        (std/net/bio/file#open-fd-output-buffer__%
         (std/os/fdio#open__% _path456_ _flags459_ _mode461_)
         _bufsz457_))))
  (define std/net/bio/file#open-file-output-buffer__%__0
    (lambda (__447466_ _flags444467_ _mode445468_ _path469_)
      (let ((_bufsz471_ '4096))
        (std/net/bio/file#open-file-output-buffer__%__%
         __447466_
         _flags444467_
         _mode445468_
         _path469_
         _bufsz471_))))
  (define std/net/bio/file#open-file-output-buffer__%
    (lambda _g4212_
      (let ((_g4211_ (##length _g4212_)))
        (cond ((##fx= _g4211_ 4)
               (apply std/net/bio/file#open-file-output-buffer__%__0 _g4212_))
              ((##fx= _g4211_ 5)
               (apply std/net/bio/file#open-file-output-buffer__%__% _g4212_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/net/bio/file#open-file-output-buffer__%
                _g4212_))))))
  (define std/net/bio/file#open-file-output-buffer__@
    (lambda (_keys443482_ . _args484_)
      (apply std/net/bio/file#open-file-output-buffer__%
             _keys443482_
             (table-ref _keys443482_ 'flags: absent-value)
             (table-ref _keys443482_ 'mode: absent-value)
             _args484_)))
  (define std/net/bio/file#open-file-output-buffer
    (lambda _args446490_
      (apply keyword-dispatch
             '#(flags: mode: #f)
             std/net/bio/file#open-file-output-buffer__@
             _args446490_)))
  (define std/net/bio/file#open-fd-output-buffer__%
    (lambda (_fd429_ _bufsz430_)
      (##structure
       std/net/bio/file#file-output-buffer::t
       (make-u8vector _bufsz430_)
       '0
       _bufsz430_
       std/net/bio/file#file-output-drain!
       std/net/bio/file#file-output-write
       _fd429_)))
  (define std/net/bio/file#open-fd-output-buffer__0
    (lambda (_fd435_)
      (let ((_bufsz437_ '4096))
        (std/net/bio/file#open-fd-output-buffer__% _fd435_ _bufsz437_))))
  (define std/net/bio/file#open-fd-output-buffer
    (lambda _g4214_
      (let ((_g4213_ (##length _g4214_)))
        (cond ((##fx= _g4213_ 1)
               (apply std/net/bio/file#open-fd-output-buffer__0 _g4214_))
              ((##fx= _g4213_ 2)
               (apply std/net/bio/file#open-fd-output-buffer__% _g4214_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/net/bio/file#open-fd-output-buffer
                _g4214_))))))
  (define std/net/bio/file#close-file-output-buffer
    (lambda (_buf419_)
      (let ((_$e421_ (##unchecked-structure-ref
                      _buf419_
                      '6
                      std/net/bio/file#file-output-buffer::t
                      '#f)))
        (if _$e421_
            ((lambda (_fd424_)
               (std/os/fdio#close _fd424_)
               (##unchecked-structure-set!
                _buf419_
                '#f
                '6
                std/net/bio/file#file-output-buffer::t
                '#f)
               (##unchecked-structure-set!
                _buf419_
                (lambda _g4215_ (error '"device is closed" _fd424_))
                '4
                std/net/bio/output#output-buffer::t
                '#f)
               (##unchecked-structure-set!
                _buf419_
                (lambda _g4216_ (error '"device is closed" _fd424_))
                '5
                std/net/bio/output#output-buffer::t
                '#f))
             _$e421_)
            '#!void))))
  (define std/net/bio/file#file-output-drain!
    (lambda (_buf416_ _need417_)
      (std/net/bio/file#file-output-write
       (##unchecked-structure-ref
        _buf416_
        '1
        std/net/bio/output#output-buffer::t
        '#f)
       '0
       (##unchecked-structure-ref
        _buf416_
        '2
        std/net/bio/output#output-buffer::t
        '#f)
       _buf416_)
      (##unchecked-structure-set!
       _buf416_
       '0
       '2
       std/net/bio/output#output-buffer::t
       '#f)))
  (define std/net/bio/file#file-output-write
    (lambda (_bytes402_ _start403_ _end404_ _buf405_)
      (let ((_fd407_ (##unchecked-structure-ref
                      _buf405_
                      '6
                      std/net/bio/file#file-output-buffer::t
                      '#f)))
        (let _lp409_ ((_count411_ '0) (_start412_ _start403_))
          (if (##fx< _start412_ _end404_)
              (let ((_r414_ (std/os/fdio#fdwrite__%
                             _fd407_
                             _bytes402_
                             _start412_
                             _end404_)))
                (if _r414_
                    (_lp409_ (##fx+ _count411_ _r414_)
                             (##fx+ _start412_ _r414_))
                    (begin
                      (if (std/os/fd#fd? _fd407_)
                          (##wait-for-io! (std/os/fd#fd-io-out _fd407_) '#t)
                          '#!void)
                      (_lp409_ _count411_ _start412_))))
              _count411_))))))
