gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

musl_openbsd_arm64.go (123956B)


      1 // Code generated by 'ccgo -export-externs X -export-fields F -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6,getnameinfo,gethostbyaddr_r, -nostdinc -nostdlib -o ../musl_openbsd_arm64.go -pkgname libc -static-locals-prefix _s -Iarch/aarch64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c ../openbsd/ctype_.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isspace.c src/ctype/isupper.c src/ctype/isxdigit.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strnlen.c src/string/strspn.c', DO NOT EDIT.
      2 
      3 package libc
      4 
      5 import (
      6 	"math"
      7 	"reflect"
      8 	"sync/atomic"
      9 	"unsafe"
     10 )
     11 
     12 var _ = math.Pi
     13 var _ reflect.Kind
     14 var _ atomic.Value
     15 var _ unsafe.Pointer
     16 
     17 // musl as a whole is licensed under the following standard MIT license:
     18 //
     19 // ----------------------------------------------------------------------
     20 // Copyright © 2005-2020 Rich Felker, et al.
     21 //
     22 // Permission is hereby granted, free of charge, to any person obtaining
     23 // a copy of this software and associated documentation files (the
     24 // "Software"), to deal in the Software without restriction, including
     25 // without limitation the rights to use, copy, modify, merge, publish,
     26 // distribute, sublicense, and/or sell copies of the Software, and to
     27 // permit persons to whom the Software is furnished to do so, subject to
     28 // the following conditions:
     29 //
     30 // The above copyright notice and this permission notice shall be
     31 // included in all copies or substantial portions of the Software.
     32 //
     33 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     34 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     35 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     36 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
     37 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     38 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     39 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     40 // ----------------------------------------------------------------------
     41 //
     42 // Authors/contributors include:
     43 //
     44 // A. Wilcox
     45 // Ada Worcester
     46 // Alex Dowad
     47 // Alex Suykov
     48 // Alexander Monakov
     49 // Andre McCurdy
     50 // Andrew Kelley
     51 // Anthony G. Basile
     52 // Aric Belsito
     53 // Arvid Picciani
     54 // Bartosz Brachaczek
     55 // Benjamin Peterson
     56 // Bobby Bingham
     57 // Boris Brezillon
     58 // Brent Cook
     59 // Chris Spiegel
     60 // Clément Vasseur
     61 // Daniel Micay
     62 // Daniel Sabogal
     63 // Daurnimator
     64 // David Carlier
     65 // David Edelsohn
     66 // Denys Vlasenko
     67 // Dmitry Ivanov
     68 // Dmitry V. Levin
     69 // Drew DeVault
     70 // Emil Renner Berthing
     71 // Fangrui Song
     72 // Felix Fietkau
     73 // Felix Janda
     74 // Gianluca Anzolin
     75 // Hauke Mehrtens
     76 // He X
     77 // Hiltjo Posthuma
     78 // Isaac Dunham
     79 // Jaydeep Patil
     80 // Jens Gustedt
     81 // Jeremy Huntwork
     82 // Jo-Philipp Wich
     83 // Joakim Sindholt
     84 // John Spencer
     85 // Julien Ramseier
     86 // Justin Cormack
     87 // Kaarle Ritvanen
     88 // Khem Raj
     89 // Kylie McClain
     90 // Leah Neukirchen
     91 // Luca Barbato
     92 // Luka Perkov
     93 // M Farkas-Dyck (Strake)
     94 // Mahesh Bodapati
     95 // Markus Wichmann
     96 // Masanori Ogino
     97 // Michael Clark
     98 // Michael Forney
     99 // Mikhail Kremnyov
    100 // Natanael Copa
    101 // Nicholas J. Kain
    102 // orc
    103 // Pascal Cuoq
    104 // Patrick Oppenlander
    105 // Petr Hosek
    106 // Petr Skocik
    107 // Pierre Carrier
    108 // Reini Urban
    109 // Rich Felker
    110 // Richard Pennington
    111 // Ryan Fairfax
    112 // Samuel Holland
    113 // Segev Finer
    114 // Shiz
    115 // sin
    116 // Solar Designer
    117 // Stefan Kristiansson
    118 // Stefan O'Rear
    119 // Szabolcs Nagy
    120 // Timo Teräs
    121 // Trutz Behn
    122 // Valentin Ochs
    123 // Will Dietz
    124 // William Haddon
    125 // William Pitcock
    126 //
    127 // Portions of this software are derived from third-party works licensed
    128 // under terms compatible with the above MIT license:
    129 //
    130 // The TRE regular expression implementation (src/regex/reg* and
    131 // src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
    132 // under a 2-clause BSD license (license text in the source files). The
    133 // included version has been heavily modified by Rich Felker in 2012, in
    134 // the interests of size, simplicity, and namespace cleanliness.
    135 //
    136 // Much of the math library code (src/math/* and src/complex/*) is
    137 // Copyright © 1993,2004 Sun Microsystems or
    138 // Copyright © 2003-2011 David Schultz or
    139 // Copyright © 2003-2009 Steven G. Kargl or
    140 // Copyright © 2003-2009 Bruce D. Evans or
    141 // Copyright © 2008 Stephen L. Moshier or
    142 // Copyright © 2017-2018 Arm Limited
    143 // and labelled as such in comments in the individual source files. All
    144 // have been licensed under extremely permissive terms.
    145 //
    146 // The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
    147 // The Android Open Source Project and is licensed under a two-clause BSD
    148 // license. It was taken from Bionic libc, used on Android.
    149 //
    150 // The AArch64 memcpy and memset code (src/string/aarch64/*) are
    151 // Copyright © 1999-2019, Arm Limited.
    152 //
    153 // The implementation of DES for crypt (src/crypt/crypt_des.c) is
    154 // Copyright © 1994 David Burren. It is licensed under a BSD license.
    155 //
    156 // The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
    157 // originally written by Solar Designer and placed into the public
    158 // domain. The code also comes with a fallback permissive license for use
    159 // in jurisdictions that may not recognize the public domain.
    160 //
    161 // The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
    162 // Valentin Ochs and is licensed under an MIT-style license.
    163 //
    164 // The x86_64 port was written by Nicholas J. Kain and is licensed under
    165 // the standard MIT terms.
    166 //
    167 // The mips and microblaze ports were originally written by Richard
    168 // Pennington for use in the ellcc project. The original code was adapted
    169 // by Rich Felker for build system and code conventions during upstream
    170 // integration. It is licensed under the standard MIT terms.
    171 //
    172 // The mips64 port was contributed by Imagination Technologies and is
    173 // licensed under the standard MIT terms.
    174 //
    175 // The powerpc port was also originally written by Richard Pennington,
    176 // and later supplemented and integrated by John Spencer. It is licensed
    177 // under the standard MIT terms.
    178 //
    179 // All other files which have no copyright comments are original works
    180 // produced specifically for use as part of this library, written either
    181 // by Rich Felker, the main author of the library, or by one or more
    182 // contibutors listed above. Details on authorship of individual files
    183 // can be found in the git version control history of the project. The
    184 // omission of copyright and license comments in each file is in the
    185 // interest of source tree size.
    186 //
    187 // In addition, permission is hereby granted for all public header files
    188 // (include/* and arch/*/bits/*) and crt files intended to be linked into
    189 // applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
    190 // the copyright notice and permission notice otherwise required by the
    191 // license, and to use these files without any requirement of
    192 // attribution. These files include substantial contributions from:
    193 //
    194 // Bobby Bingham
    195 // John Spencer
    196 // Nicholas J. Kain
    197 // Rich Felker
    198 // Richard Pennington
    199 // Stefan Kristiansson
    200 // Szabolcs Nagy
    201 //
    202 // all of whom have explicitly granted such permission.
    203 //
    204 // This file previously contained text expressing a belief that most of
    205 // the files covered by the above exception were sufficiently trivial not
    206 // to be subject to copyright, resulting in confusion over whether it
    207 // negated the permissions granted in the license. In the spirit of
    208 // permissive licensing, and of not having licensing issues being an
    209 // obstacle to adoption, that text has been removed.
    210 const ( /* copyright.c:194:1: */
    211 	__musl__copyright__ = 0
    212 )
    213 
    214 const ( /* nameser.h:117:1: */
    215 	ns_uop_delete = 0
    216 	ns_uop_add    = 1
    217 	ns_uop_max    = 2
    218 )
    219 
    220 const ( /* nameser.h:147:1: */
    221 	ns_t_invalid  = 0
    222 	ns_t_a        = 1
    223 	ns_t_ns       = 2
    224 	ns_t_md       = 3
    225 	ns_t_mf       = 4
    226 	ns_t_cname    = 5
    227 	ns_t_soa      = 6
    228 	ns_t_mb       = 7
    229 	ns_t_mg       = 8
    230 	ns_t_mr       = 9
    231 	ns_t_null     = 10
    232 	ns_t_wks      = 11
    233 	ns_t_ptr      = 12
    234 	ns_t_hinfo    = 13
    235 	ns_t_minfo    = 14
    236 	ns_t_mx       = 15
    237 	ns_t_txt      = 16
    238 	ns_t_rp       = 17
    239 	ns_t_afsdb    = 18
    240 	ns_t_x25      = 19
    241 	ns_t_isdn     = 20
    242 	ns_t_rt       = 21
    243 	ns_t_nsap     = 22
    244 	ns_t_nsap_ptr = 23
    245 	ns_t_sig      = 24
    246 	ns_t_key      = 25
    247 	ns_t_px       = 26
    248 	ns_t_gpos     = 27
    249 	ns_t_aaaa     = 28
    250 	ns_t_loc      = 29
    251 	ns_t_nxt      = 30
    252 	ns_t_eid      = 31
    253 	ns_t_nimloc   = 32
    254 	ns_t_srv      = 33
    255 	ns_t_atma     = 34
    256 	ns_t_naptr    = 35
    257 	ns_t_kx       = 36
    258 	ns_t_cert     = 37
    259 	ns_t_a6       = 38
    260 	ns_t_dname    = 39
    261 	ns_t_sink     = 40
    262 	ns_t_opt      = 41
    263 	ns_t_apl      = 42
    264 	ns_t_tkey     = 249
    265 	ns_t_tsig     = 250
    266 	ns_t_ixfr     = 251
    267 	ns_t_axfr     = 252
    268 	ns_t_mailb    = 253
    269 	ns_t_maila    = 254
    270 	ns_t_any      = 255
    271 	ns_t_zxfr     = 256
    272 	ns_t_max      = 65536
    273 )
    274 
    275 const ( /* nameser.h:210:1: */
    276 	ns_c_invalid = 0
    277 	ns_c_in      = 1
    278 	ns_c_2       = 2
    279 	ns_c_chaos   = 3
    280 	ns_c_hs      = 4
    281 	ns_c_none    = 254
    282 	ns_c_any     = 255
    283 	ns_c_max     = 65536
    284 )
    285 
    286 const ( /* nameser.h:221:1: */
    287 	ns_kt_rsa     = 1
    288 	ns_kt_dh      = 2
    289 	ns_kt_dsa     = 3
    290 	ns_kt_private = 254
    291 )
    292 
    293 const ( /* nameser.h:228:1: */
    294 	cert_t_pkix = 1
    295 	cert_t_spki = 2
    296 	cert_t_pgp  = 3
    297 	cert_t_url  = 253
    298 	cert_t_oid  = 254
    299 )
    300 
    301 const ( /* nameser.h:28:1: */
    302 	ns_s_qd  = 0
    303 	ns_s_zn  = 0
    304 	ns_s_an  = 1
    305 	ns_s_pr  = 1
    306 	ns_s_ns  = 2
    307 	ns_s_ud  = 2
    308 	ns_s_ar  = 3
    309 	ns_s_max = 4
    310 )
    311 
    312 const ( /* nameser.h:75:1: */
    313 	ns_f_qr     = 0
    314 	ns_f_opcode = 1
    315 	ns_f_aa     = 2
    316 	ns_f_tc     = 3
    317 	ns_f_rd     = 4
    318 	ns_f_ra     = 5
    319 	ns_f_z      = 6
    320 	ns_f_ad     = 7
    321 	ns_f_cd     = 8
    322 	ns_f_rcode  = 9
    323 	ns_f_max    = 10
    324 )
    325 
    326 const ( /* nameser.h:89:1: */
    327 	ns_o_query  = 0
    328 	ns_o_iquery = 1
    329 	ns_o_status = 2
    330 	ns_o_notify = 4
    331 	ns_o_update = 5
    332 	ns_o_max    = 6
    333 )
    334 
    335 const ( /* nameser.h:98:1: */
    336 	ns_r_noerror  = 0
    337 	ns_r_formerr  = 1
    338 	ns_r_servfail = 2
    339 	ns_r_nxdomain = 3
    340 	ns_r_notimpl  = 4
    341 	ns_r_refused  = 5
    342 	ns_r_yxdomain = 6
    343 	ns_r_yxrrset  = 7
    344 	ns_r_nxrrset  = 8
    345 	ns_r_notauth  = 9
    346 	ns_r_notzone  = 10
    347 	ns_r_max      = 11
    348 	ns_r_badvers  = 16
    349 	ns_r_badsig   = 16
    350 	ns_r_badkey   = 17
    351 	ns_r_badtime  = 18
    352 )
    353 
    354 type ptrdiff_t = int64 /* <builtin>:3:26 */
    355 
    356 type size_t = uint64 /* <builtin>:9:23 */
    357 
    358 type wchar_t = int32 /* <builtin>:15:24 */
    359 
    360 // # 1 "lib/libc/gen/ctype_.c"
    361 // # 1 "<built-in>"
    362 // # 1 "<command-line>"
    363 // # 1 "lib/libc/gen/ctype_.c"
    364 // # 36 "lib/libc/gen/ctype_.c"
    365 // # 1 "./include/ctype.h" 1
    366 // # 43 "./include/ctype.h"
    367 // # 1 "./sys/sys/cdefs.h" 1
    368 // # 41 "./sys/sys/cdefs.h"
    369 // # 1 "./machine/cdefs.h" 1
    370 // # 42 "./sys/sys/cdefs.h" 2
    371 // # 44 "./include/ctype.h" 2
    372 // # 57 "./include/ctype.h"
    373 // typedef void *locale_t;
    374 //
    375 //
    376 //
    377 //
    378 //
    379 // extern const char *_ctype_;
    380 // extern const short *_tolower_tab_;
    381 // extern const short *_toupper_tab_;
    382 //
    383 //
    384 // int isalnum(int);
    385 // int isalpha(int);
    386 // int iscntrl(int);
    387 // int isdigit(int);
    388 // int isgraph(int);
    389 // int islower(int);
    390 // int isprint(int);
    391 // int ispunct(int);
    392 // int isspace(int);
    393 // int isupper(int);
    394 // int isxdigit(int);
    395 // int tolower(int);
    396 // int toupper(int);
    397 //
    398 //
    399 //
    400 // int isblank(int);
    401 //
    402 //
    403 //
    404 // int isascii(int);
    405 // int toascii(int);
    406 // int _tolower(int);
    407 // int _toupper(int);
    408 //
    409 //
    410 //
    411 // int isalnum_l(int, locale_t);
    412 // int isalpha_l(int, locale_t);
    413 // int isblank_l(int, locale_t);
    414 // int iscntrl_l(int, locale_t);
    415 // int isdigit_l(int, locale_t);
    416 // int isgraph_l(int, locale_t);
    417 // int islower_l(int, locale_t);
    418 // int isprint_l(int, locale_t);
    419 // int ispunct_l(int, locale_t);
    420 // int isspace_l(int, locale_t);
    421 // int isupper_l(int, locale_t);
    422 // int isxdigit_l(int, locale_t);
    423 // int tolower_l(int, locale_t);
    424 // int toupper_l(int, locale_t);
    425 //
    426 //
    427 //
    428 //
    429 //
    430 //
    431 // extern __inline __attribute__((__gnu_inline__)) int isalnum(int _c)
    432 // {
    433 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (0x01|0x02|0x04)));
    434 // }
    435 //
    436 // extern __inline __attribute__((__gnu_inline__)) int isalpha(int _c)
    437 // {
    438 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (0x01|0x02)));
    439 // }
    440 //
    441 // extern __inline __attribute__((__gnu_inline__)) int iscntrl(int _c)
    442 // {
    443 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & 0x20));
    444 // }
    445 //
    446 // extern __inline __attribute__((__gnu_inline__)) int isdigit(int _c)
    447 // {
    448 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & 0x04));
    449 // }
    450 //
    451 // extern __inline __attribute__((__gnu_inline__)) int isgraph(int _c)
    452 // {
    453 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (0x10|0x01|0x02|0x04)));
    454 // }
    455 //
    456 // extern __inline __attribute__((__gnu_inline__)) int islower(int _c)
    457 // {
    458 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & 0x02));
    459 // }
    460 //
    461 // extern __inline __attribute__((__gnu_inline__)) int isprint(int _c)
    462 // {
    463 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (0x10|0x01|0x02|0x04|0x80)));
    464 // }
    465 //
    466 // extern __inline __attribute__((__gnu_inline__)) int ispunct(int _c)
    467 // {
    468 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & 0x10));
    469 // }
    470 //
    471 // extern __inline __attribute__((__gnu_inline__)) int isspace(int _c)
    472 // {
    473 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & 0x08));
    474 // }
    475 //
    476 // extern __inline __attribute__((__gnu_inline__)) int isupper(int _c)
    477 // {
    478 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & 0x01));
    479 // }
    480 //
    481 // extern __inline __attribute__((__gnu_inline__)) int isxdigit(int _c)
    482 // {
    483 //  return (_c == -1 ? 0 : ((_ctype_ + 1)[(unsigned char)_c] & (0x04|0x40)));
    484 // }
    485 //
    486 // extern __inline __attribute__((__gnu_inline__)) int tolower(int _c)
    487 // {
    488 //  if ((unsigned int)_c > 255)
    489 //   return (_c);
    490 //  return ((_tolower_tab_ + 1)[_c]);
    491 // }
    492 //
    493 // extern __inline __attribute__((__gnu_inline__)) int toupper(int _c)
    494 // {
    495 //  if ((unsigned int)_c > 255)
    496 //   return (_c);
    497 //  return ((_toupper_tab_ + 1)[_c]);
    498 // }
    499 //
    500 //
    501 
    502 // extern __inline __attribute__((__gnu_inline__))
    503 func Xisblank(tls *TLS, _c int32) int32 { /* ctype_.c:144:5: */
    504 	return Bool32(_c == ' ' || _c == '\t')
    505 }
    506 
    507 // extern __inline __attribute__((__gnu_inline__)) int isascii(int _c)
    508 // {
    509 //  return ((unsigned int)_c <= 0177);
    510 // }
    511 //
    512 // extern __inline __attribute__((__gnu_inline__)) int toascii(int _c)
    513 // {
    514 //  return (_c & 0177);
    515 // }
    516 //
    517 // extern __inline __attribute__((__gnu_inline__)) int _tolower(int _c)
    518 // {
    519 //  return (_c - 'A' + 'a');
    520 // }
    521 //
    522 // extern __inline __attribute__((__gnu_inline__)) int _toupper(int _c)
    523 // {
    524 //  return (_c - 'a' + 'A');
    525 // }
    526 //
    527 //
    528 //
    529 // extern __inline __attribute__((__gnu_inline__)) int
    530 // isalnum_l(int _c, locale_t _l __attribute__((__unused__)))
    531 // {
    532 //  return isalnum(_c);
    533 // }
    534 //
    535 // extern __inline __attribute__((__gnu_inline__)) int
    536 // isalpha_l(int _c, locale_t _l __attribute__((__unused__)))
    537 // {
    538 //  return isalpha(_c);
    539 // }
    540 //
    541 // extern __inline __attribute__((__gnu_inline__)) int
    542 // isblank_l(int _c, locale_t _l __attribute__((__unused__)))
    543 // {
    544 //  return isblank(_c);
    545 // }
    546 //
    547 // extern __inline __attribute__((__gnu_inline__)) int
    548 // iscntrl_l(int _c, locale_t _l __attribute__((__unused__)))
    549 // {
    550 //  return iscntrl(_c);
    551 // }
    552 //
    553 // extern __inline __attribute__((__gnu_inline__)) int
    554 // isdigit_l(int _c, locale_t _l __attribute__((__unused__)))
    555 // {
    556 //  return isdigit(_c);
    557 // }
    558 //
    559 // extern __inline __attribute__((__gnu_inline__)) int
    560 // isgraph_l(int _c, locale_t _l __attribute__((__unused__)))
    561 // {
    562 //  return isgraph(_c);
    563 // }
    564 //
    565 // extern __inline __attribute__((__gnu_inline__)) int
    566 // islower_l(int _c, locale_t _l __attribute__((__unused__)))
    567 // {
    568 //  return islower(_c);
    569 // }
    570 //
    571 // extern __inline __attribute__((__gnu_inline__)) int
    572 // isprint_l(int _c, locale_t _l __attribute__((__unused__)))
    573 // {
    574 //  return isprint(_c);
    575 // }
    576 //
    577 // extern __inline __attribute__((__gnu_inline__)) int
    578 // ispunct_l(int _c, locale_t _l __attribute__((__unused__)))
    579 // {
    580 //  return ispunct(_c);
    581 // }
    582 //
    583 // extern __inline __attribute__((__gnu_inline__)) int
    584 // isspace_l(int _c, locale_t _l __attribute__((__unused__)))
    585 // {
    586 //  return isspace(_c);
    587 // }
    588 //
    589 // extern __inline __attribute__((__gnu_inline__)) int
    590 // isupper_l(int _c, locale_t _l __attribute__((__unused__)))
    591 // {
    592 //  return isupper(_c);
    593 // }
    594 //
    595 // extern __inline __attribute__((__gnu_inline__)) int
    596 // isxdigit_l(int _c, locale_t _l __attribute__((__unused__)))
    597 // {
    598 //  return isxdigit(_c);
    599 // }
    600 //
    601 // extern __inline __attribute__((__gnu_inline__)) int
    602 // tolower_l(int _c, locale_t _l __attribute__((__unused__)))
    603 // {
    604 //  return tolower(_c);
    605 // }
    606 //
    607 // extern __inline __attribute__((__gnu_inline__)) int
    608 // toupper_l(int _c, locale_t _l __attribute__((__unused__)))
    609 // {
    610 //  return toupper(_c);
    611 // }
    612 //
    613 //
    614 //
    615 //
    616 //
    617 // # 37 "lib/libc/gen/ctype_.c" 2
    618 // # 1 "./lib/libc/include/ctype_private.h" 1
    619 //
    620 //
    621 //
    622 //
    623 //
    624 // # 5 "./lib/libc/include/ctype_private.h"
    625 // #pragma GCC visibility push(hidden)
    626 // # 5 "./lib/libc/include/ctype_private.h"
    627 //
    628 // extern const char _C_ctype_[];
    629 // extern const short _C_toupper_[];
    630 // extern const short _C_tolower_[];
    631 //
    632 // # 9 "./lib/libc/include/ctype_private.h"
    633 // #pragma GCC visibility pop
    634 // # 9 "./lib/libc/include/ctype_private.h"
    635 //
    636 // # 38 "lib/libc/gen/ctype_.c" 2
    637 
    638 var X_C_ctype_ = [257]int8{
    639 	int8(0),
    640 	int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20),
    641 	int8(0x20), int8(0x20 | 0x08), int8(0x20 | 0x08), int8(0x20 | 0x08), int8(0x20 | 0x08), int8(0x20 | 0x08), int8(0x20), int8(0x20),
    642 	int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20),
    643 	int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20), int8(0x20),
    644 	int8(0x08 | int32(Int8FromInt32(0x80))), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10),
    645 	int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10),
    646 	int8(0x04), int8(0x04), int8(0x04), int8(0x04), int8(0x04), int8(0x04), int8(0x04), int8(0x04),
    647 	int8(0x04), int8(0x04), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10),
    648 	int8(0x10), int8(0x01 | 0x40), int8(0x01 | 0x40), int8(0x01 | 0x40), int8(0x01 | 0x40), int8(0x01 | 0x40), int8(0x01 | 0x40), int8(0x01),
    649 	int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01),
    650 	int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01), int8(0x01),
    651 	int8(0x01), int8(0x01), int8(0x01), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x10),
    652 	int8(0x10), int8(0x02 | 0x40), int8(0x02 | 0x40), int8(0x02 | 0x40), int8(0x02 | 0x40), int8(0x02 | 0x40), int8(0x02 | 0x40), int8(0x02),
    653 	int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02),
    654 	int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02), int8(0x02),
    655 	int8(0x02), int8(0x02), int8(0x02), int8(0x10), int8(0x10), int8(0x10), int8(0x10), int8(0x20),
    656 
    657 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    658 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    659 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    660 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    661 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    662 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    663 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    664 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    665 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    666 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    667 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    668 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    669 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    670 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    671 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    672 	int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0),
    673 } /* ctype_.c:282:12 */
    674 
    675 var X_ctype_ uintptr = 0 /* ctype_.c:319:12 */
    676 
    677 func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
    678 	return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5))
    679 }
    680 
    681 type locale_t = uintptr /* alltypes.h:351:32 */
    682 
    683 func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */
    684 	return Bool32(func() int32 {
    685 		if 0 != 0 {
    686 			return Xisalpha(tls, c)
    687 		}
    688 		return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
    689 	}() != 0 || func() int32 {
    690 		if 0 != 0 {
    691 			return Xisdigit(tls, c)
    692 		}
    693 		return Bool32(uint32(c)-uint32('0') < uint32(10))
    694 	}() != 0)
    695 }
    696 
    697 func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */
    698 	return Xisalnum(tls, c)
    699 }
    700 
    701 func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */
    702 	return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26))
    703 }
    704 
    705 func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */
    706 	return Xisalpha(tls, c)
    707 }
    708 
    709 func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */
    710 	return Bool32(uint32(c)-uint32('0') < uint32(10))
    711 }
    712 
    713 func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */
    714 	return Xisdigit(tls, c)
    715 }
    716 
    717 func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */
    718 	return Bool32(uint32(c)-uint32('a') < uint32(26))
    719 }
    720 
    721 func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */
    722 	return Xislower(tls, c)
    723 }
    724 
    725 func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */
    726 	return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f))
    727 }
    728 
    729 func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */
    730 	return Xisprint(tls, c)
    731 }
    732 
    733 func Xisspace(tls *TLS, c int32) int32 { /* isspace.c:4:5: */
    734 	return Bool32(c == ' ' || uint32(c)-uint32('\t') < uint32(5))
    735 }
    736 
    737 func X__isspace_l(tls *TLS, c int32, l locale_t) int32 { /* isspace.c:9:5: */
    738 	return Xisspace(tls, c)
    739 }
    740 
    741 func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */
    742 	return Bool32(uint32(c)-uint32('A') < uint32(26))
    743 }
    744 
    745 func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */
    746 	return Xisupper(tls, c)
    747 }
    748 
    749 func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */
    750 	return Bool32(func() int32 {
    751 		if 0 != 0 {
    752 			return Xisdigit(tls, c)
    753 		}
    754 		return Bool32(uint32(c)-uint32('0') < uint32(10))
    755 	}() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6))
    756 }
    757 
    758 func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */
    759 	return Xisxdigit(tls, c)
    760 }
    761 
    762 type uintptr_t = uint64 /* alltypes.h:63:24 */
    763 
    764 type intptr_t = int64 /* alltypes.h:78:15 */
    765 
    766 type int8_t = int8 /* alltypes.h:104:25 */
    767 
    768 type int16_t = int16 /* alltypes.h:109:25 */
    769 
    770 type int32_t = int32 /* alltypes.h:114:25 */
    771 
    772 type int64_t = int64 /* alltypes.h:119:25 */
    773 
    774 type intmax_t = int64 /* alltypes.h:124:25 */
    775 
    776 type uint8_t = uint8 /* alltypes.h:129:25 */
    777 
    778 type uint16_t = uint16 /* alltypes.h:134:25 */
    779 
    780 type uint32_t = uint32 /* alltypes.h:139:25 */
    781 
    782 type uint64_t = uint64 /* alltypes.h:144:25 */
    783 
    784 type uintmax_t = uint64 /* alltypes.h:154:25 */
    785 
    786 type int_fast8_t = int8_t   /* stdint.h:22:16 */
    787 type int_fast64_t = int64_t /* stdint.h:23:17 */
    788 
    789 type int_least8_t = int8_t   /* stdint.h:25:17 */
    790 type int_least16_t = int16_t /* stdint.h:26:17 */
    791 type int_least32_t = int32_t /* stdint.h:27:17 */
    792 type int_least64_t = int64_t /* stdint.h:28:17 */
    793 
    794 type uint_fast8_t = uint8_t   /* stdint.h:30:17 */
    795 type uint_fast64_t = uint64_t /* stdint.h:31:18 */
    796 
    797 type uint_least8_t = uint8_t   /* stdint.h:33:18 */
    798 type uint_least16_t = uint16_t /* stdint.h:34:18 */
    799 type uint_least32_t = uint32_t /* stdint.h:35:18 */
    800 type uint_least64_t = uint64_t /* stdint.h:36:18 */
    801 
    802 type int_fast16_t = int32_t   /* stdint.h:1:17 */
    803 type int_fast32_t = int32_t   /* stdint.h:2:17 */
    804 type uint_fast16_t = uint32_t /* stdint.h:3:18 */
    805 type uint_fast32_t = uint32_t /* stdint.h:4:18 */
    806 
    807 type ssize_t = int64 /* alltypes.h:73:15 */
    808 
    809 type off_t = int64 /* alltypes.h:170:16 */
    810 
    811 type _IO_FILE = struct {
    812 	Fflags        uint32
    813 	F__ccgo_pad1  [4]byte
    814 	Frpos         uintptr
    815 	Frend         uintptr
    816 	Fclose        uintptr
    817 	Fwend         uintptr
    818 	Fwpos         uintptr
    819 	Fmustbezero_1 uintptr
    820 	Fwbase        uintptr
    821 	Fread         uintptr
    822 	Fwrite        uintptr
    823 	Fseek         uintptr
    824 	Fbuf          uintptr
    825 	Fbuf_size     size_t
    826 	Fprev         uintptr
    827 	Fnext         uintptr
    828 	Ffd           int32
    829 	Fpipe_pid     int32
    830 	Flockcount    int64
    831 	Fmode         int32
    832 	Flock         int32
    833 	Flbf          int32
    834 	F__ccgo_pad2  [4]byte
    835 	Fcookie       uintptr
    836 	Foff          off_t
    837 	Fgetln_buf    uintptr
    838 	Fmustbezero_2 uintptr
    839 	Fshend        uintptr
    840 	Fshlim        off_t
    841 	Fshcnt        off_t
    842 	Fprev_locked  uintptr
    843 	Fnext_locked  uintptr
    844 	Flocale       uintptr
    845 } /* alltypes.h:328:9 */
    846 
    847 type FILE = _IO_FILE /* alltypes.h:328:25 */
    848 
    849 type va_list = uintptr /* alltypes.h:334:27 */
    850 
    851 type _G_fpos64_t = struct {
    852 	F__ccgo_pad1 [0]uint64
    853 	F__opaque    [16]int8
    854 } /* stdio.h:54:9 */
    855 
    856 type fpos_t = _G_fpos64_t /* stdio.h:58:3 */
    857 
    858 type float_t = float32 /* alltypes.h:38:15 */
    859 
    860 type double_t = float64 /* alltypes.h:43:16 */
    861 
    862 func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */
    863 	bp := tls.Alloc(4)
    864 	defer tls.Free(4)
    865 
    866 	// var __u struct {F__f float32;} at bp, 4
    867 
    868 	*(*float32)(unsafe.Pointer(bp)) = __f
    869 	return *(*uint32)(unsafe.Pointer(bp))
    870 }
    871 
    872 func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */
    873 	bp := tls.Alloc(8)
    874 	defer tls.Free(8)
    875 
    876 	// var __u struct {F__f float64;} at bp, 8
    877 
    878 	*(*float64)(unsafe.Pointer(bp)) = __f
    879 	return *(*uint64)(unsafe.Pointer(bp))
    880 }
    881 
    882 type syscall_arg_t = int64 /* syscall.h:22:14 */
    883 
    884 func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */
    885 	var c int32
    886 	var x int32
    887 	var y int64
    888 	var neg int32 = 0
    889 
    890 	c = func() int32 {
    891 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    892 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    893 		}
    894 		return X__shgetc(tls, f)
    895 	}()
    896 	if c == '+' || c == '-' {
    897 		neg = Bool32(c == '-')
    898 		c = func() int32 {
    899 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    900 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    901 			}
    902 			return X__shgetc(tls, f)
    903 		}()
    904 		if uint32(c-'0') >= 10 && pok != 0 {
    905 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
    906 				(*FILE)(unsafe.Pointer(f)).Frpos--
    907 			} else {
    908 			}
    909 		}
    910 	}
    911 	if uint32(c-'0') >= 10 {
    912 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
    913 			(*FILE)(unsafe.Pointer(f)).Frpos--
    914 		} else {
    915 		}
    916 		return -0x7fffffffffffffff - int64(1)
    917 	}
    918 	for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 {
    919 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    920 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    921 		}
    922 		return X__shgetc(tls, f)
    923 	}() {
    924 		x = 10*x + c - '0'
    925 	}
    926 	for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 {
    927 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    928 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    929 		}
    930 		return X__shgetc(tls, f)
    931 	}() {
    932 		y = int64(10)*y + int64(c) - int64('0')
    933 	}
    934 	for ; uint32(c-'0') < 10; c = func() int32 {
    935 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    936 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    937 		}
    938 		return X__shgetc(tls, f)
    939 	}() {
    940 	}
    941 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
    942 		(*FILE)(unsafe.Pointer(f)).Frpos--
    943 	} else {
    944 	}
    945 	if neg != 0 {
    946 		return -y
    947 	}
    948 	return y
    949 }
    950 
    951 func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */
    952 	bp := tls.Alloc(512)
    953 	defer tls.Free(512)
    954 
    955 	// var x [128]uint32_t at bp, 512
    956 
    957 	var i int32
    958 	var j int32
    959 	var k int32
    960 	var a int32
    961 	var z int32
    962 	var lrp int64 = int64(0)
    963 	var dc int64 = int64(0)
    964 	var e10 int64 = int64(0)
    965 	var lnz int32 = 0
    966 	var gotdig int32 = 0
    967 	var gotrad int32 = 0
    968 	var rp int32
    969 	var e2 int32
    970 	var emax int32 = -emin - bits + 3
    971 	var denormal int32 = 0
    972 	var y float64
    973 	var frac float64 = float64(0)
    974 	var bias float64 = float64(0)
    975 
    976 	j = 0
    977 	k = 0
    978 
    979 	// Don't let leading zeros consume buffer space
    980 	for ; c == '0'; c = func() int32 {
    981 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    982 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    983 		}
    984 		return X__shgetc(tls, f)
    985 	}() {
    986 		gotdig = 1
    987 	}
    988 	if c == '.' {
    989 		gotrad = 1
    990 		for c = func() int32 {
    991 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    992 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    993 			}
    994 			return X__shgetc(tls, f)
    995 		}(); c == '0'; c = func() int32 {
    996 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    997 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    998 			}
    999 			return X__shgetc(tls, f)
   1000 		}() {
   1001 			gotdig = 1
   1002 			lrp--
   1003 		}
   1004 	}
   1005 
   1006 	*(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0)
   1007 	for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 {
   1008 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1009 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1010 		}
   1011 		return X__shgetc(tls, f)
   1012 	}() {
   1013 		if c == '.' {
   1014 			if gotrad != 0 {
   1015 				break
   1016 			}
   1017 			gotrad = 1
   1018 			lrp = dc
   1019 		} else if k < 128-3 {
   1020 			dc++
   1021 			if c != '0' {
   1022 				lnz = int32(dc)
   1023 			}
   1024 			if j != 0 {
   1025 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))*uint32_t(10) + uint32_t(c) - uint32_t('0')
   1026 			} else {
   1027 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0')
   1028 			}
   1029 			if PreIncInt32(&j, 1) == 9 {
   1030 				k++
   1031 				j = 0
   1032 			}
   1033 			gotdig = 1
   1034 		} else {
   1035 			dc++
   1036 			if c != '0' {
   1037 				lnz = (128 - 4) * 9
   1038 				*(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1)
   1039 			}
   1040 		}
   1041 	}
   1042 	if !(gotrad != 0) {
   1043 		lrp = dc
   1044 	}
   1045 
   1046 	if gotdig != 0 && c|32 == 'e' {
   1047 		e10 = scanexp(tls, f, pok)
   1048 		if e10 == -0x7fffffffffffffff-int64(1) {
   1049 			if pok != 0 {
   1050 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1051 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1052 				} else {
   1053 				}
   1054 			} else {
   1055 				X__shlim(tls, f, int64(0))
   1056 				return float64(0)
   1057 			}
   1058 			e10 = int64(0)
   1059 		}
   1060 		lrp = lrp + e10
   1061 	} else if c >= 0 {
   1062 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1063 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1064 		} else {
   1065 		}
   1066 	}
   1067 	if !(gotdig != 0) {
   1068 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1069 		X__shlim(tls, f, int64(0))
   1070 		return float64(0)
   1071 	}
   1072 
   1073 	// Handle zero specially to avoid nasty special cases later
   1074 	if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) {
   1075 		return float64(sign) * 0.0
   1076 	}
   1077 
   1078 	// Optimize small integers (w/no exponent) and over/under-flow
   1079 	if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) {
   1080 		return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
   1081 	}
   1082 	if lrp > int64(-emin/2) {
   1083 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1084 		return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
   1085 	}
   1086 	if lrp < int64(emin-2*53) {
   1087 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1088 		return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
   1089 	}
   1090 
   1091 	// Align incomplete final B1B digit
   1092 	if j != 0 {
   1093 		for ; j < 9; j++ {
   1094 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10)
   1095 		}
   1096 		k++
   1097 		j = 0
   1098 	}
   1099 
   1100 	a = 0
   1101 	z = k
   1102 	e2 = 0
   1103 	rp = int32(lrp)
   1104 
   1105 	// Optimize small to mid-size integers (even in exp. notation)
   1106 	if lnz < 9 && lnz <= rp && rp < 18 {
   1107 		if rp == 9 {
   1108 			return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
   1109 		}
   1110 		if rp < 9 {
   1111 			return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp])
   1112 		}
   1113 		var bitlim int32 = bits - 3*(rp-9)
   1114 		if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) {
   1115 			return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10])
   1116 		}
   1117 	}
   1118 
   1119 	// Drop trailing zeros
   1120 	for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- {
   1121 	}
   1122 
   1123 	// Align radix point to B1B digit boundary
   1124 	if rp%9 != 0 {
   1125 		var rpm9 int32
   1126 		if rp >= 0 {
   1127 			rpm9 = rp % 9
   1128 		} else {
   1129 			rpm9 = rp%9 + 9
   1130 		}
   1131 		var p10 int32 = _sp10s[8-rpm9]
   1132 		var carry uint32_t = uint32_t(0)
   1133 		for k = a; k != z; k++ {
   1134 			var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10)
   1135 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry
   1136 			carry = uint32_t(1000000000/p10) * tmp
   1137 			if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
   1138 				a = (a + 1) & (128 - 1)
   1139 				rp = rp - 9
   1140 			}
   1141 		}
   1142 		if carry != 0 {
   1143 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry
   1144 		}
   1145 		rp = rp + (9 - rpm9)
   1146 	}
   1147 
   1148 	// Upscale until desired number of bits are left of radix point
   1149 	for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] {
   1150 		var carry uint32_t = uint32_t(0)
   1151 		e2 = e2 - 29
   1152 		for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) {
   1153 			var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry)
   1154 			if tmp > uint64(1000000000) {
   1155 				carry = uint32_t(tmp / uint64(1000000000))
   1156 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000))
   1157 			} else {
   1158 				carry = uint32_t(0)
   1159 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp)
   1160 			}
   1161 			if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
   1162 				z = k
   1163 			}
   1164 			if k == a {
   1165 				break
   1166 			}
   1167 		}
   1168 		if carry != 0 {
   1169 			rp = rp + 9
   1170 			a = (a - 1) & (128 - 1)
   1171 			if a == z {
   1172 				z = (z - 1) & (128 - 1)
   1173 				*(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4))
   1174 			}
   1175 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry
   1176 		}
   1177 	}
   1178 
   1179 	// Downscale until exactly number of bits are left of radix point
   1180 	for {
   1181 		var carry uint32_t = uint32_t(0)
   1182 		var sh int32 = 1
   1183 		for i = 0; i < 2; i++ {
   1184 			k = (a + i) & (128 - 1)
   1185 			if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] {
   1186 				i = 2
   1187 				break
   1188 			}
   1189 			if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] {
   1190 				break
   1191 			}
   1192 		}
   1193 		if i == 2 && rp == 9*2 {
   1194 			break
   1195 		}
   1196 		// FIXME: find a way to compute optimal sh
   1197 		if rp > 9+9*2 {
   1198 			sh = 9
   1199 		}
   1200 		e2 = e2 + sh
   1201 		for k = a; k != z; k = (k + 1) & (128 - 1) {
   1202 			var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1)
   1203 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry
   1204 			carry = uint32_t(int32(1000000000)>>sh) * tmp
   1205 			if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
   1206 				a = (a + 1) & (128 - 1)
   1207 				i--
   1208 				rp = rp - 9
   1209 			}
   1210 		}
   1211 		if carry != 0 {
   1212 			if (z+1)&(128-1) != a {
   1213 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry
   1214 				z = (z + 1) & (128 - 1)
   1215 			} else {
   1216 				*(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1)
   1217 			}
   1218 		}
   1219 	}
   1220 
   1221 	// Assemble desired bits into floating point variable
   1222 	for y = float64(AssignInt32(&i, 0)); i < 2; i++ {
   1223 		if (a+i)&(128-1) == z {
   1224 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0)
   1225 		}
   1226 		y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)))
   1227 	}
   1228 
   1229 	y = y * float64(sign)
   1230 
   1231 	// Limit precision for denormal results
   1232 	if bits > 53+e2-emin {
   1233 		bits = 53 + e2 - emin
   1234 		if bits < 0 {
   1235 			bits = 0
   1236 		}
   1237 		denormal = 1
   1238 	}
   1239 
   1240 	// Calculate bias term to force rounding, move out lower bits
   1241 	if bits < 53 {
   1242 		bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y)
   1243 		frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits))
   1244 		y = y - frac
   1245 		y = y + bias
   1246 	}
   1247 
   1248 	// Process tail of decimal input so it can affect rounding
   1249 	if (a+i)&(128-1) != z {
   1250 		var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))
   1251 		if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) {
   1252 			frac = frac + 0.25*float64(sign)
   1253 		} else if t > uint32_t(500000000) {
   1254 			frac = frac + 0.75*float64(sign)
   1255 		} else if t == uint32_t(500000000) {
   1256 			if (a+i+1)&(128-1) == z {
   1257 				frac = frac + 0.5*float64(sign)
   1258 			} else {
   1259 				frac = frac + 0.75*float64(sign)
   1260 			}
   1261 		}
   1262 		if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) {
   1263 			frac += 1
   1264 		}
   1265 	}
   1266 
   1267 	y = y + frac
   1268 	y = y - bias
   1269 
   1270 	if (e2+53)&0x7fffffff > emax-5 {
   1271 		if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 {
   1272 			if denormal != 0 && bits == 53+e2-emin {
   1273 				denormal = 0
   1274 			}
   1275 			y = y * 0.5
   1276 			e2++
   1277 		}
   1278 		if e2+53 > emax || denormal != 0 && frac != 0 {
   1279 			*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1280 		}
   1281 	}
   1282 
   1283 	return Xscalbnl(tls, y, e2)
   1284 }
   1285 
   1286 var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */
   1287 var _sp10s = [8]int32{10, 100, 1000, 10000,
   1288 	100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */
   1289 
   1290 func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */
   1291 	var x uint32_t = uint32_t(0)
   1292 	var y float64 = float64(0)
   1293 	var scale float64 = float64(1)
   1294 	var bias float64 = float64(0)
   1295 	var gottail int32 = 0
   1296 	var gotrad int32 = 0
   1297 	var gotdig int32 = 0
   1298 	var rp int64 = int64(0)
   1299 	var dc int64 = int64(0)
   1300 	var e2 int64 = int64(0)
   1301 	var d int32
   1302 	var c int32
   1303 
   1304 	c = func() int32 {
   1305 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1306 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1307 		}
   1308 		return X__shgetc(tls, f)
   1309 	}()
   1310 
   1311 	// Skip leading zeros
   1312 	for ; c == '0'; c = func() int32 {
   1313 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1314 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1315 		}
   1316 		return X__shgetc(tls, f)
   1317 	}() {
   1318 		gotdig = 1
   1319 	}
   1320 
   1321 	if c == '.' {
   1322 		gotrad = 1
   1323 		c = func() int32 {
   1324 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1325 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1326 			}
   1327 			return X__shgetc(tls, f)
   1328 		}()
   1329 		// Count zeros after the radix point before significand
   1330 		rp = int64(0)
   1331 	__1:
   1332 		if !(c == '0') {
   1333 			goto __3
   1334 		}
   1335 		gotdig = 1
   1336 		goto __2
   1337 	__2:
   1338 		c = func() int32 {
   1339 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1340 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1341 			}
   1342 			return X__shgetc(tls, f)
   1343 		}()
   1344 		rp--
   1345 		goto __1
   1346 		goto __3
   1347 	__3:
   1348 	}
   1349 
   1350 	for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 {
   1351 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1352 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1353 		}
   1354 		return X__shgetc(tls, f)
   1355 	}() {
   1356 		if c == '.' {
   1357 			if gotrad != 0 {
   1358 				break
   1359 			}
   1360 			rp = dc
   1361 			gotrad = 1
   1362 		} else {
   1363 			gotdig = 1
   1364 			if c > '9' {
   1365 				d = c | 32 + 10 - 'a'
   1366 			} else {
   1367 				d = c - '0'
   1368 			}
   1369 			if dc < int64(8) {
   1370 				x = x*uint32_t(16) + uint32_t(d)
   1371 			} else if dc < int64(53/4+1) {
   1372 				y = y + float64(d)*AssignDivFloat64(&scale, float64(16))
   1373 			} else if d != 0 && !(gottail != 0) {
   1374 				y = y + 0.5*scale
   1375 				gottail = 1
   1376 			}
   1377 			dc++
   1378 		}
   1379 	}
   1380 	if !(gotdig != 0) {
   1381 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1382 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1383 		} else {
   1384 		}
   1385 		if pok != 0 {
   1386 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1387 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1388 			} else {
   1389 			}
   1390 			if gotrad != 0 {
   1391 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1392 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1393 				} else {
   1394 				}
   1395 			}
   1396 		} else {
   1397 			X__shlim(tls, f, int64(0))
   1398 		}
   1399 		return float64(sign) * 0.0
   1400 	}
   1401 	if !(gotrad != 0) {
   1402 		rp = dc
   1403 	}
   1404 	for dc < int64(8) {
   1405 		x = x * uint32_t(16)
   1406 		dc++
   1407 	}
   1408 	if c|32 == 'p' {
   1409 		e2 = scanexp(tls, f, pok)
   1410 		if e2 == -0x7fffffffffffffff-int64(1) {
   1411 			if pok != 0 {
   1412 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1413 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1414 				} else {
   1415 				}
   1416 			} else {
   1417 				X__shlim(tls, f, int64(0))
   1418 				return float64(0)
   1419 			}
   1420 			e2 = int64(0)
   1421 		}
   1422 	} else {
   1423 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1424 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1425 		} else {
   1426 		}
   1427 	}
   1428 	e2 = e2 + (int64(4)*rp - int64(32))
   1429 
   1430 	if !(x != 0) {
   1431 		return float64(sign) * 0.0
   1432 	}
   1433 	if e2 > int64(-emin) {
   1434 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1435 		return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
   1436 	}
   1437 	if e2 < int64(emin-2*53) {
   1438 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1439 		return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
   1440 	}
   1441 
   1442 	for x < 0x80000000 {
   1443 		if y >= 0.5 {
   1444 			x = x + (x + uint32_t(1))
   1445 			y = y + (y - float64(1))
   1446 		} else {
   1447 			x = x + x
   1448 			y = y + y
   1449 		}
   1450 		e2--
   1451 	}
   1452 
   1453 	if int64(bits) > int64(32)+e2-int64(emin) {
   1454 		bits = int32(int64(32) + e2 - int64(emin))
   1455 		if bits < 0 {
   1456 			bits = 0
   1457 		}
   1458 	}
   1459 
   1460 	if bits < 53 {
   1461 		bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign))
   1462 	}
   1463 
   1464 	if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) {
   1465 		x++
   1466 		y = float64(0)
   1467 	}
   1468 
   1469 	y = bias + float64(sign)*float64(x) + float64(sign)*y
   1470 	y = y - bias
   1471 
   1472 	if !(y != 0) {
   1473 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1474 	}
   1475 
   1476 	return Xscalbnl(tls, y, int32(e2))
   1477 }
   1478 
   1479 func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
   1480 	var sign int32 = 1
   1481 	var i size_t
   1482 	var bits int32
   1483 	var emin int32
   1484 	var c int32
   1485 
   1486 	switch prec {
   1487 	case 0:
   1488 		bits = 24
   1489 		emin = -125 - bits
   1490 		break
   1491 	case 1:
   1492 		bits = 53
   1493 		emin = -1021 - bits
   1494 		break
   1495 	case 2:
   1496 		bits = 53
   1497 		emin = -1021 - bits
   1498 		break
   1499 	default:
   1500 		return float64(0)
   1501 	}
   1502 
   1503 	for __isspace(tls, AssignInt32(&c, func() int32 {
   1504 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1505 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1506 		}
   1507 		return X__shgetc(tls, f)
   1508 	}())) != 0 {
   1509 	}
   1510 
   1511 	if c == '+' || c == '-' {
   1512 		sign = sign - 2*Bool32(c == '-')
   1513 		c = func() int32 {
   1514 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1515 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1516 			}
   1517 			return X__shgetc(tls, f)
   1518 		}()
   1519 	}
   1520 
   1521 	for i = uint64(0); i < uint64(8) && c|32 == int32(*(*int8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i)))); i++ {
   1522 		if i < uint64(7) {
   1523 			c = func() int32 {
   1524 				if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1525 					return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1526 				}
   1527 				return X__shgetc(tls, f)
   1528 			}()
   1529 		}
   1530 	}
   1531 	if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 {
   1532 		if i != uint64(8) {
   1533 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1534 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1535 			} else {
   1536 			}
   1537 			if pok != 0 {
   1538 				for ; i > uint64(3); i-- {
   1539 					if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1540 						(*FILE)(unsafe.Pointer(f)).Frpos--
   1541 					} else {
   1542 					}
   1543 				}
   1544 			}
   1545 		}
   1546 		return float64(float32(sign) * X__builtin_inff(tls))
   1547 	}
   1548 	if !(i != 0) {
   1549 		for i = uint64(0); i < uint64(3) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i)))); i++ {
   1550 			if i < uint64(2) {
   1551 				c = func() int32 {
   1552 					if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1553 						return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1554 					}
   1555 					return X__shgetc(tls, f)
   1556 				}()
   1557 			}
   1558 		}
   1559 	}
   1560 	if i == uint64(3) {
   1561 		if func() int32 {
   1562 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1563 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1564 			}
   1565 			return X__shgetc(tls, f)
   1566 		}() != '(' {
   1567 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1568 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1569 			} else {
   1570 			}
   1571 			return float64(X__builtin_nanf(tls, ts+13))
   1572 		}
   1573 		for i = uint64(1); ; i++ {
   1574 			c = func() int32 {
   1575 				if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1576 					return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1577 				}
   1578 				return X__shgetc(tls, f)
   1579 			}()
   1580 			if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' {
   1581 				continue
   1582 			}
   1583 			if c == ')' {
   1584 				return float64(X__builtin_nanf(tls, ts+13))
   1585 			}
   1586 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1587 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1588 			} else {
   1589 			}
   1590 			if !(pok != 0) {
   1591 				*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1592 				X__shlim(tls, f, int64(0))
   1593 				return float64(0)
   1594 			}
   1595 			for PostDecUint64(&i, 1) != 0 {
   1596 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1597 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1598 				} else {
   1599 				}
   1600 			}
   1601 			return float64(X__builtin_nanf(tls, ts+13))
   1602 		}
   1603 		return float64(X__builtin_nanf(tls, ts+13))
   1604 	}
   1605 
   1606 	if i != 0 {
   1607 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1608 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1609 		} else {
   1610 		}
   1611 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1612 		X__shlim(tls, f, int64(0))
   1613 		return float64(0)
   1614 	}
   1615 
   1616 	if c == '0' {
   1617 		c = func() int32 {
   1618 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1619 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1620 			}
   1621 			return X__shgetc(tls, f)
   1622 		}()
   1623 		if c|32 == 'x' {
   1624 			return hexfloat(tls, f, bits, emin, sign, pok)
   1625 		}
   1626 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1627 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1628 		} else {
   1629 		}
   1630 		c = '0'
   1631 	}
   1632 
   1633 	return decfloat(tls, f, c, bits, emin, sign, pok)
   1634 }
   1635 
   1636 // Lookup table for digit values. -1==255>=36 -> invalid
   1637 var table = [257]uint8{Uint8FromInt32(-1),
   1638 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1639 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1640 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1641 	uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1642 	Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24),
   1643 	uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1644 	Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24),
   1645 	uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1646 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1647 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1648 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1649 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1650 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1651 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1652 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1653 	Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1),
   1654 } /* intscan.c:7:28 */
   1655 
   1656 func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
   1657 	var val uintptr
   1658 	var c int32
   1659 	var neg int32
   1660 	var x uint32
   1661 	var y uint64
   1662 	var bs int32
   1663 	val = uintptr(unsafe.Pointer(&table)) + uintptr(1)
   1664 	neg = 0
   1665 	if !(base > uint32(36) || base == uint32(1)) {
   1666 		goto __1
   1667 	}
   1668 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1669 	return uint64(0)
   1670 __1:
   1671 	;
   1672 __2:
   1673 	if !(__isspace(tls, AssignInt32(&c, func() int32 {
   1674 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1675 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1676 		}
   1677 		return X__shgetc(tls, f)
   1678 	}())) != 0) {
   1679 		goto __3
   1680 	}
   1681 	goto __2
   1682 __3:
   1683 	;
   1684 	if !(c == '+' || c == '-') {
   1685 		goto __4
   1686 	}
   1687 	neg = -Bool32(c == '-')
   1688 	c = func() int32 {
   1689 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1690 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1691 		}
   1692 		return X__shgetc(tls, f)
   1693 	}()
   1694 __4:
   1695 	;
   1696 	if !((base == uint32(0) || base == uint32(16)) && c == '0') {
   1697 		goto __5
   1698 	}
   1699 	c = func() int32 {
   1700 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1701 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1702 		}
   1703 		return X__shgetc(tls, f)
   1704 	}()
   1705 	if !(c|32 == 'x') {
   1706 		goto __7
   1707 	}
   1708 	c = func() int32 {
   1709 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1710 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1711 		}
   1712 		return X__shgetc(tls, f)
   1713 	}()
   1714 	if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) {
   1715 		goto __9
   1716 	}
   1717 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1718 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1719 	} else {
   1720 	}
   1721 	if !(pok != 0) {
   1722 		goto __10
   1723 	}
   1724 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1725 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1726 	} else {
   1727 	}
   1728 	goto __11
   1729 __10:
   1730 	X__shlim(tls, f, int64(0))
   1731 __11:
   1732 	;
   1733 	return uint64(0)
   1734 __9:
   1735 	;
   1736 	base = uint32(16)
   1737 	goto __8
   1738 __7:
   1739 	if !(base == uint32(0)) {
   1740 		goto __12
   1741 	}
   1742 	base = uint32(8)
   1743 __12:
   1744 	;
   1745 __8:
   1746 	;
   1747 	goto __6
   1748 __5:
   1749 	if !(base == uint32(0)) {
   1750 		goto __13
   1751 	}
   1752 	base = uint32(10)
   1753 __13:
   1754 	;
   1755 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) {
   1756 		goto __14
   1757 	}
   1758 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1759 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1760 	} else {
   1761 	}
   1762 	X__shlim(tls, f, int64(0))
   1763 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1764 	return uint64(0)
   1765 __14:
   1766 	;
   1767 __6:
   1768 	;
   1769 	if !(base == uint32(10)) {
   1770 		goto __15
   1771 	}
   1772 	x = uint32(0)
   1773 __17:
   1774 	if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) {
   1775 		goto __19
   1776 	}
   1777 	x = x*uint32(10) + uint32(c-'0')
   1778 	goto __18
   1779 __18:
   1780 	c = func() int32 {
   1781 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1782 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1783 		}
   1784 		return X__shgetc(tls, f)
   1785 	}()
   1786 	goto __17
   1787 	goto __19
   1788 __19:
   1789 	;
   1790 	y = uint64(x)
   1791 __20:
   1792 	if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) {
   1793 		goto __22
   1794 	}
   1795 	y = y*uint64(10) + uint64(c-'0')
   1796 	goto __21
   1797 __21:
   1798 	c = func() int32 {
   1799 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1800 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1801 		}
   1802 		return X__shgetc(tls, f)
   1803 	}()
   1804 	goto __20
   1805 	goto __22
   1806 __22:
   1807 	;
   1808 	if !(uint32(c-'0') >= 10) {
   1809 		goto __23
   1810 	}
   1811 	goto done
   1812 __23:
   1813 	;
   1814 	goto __16
   1815 __15:
   1816 	if !!(base&(base-uint32(1)) != 0) {
   1817 		goto __24
   1818 	}
   1819 	bs = int32(*(*int8)(unsafe.Pointer(ts + 14 + uintptr(uint32(0x17)*base>>5&uint32(7)))))
   1820 	x = uint32(0)
   1821 __26:
   1822 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) {
   1823 		goto __28
   1824 	}
   1825 	x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1826 	goto __27
   1827 __27:
   1828 	c = func() int32 {
   1829 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1830 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1831 		}
   1832 		return X__shgetc(tls, f)
   1833 	}()
   1834 	goto __26
   1835 	goto __28
   1836 __28:
   1837 	;
   1838 	y = uint64(x)
   1839 __29:
   1840 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) {
   1841 		goto __31
   1842 	}
   1843 	y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1844 	goto __30
   1845 __30:
   1846 	c = func() int32 {
   1847 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1848 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1849 		}
   1850 		return X__shgetc(tls, f)
   1851 	}()
   1852 	goto __29
   1853 	goto __31
   1854 __31:
   1855 	;
   1856 	goto __25
   1857 __24:
   1858 	x = uint32(0)
   1859 __32:
   1860 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) {
   1861 		goto __34
   1862 	}
   1863 	x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1864 	goto __33
   1865 __33:
   1866 	c = func() int32 {
   1867 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1868 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1869 		}
   1870 		return X__shgetc(tls, f)
   1871 	}()
   1872 	goto __32
   1873 	goto __34
   1874 __34:
   1875 	;
   1876 	y = uint64(x)
   1877 __35:
   1878 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(base) && uint64(base)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))) {
   1879 		goto __37
   1880 	}
   1881 	y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1882 	goto __36
   1883 __36:
   1884 	c = func() int32 {
   1885 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1886 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1887 		}
   1888 		return X__shgetc(tls, f)
   1889 	}()
   1890 	goto __35
   1891 	goto __37
   1892 __37:
   1893 	;
   1894 __25:
   1895 	;
   1896 __16:
   1897 	;
   1898 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
   1899 		goto __38
   1900 	}
   1901 __39:
   1902 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
   1903 		goto __41
   1904 	}
   1905 	goto __40
   1906 __40:
   1907 	c = func() int32 {
   1908 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1909 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1910 		}
   1911 		return X__shgetc(tls, f)
   1912 	}()
   1913 	goto __39
   1914 	goto __41
   1915 __41:
   1916 	;
   1917 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1918 	y = lim
   1919 	if !(lim&uint64(1) != 0) {
   1920 		goto __42
   1921 	}
   1922 	neg = 0
   1923 __42:
   1924 	;
   1925 __38:
   1926 	;
   1927 done:
   1928 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1929 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1930 	} else {
   1931 	}
   1932 	if !(y >= lim) {
   1933 		goto __43
   1934 	}
   1935 	if !(!(lim&uint64(1) != 0) && !(neg != 0)) {
   1936 		goto __44
   1937 	}
   1938 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1939 	return lim - uint64(1)
   1940 	goto __45
   1941 __44:
   1942 	if !(y > lim) {
   1943 		goto __46
   1944 	}
   1945 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1946 	return lim
   1947 __46:
   1948 	;
   1949 __45:
   1950 	;
   1951 __43:
   1952 	;
   1953 	return y ^ uint64(neg) - uint64(neg)
   1954 }
   1955 
   1956 // The shcnt field stores the number of bytes read so far, offset by
   1957 // the value of buf-rpos at the last function call (__shlim or __shgetc),
   1958 // so that between calls the inline shcnt macro can add rpos-buf to get
   1959 // the actual count.
   1960 
   1961 func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
   1962 	(*FILE)(unsafe.Pointer(f)).Fshlim = lim
   1963 	(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
   1964 	// If lim is nonzero, rend must be a valid pointer.
   1965 	if lim != 0 && (int64((*FILE)(unsafe.Pointer(f)).Frend)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 > lim {
   1966 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr(lim)
   1967 	} else {
   1968 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
   1969 	}
   1970 }
   1971 
   1972 func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
   1973 	var c int32
   1974 	var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
   1975 	if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
   1976 		(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 + cnt
   1977 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos
   1978 		(*FILE)(unsafe.Pointer(f)).Fshlim = int64(-1)
   1979 		return -1
   1980 	}
   1981 	cnt++
   1982 	if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && (int64((*FILE)(unsafe.Pointer(f)).Frend)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 > (*FILE)(unsafe.Pointer(f)).Fshlim-cnt {
   1983 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr((*FILE)(unsafe.Pointer(f)).Fshlim-cnt)
   1984 	} else {
   1985 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
   1986 	}
   1987 	(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 + cnt
   1988 	if (*FILE)(unsafe.Pointer(f)).Frpos <= (*FILE)(unsafe.Pointer(f)).Fbuf {
   1989 		*(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).Frpos + UintptrFromInt32(-1))) = uint8(c)
   1990 	}
   1991 	return c
   1992 }
   1993 
   1994 func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
   1995 	return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24
   1996 }
   1997 
   1998 func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
   1999 	return Xcopysign(tls, x, y)
   2000 }
   2001 
   2002 func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
   2003 	return Xfabs(tls, x)
   2004 }
   2005 
   2006 func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
   2007 	return Xfmod(tls, x, y)
   2008 }
   2009 
   2010 var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
   2011 
   2012 func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
   2013 	bp := tls.Alloc(8)
   2014 	defer tls.Free(8)
   2015 
   2016 	*(*struct{ Ff float64 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float64 }) {
   2017 		*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
   2018 		return r
   2019 	}()
   2020 	var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
   2021 	var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63)
   2022 	var y double_t
   2023 
   2024 	if e >= 0x3ff+52 {
   2025 		return x
   2026 	}
   2027 	if s != 0 {
   2028 		y = x - toint + toint
   2029 	} else {
   2030 		y = x + toint - toint
   2031 	}
   2032 	if y == float64(0) {
   2033 		if s != 0 {
   2034 			return -Float64FromFloat64(0.0)
   2035 		}
   2036 		return float64(0)
   2037 	}
   2038 	return y
   2039 }
   2040 
   2041 func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
   2042 	bp := tls.Alloc(8)
   2043 	defer tls.Free(8)
   2044 
   2045 	// var u struct {Ff float64;} at bp, 8
   2046 
   2047 	var y double_t = x
   2048 
   2049 	if n > 1023 {
   2050 		y = y * 0x1p1023
   2051 		n = n - 1023
   2052 		if n > 1023 {
   2053 			y = y * 0x1p1023
   2054 			n = n - 1023
   2055 			if n > 1023 {
   2056 				n = 1023
   2057 			}
   2058 		}
   2059 	} else if n < -1022 {
   2060 		// make sure final n < -53 to avoid double
   2061 		// 		   rounding in the subnormal range
   2062 		y = y * (float64(0x1p-1022) * 0x1p53)
   2063 		n = n + (1022 - 53)
   2064 		if n < -1022 {
   2065 			y = y * (float64(0x1p-1022) * 0x1p53)
   2066 			n = n + (1022 - 53)
   2067 			if n < -1022 {
   2068 				n = -1022
   2069 			}
   2070 		}
   2071 	}
   2072 	*(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52
   2073 	x = y * *(*float64)(unsafe.Pointer(bp))
   2074 	return x
   2075 }
   2076 
   2077 func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
   2078 	return Xscalbn(tls, x, n)
   2079 }
   2080 
   2081 type div_t = struct {
   2082 	Fquot int32
   2083 	Frem  int32
   2084 } /* stdlib.h:62:35 */
   2085 type ldiv_t = struct {
   2086 	Fquot int64
   2087 	Frem  int64
   2088 } /* stdlib.h:63:36 */
   2089 type lldiv_t = struct {
   2090 	Fquot int64
   2091 	Frem  int64
   2092 } /* stdlib.h:64:41 */
   2093 
   2094 type max_align_t = struct {
   2095 	F__ll int64
   2096 	F__ld float64
   2097 } /* alltypes.h:49:54 */
   2098 
   2099 type imaxdiv_t = struct {
   2100 	Fquot intmax_t
   2101 	Frem  intmax_t
   2102 } /* inttypes.h:14:40 */
   2103 
   2104 type pid_t = int32 /* alltypes.h:243:13 */
   2105 
   2106 type uid_t = uint32 /* alltypes.h:253:18 */
   2107 
   2108 type gid_t = uint32 /* alltypes.h:258:18 */
   2109 
   2110 type iovec = struct {
   2111 	Fiov_base uintptr
   2112 	Fiov_len  size_t
   2113 } /* alltypes.h:363:1 */
   2114 
   2115 type socklen_t = uint32 /* alltypes.h:369:18 */
   2116 
   2117 type sa_family_t = uint16 /* alltypes.h:374:24 */
   2118 
   2119 type msghdr = struct {
   2120 	Fmsg_name       uintptr
   2121 	Fmsg_namelen    socklen_t
   2122 	F__ccgo_pad1    [4]byte
   2123 	Fmsg_iov        uintptr
   2124 	Fmsg_iovlen     int32
   2125 	F__pad1         int32
   2126 	Fmsg_control    uintptr
   2127 	Fmsg_controllen socklen_t
   2128 	F__pad2         int32
   2129 	Fmsg_flags      int32
   2130 	F__ccgo_pad2    [4]byte
   2131 } /* socket.h:22:1 */
   2132 
   2133 type cmsghdr = struct {
   2134 	Fcmsg_len   socklen_t
   2135 	F__pad1     int32
   2136 	Fcmsg_level int32
   2137 	Fcmsg_type  int32
   2138 } /* socket.h:44:1 */
   2139 
   2140 type linger = struct {
   2141 	Fl_onoff  int32
   2142 	Fl_linger int32
   2143 } /* socket.h:74:1 */
   2144 
   2145 type sockaddr = struct {
   2146 	Fsa_family sa_family_t
   2147 	Fsa_data   [14]int8
   2148 } /* socket.h:367:1 */
   2149 
   2150 type sockaddr_storage = struct {
   2151 	Fss_family    sa_family_t
   2152 	F__ss_padding [118]int8
   2153 	F__ss_align   uint64
   2154 } /* socket.h:372:1 */
   2155 
   2156 type in_port_t = uint16_t                  /* in.h:12:18 */
   2157 type in_addr_t = uint32_t                  /* in.h:13:18 */
   2158 type in_addr = struct{ Fs_addr in_addr_t } /* in.h:14:1 */
   2159 
   2160 type sockaddr_in = struct {
   2161 	Fsin_family sa_family_t
   2162 	Fsin_port   in_port_t
   2163 	Fsin_addr   struct{ Fs_addr in_addr_t }
   2164 	Fsin_zero   [8]uint8_t
   2165 } /* in.h:16:1 */
   2166 
   2167 type in6_addr = struct {
   2168 	F__in6_union struct {
   2169 		F__ccgo_pad1 [0]uint32
   2170 		F__s6_addr   [16]uint8_t
   2171 	}
   2172 } /* in.h:23:1 */
   2173 
   2174 type sockaddr_in6 = struct {
   2175 	Fsin6_family   sa_family_t
   2176 	Fsin6_port     in_port_t
   2177 	Fsin6_flowinfo uint32_t
   2178 	Fsin6_addr     struct {
   2179 		F__in6_union struct {
   2180 			F__ccgo_pad1 [0]uint32
   2181 			F__s6_addr   [16]uint8_t
   2182 		}
   2183 	}
   2184 	Fsin6_scope_id uint32_t
   2185 } /* in.h:34:1 */
   2186 
   2187 type ipv6_mreq = struct {
   2188 	Fipv6mr_multiaddr struct {
   2189 		F__in6_union struct {
   2190 			F__ccgo_pad1 [0]uint32
   2191 			F__s6_addr   [16]uint8_t
   2192 		}
   2193 	}
   2194 	Fipv6mr_interface uint32
   2195 } /* in.h:42:1 */
   2196 
   2197 type ip_opts = struct {
   2198 	Fip_dst  struct{ Fs_addr in_addr_t }
   2199 	Fip_opts [40]int8
   2200 } /* in.h:229:1 */
   2201 
   2202 type ip_mreq = struct {
   2203 	Fimr_multiaddr struct{ Fs_addr in_addr_t }
   2204 	Fimr_interface struct{ Fs_addr in_addr_t }
   2205 } /* in.h:247:1 */
   2206 
   2207 type ip_mreqn = struct {
   2208 	Fimr_multiaddr struct{ Fs_addr in_addr_t }
   2209 	Fimr_address   struct{ Fs_addr in_addr_t }
   2210 	Fimr_ifindex   int32
   2211 } /* in.h:252:1 */
   2212 
   2213 type ip_mreq_source = struct {
   2214 	Fimr_multiaddr  struct{ Fs_addr in_addr_t }
   2215 	Fimr_interface  struct{ Fs_addr in_addr_t }
   2216 	Fimr_sourceaddr struct{ Fs_addr in_addr_t }
   2217 } /* in.h:258:1 */
   2218 
   2219 type ip_msfilter = struct {
   2220 	Fimsf_multiaddr struct{ Fs_addr in_addr_t }
   2221 	Fimsf_interface struct{ Fs_addr in_addr_t }
   2222 	Fimsf_fmode     uint32_t
   2223 	Fimsf_numsrc    uint32_t
   2224 	Fimsf_slist     [1]struct{ Fs_addr in_addr_t }
   2225 } /* in.h:264:1 */
   2226 
   2227 type group_req = struct {
   2228 	Fgr_interface uint32_t
   2229 	F__ccgo_pad1  [4]byte
   2230 	Fgr_group     struct {
   2231 		Fss_family    sa_family_t
   2232 		F__ss_padding [118]int8
   2233 		F__ss_align   uint64
   2234 	}
   2235 } /* in.h:275:1 */
   2236 
   2237 type group_source_req = struct {
   2238 	Fgsr_interface uint32_t
   2239 	F__ccgo_pad1   [4]byte
   2240 	Fgsr_group     struct {
   2241 		Fss_family    sa_family_t
   2242 		F__ss_padding [118]int8
   2243 		F__ss_align   uint64
   2244 	}
   2245 	Fgsr_source struct {
   2246 		Fss_family    sa_family_t
   2247 		F__ss_padding [118]int8
   2248 		F__ss_align   uint64
   2249 	}
   2250 } /* in.h:280:1 */
   2251 
   2252 type group_filter = struct {
   2253 	Fgf_interface uint32_t
   2254 	F__ccgo_pad1  [4]byte
   2255 	Fgf_group     struct {
   2256 		Fss_family    sa_family_t
   2257 		F__ss_padding [118]int8
   2258 		F__ss_align   uint64
   2259 	}
   2260 	Fgf_fmode  uint32_t
   2261 	Fgf_numsrc uint32_t
   2262 	Fgf_slist  [1]struct {
   2263 		Fss_family    sa_family_t
   2264 		F__ss_padding [118]int8
   2265 		F__ss_align   uint64
   2266 	}
   2267 } /* in.h:286:1 */
   2268 
   2269 type in_pktinfo = struct {
   2270 	Fipi_ifindex  int32
   2271 	Fipi_spec_dst struct{ Fs_addr in_addr_t }
   2272 	Fipi_addr     struct{ Fs_addr in_addr_t }
   2273 } /* in.h:297:1 */
   2274 
   2275 type in6_pktinfo = struct {
   2276 	Fipi6_addr struct {
   2277 		F__in6_union struct {
   2278 			F__ccgo_pad1 [0]uint32
   2279 			F__s6_addr   [16]uint8_t
   2280 		}
   2281 	}
   2282 	Fipi6_ifindex uint32
   2283 } /* in.h:303:1 */
   2284 
   2285 type ip6_mtuinfo = struct {
   2286 	Fip6m_addr struct {
   2287 		Fsin6_family   sa_family_t
   2288 		Fsin6_port     in_port_t
   2289 		Fsin6_flowinfo uint32_t
   2290 		Fsin6_addr     struct {
   2291 			F__in6_union struct {
   2292 				F__ccgo_pad1 [0]uint32
   2293 				F__s6_addr   [16]uint8_t
   2294 			}
   2295 		}
   2296 		Fsin6_scope_id uint32_t
   2297 	}
   2298 	Fip6m_mtu uint32_t
   2299 } /* in.h:308:1 */
   2300 
   2301 type addrinfo = struct {
   2302 	Fai_flags     int32
   2303 	Fai_family    int32
   2304 	Fai_socktype  int32
   2305 	Fai_protocol  int32
   2306 	Fai_addrlen   socklen_t
   2307 	F__ccgo_pad1  [4]byte
   2308 	Fai_addr      uintptr
   2309 	Fai_canonname uintptr
   2310 	Fai_next      uintptr
   2311 } /* netdb.h:16:1 */
   2312 
   2313 // Legacy functions follow (marked OBsolete in SUS)
   2314 
   2315 type netent = struct {
   2316 	Fn_name     uintptr
   2317 	Fn_aliases  uintptr
   2318 	Fn_addrtype int32
   2319 	Fn_net      uint32_t
   2320 } /* netdb.h:62:1 */
   2321 
   2322 type hostent = struct {
   2323 	Fh_name      uintptr
   2324 	Fh_aliases   uintptr
   2325 	Fh_addrtype  int32
   2326 	Fh_length    int32
   2327 	Fh_addr_list uintptr
   2328 } /* netdb.h:69:1 */
   2329 
   2330 type servent = struct {
   2331 	Fs_name      uintptr
   2332 	Fs_aliases   uintptr
   2333 	Fs_port      int32
   2334 	F__ccgo_pad1 [4]byte
   2335 	Fs_proto     uintptr
   2336 } /* netdb.h:78:1 */
   2337 
   2338 type protoent = struct {
   2339 	Fp_name      uintptr
   2340 	Fp_aliases   uintptr
   2341 	Fp_proto     int32
   2342 	F__ccgo_pad1 [4]byte
   2343 } /* netdb.h:85:1 */
   2344 
   2345 type aibuf = struct {
   2346 	Fai struct {
   2347 		Fai_flags     int32
   2348 		Fai_family    int32
   2349 		Fai_socktype  int32
   2350 		Fai_protocol  int32
   2351 		Fai_addrlen   socklen_t
   2352 		F__ccgo_pad1  [4]byte
   2353 		Fai_addr      uintptr
   2354 		Fai_canonname uintptr
   2355 		Fai_next      uintptr
   2356 	}
   2357 	Fsa struct {
   2358 		Fsin struct {
   2359 			Fsin_family sa_family_t
   2360 			Fsin_port   in_port_t
   2361 			Fsin_addr   struct{ Fs_addr in_addr_t }
   2362 			Fsin_zero   [8]uint8_t
   2363 		}
   2364 		F__ccgo_pad1 [12]byte
   2365 	}
   2366 	Flock        [1]int32
   2367 	Fslot        int16
   2368 	Fref         int16
   2369 	F__ccgo_pad1 [4]byte
   2370 } /* lookup.h:10:1 */
   2371 
   2372 type sa = struct {
   2373 	Fsin struct {
   2374 		Fsin_family sa_family_t
   2375 		Fsin_port   in_port_t
   2376 		Fsin_addr   struct{ Fs_addr in_addr_t }
   2377 		Fsin_zero   [8]uint8_t
   2378 	}
   2379 	F__ccgo_pad1 [12]byte
   2380 } /* lookup.h:10:1 */
   2381 
   2382 type address = struct {
   2383 	Ffamily  int32
   2384 	Fscopeid uint32
   2385 	Faddr    [16]uint8_t
   2386 	Fsortkey int32
   2387 } /* lookup.h:20:1 */
   2388 
   2389 type service = struct {
   2390 	Fport     uint16_t
   2391 	Fproto    uint8
   2392 	Fsocktype uint8
   2393 } /* lookup.h:27:1 */
   2394 
   2395 type resolvconf = struct {
   2396 	Fns [3]struct {
   2397 		Ffamily  int32
   2398 		Fscopeid uint32
   2399 		Faddr    [16]uint8_t
   2400 		Fsortkey int32
   2401 	}
   2402 	Fnns      uint32
   2403 	Fattempts uint32
   2404 	Fndots    uint32
   2405 	Ftimeout  uint32
   2406 } /* lookup.h:34:1 */
   2407 
   2408 func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
   2409 	var cnt size_t
   2410 	cnt = uint64(1)
   2411 __1:
   2412 	if !((*addrinfo)(unsafe.Pointer(p)).Fai_next != 0) {
   2413 		goto __3
   2414 	}
   2415 	goto __2
   2416 __2:
   2417 	cnt++
   2418 	p = (*addrinfo)(unsafe.Pointer(p)).Fai_next
   2419 	goto __1
   2420 	goto __3
   2421 __3:
   2422 	;
   2423 	var b uintptr = p - uintptr(uint64(uintptr(0)))
   2424 	b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).Fslot)
   2425 	//TODO LOCK(b->lock);
   2426 	if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) {
   2427 		Xfree(tls, b)
   2428 	}
   2429 	//TODO else UNLOCK(b->lock);
   2430 }
   2431 
   2432 type time_t = int64 /* alltypes.h:93:16 */
   2433 
   2434 type clockid_t = int32 /* alltypes.h:222:13 */
   2435 
   2436 type timespec = struct {
   2437 	Ftv_sec  time_t
   2438 	Ftv_nsec int64
   2439 } /* alltypes.h:237:1 */
   2440 
   2441 type pthread_t = uintptr /* alltypes.h:281:26 */
   2442 
   2443 type pthread_once_t = int32 /* alltypes.h:287:13 */
   2444 
   2445 type pthread_key_t = uint32 /* alltypes.h:292:18 */
   2446 
   2447 type pthread_spinlock_t = int32 /* alltypes.h:297:13 */
   2448 
   2449 type pthread_mutexattr_t = struct{ F__attr uint32 } /* alltypes.h:302:37 */
   2450 
   2451 type pthread_condattr_t = struct{ F__attr uint32 } /* alltypes.h:307:37 */
   2452 
   2453 type pthread_barrierattr_t = struct{ F__attr uint32 } /* alltypes.h:312:37 */
   2454 
   2455 type pthread_rwlockattr_t = struct{ F__attr [2]uint32 } /* alltypes.h:317:40 */
   2456 
   2457 type __sigset_t = struct{ F__bits [16]uint64 } /* alltypes.h:357:9 */
   2458 
   2459 type sigset_t = __sigset_t /* alltypes.h:357:71 */
   2460 
   2461 type pthread_attr_t = struct {
   2462 	F__u struct {
   2463 		F__ccgo_pad1 [0]uint64
   2464 		F__i         [14]int32
   2465 	}
   2466 } /* alltypes.h:380:147 */
   2467 
   2468 type pthread_mutex_t = struct {
   2469 	F__u struct {
   2470 		F__ccgo_pad1 [0]uint64
   2471 		F__i         [10]int32
   2472 	}
   2473 } /* alltypes.h:385:157 */
   2474 
   2475 type pthread_cond_t = struct {
   2476 	F__u struct {
   2477 		F__ccgo_pad1 [0]uint64
   2478 		F__i         [12]int32
   2479 	}
   2480 } /* alltypes.h:395:112 */
   2481 
   2482 type pthread_rwlock_t = struct {
   2483 	F__u struct {
   2484 		F__ccgo_pad1 [0]uint64
   2485 		F__i         [14]int32
   2486 	}
   2487 } /* alltypes.h:405:139 */
   2488 
   2489 type pthread_barrier_t = struct {
   2490 	F__u struct {
   2491 		F__ccgo_pad1 [0]uint64
   2492 		F__i         [8]int32
   2493 	}
   2494 } /* alltypes.h:410:137 */
   2495 
   2496 type sched_param = struct {
   2497 	Fsched_priority int32
   2498 	F__reserved1    int32
   2499 	F__reserved2    [2]struct {
   2500 		F__reserved1 time_t
   2501 		F__reserved2 int64
   2502 	}
   2503 	F__reserved3 int32
   2504 	F__ccgo_pad1 [4]byte
   2505 } /* sched.h:19:1 */
   2506 
   2507 type timer_t = uintptr /* alltypes.h:217:14 */
   2508 
   2509 type clock_t = int64 /* alltypes.h:227:14 */
   2510 
   2511 type tm = struct {
   2512 	Ftm_sec      int32
   2513 	Ftm_min      int32
   2514 	Ftm_hour     int32
   2515 	Ftm_mday     int32
   2516 	Ftm_mon      int32
   2517 	Ftm_year     int32
   2518 	Ftm_wday     int32
   2519 	Ftm_yday     int32
   2520 	Ftm_isdst    int32
   2521 	F__ccgo_pad1 [4]byte
   2522 	Ftm_gmtoff   int64
   2523 	Ftm_zone     uintptr
   2524 } /* time.h:38:1 */
   2525 
   2526 type itimerspec = struct {
   2527 	Fit_interval struct {
   2528 		Ftv_sec  time_t
   2529 		Ftv_nsec int64
   2530 	}
   2531 	Fit_value struct {
   2532 		Ftv_sec  time_t
   2533 		Ftv_nsec int64
   2534 	}
   2535 } /* time.h:80:1 */
   2536 
   2537 type __ptcb = struct {
   2538 	F__f    uintptr
   2539 	F__x    uintptr
   2540 	F__next uintptr
   2541 } /* pthread.h:206:1 */
   2542 
   2543 type useconds_t = uint32 /* alltypes.h:268:18 */
   2544 
   2545 func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
   2546 	bp := tls.Alloc(1608)
   2547 	defer tls.Free(1608)
   2548 
   2549 	// var ports [2]service at bp, 8
   2550 
   2551 	// var addrs [48]address at bp+8, 1344
   2552 
   2553 	// var canon [256]int8 at bp+1352, 256
   2554 
   2555 	var outcanon uintptr
   2556 	var nservs int32
   2557 	var naddrs int32
   2558 	var nais int32
   2559 	var canon_len int32
   2560 	var i int32
   2561 	var j int32
   2562 	var k int32
   2563 	var family int32 = 0
   2564 	var flags int32 = 0
   2565 	var proto int32 = 0
   2566 	var socktype int32 = 0
   2567 	var out uintptr
   2568 
   2569 	if !(host != 0) && !(serv != 0) {
   2570 		return -2
   2571 	}
   2572 
   2573 	if hint != 0 {
   2574 		family = (*addrinfo)(unsafe.Pointer(hint)).Fai_family
   2575 		flags = (*addrinfo)(unsafe.Pointer(hint)).Fai_flags
   2576 		proto = (*addrinfo)(unsafe.Pointer(hint)).Fai_protocol
   2577 		socktype = (*addrinfo)(unsafe.Pointer(hint)).Fai_socktype
   2578 
   2579 		var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400
   2580 		if flags&mask != flags {
   2581 			return -1
   2582 		}
   2583 
   2584 		switch family {
   2585 		case 2:
   2586 			fallthrough
   2587 		case 10:
   2588 			fallthrough
   2589 		case 0:
   2590 			break
   2591 			fallthrough
   2592 		default:
   2593 			return -6
   2594 		}
   2595 	}
   2596 
   2597 	if flags&0x20 != 0 {
   2598 		Xabort(tls) //TODO-
   2599 		// 	/* Define the "an address is configured" condition for address
   2600 		// 	 * families via ability to create a socket for the family plus
   2601 		// 	 * routability of the loopback address for the family. */
   2602 		// 	static const struct sockaddr_in lo4 = {
   2603 		// 		.sin_family = AF_INET, .sin_port = 65535,
   2604 		// 		.sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN
   2605 		// 			? 0x7f000001 : 0x0100007f
   2606 		// 	};
   2607 		// 	static const struct sockaddr_in6 lo6 = {
   2608 		// 		.sin6_family = AF_INET6, .sin6_port = 65535,
   2609 		// 		.sin6_addr = IN6ADDR_LOOPBACK_INIT
   2610 		// 	};
   2611 		// 	int tf[2] = { AF_INET, AF_INET6 };
   2612 		// 	const void *ta[2] = { &lo4, &lo6 };
   2613 		// 	socklen_t tl[2] = { sizeof lo4, sizeof lo6 };
   2614 		// 	for (i=0; i<2; i++) {
   2615 		// 		if (family==tf[1-i]) continue;
   2616 		// 		int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM,
   2617 		// 			IPPROTO_UDP);
   2618 		// 		if (s>=0) {
   2619 		// 			int cs;
   2620 		// 			pthread_setcancelstate(
   2621 		// 				PTHREAD_CANCEL_DISABLE, &cs);
   2622 		// 			int r = connect(s, ta[i], tl[i]);
   2623 		// 			pthread_setcancelstate(cs, 0);
   2624 		// 			close(s);
   2625 		// 			if (!r) continue;
   2626 		// 		}
   2627 		// 		switch (errno) {
   2628 		// 		case EADDRNOTAVAIL:
   2629 		// 		case EAFNOSUPPORT:
   2630 		// 		case EHOSTUNREACH:
   2631 		// 		case ENETDOWN:
   2632 		// 		case ENETUNREACH:
   2633 		// 			break;
   2634 		// 		default:
   2635 		// 			return EAI_SYSTEM;
   2636 		// 		}
   2637 		// 		if (family == tf[i]) return EAI_NONAME;
   2638 		// 		family = tf[1-i];
   2639 		// 	}
   2640 	}
   2641 
   2642 	nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags)
   2643 	if nservs < 0 {
   2644 		return nservs
   2645 	}
   2646 
   2647 	naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags)
   2648 	if naddrs < 0 {
   2649 		return naddrs
   2650 	}
   2651 
   2652 	nais = nservs * naddrs
   2653 	canon_len = int32(Xstrlen(tls, bp+1352))
   2654 	out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1))
   2655 	if !(out != 0) {
   2656 		return -10
   2657 	}
   2658 
   2659 	if canon_len != 0 {
   2660 		outcanon = out + uintptr(nais)*88
   2661 		Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1))
   2662 	} else {
   2663 		outcanon = uintptr(0)
   2664 	}
   2665 
   2666 	for k = AssignInt32(&i, 0); i < naddrs; i++ {
   2667 		j = 0
   2668 	__1:
   2669 		if !(j < nservs) {
   2670 			goto __3
   2671 		}
   2672 		{
   2673 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fslot = int16(k)
   2674 			//TODO out[k].ai = (struct addrinfo){
   2675 			//TODO 	.ai_family = addrs[i].family,
   2676 			//TODO 	.ai_socktype = ports[j].socktype,
   2677 			//TODO 	.ai_protocol = ports[j].proto,
   2678 			//TODO 	.ai_addrlen = addrs[i].family == AF_INET
   2679 			//TODO 		? sizeof(struct sockaddr_in)
   2680 			//TODO 		: sizeof(struct sockaddr_in6),
   2681 			//TODO 	.ai_addr = (void *)&out[k].sa,
   2682 			//TODO 	.ai_canonname = outcanon };
   2683 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily
   2684 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fsocktype)
   2685 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fproto)
   2686 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_addrlen = func() uint32 {
   2687 				if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).Ffamily == 2 {
   2688 					return uint32(unsafe.Sizeof(sockaddr_in{}))
   2689 				}
   2690 				return uint32(unsafe.Sizeof(sockaddr_in6{}))
   2691 			}()
   2692 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_addr = out + uintptr(k)*88 + 48
   2693 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_canonname = outcanon
   2694 			if k != 0 {
   2695 				(*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).Fai.Fai_next = out + uintptr(k)*88
   2696 			}
   2697 			switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily {
   2698 			case 2:
   2699 				(*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin_family = sa_family_t(2)
   2700 				(*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
   2701 				Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4))
   2702 				break
   2703 			case 10:
   2704 				(*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin6_family = sa_family_t(10)
   2705 				(*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
   2706 				(*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Fscopeid
   2707 				Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16))
   2708 				break
   2709 			}
   2710 
   2711 		}
   2712 		goto __2
   2713 	__2:
   2714 		j++
   2715 		k++
   2716 		goto __1
   2717 		goto __3
   2718 	__3:
   2719 	}
   2720 	(*aibuf)(unsafe.Pointer(out)).Fref = int16(nais)
   2721 	*(*uintptr)(unsafe.Pointer(res)) = out
   2722 	return 0
   2723 }
   2724 
   2725 type ucred = struct {
   2726 	Fpid pid_t
   2727 	Fuid uid_t
   2728 	Fgid gid_t
   2729 } /* socket.h:57:1 */
   2730 
   2731 type mmsghdr = struct {
   2732 	Fmsg_hdr struct {
   2733 		Fmsg_name       uintptr
   2734 		Fmsg_namelen    socklen_t
   2735 		F__ccgo_pad1    [4]byte
   2736 		Fmsg_iov        uintptr
   2737 		Fmsg_iovlen     int32
   2738 		F__pad1         int32
   2739 		Fmsg_control    uintptr
   2740 		Fmsg_controllen socklen_t
   2741 		F__pad2         int32
   2742 		Fmsg_flags      int32
   2743 		F__ccgo_pad2    [4]byte
   2744 	}
   2745 	Fmsg_len     uint32
   2746 	F__ccgo_pad1 [4]byte
   2747 } /* socket.h:63:1 */
   2748 
   2749 func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
   2750 	bp := tls.Alloc(8)
   2751 	defer tls.Free(8)
   2752 
   2753 	var size size_t = uint64(63)
   2754 	// var res uintptr at bp, 8
   2755 
   2756 	var err int32
   2757 	for __ccgo := true; __ccgo; __ccgo = err == 34 {
   2758 		Xfree(tls, _sh)
   2759 		_sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1)))
   2760 		if !(_sh != 0) {
   2761 			*(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
   2762 			return uintptr(0)
   2763 		}
   2764 		err = Xgethostbyaddr_r(tls, a, l, af, _sh,
   2765 			_sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
   2766 	}
   2767 	if err != 0 {
   2768 		return uintptr(0)
   2769 	}
   2770 	return _sh
   2771 }
   2772 
   2773 var _sh uintptr /* gethostbyaddr.c:9:24: */
   2774 
   2775 func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
   2776 	return Xgethostbyname2(tls, name, 2)
   2777 }
   2778 
   2779 func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
   2780 	bp := tls.Alloc(8)
   2781 	defer tls.Free(8)
   2782 
   2783 	var size size_t = uint64(63)
   2784 	// var res uintptr at bp, 8
   2785 
   2786 	var err int32
   2787 	for __ccgo := true; __ccgo; __ccgo = err == 34 {
   2788 		Xfree(tls, _sh1)
   2789 		_sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1)))
   2790 		if !(_sh1 != 0) {
   2791 			*(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
   2792 			return uintptr(0)
   2793 		}
   2794 		err = Xgethostbyname2_r(tls, name, af, _sh1,
   2795 			_sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
   2796 	}
   2797 	if err != 0 {
   2798 		return uintptr(0)
   2799 	}
   2800 	return _sh1
   2801 }
   2802 
   2803 var _sh1 uintptr /* gethostbyname2.c:10:24: */
   2804 
   2805 func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */
   2806 	bp := tls.Alloc(1600)
   2807 	defer tls.Free(1600)
   2808 
   2809 	// var addrs [48]address at bp, 1344
   2810 
   2811 	// var canon [256]int8 at bp+1344, 256
   2812 
   2813 	var i int32
   2814 	var cnt int32
   2815 	var align size_t
   2816 	var need size_t
   2817 
   2818 	*(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
   2819 	cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02)
   2820 	if cnt < 0 {
   2821 		switch cnt {
   2822 		case -2:
   2823 			*(*int32)(unsafe.Pointer(err)) = 1
   2824 			return 2
   2825 			fallthrough
   2826 		case -3:
   2827 			*(*int32)(unsafe.Pointer(err)) = 2
   2828 			return 11
   2829 			fallthrough
   2830 		default:
   2831 			fallthrough
   2832 		case -4:
   2833 			*(*int32)(unsafe.Pointer(err)) = 3
   2834 			return 74
   2835 			fallthrough
   2836 		case -10:
   2837 			fallthrough
   2838 		case -11:
   2839 			*(*int32)(unsafe.Pointer(err)) = 3
   2840 			return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
   2841 		}
   2842 	}
   2843 
   2844 	(*hostent)(unsafe.Pointer(h)).Fh_addrtype = af
   2845 	(*hostent)(unsafe.Pointer(h)).Fh_length = func() int32 {
   2846 		if af == 10 {
   2847 			return 16
   2848 		}
   2849 		return 4
   2850 	}()
   2851 
   2852 	// Align buffer
   2853 	align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))
   2854 
   2855 	need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0)))
   2856 	need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).Fh_length))
   2857 	need = need + (Xstrlen(tls, name) + uint64(1))
   2858 	need = need + (Xstrlen(tls, bp+1344) + uint64(1))
   2859 	need = need + align
   2860 
   2861 	if need > buflen {
   2862 		return 34
   2863 	}
   2864 
   2865 	buf += uintptr(align)
   2866 	(*hostent)(unsafe.Pointer(h)).Fh_aliases = buf
   2867 	buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0))))
   2868 	(*hostent)(unsafe.Pointer(h)).Fh_addr_list = buf
   2869 	buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0))))
   2870 
   2871 	for i = 0; i < cnt; i++ {
   2872 		*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)) = buf
   2873 		buf += uintptr((*hostent)(unsafe.Pointer(h)).Fh_length)
   2874 		Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)), bp+uintptr(i)*28+8, uint64((*hostent)(unsafe.Pointer(h)).Fh_length))
   2875 	}
   2876 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)) = uintptr(0)
   2877 
   2878 	(*hostent)(unsafe.Pointer(h)).Fh_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).Fh_aliases, buf)
   2879 	Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, bp+1344)
   2880 	buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).Fh_name) + uint64(1))
   2881 
   2882 	if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, name) != 0 {
   2883 		*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)) = buf
   2884 		Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)), name)
   2885 		buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8))) + uint64(1))
   2886 	} else {
   2887 		*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)) = uintptr(0)
   2888 	}
   2889 
   2890 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 2*8)) = uintptr(0)
   2891 
   2892 	*(*uintptr)(unsafe.Pointer(res)) = h
   2893 	return 0
   2894 }
   2895 
   2896 type if_nameindex = struct {
   2897 	Fif_index    uint32
   2898 	F__ccgo_pad1 [4]byte
   2899 	Fif_name     uintptr
   2900 } /* if.h:12:1 */
   2901 
   2902 type ifaddr = struct {
   2903 	Fifa_addr struct {
   2904 		Fsa_family sa_family_t
   2905 		Fsa_data   [14]int8
   2906 	}
   2907 	Fifa_ifu struct {
   2908 		Fifu_broadaddr struct {
   2909 			Fsa_family sa_family_t
   2910 			Fsa_data   [14]int8
   2911 		}
   2912 	}
   2913 	Fifa_ifp  uintptr
   2914 	Fifa_next uintptr
   2915 } /* if.h:51:1 */
   2916 
   2917 type ifmap = struct {
   2918 	Fmem_start   uint64
   2919 	Fmem_end     uint64
   2920 	Fbase_addr   uint16
   2921 	Firq         uint8
   2922 	Fdma         uint8
   2923 	Fport        uint8
   2924 	F__ccgo_pad1 [3]byte
   2925 } /* if.h:64:1 */
   2926 
   2927 type ifreq = struct {
   2928 	Fifr_ifrn struct{ Fifrn_name [16]int8 }
   2929 	Fifr_ifru struct {
   2930 		F__ccgo_pad1 [0]uint64
   2931 		Fifru_addr   struct {
   2932 			Fsa_family sa_family_t
   2933 			Fsa_data   [14]int8
   2934 		}
   2935 		F__ccgo_pad2 [8]byte
   2936 	}
   2937 } /* if.h:76:1 */
   2938 
   2939 type ifconf = struct {
   2940 	Fifc_len     int32
   2941 	F__ccgo_pad1 [4]byte
   2942 	Fifc_ifcu    struct{ Fifcu_buf uintptr }
   2943 } /* if.h:116:1 */
   2944 
   2945 type ns_sect = uint32 /* nameser.h:37:3 */
   2946 
   2947 type __ns_msg = struct {
   2948 	F_msg        uintptr
   2949 	F_eom        uintptr
   2950 	F_id         uint16_t
   2951 	F_flags      uint16_t
   2952 	F_counts     [4]uint16_t
   2953 	F__ccgo_pad1 [4]byte
   2954 	F_sections   [4]uintptr
   2955 	F_sect       ns_sect
   2956 	F_rrnum      int32
   2957 	F_msg_ptr    uintptr
   2958 } /* nameser.h:39:9 */
   2959 
   2960 type ns_msg = __ns_msg /* nameser.h:46:3 */
   2961 
   2962 type _ns_flagdata = struct {
   2963 	Fmask  int32
   2964 	Fshift int32
   2965 } /* nameser.h:48:1 */
   2966 
   2967 type __ns_rr = struct {
   2968 	Fname        [1025]int8
   2969 	F__ccgo_pad1 [1]byte
   2970 	Ftype        uint16_t
   2971 	Frr_class    uint16_t
   2972 	F__ccgo_pad2 [2]byte
   2973 	Fttl         uint32_t
   2974 	Frdlength    uint16_t
   2975 	F__ccgo_pad3 [2]byte
   2976 	Frdata       uintptr
   2977 } /* nameser.h:59:9 */
   2978 
   2979 type ns_rr = __ns_rr /* nameser.h:66:3 */
   2980 
   2981 type ns_flag = uint32 /* nameser.h:87:3 */
   2982 
   2983 type ns_opcode = uint32 /* nameser.h:96:3 */
   2984 
   2985 type ns_rcode = uint32 /* nameser.h:115:3 */
   2986 
   2987 type ns_update_operation = uint32 /* nameser.h:121:3 */
   2988 
   2989 type ns_tsig_key1 = struct {
   2990 	Fname        [1025]int8
   2991 	Falg         [1025]int8
   2992 	F__ccgo_pad1 [6]byte
   2993 	Fdata        uintptr
   2994 	Flen         int32
   2995 	F__ccgo_pad2 [4]byte
   2996 } /* nameser.h:123:1 */
   2997 
   2998 type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */
   2999 
   3000 type ns_tcp_tsig_state1 = struct {
   3001 	Fcounter     int32
   3002 	F__ccgo_pad1 [4]byte
   3003 	Fkey         uintptr
   3004 	Fctx         uintptr
   3005 	Fsig         [512]uint8
   3006 	Fsiglen      int32
   3007 	F__ccgo_pad2 [4]byte
   3008 } /* nameser.h:130:1 */
   3009 
   3010 type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */
   3011 
   3012 type ns_type = uint32 /* nameser.h:200:3 */
   3013 
   3014 type ns_class = uint32 /* nameser.h:219:3 */
   3015 
   3016 type ns_key_types = uint32 /* nameser.h:226:3 */
   3017 
   3018 type ns_cert_types = uint32 /* nameser.h:234:3 */
   3019 
   3020 type HEADER = struct {
   3021 	F__ccgo_pad1 [0]uint32
   3022 	Fid          uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */
   3023 	Fqdcount     uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */
   3024 	Fnscount     uint32 /* unsigned nscount: 16, unsigned arcount: 16 */
   3025 } /* nameser.h:353:3 */
   3026 
   3027 // unused; purely for broken apps
   3028 type __res_state = struct {
   3029 	Fretrans     int32
   3030 	Fretry       int32
   3031 	Foptions     uint64
   3032 	Fnscount     int32
   3033 	Fnsaddr_list [3]struct {
   3034 		Fsin_family sa_family_t
   3035 		Fsin_port   in_port_t
   3036 		Fsin_addr   struct{ Fs_addr in_addr_t }
   3037 		Fsin_zero   [8]uint8_t
   3038 	}
   3039 	Fid          uint16
   3040 	F__ccgo_pad1 [2]byte
   3041 	Fdnsrch      [7]uintptr
   3042 	Fdefdname    [256]int8
   3043 	Fpfcode      uint64
   3044 	Fndots       uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */
   3045 	F__ccgo_pad2 [4]byte
   3046 	Fsort_list   [10]struct {
   3047 		Faddr struct{ Fs_addr in_addr_t }
   3048 		Fmask uint32_t
   3049 	}
   3050 	Fqhook       uintptr
   3051 	Frhook       uintptr
   3052 	Fres_h_errno int32
   3053 	F_vcsock     int32
   3054 	F_flags      uint32
   3055 	F__ccgo_pad3 [4]byte
   3056 	F_u          struct {
   3057 		F__ccgo_pad1 [0]uint64
   3058 		Fpad         [52]int8
   3059 		F__ccgo_pad2 [4]byte
   3060 	}
   3061 } /* resolv.h:26:9 */
   3062 
   3063 // unused; purely for broken apps
   3064 type res_state = uintptr /* resolv.h:62:3 */
   3065 
   3066 type res_sym = struct {
   3067 	Fnumber      int32
   3068 	F__ccgo_pad1 [4]byte
   3069 	Fname        uintptr
   3070 	Fhumanname   uintptr
   3071 } /* resolv.h:70:1 */
   3072 
   3073 func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */
   3074 	p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0))))
   3075 	*(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0)
   3076 	for __ccgo := true; __ccgo; __ccgo = x != 0 {
   3077 		*(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(uint32('0') + x%uint32(10))
   3078 		x = x / uint32(10)
   3079 	}
   3080 	return p
   3081 }
   3082 
   3083 func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */
   3084 	bp := tls.Alloc(32)
   3085 	defer tls.Free(32)
   3086 
   3087 	Xsprintf(tls, s, ts+23,
   3088 		VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip)))))
   3089 }
   3090 
   3091 func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */
   3092 	var i int32
   3093 	for i = 15; i >= 0; i-- {
   3094 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15]
   3095 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.')
   3096 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4]
   3097 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.')
   3098 	}
   3099 	Xstrcpy(tls, s, ts+48)
   3100 }
   3101 
   3102 var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 57)) /* getnameinfo.c:36:20 */
   3103 
   3104 func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */
   3105 	bp := tls.Alloc(556)
   3106 	defer tls.Free(556)
   3107 
   3108 	// var line [512]int8 at bp+16, 512
   3109 
   3110 	var p uintptr
   3111 	var z uintptr
   3112 	var _buf [1032]uint8
   3113 	_ = _buf
   3114 	// var atmp [16]uint8 at bp, 16
   3115 
   3116 	// var iplit address at bp+528, 28
   3117 
   3118 	//TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
   3119 	var f uintptr = Xfopen(tls, ts+74, ts+85)
   3120 	if !(f != 0) {
   3121 		return
   3122 	}
   3123 	if family == 2 {
   3124 		Xmemcpy(tls, bp+uintptr(12), a, uint64(4))
   3125 		Xmemcpy(tls, bp, ts+88, uint64(12))
   3126 		a = bp /* &atmp[0] */
   3127 	}
   3128 	for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]int8{})), f) != 0 {
   3129 		if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 {
   3130 			*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n')
   3131 			*(*int8)(unsafe.Pointer(p)) = int8(0)
   3132 		}
   3133 
   3134 		for p = bp + 16; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ {
   3135 		}
   3136 		*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0)
   3137 		if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 {
   3138 			continue
   3139 		}
   3140 
   3141 		if (*address)(unsafe.Pointer(bp+528)).Ffamily == 2 {
   3142 			Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4))
   3143 			Xmemcpy(tls, bp+528+8, ts+88, uint64(12))
   3144 			(*address)(unsafe.Pointer(bp + 528 /* &iplit */)).Fscopeid = uint32(0)
   3145 		}
   3146 
   3147 		if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).Fscopeid != scopeid {
   3148 			continue
   3149 		}
   3150 
   3151 		for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ {
   3152 		}
   3153 		for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ {
   3154 		}
   3155 		*(*int8)(unsafe.Pointer(z)) = int8(0)
   3156 		if (int64(z)-int64(p))/1 < int64(256) {
   3157 			Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1)))
   3158 			break
   3159 		}
   3160 	}
   3161 	//TODO __fclose_ca(f);
   3162 	Xfclose(tls, f)
   3163 }
   3164 
   3165 func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */
   3166 	Xabort(tls) //TODO-
   3167 	// unsigned long svport;
   3168 	// char line[128], *p, *z;
   3169 	// unsigned char _buf[1032];
   3170 	// FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
   3171 	// if (!f) return;
   3172 	// while (fgets(line, sizeof line, f)) {
   3173 	// 	if ((p=strchr(line, '#'))) *p++='\n', *p=0;
   3174 
   3175 	// 	for (p=line; *p && !isspace(*p); p++);
   3176 	// 	if (!*p) continue;
   3177 	// 	*p++ = 0;
   3178 	// 	svport = strtoul(p, &z, 10);
   3179 
   3180 	// 	if (svport != port || z==p) continue;
   3181 	// 	if (dgram && strncmp(z, "/udp", 4)) continue;
   3182 	// 	if (!dgram && strncmp(z, "/tcp", 4)) continue;
   3183 	// 	if (p-line > 32) continue;
   3184 
   3185 	// 	memcpy(buf, line, p-line);
   3186 	// 	break;
   3187 	// }
   3188 	// __fclose_ca(f);
   3189 }
   3190 
   3191 var Xh_errno int32 /* h_errno.c:4:5: */
   3192 
   3193 func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
   3194 	return uintptr(unsafe.Pointer(&Xh_errno))
   3195 }
   3196 
   3197 func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
   3198 	bp := tls.Alloc(40)
   3199 	defer tls.Free(40)
   3200 
   3201 	var s uintptr = s0
   3202 	var d uintptr = dest
   3203 	*(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)}
   3204 	// var z uintptr at bp+32, 8
   3205 
   3206 	var i int32
   3207 
   3208 	for i = 0; i < 4; i++ {
   3209 		*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0)
   3210 		if *(*uintptr)(unsafe.Pointer(bp + 32)) == s || *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))) != 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != '.' || !(func() int32 {
   3211 			if 0 != 0 {
   3212 				return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s))))
   3213 			}
   3214 			return Bool32(uint32(*(*int8)(unsafe.Pointer(s)))-uint32('0') < uint32(10))
   3215 		}() != 0) {
   3216 			return 0
   3217 		}
   3218 		if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) {
   3219 			break
   3220 		}
   3221 		s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1)
   3222 	}
   3223 	if i == 4 {
   3224 		return 0
   3225 	}
   3226 	switch i {
   3227 	case 0:
   3228 		*(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff)
   3229 		AssignShrPtrUint64(bp, int(24))
   3230 		fallthrough
   3231 	case 1:
   3232 		*(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff)
   3233 		AssignShrPtrUint64(bp+1*8, int(16))
   3234 		fallthrough
   3235 	case 2:
   3236 		*(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff)
   3237 		AssignShrPtrUint64(bp+2*8, int(8))
   3238 	}
   3239 	for i = 0; i < 4; i++ {
   3240 		if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) {
   3241 			return 0
   3242 		}
   3243 		*(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)))
   3244 	}
   3245 	return 1
   3246 }
   3247 
   3248 func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
   3249 	bp := tls.Alloc(276)
   3250 	defer tls.Free(276)
   3251 
   3252 	var a uintptr = a0
   3253 	var i int32
   3254 	var j int32
   3255 	var max int32
   3256 	var best int32
   3257 	// var buf [100]int8 at bp+176, 100
   3258 
   3259 	switch af {
   3260 	case 2:
   3261 		if socklen_t(Xsnprintf(tls, s, uint64(l), ts+101, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l {
   3262 			return s
   3263 		}
   3264 		break
   3265 	case 10:
   3266 		if Xmemcmp(tls, a, ts+88, uint64(12)) != 0 {
   3267 			Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})),
   3268 				ts+113,
   3269 				VaList(bp+32, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))),
   3270 					256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))),
   3271 					256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))),
   3272 					256*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), 256*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15)))))
   3273 		} else {
   3274 			Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})),
   3275 				ts+137,
   3276 				VaList(bp+96, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))),
   3277 					256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))),
   3278 					256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))),
   3279 					int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15)))))
   3280 		}
   3281 		// Replace longest /(^0|:)[:0]{2,}/ with "::"
   3282 		i = AssignInt32(&best, 0)
   3283 		max = 2
   3284 		for ; *(*int8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ {
   3285 			if i != 0 && int32(*(*int8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' {
   3286 				continue
   3287 			}
   3288 			j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+167))
   3289 			if j > max {
   3290 				best = i
   3291 				max = j
   3292 			}
   3293 		}
   3294 		if max > 3 {
   3295 			*(*int8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrInt8(bp+176+uintptr(best+1), int8(':'))
   3296 			Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1))
   3297 		}
   3298 		if Xstrlen(tls, bp+176) < size_t(l) {
   3299 			Xstrcpy(tls, s, bp+176)
   3300 			return s
   3301 		}
   3302 		break
   3303 	default:
   3304 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
   3305 		return uintptr(0)
   3306 	}
   3307 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28
   3308 	return uintptr(0)
   3309 }
   3310 
   3311 func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
   3312 	if c-uint32('0') < uint32(10) {
   3313 		return int32(c - uint32('0'))
   3314 	}
   3315 	c = c | uint32(32)
   3316 	if c-uint32('a') < uint32(6) {
   3317 		return int32(c - uint32('a') + uint32(10))
   3318 	}
   3319 	return -1
   3320 }
   3321 
   3322 func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
   3323 	bp := tls.Alloc(16)
   3324 	defer tls.Free(16)
   3325 
   3326 	// var ip [8]uint16_t at bp, 16
   3327 
   3328 	var a uintptr = a0
   3329 	var i int32
   3330 	var j int32
   3331 	var v int32
   3332 	var d int32
   3333 	var brk int32 = -1
   3334 	var need_v4 int32 = 0
   3335 
   3336 	if af == 2 {
   3337 		for i = 0; i < 4; i++ {
   3338 			for v = AssignInt32(&j, 0); j < 3 && func() int32 {
   3339 				if 0 != 0 {
   3340 					return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))
   3341 				}
   3342 				return Bool32(uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10))
   3343 			}() != 0; j++ {
   3344 				v = 10*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - '0'
   3345 			}
   3346 			if j == 0 || j > 1 && int32(*(*int8)(unsafe.Pointer(s))) == '0' || v > 255 {
   3347 				return 0
   3348 			}
   3349 			*(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v)
   3350 			if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 {
   3351 				return 1
   3352 			}
   3353 			if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' {
   3354 				return 0
   3355 			}
   3356 			s += uintptr(j + 1)
   3357 		}
   3358 		return 0
   3359 	} else if af != 10 {
   3360 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
   3361 		return -1
   3362 	}
   3363 
   3364 	if int32(*(*int8)(unsafe.Pointer(s))) == ':' && int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' {
   3365 		return 0
   3366 	}
   3367 
   3368 	for i = 0; ; i++ {
   3369 		if int32(*(*int8)(unsafe.Pointer(s))) == ':' && brk < 0 {
   3370 			brk = i
   3371 			*(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0)
   3372 			if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) {
   3373 				break
   3374 			}
   3375 			if i == 7 {
   3376 				return 0
   3377 			}
   3378 			continue
   3379 		}
   3380 		for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ {
   3381 			v = 16*v + d
   3382 		}
   3383 		if j == 0 {
   3384 			return 0
   3385 		}
   3386 		*(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v)
   3387 		if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) {
   3388 			break
   3389 		}
   3390 		if i == 7 {
   3391 			return 0
   3392 		}
   3393 		if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' {
   3394 			if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 {
   3395 				return 0
   3396 			}
   3397 			need_v4 = 1
   3398 			i++
   3399 			break
   3400 		}
   3401 		s += uintptr(j + 1)
   3402 	}
   3403 	if brk >= 0 {
   3404 		Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk)))
   3405 		for j = 0; j < 7-i; j++ {
   3406 			*(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0)
   3407 		}
   3408 	}
   3409 	for j = 0; j < 8; j++ {
   3410 		*(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8)
   3411 		*(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2)))
   3412 	}
   3413 	if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 {
   3414 		return 0
   3415 	}
   3416 	return 1
   3417 }
   3418 
   3419 func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
   3420 	bp := tls.Alloc(96)
   3421 	defer tls.Free(96)
   3422 
   3423 	// var a4 in_addr at bp, 4
   3424 
   3425 	// var a6 in6_addr at bp+68, 16
   3426 
   3427 	if X__inet_aton(tls, name, bp) > 0 {
   3428 		if family == 10 { // wrong family
   3429 			return -2
   3430 		}
   3431 		Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{})))
   3432 		(*address)(unsafe.Pointer(buf)).Ffamily = 2
   3433 		(*address)(unsafe.Pointer(buf)).Fscopeid = uint32(0)
   3434 		return 1
   3435 	}
   3436 	// var tmp [64]int8 at bp+4, 64
   3437 
   3438 	var p uintptr = Xstrchr(tls, name, '%')
   3439 	// var z uintptr at bp+88, 8
   3440 
   3441 	var scopeid uint64 = uint64(0)
   3442 	if p != 0 && (int64(p)-int64(name))/1 < int64(64) {
   3443 		Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1))
   3444 		*(*int8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = int8(0)
   3445 		name = bp + 4 /* &tmp[0] */
   3446 	}
   3447 
   3448 	if Xinet_pton(tls, 10, name, bp+68) <= 0 {
   3449 		return 0
   3450 	}
   3451 	if family == 2 { // wrong family
   3452 		return -2
   3453 	}
   3454 
   3455 	Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{})))
   3456 	(*address)(unsafe.Pointer(buf)).Ffamily = 10
   3457 	if p != 0 {
   3458 		if func() int32 {
   3459 			if 0 != 0 {
   3460 				return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1)))))
   3461 			}
   3462 			return Bool32(uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10))
   3463 		}() != 0 {
   3464 			scopeid = Xstrtoull(tls, p, bp+88, 10)
   3465 		} else {
   3466 			*(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1)
   3467 		}
   3468 		if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 {
   3469 			Xabort(tls) //TODO-
   3470 			// if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
   3471 			//     !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
   3472 			// 	return EAI_NONAME;
   3473 			// scopeid = if_nametoindex(p);
   3474 			// if (!scopeid) return EAI_NONAME;
   3475 		}
   3476 		if scopeid > uint64(0xffffffff) {
   3477 			return -2
   3478 		}
   3479 	}
   3480 	(*address)(unsafe.Pointer(buf)).Fscopeid = uint32(scopeid)
   3481 	return 1
   3482 }
   3483 
   3484 type mode_t = uint32 /* alltypes.h:160:18 */
   3485 
   3486 type flock = struct {
   3487 	Fl_type      int16
   3488 	Fl_whence    int16
   3489 	F__ccgo_pad1 [4]byte
   3490 	Fl_start     off_t
   3491 	Fl_len       off_t
   3492 	Fl_pid       pid_t
   3493 	F__ccgo_pad2 [4]byte
   3494 } /* fcntl.h:24:1 */
   3495 
   3496 func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */
   3497 	var s uintptr
   3498 	//TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0;
   3499 	if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) {
   3500 		return 0
   3501 	}
   3502 	for s = host; int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80 || int32(*(*uint8)(unsafe.Pointer(s))) == '.' || int32(*(*uint8)(unsafe.Pointer(s))) == '-' || Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0; s++ {
   3503 	}
   3504 	return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0))
   3505 }
   3506 
   3507 var Xzero_struct_address address /* lookup_name.c:27:16: */
   3508 
   3509 func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */
   3510 	var cnt int32 = 0
   3511 	if name != 0 {
   3512 		return 0
   3513 	}
   3514 	if flags&0x01 != 0 {
   3515 		//TODO if (family != AF_INET6)
   3516 		//TODO 	buf[cnt++] = (struct address){ .family = AF_INET };
   3517 		if family != 10 {
   3518 			var x = Xzero_struct_address
   3519 			x.Ffamily = 2
   3520 			*(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
   3521 		}
   3522 		//TODO if (family != AF_INET)
   3523 		//TODO 	buf[cnt++] = (struct address){ .family = AF_INET6 };
   3524 		if family != 2 {
   3525 			var x = Xzero_struct_address
   3526 			x.Ffamily = 10
   3527 			*(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
   3528 		}
   3529 	} else {
   3530 		Xabort(tls) //TODO-
   3531 		// 	if (family != AF_INET6)
   3532 		// 		buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
   3533 		// 	if (family != AF_INET)
   3534 		// 		buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
   3535 	}
   3536 	return cnt
   3537 }
   3538 
   3539 func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */
   3540 	return X__lookup_ipliteral(tls, buf, name, family)
   3541 }
   3542 
   3543 func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */
   3544 	bp := tls.Alloc(512)
   3545 	defer tls.Free(512)
   3546 
   3547 	// var line [512]int8 at bp, 512
   3548 
   3549 	var l size_t = Xstrlen(tls, name)
   3550 	var cnt int32 = 0
   3551 	var badfam int32 = 0
   3552 	var _buf [1032]uint8
   3553 	_ = _buf
   3554 	//TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
   3555 	var _f FILE
   3556 	_ = _f
   3557 	var f uintptr = Xfopen(tls, ts+74, ts+85)
   3558 	if !(f != 0) {
   3559 		switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) {
   3560 		case 2:
   3561 			fallthrough
   3562 		case 20:
   3563 			fallthrough
   3564 		case 13:
   3565 			return 0
   3566 			fallthrough
   3567 		default:
   3568 			return -11
   3569 		}
   3570 	}
   3571 	for Xfgets(tls, bp, int32(unsafe.Sizeof([512]int8{})), f) != 0 && cnt < 48 {
   3572 		var p uintptr
   3573 		var z uintptr
   3574 
   3575 		if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 {
   3576 			*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n')
   3577 			*(*int8)(unsafe.Pointer(p)) = int8(0)
   3578 		}
   3579 		for p = bp + uintptr(1); AssignUintptr(&p, Xstrstr(tls, p, name)) != 0 && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ {
   3580 		}
   3581 		if !(p != 0) {
   3582 			continue
   3583 		}
   3584 
   3585 		// Isolate IP address to parse
   3586 		for p = bp; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ {
   3587 		}
   3588 		*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0)
   3589 		switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) {
   3590 		case 1:
   3591 			cnt++
   3592 			break
   3593 		case 0:
   3594 			continue
   3595 		default:
   3596 			badfam = -2
   3597 			continue
   3598 		}
   3599 
   3600 		// Extract first name as canonical name
   3601 		for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ {
   3602 		}
   3603 		for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ {
   3604 		}
   3605 		*(*int8)(unsafe.Pointer(z)) = int8(0)
   3606 		if is_valid_hostname(tls, p) != 0 {
   3607 			Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1)))
   3608 		}
   3609 	}
   3610 	//TODO __fclose_ca(f);
   3611 	Xfclose(tls, f)
   3612 	if cnt != 0 {
   3613 		return cnt
   3614 	}
   3615 	return badfam
   3616 }
   3617 
   3618 type dpc_ctx = struct {
   3619 	Faddrs       uintptr
   3620 	Fcanon       uintptr
   3621 	Fcnt         int32
   3622 	F__ccgo_pad1 [4]byte
   3623 } /* lookup_name.c:112:1 */
   3624 
   3625 func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */
   3626 	return -1 //TODO-
   3627 	Xabort(tls)
   3628 	return int32(0) //TODO-
   3629 	// char search[256];
   3630 	// struct resolvconf conf;
   3631 	// size_t l, dots;
   3632 	// char *p, *z;
   3633 
   3634 	// if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1;
   3635 
   3636 	// /* Count dots, suppress search when >=ndots or name ends in
   3637 	//  * a dot, which is an explicit request for global scope. */
   3638 	// for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++;
   3639 	// if (dots >= conf.ndots || name[l-1]=='.') *search = 0;
   3640 
   3641 	// /* Strip final dot for canon, fail if multiple trailing dots. */
   3642 	// if (name[l-1]=='.') l--;
   3643 	// if (!l || name[l-1]=='.') return EAI_NONAME;
   3644 
   3645 	// /* This can never happen; the caller already checked length. */
   3646 	// if (l >= 256) return EAI_NONAME;
   3647 
   3648 	// /* Name with search domain appended is setup in canon[]. This both
   3649 	//  * provides the desired default canonical name (if the requested
   3650 	//  * name is not a CNAME record) and serves as a buffer for passing
   3651 	//  * the full requested name to name_from_dns. */
   3652 	// memcpy(canon, name, l);
   3653 	// canon[l] = '.';
   3654 
   3655 	// for (p=search; *p; p=z) {
   3656 	// 	for (; isspace(*p); p++);
   3657 	// 	for (z=p; *z && !isspace(*z); z++);
   3658 	// 	if (z==p) break;
   3659 	// 	if (z-p < 256 - l - 1) {
   3660 	// 		memcpy(canon+l+1, p, z-p);
   3661 	// 		canon[z-p+1+l] = 0;
   3662 	// 		int cnt = name_from_dns(buf, canon, canon, family, &conf);
   3663 	// 		if (cnt) return cnt;
   3664 	// 	}
   3665 	// }
   3666 
   3667 	// canon[l] = 0;
   3668 	// return name_from_dns(buf, canon, name, family, &conf);
   3669 }
   3670 
   3671 type policy = struct {
   3672 	Faddr  [16]uint8
   3673 	Flen   uint8
   3674 	Fmask  uint8
   3675 	Fprec  uint8
   3676 	Flabel uint8
   3677 } /* lookup_name.c:237:14 */
   3678 
   3679 var defpolicy = [6]policy{
   3680 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 170)), Flen: uint8(15), Fmask: uint8(0xff), Fprec: uint8(50)},
   3681 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 187)), Flen: uint8(11), Fmask: uint8(0xff), Fprec: uint8(35), Flabel: uint8(4)},
   3682 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 203)), Flen: uint8(1), Fmask: uint8(0xff), Fprec: uint8(30), Flabel: uint8(2)},
   3683 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 219)), Flen: uint8(3), Fmask: uint8(0xff), Fprec: uint8(5), Flabel: uint8(5)},
   3684 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 235)), Fmask: uint8(0xfe), Fprec: uint8(3), Flabel: uint8(13)},
   3685 	// Last rule must match all addresses to stop loop.
   3686 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 251)), Fprec: uint8(40), Flabel: uint8(1)},
   3687 } /* lookup_name.c:241:3 */
   3688 
   3689 func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */
   3690 	var i int32
   3691 	for i = 0; ; i++ {
   3692 		if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].Flen)) != 0 {
   3693 			continue
   3694 		}
   3695 		if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].Flen))))&int32(defpolicy[i].Fmask) !=
   3696 			int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].Flen)))) {
   3697 			continue
   3698 		}
   3699 		return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20
   3700 	}
   3701 	return uintptr(0)
   3702 }
   3703 
   3704 func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */
   3705 	return int32((*policy)(unsafe.Pointer(policyof(tls, a))).Flabel)
   3706 }
   3707 
   3708 func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */
   3709 	if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff {
   3710 		return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15
   3711 	}
   3712 	if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 {
   3713 		return 2
   3714 	}
   3715 	if *(*uint32_t)(unsafe.Pointer(a)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 1*4)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 2*4)) == uint32_t(0) && int32(*(*uint8_t)(unsafe.Pointer(a + 12))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 13))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 14))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 15))) == 1 {
   3716 		return 2
   3717 	}
   3718 	if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 {
   3719 		return 5
   3720 	}
   3721 	return 14
   3722 }
   3723 
   3724 func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */
   3725 	// FIXME: The common prefix length should be limited to no greater
   3726 	// than the nominal length of the prefix portion of the source
   3727 	// address. However the definition of the source prefix length is
   3728 	// not clear and thus this limiting is not yet implemented.
   3729 	var i uint32
   3730 	for i = uint32(0); i < uint32(128) && !((int32(*(*uint8_t)(unsafe.Pointer(s /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8)))))^int32(*(*uint8_t)(unsafe.Pointer(d /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8))))))&(int32(128)>>(i%uint32(8))) != 0); i++ {
   3731 	}
   3732 	return int32(i)
   3733 }
   3734 
   3735 func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */
   3736 	var a uintptr = _a
   3737 	var b uintptr = _b
   3738 	return (*address)(unsafe.Pointer(b)).Fsortkey - (*address)(unsafe.Pointer(a)).Fsortkey
   3739 }
   3740 
   3741 func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
   3742 	bp := tls.Alloc(92)
   3743 	defer tls.Free(92)
   3744 
   3745 	var cnt int32 = 0
   3746 	var i int32
   3747 	var j int32
   3748 	_ = j
   3749 
   3750 	*(*int8)(unsafe.Pointer(canon)) = int8(0)
   3751 	if name != 0 {
   3752 		// reject empty name and check len so it fits into temp bufs
   3753 		var l size_t = Xstrnlen(tls, name, uint64(255))
   3754 		if l-uint64(1) >= uint64(254) {
   3755 			return -2
   3756 		}
   3757 		Xmemcpy(tls, canon, name, l+uint64(1))
   3758 	}
   3759 
   3760 	// Procedurally, a request for v6 addresses with the v4-mapped
   3761 	// flag set is like a request for unspecified family, followed
   3762 	// by filtering of the results.
   3763 	if flags&0x08 != 0 {
   3764 		if family == 10 {
   3765 			family = 0
   3766 		} else {
   3767 			flags = flags - 0x08
   3768 		}
   3769 	}
   3770 
   3771 	// Try each backend until there's at least one result.
   3772 	cnt = name_from_null(tls, buf, name, family, flags)
   3773 	if !(cnt != 0) {
   3774 		cnt = name_from_numeric(tls, buf, name, family)
   3775 	}
   3776 	if !(cnt != 0) && !(flags&0x04 != 0) {
   3777 		cnt = name_from_hosts(tls, buf, canon, name, family)
   3778 		if !(cnt != 0) {
   3779 			cnt = name_from_dns_search(tls, buf, canon, name, family)
   3780 		}
   3781 	}
   3782 	if cnt <= 0 {
   3783 		if cnt != 0 {
   3784 			return cnt
   3785 		}
   3786 		return -2
   3787 	}
   3788 
   3789 	// Filter/transform results for v4-mapped lookup, if requested.
   3790 	if flags&0x08 != 0 {
   3791 		Xabort(tls) //TODO-
   3792 		// 	if (!(flags & AI_ALL)) {
   3793 		// 		/* If any v6 results exist, remove v4 results. */
   3794 		// 		for (i=0; i<cnt && buf[i].family != AF_INET6; i++);
   3795 		// 		if (i<cnt) {
   3796 		// 			for (j=0; i<cnt; i++) {
   3797 		// 				if (buf[i].family == AF_INET6)
   3798 		// 					buf[j++] = buf[i];
   3799 		// 			}
   3800 		// 			cnt = i = j;
   3801 		// 		}
   3802 		// 	}
   3803 		// 	/* Translate any remaining v4 results to v6 */
   3804 		// 	for (i=0; i<cnt; i++) {
   3805 		// 		if (buf[i].family != AF_INET) continue;
   3806 		// 		memcpy(buf[i].addr+12, buf[i].addr, 4);
   3807 		// 		memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
   3808 		// 		buf[i].family = AF_INET6;
   3809 		// 	}
   3810 	}
   3811 
   3812 	// No further processing is needed if there are fewer than 2
   3813 	// results or if there are only IPv4 results.
   3814 	if cnt < 2 || family == 2 {
   3815 		return cnt
   3816 	}
   3817 	for i = 0; i < cnt; i++ {
   3818 		if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).Ffamily != 2 {
   3819 			break
   3820 		}
   3821 	}
   3822 	if i == cnt {
   3823 		return cnt
   3824 	}
   3825 	var cs int32
   3826 	_ = cs
   3827 	//TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
   3828 
   3829 	// The following implements a subset of RFC 3484/6724 destination
   3830 	// address selection by generating a single 31-bit sort key for
   3831 	// each address. Rules 3, 4, and 7 are omitted for having
   3832 	// excessive runtime and code size cost and dubious benefit.
   3833 	// So far the label/precedence table cannot be customized.
   3834 	for i = 0; i < cnt; i++ {
   3835 		var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Ffamily
   3836 		var key int32 = 0
   3837 		*(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{}
   3838 		*(*sockaddr_in6)(unsafe.Pointer(bp /* da6 */)) = sockaddr_in6{Fsin6_family: sa_family_t(10), Fsin6_port: in_port_t(65535), Fsin6_scope_id: (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fscopeid}
   3839 		*(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{}
   3840 		*(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{Fsin_family: sa_family_t(2), Fsin_port: in_port_t(65535)}
   3841 		var sa1 uintptr
   3842 		var da uintptr
   3843 		// var salen socklen_t at bp+88, 4
   3844 
   3845 		var dalen socklen_t
   3846 		if family == 10 {
   3847 			Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint64(16))
   3848 			da = bp /* &da6 */
   3849 			dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
   3850 			sa1 = bp + 28 /* &sa6 */
   3851 			*(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
   3852 		} else {
   3853 			Xmemcpy(tls, bp+28+8,
   3854 				ts+88, uint64(12))
   3855 			Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4))
   3856 			Xmemcpy(tls, bp+8,
   3857 				ts+88, uint64(12))
   3858 			Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4))
   3859 			Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint64(4))
   3860 			da = bp + 56 /* &da4 */
   3861 			dalen = socklen_t(unsafe.Sizeof(sockaddr_in{}))
   3862 			sa1 = bp + 72 /* &sa4 */
   3863 			*(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{}))
   3864 		}
   3865 		var dpolicy uintptr = policyof(tls, bp+8)
   3866 		var dscope int32 = scopeof(tls, bp+8)
   3867 		var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Flabel)
   3868 		var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Fprec)
   3869 		var prefixlen int32 = 0
   3870 		var fd int32 = Xsocket(tls, family, 2|02000000, 17)
   3871 		if fd >= 0 {
   3872 			if !(Xconnect(tls, fd, da, dalen) != 0) {
   3873 				key = key | 0x40000000
   3874 				if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) {
   3875 					if family == 2 {
   3876 						Xmemcpy(tls,
   3877 							bp+28+8+uintptr(12),
   3878 							bp+72+4, uint64(4))
   3879 					}
   3880 					if dscope == scopeof(tls, bp+28+8) {
   3881 						key = key | 0x20000000
   3882 					}
   3883 					if dlabel == labelof(tls, bp+28+8) {
   3884 						key = key | 0x10000000
   3885 					}
   3886 					prefixlen = prefixmatch(tls, bp+28+8,
   3887 						bp+8)
   3888 				}
   3889 			}
   3890 			Xclose(tls, fd)
   3891 		}
   3892 		key = key | dprec<<20
   3893 		key = key | (15-dscope)<<16
   3894 		key = key | prefixlen<<8
   3895 		key = key | (48-i)<<0
   3896 		(*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fsortkey = key
   3897 	}
   3898 	Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct {
   3899 		f func(*TLS, uintptr, uintptr) int32
   3900 	}{addrcmp})))
   3901 
   3902 	//TODO pthread_setcancelstate(cs, 0);
   3903 
   3904 	return cnt
   3905 }
   3906 
   3907 func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
   3908 	bp := tls.Alloc(8)
   3909 	defer tls.Free(8)
   3910 
   3911 	var line [128]int8
   3912 	_ = line
   3913 	var cnt int32 = 0
   3914 	var p uintptr
   3915 	_ = p
   3916 	*(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */
   3917 	var port uint64 = uint64(0)
   3918 
   3919 	switch socktype {
   3920 	case 1:
   3921 		switch proto {
   3922 		case 0:
   3923 			proto = 6
   3924 			fallthrough
   3925 		case 6:
   3926 			break
   3927 		default:
   3928 			return -8
   3929 		}
   3930 		break
   3931 	case 2:
   3932 		switch proto {
   3933 		case 0:
   3934 			proto = 17
   3935 			fallthrough
   3936 		case 17:
   3937 			break
   3938 		default:
   3939 			return -8
   3940 		}
   3941 		fallthrough
   3942 	case 0:
   3943 		break
   3944 	default:
   3945 		if name != 0 {
   3946 			return -8
   3947 		}
   3948 		(*service)(unsafe.Pointer(buf)).Fport = uint16_t(0)
   3949 		(*service)(unsafe.Pointer(buf)).Fproto = uint8(proto)
   3950 		(*service)(unsafe.Pointer(buf)).Fsocktype = uint8(socktype)
   3951 		return 1
   3952 	}
   3953 
   3954 	if name != 0 {
   3955 		if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) {
   3956 			return -8
   3957 		}
   3958 		port = Xstrtoul(tls, name, bp, 10)
   3959 	}
   3960 	if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) {
   3961 		if port > uint64(65535) {
   3962 			return -8
   3963 		}
   3964 		if proto != 17 {
   3965 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
   3966 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(1)
   3967 			(*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(6)
   3968 		}
   3969 		if proto != 6 {
   3970 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
   3971 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(2)
   3972 			(*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(17)
   3973 		}
   3974 		return cnt
   3975 	}
   3976 
   3977 	if flags&0x400 != 0 {
   3978 		return -2
   3979 	}
   3980 
   3981 	var l size_t = Xstrlen(tls, name)
   3982 	_ = l
   3983 
   3984 	Xabort(tls) //TODO-
   3985 	// unsigned char _buf[1032];
   3986 	// FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
   3987 	// if (!f) switch (errno) {
   3988 	// case ENOENT:
   3989 	// case ENOTDIR:
   3990 	// case EACCES:
   3991 	// 	return EAI_SERVICE;
   3992 	// default:
   3993 	// 	return EAI_SYSTEM;
   3994 	// }
   3995 
   3996 	Xabort(tls) //TODO-
   3997 	// while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
   3998 	// 	if ((p=strchr(line, '#'))) *p++='\n', *p=0;
   3999 
   4000 	// 	/* Find service name */
   4001 	// 	for(p=line; (p=strstr(p, name)); p++) {
   4002 	// 		if (p>line && !isspace(p[-1])) continue;
   4003 	// 		if (p[l] && !isspace(p[l])) continue;
   4004 	// 		break;
   4005 	// 	}
   4006 	// 	if (!p) continue;
   4007 
   4008 	// 	/* Skip past canonical name at beginning of line */
   4009 	// 	for (p=line; *p && !isspace(*p); p++);
   4010 
   4011 	// 	port = strtoul(p, &z, 10);
   4012 	// 	if (port > 65535 || z==p) continue;
   4013 	// 	if (!strncmp(z, "/udp", 4)) {
   4014 	// 		if (proto == IPPROTO_TCP) continue;
   4015 	// 		buf[cnt].port = port;
   4016 	// 		buf[cnt].socktype = SOCK_DGRAM;
   4017 	// 		buf[cnt++].proto = IPPROTO_UDP;
   4018 	// 	}
   4019 	// 	if (!strncmp(z, "/tcp", 4)) {
   4020 	// 		if (proto == IPPROTO_UDP) continue;
   4021 	// 		buf[cnt].port = port;
   4022 	// 		buf[cnt].socktype = SOCK_STREAM;
   4023 	// 		buf[cnt++].proto = IPPROTO_TCP;
   4024 	// 	}
   4025 	// }
   4026 	// __fclose_ca(f);
   4027 	// return cnt > 0 ? cnt : EAI_SERVICE;
   4028 	Xabort(tls)
   4029 	return int32(0) //TODO-
   4030 }
   4031 
   4032 func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
   4033 	*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
   4034 	if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
   4035 		(*struct {
   4036 			f func(*TLS, uintptr, uintptr, size_t) size_t
   4037 		})(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fwrite})).f(tls, f, uintptr(0), uint64(0))
   4038 	}
   4039 	(*FILE)(unsafe.Pointer(f)).Fwpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0)))
   4040 	if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(4) != 0 {
   4041 		*(*uint32)(unsafe.Pointer(f)) |= uint32(32)
   4042 		return -1
   4043 	}
   4044 	(*FILE)(unsafe.Pointer(f)).Frpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).Fbuf+uintptr((*FILE)(unsafe.Pointer(f)).Fbuf_size))
   4045 	if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(16) != 0 {
   4046 		return -1
   4047 	}
   4048 	return 0
   4049 }
   4050 
   4051 func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
   4052 	X__builtin_abort(tls) //TODO-
   4053 	// __stdio_exit_needed();
   4054 }
   4055 
   4056 // This function assumes it will never be called if there is already
   4057 // data buffered for reading.
   4058 
   4059 func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
   4060 	bp := tls.Alloc(1)
   4061 	defer tls.Free(1)
   4062 
   4063 	// var c uint8 at bp, 1
   4064 
   4065 	if !(X__toread(tls, f) != 0) && (*struct {
   4066 		f func(*TLS, uintptr, uintptr, size_t) size_t
   4067 	})(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fread})).f(tls, f, bp, uint64(1)) == uint64(1) {
   4068 		return int32(*(*uint8)(unsafe.Pointer(bp)))
   4069 	}
   4070 	return -1
   4071 }
   4072 
   4073 func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
   4074 	var try uintptr
   4075 	var sign int32
   4076 	for nel > uint64(0) {
   4077 		try = base + uintptr(width*(nel/uint64(2)))
   4078 		sign = (*struct {
   4079 			f func(*TLS, uintptr, uintptr) int32
   4080 		})(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try)
   4081 		if sign < 0 {
   4082 			nel = nel / uint64(2)
   4083 		} else if sign > 0 {
   4084 			base = try + uintptr(width)
   4085 			nel = nel - (nel/uint64(2) + uint64(1))
   4086 		} else {
   4087 			return try
   4088 		}
   4089 	}
   4090 	return uintptr(0)
   4091 }
   4092 
   4093 func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */
   4094 	bp := tls.Alloc(232)
   4095 	defer tls.Free(232)
   4096 
   4097 	// var f FILE at bp, 232
   4098 
   4099 	(*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+8, s)
   4100 	(*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
   4101 	X__shlim(tls, bp, int64(0))
   4102 	var y float64 = X__floatscan(tls, bp, prec, 1)
   4103 	var cnt off_t = (*FILE)(unsafe.Pointer(bp)).Fshcnt + (int64((*FILE)(unsafe.Pointer(bp)).Frpos)-int64((*FILE)(unsafe.Pointer(bp)).Fbuf))/1
   4104 	if p != 0 {
   4105 		*(*uintptr)(unsafe.Pointer(p)) = func() uintptr {
   4106 			if cnt != 0 {
   4107 				return s + uintptr(cnt)
   4108 			}
   4109 			return s
   4110 		}()
   4111 	}
   4112 	return y
   4113 }
   4114 
   4115 func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
   4116 	return float32(strtox(tls, s, p, 0))
   4117 }
   4118 
   4119 func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
   4120 	return strtox(tls, s, p, 1)
   4121 }
   4122 
   4123 func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
   4124 	return strtox(tls, s, p, 2)
   4125 }
   4126 
   4127 func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */
   4128 	bp := tls.Alloc(232)
   4129 	defer tls.Free(232)
   4130 
   4131 	// var f FILE at bp, 232
   4132 
   4133 	(*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+8, s)
   4134 	(*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
   4135 	X__shlim(tls, bp, int64(0))
   4136 	var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim)
   4137 	if p != 0 {
   4138 		var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).Fshcnt + (int64((*FILE)(unsafe.Pointer(bp)).Frpos)-int64((*FILE)(unsafe.Pointer(bp)).Fbuf))/1)
   4139 		*(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt)
   4140 	}
   4141 	return y
   4142 }
   4143 
   4144 func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
   4145 	return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
   4146 }
   4147 
   4148 func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
   4149 	return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
   4150 }
   4151 
   4152 func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
   4153 	return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
   4154 }
   4155 
   4156 func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
   4157 	return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
   4158 }
   4159 
   4160 func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
   4161 	return intmax_t(Xstrtoll(tls, s, p, base))
   4162 }
   4163 
   4164 func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
   4165 	return uintmax_t(Xstrtoull(tls, s, p, base))
   4166 }
   4167 
   4168 func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
   4169 	var l size_t = Xstrlen(tls, s)
   4170 	var d uintptr = Xmalloc(tls, l+uint64(1))
   4171 	if !(d != 0) {
   4172 		return uintptr(0)
   4173 	}
   4174 	return Xmemcpy(tls, d, s, l+uint64(1))
   4175 }
   4176 
   4177 func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
   4178 	var p uintptr = Xmemchr(tls, s, 0, n)
   4179 	if p != 0 {
   4180 		return uint64((int64(p) - int64(s)) / 1)
   4181 	}
   4182 	return n
   4183 }
   4184 
   4185 func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
   4186 	bp := tls.Alloc(32)
   4187 	defer tls.Free(32)
   4188 
   4189 	var a uintptr = s
   4190 	*(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)}
   4191 
   4192 	if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) {
   4193 		return uint64(0)
   4194 	}
   4195 	if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) {
   4196 		for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ {
   4197 		}
   4198 		return size_t((int64(s) - int64(a)) / 1)
   4199 	}
   4200 
   4201 	for ; *(*int8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint64(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))*8, size_t(uint64(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))) != 0; c++ {
   4202 	}
   4203 	for ; *(*int8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))*8))&(size_t(uint64(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))) != 0; s++ {
   4204 	}
   4205 	return size_t((int64(s) - int64(a)) / 1)
   4206 }
   4207 
   4208 func init() {
   4209 	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_ctype_)) + 0)) = uintptr(unsafe.Pointer(&X_C_ctype_)) // ctype_.c:319:23:
   4210 }
   4211 
   4212 var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
   4213 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data