(declare (block) (standard-bindings) (extended-bindings))
(begin
  (declare (not safe))
  (define std/actor/xdr#opaque::t
    (make-struct-type
     'std/actor/xdr#opaque::t
     '#f
     '2
     'opaque
     '((final: . #t))
     ':init!
     '(e bytes)))
  (define std/actor/xdr#opaque?
    (make-struct-predicate std/actor/xdr#opaque::t))
  (define std/actor/xdr#make-opaque
    (lambda _$args1774_
      (apply make-struct-instance std/actor/xdr#opaque::t _$args1774_)))
  (define std/actor/xdr#opaque-e
    (make-struct-field-accessor std/actor/xdr#opaque::t '0))
  (define std/actor/xdr#opaque-bytes
    (make-struct-field-accessor std/actor/xdr#opaque::t '1))
  (define std/actor/xdr#opaque-e-set!
    (make-struct-field-mutator std/actor/xdr#opaque::t '0))
  (define std/actor/xdr#opaque-bytes-set!
    (make-struct-field-mutator std/actor/xdr#opaque::t '1))
  (define std/actor/xdr#opaque:::init!__%
    (lambda (_self1758_ _e1759_ _bytes1760_)
      (if (##fx< '2 (##vector-length _self1758_))
          (begin
            (##vector-set! _self1758_ '1 _e1759_)
            (##vector-set! _self1758_ '2 _bytes1760_))
          (error '"struct-instance-init!: too many arguments for struct"
                 _self1758_))))
  (define std/actor/xdr#opaque:::init!__0
    (lambda (_self1765_ _e1766_)
      (let ((_bytes1768_ '#f))
        (if (##fx< '2 (##vector-length _self1765_))
            (begin
              (##vector-set! _self1765_ '1 _e1766_)
              (##vector-set! _self1765_ '2 _bytes1768_))
            (error '"struct-instance-init!: too many arguments for struct"
                   _self1765_)))))
  (define std/actor/xdr#opaque:::init!
    (lambda _g5610_
      (let ((_g5609_ (##length _g5610_)))
        (cond ((##fx= _g5609_ 2)
               (apply std/actor/xdr#opaque:::init!__0 _g5610_))
              ((##fx= _g5609_ 3)
               (apply (lambda (_self1770_ _e1771_ _bytes1772_)
                        (if (##fx< '2 (##vector-length _self1770_))
                            (begin
                              (##vector-set! _self1770_ '1 _e1771_)
                              (##vector-set! _self1770_ '2 _bytes1772_))
                            (error '"struct-instance-init!: too many arguments for struct"
                                   _self1770_)))
                      _g5610_))
              (else
               (##raise-wrong-number-of-arguments-exception
                std/actor/xdr#opaque:::init!
                _g5610_))))))
  (bind-method!
   std/actor/xdr#opaque::t
   ':init!
   std/actor/xdr#opaque:::init!
   '#f)
  (define std/actor/xdr#opaque-value
    (lambda (_opq1626_)
      (let ((_$e1628_
             (##direct-structure-ref
              _opq1626_
              '2
              std/actor/xdr#opaque::t
              '#f)))
        (if _$e1628_
            ((lambda (_bytes1631_)
               (let ((_obj1633_ (u8vector->object _bytes1631_)))
                 (##direct-structure-set!
                  _opq1626_
                  _obj1633_
                  '1
                  std/actor/xdr#opaque::t
                  '#f)
                 (##direct-structure-set!
                  _opq1626_
                  '#f
                  '2
                  std/actor/xdr#opaque::t
                  '#f)
                 _obj1633_))
             _$e1628_)
            (##direct-structure-ref
             _opq1626_
             '1
             std/actor/xdr#opaque::t
             '#f)))))
  (define std/actor/xdr#xdr-error::t
    (make-struct-type
     'std/actor/xdr#xdr-error::t
     std/error#io-error::t
     '0
     'xdr-error
     '()
     '#f
     '()))
  (define std/actor/xdr#xdr-error?
    (make-struct-predicate std/actor/xdr#xdr-error::t))
  (define std/actor/xdr#make-xdr-error
    (lambda _$args1623_
      (apply make-struct-instance std/actor/xdr#xdr-error::t _$args1623_)))
  (define std/actor/xdr#raise-xdr-error
    (lambda (_where1619_ _what1620_ . _irritants1621_)
      (raise (make-struct-instance
              std/actor/xdr#xdr-error::t
              _what1620_
              _irritants1621_
              _where1619_))))
  (define std/actor/xdr#xdr-max-rope-length (expt '2 '20))
  (define std/actor/xdr#+xdr-read+ (make-vector '256 '#f))
  (define std/actor/xdr#+xdr-write+ (make-vector '256 '#f))
  (define std/actor/xdr#+xdr-type-tag+ (make-vector '4 false))
  (define std/actor/xdr#+xdr-subtype-tag+ (make-vector '32 false))
  (define std/actor/xdr#+xdr-default-type-registry+ (make-table 'test: eq?))
  (define std/actor/xdr#current-xdr-type-registry
    (make-parameter std/actor/xdr#+xdr-default-type-registry+))
  (define std/actor/xdr#XDR::t
    (make-struct-type
     'std/actor/xdr#XDR::t
     '#f
     '2
     'XDR
     '((final: . #t))
     '#f
     '(read write)))
  (define std/actor/xdr#XDR? (make-struct-predicate std/actor/xdr#XDR::t))
  (define std/actor/xdr#make-XDR
    (lambda _$args1616_
      (apply make-struct-instance std/actor/xdr#XDR::t _$args1616_)))
  (define std/actor/xdr#XDR-read
    (make-struct-field-accessor std/actor/xdr#XDR::t '0))
  (define std/actor/xdr#XDR-write
    (make-struct-field-accessor std/actor/xdr#XDR::t '1))
  (define std/actor/xdr#XDR-read-set!
    (make-struct-field-mutator std/actor/xdr#XDR::t '0))
  (define std/actor/xdr#XDR-write-set!
    (make-struct-field-mutator std/actor/xdr#XDR::t '1))
  (define std/actor/xdr#&XDR-read
    (make-struct-field-unchecked-accessor std/actor/xdr#XDR::t '0))
  (define std/actor/xdr#&XDR-write
    (make-struct-field-unchecked-accessor std/actor/xdr#XDR::t '1))
  (define std/actor/xdr#&XDR-read-set!
    (make-struct-field-unchecked-mutator std/actor/xdr#XDR::t '0))
  (define std/actor/xdr#&XDR-write-set!
    (make-struct-field-unchecked-mutator std/actor/xdr#XDR::t '1))
  (define std/actor/xdr#xdr-read
    (lambda (_buf1605_)
      (let ((_tag1607_ (std/net/bio/input#bio-read-u8 _buf1605_)))
        (if (eof-object? _tag1607_)
            (std/actor/xdr#raise-xdr-error
             'xdr-read
             '"premature end of input"
             _buf1605_)
            (let ((_$e1609_ (##vector-ref std/actor/xdr#+xdr-read+ _tag1607_)))
              (if _$e1609_
                  ((lambda (_g16111613_) (_g16111613_ _buf1605_)) _$e1609_)
                  (std/actor/xdr#raise-xdr-error
                   'xdr-read
                   '"unknown object tag"
                   _tag1607_)))))))
  (define std/actor/xdr#xdr-write
    (lambda (_obj1592_ _buf1593_)
      (let ((_$e1595_ (std/actor/xdr#xdr-object-tag _obj1592_)))
        (if _$e1595_
            ((lambda (_tag1598_)
               (let ((_$e1600_
                      (##vector-ref std/actor/xdr#+xdr-write+ _tag1598_)))
                 (if _$e1600_
                     ((lambda (_writef1603_)
                        (std/net/bio/output#bio-write-u8 _tag1598_ _buf1593_)
                        (_writef1603_ _obj1592_ _buf1593_))
                      _$e1600_)
                     (std/actor/xdr#raise-xdr-error
                      'xdr-write
                      '"unknown object tag"
                      _tag1598_))))
             _$e1595_)
            (std/actor/xdr#raise-xdr-error
             'xdr-write
             '"cannot serialize object"
             _obj1592_)))))
  (define std/actor/xdr#xdr-tag-void '0)
  (define std/actor/xdr#xdr-tag-null '1)
  (define std/actor/xdr#xdr-tag-false '2)
  (define std/actor/xdr#xdr-tag-true '3)
  (define std/actor/xdr#xdr-tag-eof '4)
  (define std/actor/xdr#xdr-tag-char '5)
  (define std/actor/xdr#xdr-tag-uint '6)
  (define std/actor/xdr#xdr-tag-sint '7)
  (define std/actor/xdr#xdr-tag-flonum '8)
  (define std/actor/xdr#xdr-tag-pair '9)
  (define std/actor/xdr#xdr-tag-vector '10)
  (define std/actor/xdr#xdr-tag-values '11)
  (define std/actor/xdr#xdr-tag-symbol '12)
  (define std/actor/xdr#xdr-tag-keyword '13)
  (define std/actor/xdr#xdr-tag-string '14)
  (define std/actor/xdr#xdr-tag-u8vector '15)
  (define std/actor/xdr#xdr-tag-hash '16)
  (define std/actor/xdr#xdr-tag-object '17)
  (define std/actor/xdr#xdr-tag-ratnum '18)
  (define std/actor/xdr#xdr-tag-cpxnum '19)
  (define std/actor/xdr#xdr-tag-time '20)
  (define std/actor/xdr#xdr-tag-opaque '64)
  (define std/actor/xdr#xdr-tag-hash-equal '0)
  (define std/actor/xdr#xdr-tag-hash-eq '1)
  (define std/actor/xdr#xdr-tag-hash-eqv '2)
  (define std/actor/xdr#xdr-object-tag
    (lambda (_obj1590_)
      ((##vector-ref std/actor/xdr#+xdr-type-tag+ (##type _obj1590_))
       _obj1590_)))
  (define std/actor/xdr#xdr-type-fixnum-tag
    (lambda (_obj1588_)
      (if (##fx< _obj1588_ '0)
          std/actor/xdr#xdr-tag-sint
          std/actor/xdr#xdr-tag-uint)))
  (define std/actor/xdr#xdr-type-subtyped-tag
    (lambda (_obj1586_)
      ((##vector-ref std/actor/xdr#+xdr-subtype-tag+ (##subtype _obj1586_))
       _obj1586_)))
  (define std/actor/xdr#xdr-type-immediate-tag
    (lambda (_obj1584_)
      (if (eq? _obj1584_ '#!void)
          std/actor/xdr#xdr-tag-void
          (if (eq? _obj1584_ '())
              std/actor/xdr#xdr-tag-null
              (if (eq? _obj1584_ '#f)
                  std/actor/xdr#xdr-tag-false
                  (if (eq? _obj1584_ '#t)
                      std/actor/xdr#xdr-tag-true
                      (if (char? _obj1584_)
                          std/actor/xdr#xdr-tag-char
                          (if (eof-object? _obj1584_)
                              std/actor/xdr#xdr-tag-eof
                              '#f))))))))
  (define std/actor/xdr#xdr-subtype-structure-tag
    (lambda (_obj1582_)
      (if (table-ref
           (std/actor/xdr#current-xdr-type-registry)
           (##type-id (##structure-type _obj1582_))
           '#f)
          std/actor/xdr#xdr-tag-object
          (if (table? _obj1582_)
              std/actor/xdr#xdr-tag-hash
              (if (time? _obj1582_)
                  std/actor/xdr#xdr-tag-time
                  (if (##structure-direct-instance-of?
                       _obj1582_
                       'std/actor/xdr#opaque::t)
                      std/actor/xdr#xdr-tag-opaque
                      '#f))))))
  (define std/actor/xdr#xdr-subtype-bigint-tag
    (lambda (_obj1580_)
      (if (< _obj1580_ '0)
          std/actor/xdr#xdr-tag-sint
          std/actor/xdr#xdr-tag-uint)))
  (vector-set!
   std/actor/xdr#+xdr-type-tag+
   (macro-type-fixnum)
   std/actor/xdr#xdr-type-fixnum-tag)
  (vector-set!
   std/actor/xdr#+xdr-type-tag+
   (macro-type-mem1)
   std/actor/xdr#xdr-type-subtyped-tag)
  (vector-set!
   std/actor/xdr#+xdr-type-tag+
   (macro-type-special)
   std/actor/xdr#xdr-type-immediate-tag)
  (vector-set!
   std/actor/xdr#+xdr-type-tag+
   (macro-type-mem2)
   (lambda (_obj1577_) std/actor/xdr#xdr-tag-pair))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-vector)
   (lambda (_obj1574_) std/actor/xdr#xdr-tag-vector))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-pair)
   (lambda (_obj1571_) std/actor/xdr#xdr-tag-pair))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-structure)
   std/actor/xdr#xdr-subtype-structure-tag)
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-boxvalues)
   (lambda (_obj1568_) std/actor/xdr#xdr-tag-values))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-symbol)
   (lambda (_obj1565_) std/actor/xdr#xdr-tag-symbol))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-keyword)
   (lambda (_obj1562_) std/actor/xdr#xdr-tag-keyword))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-string)
   (lambda (_obj1559_) std/actor/xdr#xdr-tag-string))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-u8vector)
   (lambda (_obj1556_) std/actor/xdr#xdr-tag-u8vector))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-flonum)
   (lambda (_obj1553_) std/actor/xdr#xdr-tag-flonum))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-bignum)
   std/actor/xdr#xdr-subtype-bigint-tag)
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-ratnum)
   (lambda (_obj1550_) std/actor/xdr#xdr-tag-ratnum))
  (vector-set!
   std/actor/xdr#+xdr-subtype-tag+
   (macro-subtype-cpxnum)
   (lambda (_obj1547_) std/actor/xdr#xdr-tag-cpxnum))
  (define std/actor/xdr#xdr-read-void (lambda (_buf1545_) '#!void))
  (define std/actor/xdr#xdr-write-void void)
  (define std/actor/xdr#xdr-read-null (lambda (_buf1543_) '()))
  (define std/actor/xdr#xdr-write-null void)
  (define std/actor/xdr#xdr-read-false (lambda (_buf1541_) '#f))
  (define std/actor/xdr#xdr-write-false void)
  (define std/actor/xdr#xdr-read-true (lambda (_buf1539_) '#t))
  (define std/actor/xdr#xdr-write-true void)
  (define std/actor/xdr#xdr-read-eof (lambda (_buf1537_) (eof-object)))
  (define std/actor/xdr#xdr-write-eof void)
  (define std/actor/xdr#xdr-read-char
    (lambda (_buf1535_)
      (integer->char (std/actor/xdr#xdr-read-uint _buf1535_))))
  (define std/actor/xdr#xdr-write-char
    (lambda (_obj1532_ _buf1533_)
      (std/actor/xdr#xdr-write-uint (##char->integer _obj1532_) _buf1533_)))
  (define std/actor/xdr#xdr-read-flonum
    (lambda (_buf1525_)
      (let* ((_bytes1527_ (make-u8vector '8))
             (_rd1529_
              (std/net/bio/input#bio-read-subu8vector
               _bytes1527_
               '0
               '8
               _buf1525_)))
        (if (##fx= _rd1529_ '8)
            (std/actor/xdr#xdr-bytes->float _bytes1527_)
            (std/actor/xdr#raise-xdr-error
             'xdr-read-flonum
             '"premature end of input"
             _buf1525_)))))
  (define std/actor/xdr#xdr-write-flonum
    (lambda (_obj1520_ _buf1521_)
      (let ((_bytes1523_ (make-u8vector '8)))
        (std/actor/xdr#xdr-float->bytes! _obj1520_ _bytes1523_)
        (std/net/bio/output#bio-write-subu8vector
         _bytes1523_
         '0
         '8
         _buf1521_))))
  (define std/actor/xdr#xdr-read-pair
    (lambda (_buf1513_)
      (let* ((_hd1515_ (std/actor/xdr#xdr-read _buf1513_))
             (_tl1517_ (std/actor/xdr#xdr-read _buf1513_)))
        (cons _hd1515_ _tl1517_))))
  (define std/actor/xdr#xdr-write-pair
    (lambda (_obj1510_ _buf1511_)
      (std/actor/xdr#xdr-write (##car _obj1510_) _buf1511_)
      (std/actor/xdr#xdr-write (##cdr _obj1510_) _buf1511_)))
  (define std/actor/xdr#xdr-read-vector
    (lambda (_buf1498_)
      (let* ((_len1500_ (std/actor/xdr#xdr-read-uint _buf1498_))
             (_g5611_ (if (##fx<= _len1500_ std/actor/xdr#xdr-max-rope-length)
                          '#!void
                          (std/actor/xdr#raise-xdr-error
                           'xdr-read-vector
                           '"maxium rope length exceeded"
                           _len1500_)))
             (_obj1503_ (make-vector _len1500_)))
        (let _lp1506_ ((_i1508_ '0))
          (if (##fx< _i1508_ _len1500_)
              (begin
                (##vector-set!
                 _obj1503_
                 _i1508_
                 (std/actor/xdr#xdr-read _buf1498_))
                (_lp1506_ (##fx+ _i1508_ '1)))
              _obj1503_)))))
  (define std/actor/xdr#xdr-write-vector
    (lambda (_obj1489_ _buf1490_)
      (let ((_len1492_ (##vector-length _obj1489_)))
        (std/actor/xdr#xdr-write-uint _len1492_ _buf1490_)
        (let _lp1494_ ((_i1496_ '0))
          (if (##fx< _i1496_ _len1492_)
              (begin
                (std/actor/xdr#xdr-write
                 (##vector-ref _obj1489_ _i1496_)
                 _buf1490_)
                (_lp1494_ (##fx+ _i1496_ '1)))
              '#!void)))))
  (define std/actor/xdr#xdr-read-values
    (lambda (_buf1485_)
      (let ((_obj1487_ (std/actor/xdr#xdr-read-vector _buf1485_)))
        (##subtype-set! _obj1487_ (macro-subtype-boxvalues))
        _obj1487_)))
  (define std/actor/xdr#xdr-write-values std/actor/xdr#xdr-write-vector)
  (define std/actor/xdr#xdr-read-symbol
    (lambda (_buf1483_)
      (##string->symbol (std/actor/xdr#xdr-read-string _buf1483_))))
  (define std/actor/xdr#xdr-write-symbol
    (lambda (_obj1480_ _buf1481_)
      (std/actor/xdr#xdr-write-string (##symbol->string _obj1480_) _buf1481_)))
  (define std/actor/xdr#xdr-read-keyword
    (lambda (_buf1478_)
      (##string->keyword (std/actor/xdr#xdr-read-string _buf1478_))))
  (define std/actor/xdr#xdr-write-keyword
    (lambda (_obj1475_ _buf1476_)
      (std/actor/xdr#xdr-write-string
       (##keyword->string _obj1475_)
       _buf1476_)))
  (define std/actor/xdr#xdr-read-string
    (lambda (_buf1463_)
      (let* ((_len1465_ (std/actor/xdr#xdr-read-uint _buf1463_))
             (_g5612_ (if (##fx<= _len1465_ std/actor/xdr#xdr-max-rope-length)
                          '#!void
                          (std/actor/xdr#raise-xdr-error
                           'xdr-read-string
                           '"maxium rope length exceeded"
                           _len1465_)))
             (_str1468_ (make-string _len1465_)))
        (let _lp1471_ ((_i1473_ '0))
          (if (##fx< _i1473_ _len1465_)
              (begin
                (##string-set!
                 _str1468_
                 _i1473_
                 (std/actor/xdr#xdr-read-char _buf1463_))
                (_lp1471_ (##fx+ _i1473_ '1)))
              _str1468_)))))
  (define std/actor/xdr#xdr-write-string
    (lambda (_obj1454_ _buf1455_)
      (let ((_len1457_ (##string-length _obj1454_)))
        (std/actor/xdr#xdr-write-uint _len1457_ _buf1455_)
        (let _lp1459_ ((_i1461_ '0))
          (if (##fx< _i1461_ _len1457_)
              (begin
                (std/actor/xdr#xdr-write-char
                 (##string-ref _obj1454_ _i1461_)
                 _buf1455_)
                (_lp1459_ (##fx+ _i1461_ '1)))
              '#!void)))))
  (define std/actor/xdr#xdr-read-u8vector
    (lambda (_buf1446_)
      (let* ((_len1448_ (std/actor/xdr#xdr-read-uint _buf1446_))
             (_g5613_ (if (##fx<= _len1448_ std/actor/xdr#xdr-max-rope-length)
                          '#!void
                          (std/actor/xdr#raise-xdr-error
                           'xdr-read-u8vector
                           '"maxium rope length exceeded"
                           _len1448_)))
             (_bytes1451_ (make-u8vector _len1448_)))
        (std/net/bio/input#bio-read-bytes _bytes1451_ _buf1446_)
        _bytes1451_)))
  (define std/actor/xdr#xdr-write-u8vector
    (lambda (_obj1443_ _buf1444_)
      (std/actor/xdr#xdr-write-uint (##u8vector-length _obj1443_) _buf1444_)
      (std/net/bio/output#bio-write-bytes _obj1443_ _buf1444_)))
  (define std/actor/xdr#xdr-read-hash
    (lambda (_buf1434_)
      (let* ((_htype1436_ (std/net/bio/input#bio-read-u8 _buf1434_))
             (_makef1438_
              (if (##fx= _htype1436_ std/actor/xdr#xdr-tag-hash-equal)
                  list->hash-table
                  (if (##fx= _htype1436_ std/actor/xdr#xdr-tag-hash-eq)
                      list->hash-table-eq
                      (if (##fx= _htype1436_ std/actor/xdr#xdr-tag-hash-eqv)
                          list->hash-table-eqv
                          (std/actor/xdr#raise-xdr-error
                           'xdr-read-hash
                           '"unknown hash table type"
                           _htype1436_)))))
             (_lst1440_ (std/actor/xdr#xdr-read-inline-list _buf1434_)))
        (_makef1438_ _lst1440_))))
  (define std/actor/xdr#xdr-write-hash
    (lambda (_obj1417_ _buf1418_)
      (let ((_testf1420_ (##vector-ref _obj1417_ '2)))
        (if (or (not _testf1420_)
                (eq? _testf1420_ eq?)
                (eq? _testf1420_ ##eq?))
            (std/net/bio/output#bio-write-u8
             std/actor/xdr#xdr-tag-hash-eq
             _buf1418_)
            (if (or (eq? _testf1420_ eqv?) (eq? _testf1420_ ##eqv?))
                (std/net/bio/output#bio-write-u8
                 std/actor/xdr#xdr-tag-hash-eqv
                 _buf1418_)
                (if (or (eq? _testf1420_ equal?) (eq? _testf1420_ ##equal?))
                    (std/net/bio/output#bio-write-u8
                     std/actor/xdr#xdr-tag-hash-equal
                     _buf1418_)
                    (std/actor/xdr#raise-xdr-error
                     'xdr-wrie-hash
                     '"unknown hash test function"
                     _testf1420_))))
        (std/actor/xdr#xdr-write-inline-list
         (table->list _obj1417_)
         _buf1418_))))
  (define std/actor/xdr#xdr-read-object
    (lambda (_buf1408_)
      (let* ((_tid1410_ (std/actor/xdr#xdr-read-symbol _buf1408_))
             (_$e1412_
              (table-ref
               (std/actor/xdr#current-xdr-type-registry)
               _tid1410_
               '#f)))
        (if _$e1412_
            ((lambda (_xdr1415_)
               ((##unchecked-structure-ref
                 _xdr1415_
                 '1
                 std/actor/xdr#XDR::t
                 '#f)
                _buf1408_))
             _$e1412_)
            (std/actor/xdr#raise-xdr-error
             'xdr-read-object
             '"unknown type id"
             _tid1410_)))))
  (define std/actor/xdr#xdr-write-object
    (lambda (_obj1398_ _buf1399_)
      (let* ((_tid1401_ (##type-id (##structure-type _obj1398_)))
             (_$e1403_
              (table-ref
               (std/actor/xdr#current-xdr-type-registry)
               _tid1401_
               '#f)))
        (if _$e1403_
            ((lambda (_xdr1406_)
               (std/actor/xdr#xdr-write-symbol _tid1401_ _buf1399_)
               ((##unchecked-structure-ref
                 _xdr1406_
                 '2
                 std/actor/xdr#XDR::t
                 '#f)
                _obj1398_
                _buf1399_))
             _$e1403_)
            (std/actor/xdr#raise-xdr-error
             'xdr-write-object
             '"unknown type id"
             _tid1401_)))))
  (define std/actor/xdr#xdr-read-opaque
    (lambda (_buf1394_)
      (let* ((_bytes1396_ (std/actor/xdr#xdr-read-u8vector _buf1394_))
             (__obj5608 (make-object std/actor/xdr#opaque::t '2)))
        (if (##fx< '2 (##vector-length __obj5608))
            (begin
              (##vector-set! __obj5608 '1 '#f)
              (##vector-set! __obj5608 '2 _bytes1396_))
            (error '"struct-instance-init!: too many arguments for struct"
                   __obj5608))
        __obj5608)))
  (define std/actor/xdr#xdr-write-opaque
    (lambda (_obj1386_ _buf1387_)
      (let ((_bytes1392_
             (let ((_$e1389_
                    (##direct-structure-ref
                     _obj1386_
                     '2
                     std/actor/xdr#opaque::t
                     '#f)))
               (if _$e1389_
                   _$e1389_
                   (object->u8vector
                    (##direct-structure-ref
                     _obj1386_
                     '1
                     std/actor/xdr#opaque::t
                     '#f))))))
        (std/actor/xdr#xdr-write-u8vector _bytes1392_ _buf1387_))))
  (define std/actor/xdr#xdr-read-uint
    (lambda (_buf1359_)
      (let ((_bits1361_ (std/net/bio/input#bio-read-u8 _buf1359_)))
        (if (##fxzero? (##fxand _bits1361_ '128))
            _bits1361_
            (let _lp1363_ ((_val1365_ (##fxand _bits1361_ '127))
                           (_shift1366_ '7))
              (let ((_bits1368_ (std/net/bio/input#bio-read-u8 _buf1359_)))
                (if (##fxzero? (##fxand _bits1368_ '128))
                    (let ((_$e1370_
                           (##fxarithmetic-shift-left?
                            _bits1368_
                            _shift1366_)))
                      (if _$e1370_
                          ((lambda (_bits1373_) (##fxior _bits1373_ _val1365_))
                           _$e1370_)
                          (let ((_bits1375_
                                 (arithmetic-shift _bits1368_ _shift1366_)))
                            (bitwise-ior _bits1375_ _val1365_))))
                    (let* ((_bits1377_ (##fxand _bits1368_ '127))
                           (_$e1379_
                            (##fxarithmetic-shift-left?
                             _bits1377_
                             _shift1366_)))
                      (if _$e1379_
                          ((lambda (_bits1382_)
                             (_lp1363_
                              (##fxior _bits1382_ _val1365_)
                              (##fx+ _shift1366_ '7)))
                           _$e1379_)
                          (let ((_bits1384_
                                 (arithmetic-shift _bits1377_ _shift1366_)))
                            (_lp1363_
                             (bitwise-ior _bits1384_ _val1365_)
                             (##fx+ _shift1366_ '7))))))))))))
  (define std/actor/xdr#xdr-write-uint
    (lambda (_obj1348_ _buf1349_)
      (if (fixnum? _obj1348_)
          (let _lp1351_ ((_val1353_ _obj1348_))
            (if (##fx> _val1353_ '127)
                (let ((_bits1355_ (##fxior (##fxand _val1353_ '127) '128)))
                  (std/net/bio/output#bio-write-u8 _bits1355_ _buf1349_)
                  (_lp1351_ (##fxarithmetic-shift-right _val1353_ '7)))
                (std/net/bio/output#bio-write-u8 _val1353_ _buf1349_)))
          (let ((_bits1357_ (##fxior (bitwise-and _obj1348_ '127) '128)))
            (std/net/bio/output#bio-write-u8 _bits1357_ _buf1349_)
            (std/actor/xdr#xdr-write-uint
             (arithmetic-shift _obj1348_ '-7)
             _buf1349_)))))
  (define std/actor/xdr#xdr-read-sint
    (lambda (_buf1346_) (- (std/actor/xdr#xdr-read-uint _buf1346_))))
  (define std/actor/xdr#xdr-write-sint
    (lambda (_obj1343_ _buf1344_)
      (std/actor/xdr#xdr-write-uint (- _obj1343_) _buf1344_)))
  (define std/actor/xdr#xdr-read-ratnum
    (lambda (_buf1336_)
      (let* ((_num1338_ (std/actor/xdr#xdr-read _buf1336_))
             (_den1340_ (std/actor/xdr#xdr-read _buf1336_)))
        (if (and (integer? _num1338_)
                 (exact? _num1338_)
                 (integer? _den1340_)
                 (exact? _den1340_))
            (##ratnum-make _num1338_ _den1340_)
            (std/actor/xdr#raise-xdr-error
             'xdr-read-ratnum
             '"malformed rational number"
             _num1338_
             _den1340_)))))
  (define std/actor/xdr#xdr-write-ratnum
    (lambda (_obj1333_ _buf1334_)
      (std/actor/xdr#xdr-write (##ratnum-numerator _obj1333_) _buf1334_)
      (std/actor/xdr#xdr-write (##ratnum-denominator _obj1333_) _buf1334_)))
  (define std/actor/xdr#xdr-read-cpxnum
    (lambda (_buf1326_)
      (let* ((_real1328_ (std/actor/xdr#xdr-read _buf1326_))
             (_imag1330_ (std/actor/xdr#xdr-read _buf1326_)))
        (if (and (real? _real1328_) (real? _imag1330_))
            (##cpxnum-make _real1328_ _imag1330_)
            (std/actor/xdr#raise-xdr-error
             'xdr-read-cpxnum
             '"malformed complex number"
             _real1328_
             _imag1330_)))))
  (define std/actor/xdr#xdr-write-cpxnum
    (lambda (_obj1323_ _buf1324_)
      (std/actor/xdr#xdr-write (##cpxnum-real _obj1323_) _buf1324_)
      (std/actor/xdr#xdr-write (##cpxnum-imag _obj1323_) _buf1324_)))
  (define std/actor/xdr#xdr-read-time
    (lambda (_buf1321_)
      (seconds->time (std/actor/xdr#xdr-read-flonum _buf1321_))))
  (define std/actor/xdr#xdr-write-time
    (lambda (_tm1318_ _buf1319_)
      (std/actor/xdr#xdr-write-flonum (time->seconds _tm1318_) _buf1319_)))
  (define std/actor/xdr#xdr-read-inline-list
    (lambda (_buf1310_)
      (let _lp1312_ ((_r1314_ '()))
        (let ((_next1316_ (std/actor/xdr#xdr-read _buf1310_)))
          (if (null? _next1316_)
              (std/srfi/1#reverse! _r1314_)
              (_lp1312_ (cons _next1316_ _r1314_)))))))
  (define std/actor/xdr#xdr-write-inline-list
    (lambda (_lst1303_ _buf1304_)
      (let _lp1306_ ((_rest1308_ _lst1303_))
        (if (pair? _rest1308_)
            (begin
              (std/actor/xdr#xdr-write (##car _rest1308_) _buf1304_)
              (_lp1306_ (##cdr _rest1308_)))
            (std/net/bio/output#bio-write-u8
             std/actor/xdr#xdr-tag-null
             _buf1304_)))))
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-void
   std/actor/xdr#xdr-read-void)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-null
   std/actor/xdr#xdr-read-null)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-false
   std/actor/xdr#xdr-read-false)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-true
   std/actor/xdr#xdr-read-true)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-eof
   std/actor/xdr#xdr-read-eof)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-char
   std/actor/xdr#xdr-read-char)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-uint
   std/actor/xdr#xdr-read-uint)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-sint
   std/actor/xdr#xdr-read-sint)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-flonum
   std/actor/xdr#xdr-read-flonum)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-pair
   std/actor/xdr#xdr-read-pair)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-vector
   std/actor/xdr#xdr-read-vector)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-values
   std/actor/xdr#xdr-read-values)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-symbol
   std/actor/xdr#xdr-read-symbol)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-keyword
   std/actor/xdr#xdr-read-keyword)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-string
   std/actor/xdr#xdr-read-string)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-u8vector
   std/actor/xdr#xdr-read-u8vector)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-hash
   std/actor/xdr#xdr-read-hash)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-object
   std/actor/xdr#xdr-read-object)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-ratnum
   std/actor/xdr#xdr-read-ratnum)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-cpxnum
   std/actor/xdr#xdr-read-cpxnum)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-time
   std/actor/xdr#xdr-read-time)
  (vector-set!
   std/actor/xdr#+xdr-read+
   std/actor/xdr#xdr-tag-opaque
   std/actor/xdr#xdr-read-opaque)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-void
   std/actor/xdr#xdr-write-void)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-null
   std/actor/xdr#xdr-write-null)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-false
   std/actor/xdr#xdr-write-false)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-true
   std/actor/xdr#xdr-write-true)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-eof
   std/actor/xdr#xdr-write-eof)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-char
   std/actor/xdr#xdr-write-char)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-uint
   std/actor/xdr#xdr-write-uint)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-sint
   std/actor/xdr#xdr-write-sint)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-flonum
   std/actor/xdr#xdr-write-flonum)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-pair
   std/actor/xdr#xdr-write-pair)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-vector
   std/actor/xdr#xdr-write-vector)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-values
   std/actor/xdr#xdr-write-values)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-symbol
   std/actor/xdr#xdr-write-symbol)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-keyword
   std/actor/xdr#xdr-write-keyword)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-string
   std/actor/xdr#xdr-write-string)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-u8vector
   std/actor/xdr#xdr-write-u8vector)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-hash
   std/actor/xdr#xdr-write-hash)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-object
   std/actor/xdr#xdr-write-object)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-ratnum
   std/actor/xdr#xdr-write-ratnum)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-cpxnum
   std/actor/xdr#xdr-write-cpxnum)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-time
   std/actor/xdr#xdr-write-time)
  (vector-set!
   std/actor/xdr#+xdr-write+
   std/actor/xdr#xdr-tag-opaque
   std/actor/xdr#xdr-write-opaque)
  (define std/actor/xdr#xdr-read-struct
    (lambda (_klass1290_ _buf1291_)
      (let ((_fields1293_ (std/actor/xdr#xdr-read-uint _buf1291_)))
        (if (##fx= _fields1293_ (type-descriptor-fields _klass1290_))
            (let ((_obj1295_ (make-object _klass1290_ _fields1293_)))
              (let _lp1297_ ((_i1299_ '0))
                (if (##fx< _i1299_ _fields1293_)
                    (let ((_i+11301_ (##fx+ _i1299_ '1)))
                      (##vector-set!
                       _obj1295_
                       _i+11301_
                       (std/actor/xdr#xdr-read _buf1291_))
                      (_lp1297_ _i+11301_))
                    _obj1295_)))
            (std/actor/xdr#raise-xdr-error
             'xdr-read-struct
             '"type descriptor field mismatch"
             _klass1290_
             _fields1293_)))))
  (define std/actor/xdr#xdr-write-struct
    (lambda (_obj1278_ _buf1279_)
      (let* ((_len1281_ (##vector-length _obj1278_))
             (_fields1283_ (##fx- _len1281_ '1)))
        (std/actor/xdr#xdr-write-uint _fields1283_ _buf1279_)
        (let _lp1286_ ((_i1288_ '1))
          (if (##fx< _i1288_ _len1281_)
              (begin
                (std/actor/xdr#xdr-write
                 (##vector-ref _obj1278_ _i1288_)
                 _buf1279_)
                (_lp1286_ (##fx+ _i1288_ '1)))
              '#!void)))))
  (define-macro (define-guard guard defn)
    (if (eval `(cond-expand (,guard #t) (else #f)))
        '(begin)
        (begin (eval `(define-cond-expand-feature ,guard)) defn)))
  (define-macro (define-c-lambda id args ret #!optional (name #f))
    (let ((name (or name (symbol->string id))))
      `(define ,id (c-lambda ,args ,ret ,name))))
  (define-macro (define-const symbol)
    (let* ((str (symbol->string symbol))
           (ref (string-append "___return (" str ");")))
      `(define ,symbol ((c-lambda () int ,ref)))))
  (define-macro (define-const* symbol)
    (let* ((str (symbol->string symbol))
           (code (string-append
                  "#ifdef "
                  str
                  "\n"
                  "___return (___FIX ("
                  str
                  "));\n"
                  "#else \n"
                  "___return (___FAL);\n"
                  "#endif")))
      `(define ,symbol ((c-lambda () scheme-object ,code)))))
  (define-macro (define-with-errno symbol ffi-symbol args)
    `(define (,symbol ,@args)
       (declare (not interrupts-enabled))
       (let ((r (,ffi-symbol ,@args)))
         (if (##fx< r 0) (##fx- (##c-code "___RESULT = ___FIX (errno);")) r))))
  (define-macro (define-c-struct
                 struct
                 #!optional
                 (members '())
                 release-function)
    (let* ((struct-str (symbol->string struct))
           (struct-ptr (string->symbol (string-append struct-str "*")))
           (shallow-ptr
            (string->symbol (string-append struct-str "-shallow-ptr*")))
           (borrowed-ptr
            (string->symbol (string-append struct-str "-borrowed-ptr*")))
           (string-types
            '(char-string
              nonull-char-string
              UTF-8-string
              nonnull-UTF-8-string
              UTF-16-string
              nonnull-UTF16-string))
           (string-compat-required?
            (let loop ((m members))
              (cond ((null? m) #f)
                    ((member (cdr (car m)) string-types) #t)
                    (else (loop (cdr m))))))
           (string-setter-body
            (lambda (member-name)
              (let ((m (string-append "___arg1->" member-name)))
                (string-append
                 "if("
                 m
                 " == NULL)"
                 "\n"
                 m
                 "= strdup(___arg2);"
                 "\n"
                 "else if (strcmp("
                 m
                 ", ___arg2) != 0) {"
                 "\n"
                 "free("
                 m
                 ");"
                 "\n"
                 m
                 "= strdup(___arg2);"
                 "\n"
                 "}"
                 "\n"
                 "___return;"
                 "\n"))))
           (default-free-body
            (and string-compat-required?
                 (string-append
                  "___SCMOBJ "
                  struct-str
                  "_ffi_free (void *ptr) {"
                  "\n"
                  "struct "
                  struct-str
                  " *obj = (struct "
                  struct-str
                  "*) ptr;"
                  "\n"
                  (apply string-append
                         (map (lambda (m)
                                (cond ((memq (cdr m) string-types)
                                       (let ((mem-name
                                              (symbol->string (car m))))
                                         (string-append
                                          "if(obj->"
                                          mem-name
                                          ") "
                                          "free(obj->"
                                          mem-name
                                          ");"
                                          "\n")))
                                      (else "")))
                              members))
                  "free(obj);"
                  "\n"
                  "return ___FIX (___NO_ERR);"
                  "\n"
                  "}")))
           (release-function
            (or release-function
                (if string-compat-required?
                    (string-append struct-str "_ffi_free")
                    "ffi_free")))
           (string-compat-types
            (if string-compat-required?
                `((c-declare ,default-free-body)
                  (c-define-type
                   ,shallow-ptr
                   (pointer ,struct (,struct-ptr) "ffi_free")))
                '())))
      `(begin
         (c-define-type ,struct (struct ,struct-str))
         (c-define-type
          ,struct-ptr
          (pointer ,struct (,struct-ptr) ,release-function))
         (c-define-type ,borrowed-ptr (pointer ,struct (,struct-ptr)))
         ,@string-compat-types
         (define ,(string->symbol (string-append struct-str "-ptr?"))
           (lambda (obj)
             (and (foreign? obj) (equal? (foreign-tags obj) '(,struct-ptr)))))
         ,@(apply append
                  (map (lambda (m)
                         (let* ((member-name (symbol->string (car m)))
                                (member-type (cdr m))
                                (getter-name
                                 (string-append struct-str "-" member-name))
                                (setter-body
                                 (cond ((member member-type string-types)
                                        (string-setter-body member-name))
                                       (else
                                        (string-append
                                         "___arg1->"
                                         member-name
                                         " = ___arg2;"
                                         "\n"
                                         "___return;"
                                         "\n")))))
                           `((define ,(string->symbol getter-name)
                               (c-lambda
                                (,struct-ptr)
                                ,member-type
                                ,(string-append
                                  "___return(___arg1->"
                                  member-name
                                  ");")))
                             (define ,(string->symbol
                                       (string-append getter-name "-set!"))
                               (c-lambda
                                (,struct-ptr ,member-type)
                                void
                                ,setter-body)))))
                       members))
         (define ,(string->symbol (string-append "malloc-" struct-str))
           (c-lambda
            ()
            ,struct-ptr
            ,(string-append
              "struct "
              struct-str
              "* var = (struct "
              struct-str
              " *) malloc(sizeof(struct "
              struct-str
              "));"
              "\n"
              "if (var == NULL)"
              "\n"
              "    ___return (NULL);"
              "\n"
              "memset(var, 0, sizeof(struct "
              struct-str
              "));"
              "___return(var);")))
         (define ,(string->symbol (string-append "ptr->" struct-str))
           (c-lambda (,struct-ptr) ,struct "___return(*___arg1);"))
         (define ,(string->symbol
                   (string-append "malloc-" struct-str "-array"))
           (c-lambda
            (unsigned-int32)
            ,(if string-compat-required? shallow-ptr struct-ptr)
            ,(string-append
              "struct "
              struct-str
              " *arr_var=(struct "
              struct-str
              " *) malloc(___arg1*sizeof(struct "
              struct-str
              "));"
              "\n"
              "if (arr_var == NULL)"
              "\n"
              "    ___return (NULL);"
              "\n"
              "memset(arr_var, 0, ___arg1*sizeof(struct "
              struct-str
              "));"
              "\n"
              "___return(arr_var);")))
         (define ,(string->symbol (string-append struct-str "-array-ref"))
           (c-lambda
            (,struct-ptr unsigned-int32)
            ,borrowed-ptr
            "___return (___arg1 + ___arg2);"))
         (define ,(string->symbol (string-append struct-str "-array-set!"))
           (c-lambda
            (,struct-ptr unsigned-int32 ,struct-ptr)
            void
            "*(___arg1 + ___arg2) = *___arg3; ___return;")))))
  (c-declare "#include <stdlib.h>")
  (c-declare "#include <string.h>")
  (c-declare "#include <errno.h>")
  (c-declare "static ___SCMOBJ ffi_free (void *ptr);")
  (c-declare
   "#ifndef ___HAVE_FFI_U8VECTOR\n#define ___HAVE_FFI_U8VECTOR\n#define U8_DATA(obj) ___CAST (___U8*, ___BODY_AS (obj, ___tSUBTYPED))\n#define U8_LEN(obj) ___HD_BYTES (___HEADER (obj))\n#endif")
  (namespace ("std/actor/xdr#" xdr-bytes->float xdr-float->bytes!))
  (c-declare
   "static double ffi_xdr_read_float_bytes (___SCMOBJ bytes)\n{\n return *(double*)(U8_DATA (bytes));\n}\n\nstatic int ffi_xdr_write_float_bytes (double val, ___SCMOBJ bytes)\n{\n *(double*)(U8_DATA (bytes)) = val;\n  return 0;\n}")
  (define-c-lambda
   std/actor/xdr#xdr-float->bytes!
   (double scheme-object)
   int
   "ffi_xdr_write_float_bytes")
  (define-c-lambda
   std/actor/xdr#xdr-bytes->float
   (scheme-object)
   double
   "ffi_xdr_read_float_bytes")
  (c-declare
   "#ifndef ___HAVE_FFI_FREE\n#define ___HAVE_FFI_FREE\n___SCMOBJ ffi_free (void *ptr)\n{\n free (ptr);\n return ___FIX (___NO_ERR);\n}\n#endif"))
