(declare (block) (standard-bindings) (extended-bindings))
(begin
  (declare (not safe))
  (define std/net/socket/buffer#default-buffer-size '4096)
  (define std/net/socket/buffer#ssocket-input-buffer::t
    (make-struct-type
     'std/net/socket/buffer#ssocket-input-buffer::t
     std/net/bio/input#input-buffer::t
     '2
     'ssocket-input-buffer
     '((final: . #t))
     '#f
     '(sock timeo)))
  (define std/net/socket/buffer#ssocket-input-buffer?
    (make-struct-predicate std/net/socket/buffer#ssocket-input-buffer::t))
  (define std/net/socket/buffer#make-ssocket-input-buffer
    (lambda _$args509_
      (apply make-struct-instance
             std/net/socket/buffer#ssocket-input-buffer::t
             _$args509_)))
  (define std/net/socket/buffer#ssocket-input-buffer-sock
    (make-struct-field-accessor
     std/net/socket/buffer#ssocket-input-buffer::t
     '0))
  (define std/net/socket/buffer#ssocket-input-buffer-timeo
    (make-struct-field-accessor
     std/net/socket/buffer#ssocket-input-buffer::t
     '1))
  (define std/net/socket/buffer#ssocket-input-buffer-sock-set!
    (make-struct-field-mutator
     std/net/socket/buffer#ssocket-input-buffer::t
     '0))
  (define std/net/socket/buffer#ssocket-input-buffer-timeo-set!
    (make-struct-field-mutator
     std/net/socket/buffer#ssocket-input-buffer::t
     '1))
  (define std/net/socket/buffer#&ssocket-input-buffer-sock
    (make-struct-field-unchecked-accessor
     std/net/socket/buffer#ssocket-input-buffer::t
     '0))
  (define std/net/socket/buffer#&ssocket-input-buffer-timeo
    (make-struct-field-unchecked-accessor
     std/net/socket/buffer#ssocket-input-buffer::t
     '1))
  (define std/net/socket/buffer#&ssocket-input-buffer-sock-set!
    (make-struct-field-unchecked-mutator
     std/net/socket/buffer#ssocket-input-buffer::t
     '0))
  (define std/net/socket/buffer#&ssocket-input-buffer-timeo-set!
    (make-struct-field-unchecked-mutator
     std/net/socket/buffer#ssocket-input-buffer::t
     '1))
  (define std/net/socket/buffer#open-ssocket-input-buffer__%
    (lambda (_ssock496_ _size497_)
      (##structure
       std/net/socket/buffer#ssocket-input-buffer::t
       (make-u8vector _size497_)
       '0
       '0
       std/net/socket/buffer#ssocket-input-fill!
       std/net/socket/buffer#ssocket-input-read
       _ssock496_
       '#f)))
  (define std/net/socket/buffer#open-ssocket-input-buffer__0
    (lambda (_ssock502_)
      (let ((_size504_ std/net/socket/buffer#default-buffer-size))
        (std/net/socket/buffer#open-ssocket-input-buffer__%
         _ssock502_
         _size504_))))
  (define std/net/socket/buffer#open-ssocket-input-buffer
    (lambda _g5572_
      (let ((_g5571_ (##length _g5572_)))
        (cond ((##fx= _g5571_ 1)
               (apply std/net/socket/buffer#open-ssocket-input-buffer__0
                      _g5572_))
              ((##fx= _g5571_ 2)
               (apply std/net/socket/buffer#open-ssocket-input-buffer__%
                      _g5572_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/net/socket/buffer#open-ssocket-input-buffer
                _g5572_))))))
  (define std/net/socket/buffer#ssocket-input-fill!
    (lambda (_buf474_ _need475_)
      (let ((_bytes477_
             (##unchecked-structure-ref
              _buf474_
              '1
              std/net/bio/input#input-buffer::t
              '#f))
            (_rlo478_
             (##unchecked-structure-ref
              _buf474_
              '2
              std/net/bio/input#input-buffer::t
              '#f))
            (_rhi479_
             (##unchecked-structure-ref
              _buf474_
              '3
              std/net/bio/input#input-buffer::t
              '#f)))
        (if (##fx> _rlo478_ '0)
            (if (##fx= _rlo478_ _rhi479_)
                (begin
                  (##unchecked-structure-set!
                   _buf474_
                   '0
                   '2
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (##unchecked-structure-set!
                   _buf474_
                   '0
                   '3
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (std/net/socket/buffer#ssocket-input-fill!
                   _buf474_
                   _need475_))
                (begin
                  (##subu8vector-move!
                   _bytes477_
                   _rlo478_
                   _rhi479_
                   _bytes477_
                   '0)
                  (##unchecked-structure-set!
                   _buf474_
                   '0
                   '2
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (##unchecked-structure-set!
                   _buf474_
                   (##fx- _rhi479_ _rlo478_)
                   '3
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (std/net/socket/buffer#ssocket-input-fill!
                   _buf474_
                   _need475_)))
            (let ((_sock481_
                   (##unchecked-structure-ref
                    _buf474_
                    '6
                    std/net/socket/buffer#ssocket-input-buffer::t
                    '#f))
                  (_timeo482_
                   (##unchecked-structure-ref
                    _buf474_
                    '7
                    std/net/socket/buffer#ssocket-input-buffer::t
                    '#f)))
              (let _lp484_ ((_rhi486_ _rhi479_)
                            (_want487_ (##fx- _need475_ _rhi479_))
                            (_count488_ '0))
                (let* ((_rd490_ (std/net/socket/api#ssocket-recv__%
                                 _sock481_
                                 _bytes477_
                                 _rhi486_
                                 (##u8vector-length _bytes477_)
                                 _timeo482_))
                       (_rhi+rd492_ (##fx+ _rhi486_ _rd490_)))
                  (##unchecked-structure-set!
                   _buf474_
                   _rhi+rd492_
                   '3
                   std/net/bio/input#input-buffer::t
                   '#f)
                  (if (##fx< _rd490_ _want487_)
                      (if (##fx> _rd490_ '0)
                          (_lp484_ _rhi+rd492_
                                   (##fx- _want487_ _rd490_)
                                   (##fx+ _count488_ _rd490_))
                          _count488_)
                      (##fx+ _count488_ _rd490_)))))))))
  (define std/net/socket/buffer#ssocket-input-read
    (lambda (_bytes469_ _start470_ _end471_ _buf472_)
      (std/net/socket/api#ssocket-recv-all__%
       (##unchecked-structure-ref
        _buf472_
        '6
        std/net/socket/buffer#ssocket-input-buffer::t
        '#f)
       _bytes469_
       _start470_
       _end471_
       (##unchecked-structure-ref
        _buf472_
        '7
        std/net/socket/buffer#ssocket-input-buffer::t
        '#f))))
  (define std/net/socket/buffer#ssocket-input-buffer-timeout-set!
    (lambda (_buf464_ _timeo465_)
      (let ((_timeo467_ (std/net/socket/base#abs-timeout _timeo465_)))
        (##direct-structure-set!
         _buf464_
         _timeo467_
         '7
         std/net/socket/buffer#ssocket-input-buffer::t
         '#f))))
  (define std/net/socket/buffer#ssocket-output-buffer::t
    (make-struct-type
     'std/net/socket/buffer#ssocket-output-buffer::t
     std/net/bio/output#output-buffer::t
     '2
     'ssocket-output-buffer
     '((final: . #t))
     '#f
     '(sock timeo)))
  (define std/net/socket/buffer#ssocket-output-buffer?
    (make-struct-predicate std/net/socket/buffer#ssocket-output-buffer::t))
  (define std/net/socket/buffer#make-ssocket-output-buffer
    (lambda _$args461_
      (apply make-struct-instance
             std/net/socket/buffer#ssocket-output-buffer::t
             _$args461_)))
  (define std/net/socket/buffer#ssocket-output-buffer-sock
    (make-struct-field-accessor
     std/net/socket/buffer#ssocket-output-buffer::t
     '0))
  (define std/net/socket/buffer#ssocket-output-buffer-timeo
    (make-struct-field-accessor
     std/net/socket/buffer#ssocket-output-buffer::t
     '1))
  (define std/net/socket/buffer#ssocket-output-buffer-sock-set!
    (make-struct-field-mutator
     std/net/socket/buffer#ssocket-output-buffer::t
     '0))
  (define std/net/socket/buffer#ssocket-output-buffer-timeo-set!
    (make-struct-field-mutator
     std/net/socket/buffer#ssocket-output-buffer::t
     '1))
  (define std/net/socket/buffer#&ssocket-output-buffer-sock
    (make-struct-field-unchecked-accessor
     std/net/socket/buffer#ssocket-output-buffer::t
     '0))
  (define std/net/socket/buffer#&ssocket-output-buffer-timeo
    (make-struct-field-unchecked-accessor
     std/net/socket/buffer#ssocket-output-buffer::t
     '1))
  (define std/net/socket/buffer#&ssocket-output-buffer-sock-set!
    (make-struct-field-unchecked-mutator
     std/net/socket/buffer#ssocket-output-buffer::t
     '0))
  (define std/net/socket/buffer#&ssocket-output-buffer-timeo-set!
    (make-struct-field-unchecked-mutator
     std/net/socket/buffer#ssocket-output-buffer::t
     '1))
  (define std/net/socket/buffer#open-ssocket-output-buffer__%
    (lambda (_ssock448_ _size449_)
      (##structure
       std/net/socket/buffer#ssocket-output-buffer::t
       (make-u8vector _size449_)
       '0
       _size449_
       std/net/socket/buffer#ssocket-output-drain!
       std/net/socket/buffer#ssocket-output-write
       _ssock448_
       '#f)))
  (define std/net/socket/buffer#open-ssocket-output-buffer__0
    (lambda (_ssock454_)
      (let ((_size456_ std/net/socket/buffer#default-buffer-size))
        (std/net/socket/buffer#open-ssocket-output-buffer__%
         _ssock454_
         _size456_))))
  (define std/net/socket/buffer#open-ssocket-output-buffer
    (lambda _g5574_
      (let ((_g5573_ (##length _g5574_)))
        (cond ((##fx= _g5573_ 1)
               (apply std/net/socket/buffer#open-ssocket-output-buffer__0
                      _g5574_))
              ((##fx= _g5573_ 2)
               (apply std/net/socket/buffer#open-ssocket-output-buffer__%
                      _g5574_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/net/socket/buffer#open-ssocket-output-buffer
                _g5574_))))))
  (define std/net/socket/buffer#ssocket-output-drain!
    (lambda (_buf444_ _need445_)
      (std/net/socket/api#ssocket-send-all__%
       (##unchecked-structure-ref
        _buf444_
        '6
        std/net/socket/buffer#ssocket-output-buffer::t
        '#f)
       (##unchecked-structure-ref
        _buf444_
        '1
        std/net/bio/output#output-buffer::t
        '#f)
       '0
       (##unchecked-structure-ref
        _buf444_
        '2
        std/net/bio/output#output-buffer::t
        '#f)
       (##unchecked-structure-ref
        _buf444_
        '7
        std/net/socket/buffer#ssocket-output-buffer::t
        '#f))
      (##unchecked-structure-set!
       _buf444_
       '0
       '2
       std/net/bio/output#output-buffer::t
       '#f)))
  (define std/net/socket/buffer#ssocket-output-write
    (lambda (_bytes439_ _start440_ _end441_ _buf442_)
      (std/net/socket/api#ssocket-send-all__%
       (##unchecked-structure-ref
        _buf442_
        '6
        std/net/socket/buffer#ssocket-output-buffer::t
        '#f)
       _bytes439_
       _start440_
       _end441_
       (##unchecked-structure-ref
        _buf442_
        '7
        std/net/socket/buffer#ssocket-output-buffer::t
        '#f))))
  (define std/net/socket/buffer#ssocket-output-buffer-timeout-set!
    (lambda (_buf434_ _timeo435_)
      (let ((_timeo437_ (std/net/socket/base#abs-timeout _timeo435_)))
        (##direct-structure-set!
         _buf434_
         _timeo437_
         '7
         std/net/socket/buffer#ssocket-output-buffer::t
         '#f))))
  (define std/net/socket/buffer#ssocket-input-buffer-reset!
    (lambda (_buf431_ _sock432_)
      (##unchecked-structure-set!
       _buf431_
       '0
       '2
       std/net/bio/input#input-buffer::t
       '#f)
      (##unchecked-structure-set!
       _buf431_
       '0
       '3
       std/net/bio/input#input-buffer::t
       '#f)
      (##unchecked-structure-set!
       _buf431_
       _sock432_
       '6
       std/net/socket/buffer#ssocket-input-buffer::t
       '#f)
      (##unchecked-structure-set!
       _buf431_
       '#f
       '7
       std/net/socket/buffer#ssocket-input-buffer::t
       '#f)))
  (define std/net/socket/buffer#ssocket-input-buffer-release!
    (lambda (_buf429_)
      (##unchecked-structure-set!
       _buf429_
       '#f
       '6
       std/net/socket/buffer#ssocket-input-buffer::t
       '#f)))
  (define std/net/socket/buffer#ssocket-output-buffer-reset!
    (lambda (_buf426_ _sock427_)
      (##unchecked-structure-set!
       _buf426_
       '0
       '2
       std/net/bio/output#output-buffer::t
       '#f)
      (##unchecked-structure-set!
       _buf426_
       (u8vector-length
        (##unchecked-structure-ref
         _buf426_
         '1
         std/net/bio/output#output-buffer::t
         '#f))
       '3
       std/net/bio/output#output-buffer::t
       '#f)
      (##unchecked-structure-set!
       _buf426_
       _sock427_
       '6
       std/net/socket/buffer#ssocket-output-buffer::t
       '#f)
      (##unchecked-structure-set!
       _buf426_
       '#f
       '7
       std/net/socket/buffer#ssocket-output-buffer::t
       '#f)))
  (define std/net/socket/buffer#ssocket-output-buffer-release!
    (lambda (_buf424_)
      (##unchecked-structure-set!
       _buf424_
       '#f
       '6
       std/net/socket/buffer#ssocket-output-buffer::t
       '#f))))
