gtsocial-umbx

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

musl_darwin_arm64.go (143577B)


      1 // Code generated by 'ccgo -D__environ=environ -export-externs X -export-fields F -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -hide isascii,isspace,tolower,toupper -nostdinc -nostdlib -o ../musl_darwin_arm64.go -pkgname libc -static-locals-prefix _s -Iarch/aarch64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c ../darwin/table.c src/env/putenv.c src/env/setenv.c src/env/unsetenv.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/locale/localeconv.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.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/prng/rand_r.c src/stdio/__toread.c src/stdio/__uflow.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strchrnul.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.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 var X__darwin_check_fd_set_overflow uintptr /* <builtin>:146:5: */
    361 
    362 // pthread opaque structures
    363 
    364 type __darwin_pthread_handler_rec = struct {
    365 	F__routine uintptr
    366 	F__arg     uintptr
    367 	F__next    uintptr
    368 } /* table.c:1396:1 */
    369 
    370 type _opaque_pthread_attr_t = struct {
    371 	F__sig    int64
    372 	F__opaque [56]int8
    373 } /* table.c:1402:1 */
    374 
    375 type _opaque_pthread_cond_t = struct {
    376 	F__sig    int64
    377 	F__opaque [40]int8
    378 } /* table.c:1407:1 */
    379 
    380 type _opaque_pthread_condattr_t = struct {
    381 	F__sig    int64
    382 	F__opaque [8]int8
    383 } /* table.c:1412:1 */
    384 
    385 type _opaque_pthread_mutex_t = struct {
    386 	F__sig    int64
    387 	F__opaque [56]int8
    388 } /* table.c:1417:1 */
    389 
    390 type _opaque_pthread_mutexattr_t = struct {
    391 	F__sig    int64
    392 	F__opaque [8]int8
    393 } /* table.c:1422:1 */
    394 
    395 type _opaque_pthread_once_t = struct {
    396 	F__sig    int64
    397 	F__opaque [8]int8
    398 } /* table.c:1427:1 */
    399 
    400 type _opaque_pthread_rwlock_t = struct {
    401 	F__sig    int64
    402 	F__opaque [192]int8
    403 } /* table.c:1432:1 */
    404 
    405 type _opaque_pthread_rwlockattr_t = struct {
    406 	F__sig    int64
    407 	F__opaque [16]int8
    408 } /* table.c:1437:1 */
    409 
    410 type _opaque_pthread_t = struct {
    411 	F__sig           int64
    412 	F__cleanup_stack uintptr
    413 	F__opaque        [8176]int8
    414 } /* table.c:1442:1 */
    415 
    416 type ct_rune_t = int32 /* table.c:1527:28 */
    417 
    418 type rune_t = int32 /* table.c:1536:25 */
    419 
    420 type wint_t = int32 /* table.c:1558:25 */
    421 
    422 type _RuneEntry = struct {
    423 	F__min       int32
    424 	F__max       int32
    425 	F__map       int32
    426 	F__ccgo_pad1 [4]byte
    427 	F__types     uintptr
    428 } /* table.c:1575:3 */
    429 
    430 type _RuneRange = struct {
    431 	F__nranges   int32
    432 	F__ccgo_pad1 [4]byte
    433 	F__ranges    uintptr
    434 } /* table.c:1580:3 */
    435 
    436 type _RuneCharClass = struct {
    437 	F__name      [14]int8
    438 	F__ccgo_pad1 [2]byte
    439 	F__mask      uint32
    440 } /* table.c:1585:3 */
    441 
    442 type _RuneLocale = struct {
    443 	F__magic        [8]int8
    444 	F__encoding     [32]int8
    445 	F__sgetrune     uintptr
    446 	F__sputrune     uintptr
    447 	F__invalid_rune int32
    448 	F__runetype     [256]uint32
    449 	F__maplower     [256]int32
    450 	F__mapupper     [256]int32
    451 	F__ccgo_pad1    [4]byte
    452 	F__runetype_ext _RuneRange
    453 	F__maplower_ext _RuneRange
    454 	F__mapupper_ext _RuneRange
    455 	F__variable     uintptr
    456 	F__variable_len int32
    457 	F__ncharclasses int32
    458 	F__charclasses  uintptr
    459 } /* table.c:1616:3 */
    460 
    461 func X__istype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1670:1: */
    462 
    463 	return func() int32 {
    464 		if Xisascii(tls, _c) != 0 {
    465 			return BoolInt32(!!(uint64(*(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) + 60 + uintptr(_c)*4)))&_f != 0))
    466 		}
    467 		return BoolInt32(!!(X__maskrune(tls, _c, _f) != 0))
    468 	}()
    469 
    470 }
    471 
    472 func X__isctype(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1681:1: */
    473 
    474 	if _c < 0 || _c >= int32(1)<<8 {
    475 		return 0
    476 	}
    477 	return BoolInt32(!!(uint64(*(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) + 60 + uintptr(_c)*4)))&_f != 0))
    478 
    479 }
    480 
    481 func X__wcwidth(tls *TLS, _c int32) int32 { /* table.c:1700:1: */
    482 	var _x uint32
    483 
    484 	if _c == 0 {
    485 		return 0
    486 	}
    487 	_x = uint32(X__maskrune(tls, _c, uint64(0xe0000000|0x00040000)))
    488 	if int64(_x)&0xe0000000 != int64(0) {
    489 		return int32(int64(_x) & 0xe0000000 >> 30)
    490 	}
    491 	return func() int32 {
    492 		if int64(_x)&0x00040000 != int64(0) {
    493 			return 1
    494 		}
    495 		return -1
    496 	}()
    497 }
    498 
    499 func Xisalnum(tls *TLS, _c int32) int32 { /* table.c:1718:1: */
    500 	return X__istype(tls, _c, uint64(0x00000100|0x00000400))
    501 }
    502 
    503 func Xisalpha(tls *TLS, _c int32) int32 { /* table.c:1724:1: */
    504 	return X__istype(tls, _c, uint64(0x00000100))
    505 }
    506 
    507 func Xisblank(tls *TLS, _c int32) int32 { /* table.c:1730:1: */
    508 	return X__istype(tls, _c, uint64(0x00020000))
    509 }
    510 
    511 func Xiscntrl(tls *TLS, _c int32) int32 { /* table.c:1736:1: */
    512 	return X__istype(tls, _c, uint64(0x00000200))
    513 }
    514 
    515 func Xisdigit(tls *TLS, _c int32) int32 { /* table.c:1743:1: */
    516 	return X__isctype(tls, _c, uint64(0x00000400))
    517 }
    518 
    519 func Xisgraph(tls *TLS, _c int32) int32 { /* table.c:1749:1: */
    520 	return X__istype(tls, _c, uint64(0x00000800))
    521 }
    522 
    523 func Xislower(tls *TLS, _c int32) int32 { /* table.c:1755:1: */
    524 	return X__istype(tls, _c, uint64(0x00001000))
    525 }
    526 
    527 func Xisprint(tls *TLS, _c int32) int32 { /* table.c:1761:1: */
    528 	return X__istype(tls, _c, uint64(0x00040000))
    529 }
    530 
    531 func Xispunct(tls *TLS, _c int32) int32 { /* table.c:1767:1: */
    532 	return X__istype(tls, _c, uint64(0x00002000))
    533 }
    534 
    535 func Xisupper(tls *TLS, _c int32) int32 { /* table.c:1779:1: */
    536 	return X__istype(tls, _c, uint64(0x00008000))
    537 }
    538 
    539 func Xisxdigit(tls *TLS, _c int32) int32 { /* table.c:1786:1: */
    540 	return X__isctype(tls, _c, uint64(0x00010000))
    541 }
    542 
    543 func Xtoascii(tls *TLS, _c int32) int32 { /* table.c:1792:1: */
    544 	return _c & 0x7F
    545 }
    546 
    547 func Xdigittoint(tls *TLS, _c int32) int32 { /* table.c:1811:1: */
    548 	return X__maskrune(tls, _c, uint64(0x0F))
    549 }
    550 
    551 func Xishexnumber(tls *TLS, _c int32) int32 { /* table.c:1817:1: */
    552 	return X__istype(tls, _c, uint64(0x00010000))
    553 }
    554 
    555 func Xisideogram(tls *TLS, _c int32) int32 { /* table.c:1823:1: */
    556 	return X__istype(tls, _c, uint64(0x00080000))
    557 }
    558 
    559 func Xisnumber(tls *TLS, _c int32) int32 { /* table.c:1829:1: */
    560 	return X__istype(tls, _c, uint64(0x00000400))
    561 }
    562 
    563 func Xisphonogram(tls *TLS, _c int32) int32 { /* table.c:1835:1: */
    564 	return X__istype(tls, _c, uint64(0x00200000))
    565 }
    566 
    567 func Xisrune(tls *TLS, _c int32) int32 { /* table.c:1841:1: */
    568 	return X__istype(tls, _c, uint64(0xFFFFFFF0))
    569 }
    570 
    571 func Xisspecial(tls *TLS, _c int32) int32 { /* table.c:1847:1: */
    572 	return X__istype(tls, _c, uint64(0x00100000))
    573 }
    574 
    575 func X__maskrune(tls *TLS, _c int32, _f uint64) int32 { /* table.c:1871:2: */
    576 	return int32(uint32(int32(*(*uint32)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) + 60 + uintptr(_c&0xff)*4)))) & uint32(_f))
    577 }
    578 
    579 func X__toupper(tls *TLS, c int32) int32 { /* table.c:1876:20: */
    580 	return Xtoupper(tls, c)
    581 }
    582 
    583 func X__tolower(tls *TLS, c int32) int32 { /* table.c:1878:20: */
    584 	return Xtolower(tls, c)
    585 }
    586 
    587 var X_DefaultRuneLocale = _RuneLocale{F__magic: [8]int8{int8(82), int8(117), int8(110), int8(101), int8(77), int8(97), int8(103), int8(65)}, F__encoding: [32]int8{int8(78), int8(79), int8(78), int8(69), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0), int8(0)}, F__invalid_rune: 0xfffd, F__runetype: [256]uint32{
    588 	uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x24200), uint32(0x4200), uint32(0x4200), uint32(0x4200), uint32(0x4200), uint32(0x200), uint32(0x200),
    589 	uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200), uint32(0x200),
    590 	uint32(0x64000), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800),
    591 	uint32(0x50c00), uint32(0x50c01), uint32(0x50c02), uint32(0x50c03), uint32(0x50c04), uint32(0x50c05), uint32(0x50c06), uint32(0x50c07), uint32(0x50c08), uint32(0x50c09), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800),
    592 	uint32(0x42800), uint32(0x5890a), uint32(0x5890b), uint32(0x5890c), uint32(0x5890d), uint32(0x5890e), uint32(0x5890f), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900),
    593 	uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x48900), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800),
    594 	uint32(0x42800), uint32(0x5190a), uint32(0x5190b), uint32(0x5190c), uint32(0x5190d), uint32(0x5190e), uint32(0x5190f), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900),
    595 	uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x41900), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x42800), uint32(0x200),
    596 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    597 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    598 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    599 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    600 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    601 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    602 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    603 	uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0), uint32(0x0),
    604 }, F__maplower: [256]int32{
    605 	0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
    606 	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
    607 	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
    608 	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
    609 	0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
    610 	0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
    611 	0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
    612 	0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
    613 	0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
    614 	0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
    615 	0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
    616 	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
    617 	0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
    618 	0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
    619 	0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
    620 	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
    621 }, F__mapupper: [256]int32{
    622 	0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
    623 	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
    624 	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
    625 	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
    626 	0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
    627 	0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
    628 	0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
    629 	0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
    630 	0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
    631 	0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
    632 	0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
    633 	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
    634 	0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
    635 	0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
    636 	0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
    637 	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
    638 },
    639 } /* table.c:1879:13 */
    640 
    641 var X_CurrentRuneLocale uintptr = 0 /* table.c:1940:13 */
    642 
    643 type div_t = struct {
    644 	Fquot int32
    645 	Frem  int32
    646 } /* stdlib.h:62:35 */
    647 type ldiv_t = struct {
    648 	Fquot int64
    649 	Frem  int64
    650 } /* stdlib.h:63:36 */
    651 type lldiv_t = struct {
    652 	Fquot int64
    653 	Frem  int64
    654 } /* stdlib.h:64:41 */
    655 
    656 type locale_t = uintptr /* alltypes.h:351:32 */
    657 
    658 type ssize_t = int64 /* alltypes.h:73:15 */
    659 
    660 type intptr_t = int64 /* alltypes.h:78:15 */
    661 
    662 type off_t = int64 /* alltypes.h:170:16 */
    663 
    664 type pid_t = int32 /* alltypes.h:243:13 */
    665 
    666 type uid_t = uint32 /* alltypes.h:253:18 */
    667 
    668 type gid_t = uint32 /* alltypes.h:258:18 */
    669 
    670 type useconds_t = uint32 /* alltypes.h:268:18 */
    671 
    672 func X__putenv(tls *TLS, s uintptr, l size_t, r uintptr) int32 { /* putenv.c:8:5: */
    673 	var i size_t
    674 	var newenv uintptr
    675 	var tmp uintptr
    676 	//TODO for (char **e = __environ; *e; e++, i++)
    677 	var e uintptr
    678 	i = uint64(0)
    679 	if !(Environ() != 0) {
    680 		goto __1
    681 	}
    682 	//TODO for (char **e = __environ; *e; e++, i++)
    683 	e = Environ()
    684 __2:
    685 	if !(*(*uintptr)(unsafe.Pointer(e)) != 0) {
    686 		goto __4
    687 	}
    688 	if !!(Xstrncmp(tls, s, *(*uintptr)(unsafe.Pointer(e)), l+uint64(1)) != 0) {
    689 		goto __5
    690 	}
    691 	tmp = *(*uintptr)(unsafe.Pointer(e))
    692 	*(*uintptr)(unsafe.Pointer(e)) = s
    693 	X__env_rm_add(tls, tmp, r)
    694 	return 0
    695 __5:
    696 	;
    697 	goto __3
    698 __3:
    699 	e += 8
    700 	i++
    701 	goto __2
    702 	goto __4
    703 __4:
    704 	;
    705 __1:
    706 	;
    707 	if !(Environ() == _soldenv) {
    708 		goto __6
    709 	}
    710 	newenv = Xrealloc(tls, _soldenv, uint64(unsafe.Sizeof(uintptr(0)))*(i+uint64(2)))
    711 	if !!(newenv != 0) {
    712 		goto __8
    713 	}
    714 	goto oom
    715 __8:
    716 	;
    717 	goto __7
    718 __6:
    719 	newenv = Xmalloc(tls, uint64(unsafe.Sizeof(uintptr(0)))*(i+uint64(2)))
    720 	if !!(newenv != 0) {
    721 		goto __9
    722 	}
    723 	goto oom
    724 __9:
    725 	;
    726 	if !(i != 0) {
    727 		goto __10
    728 	}
    729 	Xmemcpy(tls, newenv, Environ(), uint64(unsafe.Sizeof(uintptr(0)))*i)
    730 __10:
    731 	;
    732 	Xfree(tls, _soldenv)
    733 __7:
    734 	;
    735 	*(*uintptr)(unsafe.Pointer(newenv + uintptr(i)*8)) = s
    736 	*(*uintptr)(unsafe.Pointer(newenv + uintptr(i+uint64(1))*8)) = uintptr(0)
    737 	*(*uintptr)(unsafe.Pointer(EnvironP())) = AssignPtrUintptr(uintptr(unsafe.Pointer(&_soldenv)), newenv)
    738 	if !(r != 0) {
    739 		goto __11
    740 	}
    741 	X__env_rm_add(tls, uintptr(0), r)
    742 __11:
    743 	;
    744 	return 0
    745 oom:
    746 	Xfree(tls, r)
    747 	return -1
    748 }
    749 
    750 var _soldenv uintptr /* putenv.c:22:14: */
    751 
    752 func Xputenv(tls *TLS, s uintptr) int32 { /* putenv.c:43:5: */
    753 	var l size_t = size_t((int64(X__strchrnul(tls, s, '=')) - int64(s)) / 1)
    754 	if !(l != 0) || !(int32(*(*int8)(unsafe.Pointer(s + uintptr(l)))) != 0) {
    755 		return Xunsetenv(tls, s)
    756 	}
    757 	return X__putenv(tls, s, l, uintptr(0))
    758 }
    759 
    760 func X__env_rm_add(tls *TLS, old uintptr, new uintptr) { /* setenv.c:5:6: */
    761 	//TODO for (size_t i=0; i < env_alloced_n; i++)
    762 	var i size_t = uint64(0)
    763 	for ; i < _senv_alloced_n; i++ {
    764 		if *(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*8)) == old {
    765 			*(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*8)) = new
    766 			Xfree(tls, old)
    767 			return
    768 		} else if !(int32(*(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*8))) != 0) && new != 0 {
    769 			*(*uintptr)(unsafe.Pointer(_senv_alloced + uintptr(i)*8)) = new
    770 			new = uintptr(0)
    771 		}
    772 	}
    773 	if !(new != 0) {
    774 		return
    775 	}
    776 	var t uintptr = Xrealloc(tls, _senv_alloced, uint64(unsafe.Sizeof(uintptr(0)))*(_senv_alloced_n+uint64(1)))
    777 	if !(t != 0) {
    778 		return
    779 	}
    780 	*(*uintptr)(unsafe.Pointer(AssignPtrUintptr(uintptr(unsafe.Pointer(&_senv_alloced)), t) + uintptr(PostIncUint64(&_senv_alloced_n, 1))*8)) = new
    781 }
    782 
    783 var _senv_alloced uintptr  /* setenv.c:7:14: */
    784 var _senv_alloced_n size_t /* setenv.c:8:16: */
    785 
    786 func Xsetenv(tls *TLS, var1 uintptr, value uintptr, overwrite int32) int32 { /* setenv.c:26:5: */
    787 	var s uintptr
    788 	var l1 size_t
    789 	var l2 size_t
    790 
    791 	if !(var1 != 0) || !(int32(AssignUint64(&l1, size_t((int64(X__strchrnul(tls, var1, '='))-int64(var1))/1))) != 0) || *(*int8)(unsafe.Pointer(var1 + uintptr(l1))) != 0 {
    792 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
    793 		return -1
    794 	}
    795 	if !(overwrite != 0) && Xgetenv(tls, var1) != 0 {
    796 		return 0
    797 	}
    798 
    799 	l2 = Xstrlen(tls, value)
    800 	s = Xmalloc(tls, l1+l2+uint64(2))
    801 	if !(s != 0) {
    802 		return -1
    803 	}
    804 	Xmemcpy(tls, s, var1, l1)
    805 	*(*int8)(unsafe.Pointer(s + uintptr(l1))) = int8('=')
    806 	Xmemcpy(tls, s+uintptr(l1)+uintptr(1), value, l2+uint64(1))
    807 	return X__putenv(tls, s, l1, s)
    808 }
    809 
    810 func Xunsetenv(tls *TLS, name uintptr) int32 { /* unsetenv.c:9:5: */
    811 	var l size_t = size_t((int64(X__strchrnul(tls, name, '=')) - int64(name)) / 1)
    812 	if !(l != 0) || *(*int8)(unsafe.Pointer(name + uintptr(l))) != 0 {
    813 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
    814 		return -1
    815 	}
    816 	if Environ() != 0 {
    817 		var e uintptr = Environ()
    818 		var eo uintptr = e
    819 		for ; *(*uintptr)(unsafe.Pointer(e)) != 0; e += 8 {
    820 			//TODO if (!strncmp(name, *e, l) && l[*e] == '=')
    821 			if !(Xstrncmp(tls, name, *(*uintptr)(unsafe.Pointer(e)), l) != 0) && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(e)) + uintptr(l)))) == '=' {
    822 				X__env_rm_add(tls, *(*uintptr)(unsafe.Pointer(e)), uintptr(0))
    823 			} else if eo != e {
    824 				*(*uintptr)(unsafe.Pointer(PostIncUintptr(&eo, 8))) = *(*uintptr)(unsafe.Pointer(e))
    825 			} else {
    826 				eo += 8
    827 			}
    828 		}
    829 		if eo != e {
    830 			*(*uintptr)(unsafe.Pointer(eo)) = uintptr(0)
    831 		}
    832 	}
    833 	return 0
    834 }
    835 
    836 type uintptr_t = uint64 /* alltypes.h:63:24 */
    837 
    838 type int8_t = int8 /* alltypes.h:104:25 */
    839 
    840 type int16_t = int16 /* alltypes.h:109:25 */
    841 
    842 type int32_t = int32 /* alltypes.h:114:25 */
    843 
    844 type int64_t = int64 /* alltypes.h:119:25 */
    845 
    846 type intmax_t = int64 /* alltypes.h:124:25 */
    847 
    848 type uint8_t = uint8 /* alltypes.h:129:25 */
    849 
    850 type uint16_t = uint16 /* alltypes.h:134:25 */
    851 
    852 type uint32_t = uint32 /* alltypes.h:139:25 */
    853 
    854 type uint64_t = uint64 /* alltypes.h:144:25 */
    855 
    856 type uintmax_t = uint64 /* alltypes.h:154:25 */
    857 
    858 type int_fast8_t = int8_t   /* stdint.h:22:16 */
    859 type int_fast64_t = int64_t /* stdint.h:23:17 */
    860 
    861 type int_least8_t = int8_t   /* stdint.h:25:17 */
    862 type int_least16_t = int16_t /* stdint.h:26:17 */
    863 type int_least32_t = int32_t /* stdint.h:27:17 */
    864 type int_least64_t = int64_t /* stdint.h:28:17 */
    865 
    866 type uint_fast8_t = uint8_t   /* stdint.h:30:17 */
    867 type uint_fast64_t = uint64_t /* stdint.h:31:18 */
    868 
    869 type uint_least8_t = uint8_t   /* stdint.h:33:18 */
    870 type uint_least16_t = uint16_t /* stdint.h:34:18 */
    871 type uint_least32_t = uint32_t /* stdint.h:35:18 */
    872 type uint_least64_t = uint64_t /* stdint.h:36:18 */
    873 
    874 type int_fast16_t = int32_t   /* stdint.h:1:17 */
    875 type int_fast32_t = int32_t   /* stdint.h:2:17 */
    876 type uint_fast16_t = uint32_t /* stdint.h:3:18 */
    877 type uint_fast32_t = uint32_t /* stdint.h:4:18 */
    878 
    879 type _IO_FILE = struct {
    880 	Fflags        uint32
    881 	F__ccgo_pad1  [4]byte
    882 	Frpos         uintptr
    883 	Frend         uintptr
    884 	Fclose        uintptr
    885 	Fwend         uintptr
    886 	Fwpos         uintptr
    887 	Fmustbezero_1 uintptr
    888 	Fwbase        uintptr
    889 	Fread         uintptr
    890 	Fwrite        uintptr
    891 	Fseek         uintptr
    892 	Fbuf          uintptr
    893 	Fbuf_size     size_t
    894 	Fprev         uintptr
    895 	Fnext         uintptr
    896 	Ffd           int32
    897 	Fpipe_pid     int32
    898 	Flockcount    int64
    899 	Fmode         int32
    900 	Flock         int32
    901 	Flbf          int32
    902 	F__ccgo_pad2  [4]byte
    903 	Fcookie       uintptr
    904 	Foff          off_t
    905 	Fgetln_buf    uintptr
    906 	Fmustbezero_2 uintptr
    907 	Fshend        uintptr
    908 	Fshlim        off_t
    909 	Fshcnt        off_t
    910 	Fprev_locked  uintptr
    911 	Fnext_locked  uintptr
    912 	Flocale       uintptr
    913 } /* alltypes.h:328:9 */
    914 
    915 type FILE = _IO_FILE /* alltypes.h:328:25 */
    916 
    917 type va_list = uintptr /* alltypes.h:334:27 */
    918 
    919 type _G_fpos64_t = struct {
    920 	F__ccgo_pad1 [0]uint64
    921 	F__opaque    [16]int8
    922 } /* stdio.h:54:9 */
    923 
    924 type fpos_t = _G_fpos64_t /* stdio.h:58:3 */
    925 
    926 type float_t = float32 /* alltypes.h:38:15 */
    927 
    928 type double_t = float64 /* alltypes.h:43:16 */
    929 
    930 func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */
    931 	bp := tls.Alloc(4)
    932 	defer tls.Free(4)
    933 
    934 	// var __u struct {F__f float32;} at bp, 4
    935 
    936 	*(*float32)(unsafe.Pointer(bp)) = __f
    937 	return *(*uint32)(unsafe.Pointer(bp))
    938 }
    939 
    940 func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */
    941 	bp := tls.Alloc(8)
    942 	defer tls.Free(8)
    943 
    944 	// var __u struct {F__f float64;} at bp, 8
    945 
    946 	*(*float64)(unsafe.Pointer(bp)) = __f
    947 	return *(*uint64)(unsafe.Pointer(bp))
    948 }
    949 
    950 func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */
    951 	return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5))
    952 }
    953 
    954 type syscall_arg_t = int64 /* syscall.h:22:14 */
    955 
    956 func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */
    957 	var c int32
    958 	var x int32
    959 	var y int64
    960 	var neg int32 = 0
    961 
    962 	c = func() int32 {
    963 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    964 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    965 		}
    966 		return X__shgetc(tls, f)
    967 	}()
    968 	if c == '+' || c == '-' {
    969 		neg = Bool32(c == '-')
    970 		c = func() int32 {
    971 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
    972 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
    973 			}
    974 			return X__shgetc(tls, f)
    975 		}()
    976 		if uint32(c-'0') >= 10 && pok != 0 {
    977 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
    978 				(*FILE)(unsafe.Pointer(f)).Frpos--
    979 			} else {
    980 			}
    981 		}
    982 	}
    983 	if uint32(c-'0') >= 10 {
    984 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
    985 			(*FILE)(unsafe.Pointer(f)).Frpos--
    986 		} else {
    987 		}
    988 		return -0x7fffffffffffffff - int64(1)
    989 	}
    990 	for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; 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 	}() {
    996 		x = 10*x + c - '0'
    997 	}
    998 	for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 {
    999 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1000 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1001 		}
   1002 		return X__shgetc(tls, f)
   1003 	}() {
   1004 		y = int64(10)*y + int64(c) - int64('0')
   1005 	}
   1006 	for ; uint32(c-'0') < 10; c = func() int32 {
   1007 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1008 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1009 		}
   1010 		return X__shgetc(tls, f)
   1011 	}() {
   1012 	}
   1013 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1014 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1015 	} else {
   1016 	}
   1017 	if neg != 0 {
   1018 		return -y
   1019 	}
   1020 	return y
   1021 }
   1022 
   1023 func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */
   1024 	bp := tls.Alloc(512)
   1025 	defer tls.Free(512)
   1026 
   1027 	// var x [128]uint32_t at bp, 512
   1028 
   1029 	var i int32
   1030 	var j int32
   1031 	var k int32
   1032 	var a int32
   1033 	var z int32
   1034 	var lrp int64 = int64(0)
   1035 	var dc int64 = int64(0)
   1036 	var e10 int64 = int64(0)
   1037 	var lnz int32 = 0
   1038 	var gotdig int32 = 0
   1039 	var gotrad int32 = 0
   1040 	var rp int32
   1041 	var e2 int32
   1042 	var emax int32 = -emin - bits + 3
   1043 	var denormal int32 = 0
   1044 	var y float64
   1045 	var frac float64 = float64(0)
   1046 	var bias float64 = float64(0)
   1047 
   1048 	j = 0
   1049 	k = 0
   1050 
   1051 	// Don't let leading zeros consume buffer space
   1052 	for ; c == '0'; c = func() int32 {
   1053 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1054 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1055 		}
   1056 		return X__shgetc(tls, f)
   1057 	}() {
   1058 		gotdig = 1
   1059 	}
   1060 	if c == '.' {
   1061 		gotrad = 1
   1062 		for c = func() int32 {
   1063 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1064 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1065 			}
   1066 			return X__shgetc(tls, f)
   1067 		}(); c == '0'; c = func() int32 {
   1068 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1069 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1070 			}
   1071 			return X__shgetc(tls, f)
   1072 		}() {
   1073 			gotdig = 1
   1074 			lrp--
   1075 		}
   1076 	}
   1077 
   1078 	*(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0)
   1079 	for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 {
   1080 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1081 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1082 		}
   1083 		return X__shgetc(tls, f)
   1084 	}() {
   1085 		if c == '.' {
   1086 			if gotrad != 0 {
   1087 				break
   1088 			}
   1089 			gotrad = 1
   1090 			lrp = dc
   1091 		} else if k < 128-3 {
   1092 			dc++
   1093 			if c != '0' {
   1094 				lnz = int32(dc)
   1095 			}
   1096 			if j != 0 {
   1097 				*(*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')
   1098 			} else {
   1099 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0')
   1100 			}
   1101 			if PreIncInt32(&j, 1) == 9 {
   1102 				k++
   1103 				j = 0
   1104 			}
   1105 			gotdig = 1
   1106 		} else {
   1107 			dc++
   1108 			if c != '0' {
   1109 				lnz = (128 - 4) * 9
   1110 				*(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1)
   1111 			}
   1112 		}
   1113 	}
   1114 	if !(gotrad != 0) {
   1115 		lrp = dc
   1116 	}
   1117 
   1118 	if gotdig != 0 && c|32 == 'e' {
   1119 		e10 = scanexp(tls, f, pok)
   1120 		if e10 == -0x7fffffffffffffff-int64(1) {
   1121 			if pok != 0 {
   1122 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1123 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1124 				} else {
   1125 				}
   1126 			} else {
   1127 				X__shlim(tls, f, int64(0))
   1128 				return float64(0)
   1129 			}
   1130 			e10 = int64(0)
   1131 		}
   1132 		lrp = lrp + e10
   1133 	} else if c >= 0 {
   1134 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1135 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1136 		} else {
   1137 		}
   1138 	}
   1139 	if !(gotdig != 0) {
   1140 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1141 		X__shlim(tls, f, int64(0))
   1142 		return float64(0)
   1143 	}
   1144 
   1145 	// Handle zero specially to avoid nasty special cases later
   1146 	if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) {
   1147 		return float64(sign) * 0.0
   1148 	}
   1149 
   1150 	// Optimize small integers (w/no exponent) and over/under-flow
   1151 	if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) {
   1152 		return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
   1153 	}
   1154 	if lrp > int64(-emin/2) {
   1155 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1156 		return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
   1157 	}
   1158 	if lrp < int64(emin-2*53) {
   1159 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1160 		return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
   1161 	}
   1162 
   1163 	// Align incomplete final B1B digit
   1164 	if j != 0 {
   1165 		for ; j < 9; j++ {
   1166 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10)
   1167 		}
   1168 		k++
   1169 		j = 0
   1170 	}
   1171 
   1172 	a = 0
   1173 	z = k
   1174 	e2 = 0
   1175 	rp = int32(lrp)
   1176 
   1177 	// Optimize small to mid-size integers (even in exp. notation)
   1178 	if lnz < 9 && lnz <= rp && rp < 18 {
   1179 		if rp == 9 {
   1180 			return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp)))
   1181 		}
   1182 		if rp < 9 {
   1183 			return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp])
   1184 		}
   1185 		var bitlim int32 = bits - 3*(rp-9)
   1186 		if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) {
   1187 			return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10])
   1188 		}
   1189 	}
   1190 
   1191 	// Drop trailing zeros
   1192 	for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- {
   1193 	}
   1194 
   1195 	// Align radix point to B1B digit boundary
   1196 	if rp%9 != 0 {
   1197 		var rpm9 int32
   1198 		if rp >= 0 {
   1199 			rpm9 = rp % 9
   1200 		} else {
   1201 			rpm9 = rp%9 + 9
   1202 		}
   1203 		var p10 int32 = _sp10s[8-rpm9]
   1204 		var carry uint32_t = uint32_t(0)
   1205 		for k = a; k != z; k++ {
   1206 			var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10)
   1207 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry
   1208 			carry = uint32_t(1000000000/p10) * tmp
   1209 			if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
   1210 				a = (a + 1) & (128 - 1)
   1211 				rp = rp - 9
   1212 			}
   1213 		}
   1214 		if carry != 0 {
   1215 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry
   1216 		}
   1217 		rp = rp + (9 - rpm9)
   1218 	}
   1219 
   1220 	// Upscale until desired number of bits are left of radix point
   1221 	for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] {
   1222 		var carry uint32_t = uint32_t(0)
   1223 		e2 = e2 - 29
   1224 		for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) {
   1225 			var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry)
   1226 			if tmp > uint64(1000000000) {
   1227 				carry = uint32_t(tmp / uint64(1000000000))
   1228 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000))
   1229 			} else {
   1230 				carry = uint32_t(0)
   1231 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp)
   1232 			}
   1233 			if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
   1234 				z = k
   1235 			}
   1236 			if k == a {
   1237 				break
   1238 			}
   1239 		}
   1240 		if carry != 0 {
   1241 			rp = rp + 9
   1242 			a = (a - 1) & (128 - 1)
   1243 			if a == z {
   1244 				z = (z - 1) & (128 - 1)
   1245 				*(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4))
   1246 			}
   1247 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry
   1248 		}
   1249 	}
   1250 
   1251 	// Downscale until exactly number of bits are left of radix point
   1252 	for {
   1253 		var carry uint32_t = uint32_t(0)
   1254 		var sh int32 = 1
   1255 		for i = 0; i < 2; i++ {
   1256 			k = (a + i) & (128 - 1)
   1257 			if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] {
   1258 				i = 2
   1259 				break
   1260 			}
   1261 			if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] {
   1262 				break
   1263 			}
   1264 		}
   1265 		if i == 2 && rp == 9*2 {
   1266 			break
   1267 		}
   1268 		// FIXME: find a way to compute optimal sh
   1269 		if rp > 9+9*2 {
   1270 			sh = 9
   1271 		}
   1272 		e2 = e2 + sh
   1273 		for k = a; k != z; k = (k + 1) & (128 - 1) {
   1274 			var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1)
   1275 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry
   1276 			carry = uint32_t(int32(1000000000)>>sh) * tmp
   1277 			if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) {
   1278 				a = (a + 1) & (128 - 1)
   1279 				i--
   1280 				rp = rp - 9
   1281 			}
   1282 		}
   1283 		if carry != 0 {
   1284 			if (z+1)&(128-1) != a {
   1285 				*(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry
   1286 				z = (z + 1) & (128 - 1)
   1287 			} else {
   1288 				*(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1)
   1289 			}
   1290 		}
   1291 	}
   1292 
   1293 	// Assemble desired bits into floating point variable
   1294 	for y = float64(AssignInt32(&i, 0)); i < 2; i++ {
   1295 		if (a+i)&(128-1) == z {
   1296 			*(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0)
   1297 		}
   1298 		y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)))
   1299 	}
   1300 
   1301 	y = y * float64(sign)
   1302 
   1303 	// Limit precision for denormal results
   1304 	if bits > 53+e2-emin {
   1305 		bits = 53 + e2 - emin
   1306 		if bits < 0 {
   1307 			bits = 0
   1308 		}
   1309 		denormal = 1
   1310 	}
   1311 
   1312 	// Calculate bias term to force rounding, move out lower bits
   1313 	if bits < 53 {
   1314 		bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y)
   1315 		frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits))
   1316 		y = y - frac
   1317 		y = y + bias
   1318 	}
   1319 
   1320 	// Process tail of decimal input so it can affect rounding
   1321 	if (a+i)&(128-1) != z {
   1322 		var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))
   1323 		if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) {
   1324 			frac = frac + 0.25*float64(sign)
   1325 		} else if t > uint32_t(500000000) {
   1326 			frac = frac + 0.75*float64(sign)
   1327 		} else if t == uint32_t(500000000) {
   1328 			if (a+i+1)&(128-1) == z {
   1329 				frac = frac + 0.5*float64(sign)
   1330 			} else {
   1331 				frac = frac + 0.75*float64(sign)
   1332 			}
   1333 		}
   1334 		if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) {
   1335 			frac += 1
   1336 		}
   1337 	}
   1338 
   1339 	y = y + frac
   1340 	y = y - bias
   1341 
   1342 	if (e2+53)&0x7fffffff > emax-5 {
   1343 		if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 {
   1344 			if denormal != 0 && bits == 53+e2-emin {
   1345 				denormal = 0
   1346 			}
   1347 			y = y * 0.5
   1348 			e2++
   1349 		}
   1350 		if e2+53 > emax || denormal != 0 && frac != 0 {
   1351 			*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1352 		}
   1353 	}
   1354 
   1355 	return Xscalbnl(tls, y, e2)
   1356 }
   1357 
   1358 var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */
   1359 var _sp10s = [8]int32{10, 100, 1000, 10000,
   1360 	100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */
   1361 
   1362 func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */
   1363 	var x uint32_t = uint32_t(0)
   1364 	var y float64 = float64(0)
   1365 	var scale float64 = float64(1)
   1366 	var bias float64 = float64(0)
   1367 	var gottail int32 = 0
   1368 	var gotrad int32 = 0
   1369 	var gotdig int32 = 0
   1370 	var rp int64 = int64(0)
   1371 	var dc int64 = int64(0)
   1372 	var e2 int64 = int64(0)
   1373 	var d int32
   1374 	var c int32
   1375 
   1376 	c = func() int32 {
   1377 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1378 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1379 		}
   1380 		return X__shgetc(tls, f)
   1381 	}()
   1382 
   1383 	// Skip leading zeros
   1384 	for ; c == '0'; c = func() int32 {
   1385 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1386 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1387 		}
   1388 		return X__shgetc(tls, f)
   1389 	}() {
   1390 		gotdig = 1
   1391 	}
   1392 
   1393 	if c == '.' {
   1394 		gotrad = 1
   1395 		c = func() int32 {
   1396 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1397 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1398 			}
   1399 			return X__shgetc(tls, f)
   1400 		}()
   1401 		// Count zeros after the radix point before significand
   1402 		rp = int64(0)
   1403 	__1:
   1404 		if !(c == '0') {
   1405 			goto __3
   1406 		}
   1407 		gotdig = 1
   1408 		goto __2
   1409 	__2:
   1410 		c = func() int32 {
   1411 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1412 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1413 			}
   1414 			return X__shgetc(tls, f)
   1415 		}()
   1416 		rp--
   1417 		goto __1
   1418 		goto __3
   1419 	__3:
   1420 	}
   1421 
   1422 	for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 {
   1423 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1424 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1425 		}
   1426 		return X__shgetc(tls, f)
   1427 	}() {
   1428 		if c == '.' {
   1429 			if gotrad != 0 {
   1430 				break
   1431 			}
   1432 			rp = dc
   1433 			gotrad = 1
   1434 		} else {
   1435 			gotdig = 1
   1436 			if c > '9' {
   1437 				d = c | 32 + 10 - 'a'
   1438 			} else {
   1439 				d = c - '0'
   1440 			}
   1441 			if dc < int64(8) {
   1442 				x = x*uint32_t(16) + uint32_t(d)
   1443 			} else if dc < int64(53/4+1) {
   1444 				y = y + float64(d)*AssignDivFloat64(&scale, float64(16))
   1445 			} else if d != 0 && !(gottail != 0) {
   1446 				y = y + 0.5*scale
   1447 				gottail = 1
   1448 			}
   1449 			dc++
   1450 		}
   1451 	}
   1452 	if !(gotdig != 0) {
   1453 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1454 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1455 		} else {
   1456 		}
   1457 		if pok != 0 {
   1458 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1459 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1460 			} else {
   1461 			}
   1462 			if gotrad != 0 {
   1463 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1464 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1465 				} else {
   1466 				}
   1467 			}
   1468 		} else {
   1469 			X__shlim(tls, f, int64(0))
   1470 		}
   1471 		return float64(sign) * 0.0
   1472 	}
   1473 	if !(gotrad != 0) {
   1474 		rp = dc
   1475 	}
   1476 	for dc < int64(8) {
   1477 		x = x * uint32_t(16)
   1478 		dc++
   1479 	}
   1480 	if c|32 == 'p' {
   1481 		e2 = scanexp(tls, f, pok)
   1482 		if e2 == -0x7fffffffffffffff-int64(1) {
   1483 			if pok != 0 {
   1484 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1485 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1486 				} else {
   1487 				}
   1488 			} else {
   1489 				X__shlim(tls, f, int64(0))
   1490 				return float64(0)
   1491 			}
   1492 			e2 = int64(0)
   1493 		}
   1494 	} else {
   1495 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1496 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1497 		} else {
   1498 		}
   1499 	}
   1500 	e2 = e2 + (int64(4)*rp - int64(32))
   1501 
   1502 	if !(x != 0) {
   1503 		return float64(sign) * 0.0
   1504 	}
   1505 	if e2 > int64(-emin) {
   1506 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1507 		return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308
   1508 	}
   1509 	if e2 < int64(emin-2*53) {
   1510 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1511 		return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308
   1512 	}
   1513 
   1514 	for x < 0x80000000 {
   1515 		if y >= 0.5 {
   1516 			x = x + (x + uint32_t(1))
   1517 			y = y + (y - float64(1))
   1518 		} else {
   1519 			x = x + x
   1520 			y = y + y
   1521 		}
   1522 		e2--
   1523 	}
   1524 
   1525 	if int64(bits) > int64(32)+e2-int64(emin) {
   1526 		bits = int32(int64(32) + e2 - int64(emin))
   1527 		if bits < 0 {
   1528 			bits = 0
   1529 		}
   1530 	}
   1531 
   1532 	if bits < 53 {
   1533 		bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign))
   1534 	}
   1535 
   1536 	if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) {
   1537 		x++
   1538 		y = float64(0)
   1539 	}
   1540 
   1541 	y = bias + float64(sign)*float64(x) + float64(sign)*y
   1542 	y = y - bias
   1543 
   1544 	if !(y != 0) {
   1545 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1546 	}
   1547 
   1548 	return Xscalbnl(tls, y, int32(e2))
   1549 }
   1550 
   1551 func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */
   1552 	var sign int32 = 1
   1553 	var i size_t
   1554 	var bits int32
   1555 	var emin int32
   1556 	var c int32
   1557 
   1558 	switch prec {
   1559 	case 0:
   1560 		bits = 24
   1561 		emin = -125 - bits
   1562 		break
   1563 	case 1:
   1564 		bits = 53
   1565 		emin = -1021 - bits
   1566 		break
   1567 	case 2:
   1568 		bits = 53
   1569 		emin = -1021 - bits
   1570 		break
   1571 	default:
   1572 		return float64(0)
   1573 	}
   1574 
   1575 	for __isspace(tls, AssignInt32(&c, func() int32 {
   1576 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1577 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1578 		}
   1579 		return X__shgetc(tls, f)
   1580 	}())) != 0 {
   1581 	}
   1582 
   1583 	if c == '+' || c == '-' {
   1584 		sign = sign - 2*Bool32(c == '-')
   1585 		c = func() int32 {
   1586 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1587 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1588 			}
   1589 			return X__shgetc(tls, f)
   1590 		}()
   1591 	}
   1592 
   1593 	for i = uint64(0); i < uint64(8) && c|32 == int32(*(*int8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i)))); i++ {
   1594 		if i < uint64(7) {
   1595 			c = func() int32 {
   1596 				if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1597 					return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1598 				}
   1599 				return X__shgetc(tls, f)
   1600 			}()
   1601 		}
   1602 	}
   1603 	if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 {
   1604 		if i != uint64(8) {
   1605 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1606 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1607 			} else {
   1608 			}
   1609 			if pok != 0 {
   1610 				for ; i > uint64(3); i-- {
   1611 					if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1612 						(*FILE)(unsafe.Pointer(f)).Frpos--
   1613 					} else {
   1614 					}
   1615 				}
   1616 			}
   1617 		}
   1618 		return float64(float32(sign) * X__builtin_inff(tls))
   1619 	}
   1620 	if !(i != 0) {
   1621 		for i = uint64(0); i < uint64(3) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i)))); i++ {
   1622 			if i < uint64(2) {
   1623 				c = func() int32 {
   1624 					if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1625 						return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1626 					}
   1627 					return X__shgetc(tls, f)
   1628 				}()
   1629 			}
   1630 		}
   1631 	}
   1632 	if i == uint64(3) {
   1633 		if func() int32 {
   1634 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1635 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1636 			}
   1637 			return X__shgetc(tls, f)
   1638 		}() != '(' {
   1639 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1640 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1641 			} else {
   1642 			}
   1643 			return float64(X__builtin_nanf(tls, ts+13))
   1644 		}
   1645 		for i = uint64(1); ; i++ {
   1646 			c = func() int32 {
   1647 				if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1648 					return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1649 				}
   1650 				return X__shgetc(tls, f)
   1651 			}()
   1652 			if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' {
   1653 				continue
   1654 			}
   1655 			if c == ')' {
   1656 				return float64(X__builtin_nanf(tls, ts+13))
   1657 			}
   1658 			if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1659 				(*FILE)(unsafe.Pointer(f)).Frpos--
   1660 			} else {
   1661 			}
   1662 			if !(pok != 0) {
   1663 				*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1664 				X__shlim(tls, f, int64(0))
   1665 				return float64(0)
   1666 			}
   1667 			for PostDecUint64(&i, 1) != 0 {
   1668 				if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1669 					(*FILE)(unsafe.Pointer(f)).Frpos--
   1670 				} else {
   1671 				}
   1672 			}
   1673 			return float64(X__builtin_nanf(tls, ts+13))
   1674 		}
   1675 		return float64(X__builtin_nanf(tls, ts+13))
   1676 	}
   1677 
   1678 	if i != 0 {
   1679 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1680 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1681 		} else {
   1682 		}
   1683 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1684 		X__shlim(tls, f, int64(0))
   1685 		return float64(0)
   1686 	}
   1687 
   1688 	if c == '0' {
   1689 		c = func() int32 {
   1690 			if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1691 				return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1692 			}
   1693 			return X__shgetc(tls, f)
   1694 		}()
   1695 		if c|32 == 'x' {
   1696 			return hexfloat(tls, f, bits, emin, sign, pok)
   1697 		}
   1698 		if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1699 			(*FILE)(unsafe.Pointer(f)).Frpos--
   1700 		} else {
   1701 		}
   1702 		c = '0'
   1703 	}
   1704 
   1705 	return decfloat(tls, f, c, bits, emin, sign, pok)
   1706 }
   1707 
   1708 // Lookup table for digit values. -1==255>=36 -> invalid
   1709 var table = [257]uint8{Uint8FromInt32(-1),
   1710 	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),
   1711 	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),
   1712 	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),
   1713 	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),
   1714 	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),
   1715 	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),
   1716 	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),
   1717 	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),
   1718 	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),
   1719 	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),
   1720 	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),
   1721 	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),
   1722 	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),
   1723 	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),
   1724 	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),
   1725 	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),
   1726 } /* intscan.c:7:28 */
   1727 
   1728 func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */
   1729 	var val uintptr
   1730 	var c int32
   1731 	var neg int32
   1732 	var x uint32
   1733 	var y uint64
   1734 	var bs int32
   1735 	val = uintptr(unsafe.Pointer(&table)) + uintptr(1)
   1736 	neg = 0
   1737 	if !(base > uint32(36) || base == uint32(1)) {
   1738 		goto __1
   1739 	}
   1740 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1741 	return uint64(0)
   1742 __1:
   1743 	;
   1744 __2:
   1745 	if !(__isspace(tls, AssignInt32(&c, func() int32 {
   1746 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1747 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1748 		}
   1749 		return X__shgetc(tls, f)
   1750 	}())) != 0) {
   1751 		goto __3
   1752 	}
   1753 	goto __2
   1754 __3:
   1755 	;
   1756 	if !(c == '+' || c == '-') {
   1757 		goto __4
   1758 	}
   1759 	neg = -Bool32(c == '-')
   1760 	c = func() int32 {
   1761 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1762 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1763 		}
   1764 		return X__shgetc(tls, f)
   1765 	}()
   1766 __4:
   1767 	;
   1768 	if !((base == uint32(0) || base == uint32(16)) && c == '0') {
   1769 		goto __5
   1770 	}
   1771 	c = func() int32 {
   1772 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1773 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1774 		}
   1775 		return X__shgetc(tls, f)
   1776 	}()
   1777 	if !(c|32 == 'x') {
   1778 		goto __7
   1779 	}
   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 	if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) {
   1787 		goto __9
   1788 	}
   1789 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1790 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1791 	} else {
   1792 	}
   1793 	if !(pok != 0) {
   1794 		goto __10
   1795 	}
   1796 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1797 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1798 	} else {
   1799 	}
   1800 	goto __11
   1801 __10:
   1802 	X__shlim(tls, f, int64(0))
   1803 __11:
   1804 	;
   1805 	return uint64(0)
   1806 __9:
   1807 	;
   1808 	base = uint32(16)
   1809 	goto __8
   1810 __7:
   1811 	if !(base == uint32(0)) {
   1812 		goto __12
   1813 	}
   1814 	base = uint32(8)
   1815 __12:
   1816 	;
   1817 __8:
   1818 	;
   1819 	goto __6
   1820 __5:
   1821 	if !(base == uint32(0)) {
   1822 		goto __13
   1823 	}
   1824 	base = uint32(10)
   1825 __13:
   1826 	;
   1827 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) {
   1828 		goto __14
   1829 	}
   1830 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   1831 		(*FILE)(unsafe.Pointer(f)).Frpos--
   1832 	} else {
   1833 	}
   1834 	X__shlim(tls, f, int64(0))
   1835 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22
   1836 	return uint64(0)
   1837 __14:
   1838 	;
   1839 __6:
   1840 	;
   1841 	if !(base == uint32(10)) {
   1842 		goto __15
   1843 	}
   1844 	x = uint32(0)
   1845 __17:
   1846 	if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) {
   1847 		goto __19
   1848 	}
   1849 	x = x*uint32(10) + uint32(c-'0')
   1850 	goto __18
   1851 __18:
   1852 	c = func() int32 {
   1853 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1854 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1855 		}
   1856 		return X__shgetc(tls, f)
   1857 	}()
   1858 	goto __17
   1859 	goto __19
   1860 __19:
   1861 	;
   1862 	y = uint64(x)
   1863 __20:
   1864 	if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) {
   1865 		goto __22
   1866 	}
   1867 	y = y*uint64(10) + uint64(c-'0')
   1868 	goto __21
   1869 __21:
   1870 	c = func() int32 {
   1871 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1872 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1873 		}
   1874 		return X__shgetc(tls, f)
   1875 	}()
   1876 	goto __20
   1877 	goto __22
   1878 __22:
   1879 	;
   1880 	if !(uint32(c-'0') >= 10) {
   1881 		goto __23
   1882 	}
   1883 	goto done
   1884 __23:
   1885 	;
   1886 	goto __16
   1887 __15:
   1888 	if !!(base&(base-uint32(1)) != 0) {
   1889 		goto __24
   1890 	}
   1891 	bs = int32(*(*int8)(unsafe.Pointer(ts + 14 + uintptr(uint32(0x17)*base>>5&uint32(7)))))
   1892 	x = uint32(0)
   1893 __26:
   1894 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) {
   1895 		goto __28
   1896 	}
   1897 	x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1898 	goto __27
   1899 __27:
   1900 	c = func() int32 {
   1901 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1902 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1903 		}
   1904 		return X__shgetc(tls, f)
   1905 	}()
   1906 	goto __26
   1907 	goto __28
   1908 __28:
   1909 	;
   1910 	y = uint64(x)
   1911 __29:
   1912 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) {
   1913 		goto __31
   1914 	}
   1915 	y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1916 	goto __30
   1917 __30:
   1918 	c = func() int32 {
   1919 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1920 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1921 		}
   1922 		return X__shgetc(tls, f)
   1923 	}()
   1924 	goto __29
   1925 	goto __31
   1926 __31:
   1927 	;
   1928 	goto __25
   1929 __24:
   1930 	x = uint32(0)
   1931 __32:
   1932 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) {
   1933 		goto __34
   1934 	}
   1935 	x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1936 	goto __33
   1937 __33:
   1938 	c = func() int32 {
   1939 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1940 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1941 		}
   1942 		return X__shgetc(tls, f)
   1943 	}()
   1944 	goto __32
   1945 	goto __34
   1946 __34:
   1947 	;
   1948 	y = uint64(x)
   1949 __35:
   1950 	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))))) {
   1951 		goto __37
   1952 	}
   1953 	y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c))))
   1954 	goto __36
   1955 __36:
   1956 	c = func() int32 {
   1957 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1958 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1959 		}
   1960 		return X__shgetc(tls, f)
   1961 	}()
   1962 	goto __35
   1963 	goto __37
   1964 __37:
   1965 	;
   1966 __25:
   1967 	;
   1968 __16:
   1969 	;
   1970 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
   1971 		goto __38
   1972 	}
   1973 __39:
   1974 	if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) {
   1975 		goto __41
   1976 	}
   1977 	goto __40
   1978 __40:
   1979 	c = func() int32 {
   1980 		if (*FILE)(unsafe.Pointer(f)).Frpos != (*FILE)(unsafe.Pointer(f)).Fshend {
   1981 			return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).Frpos, 1))))
   1982 		}
   1983 		return X__shgetc(tls, f)
   1984 	}()
   1985 	goto __39
   1986 	goto __41
   1987 __41:
   1988 	;
   1989 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   1990 	y = lim
   1991 	if !(lim&uint64(1) != 0) {
   1992 		goto __42
   1993 	}
   1994 	neg = 0
   1995 __42:
   1996 	;
   1997 __38:
   1998 	;
   1999 done:
   2000 	if (*FILE)(unsafe.Pointer(f)).Fshlim >= int64(0) {
   2001 		(*FILE)(unsafe.Pointer(f)).Frpos--
   2002 	} else {
   2003 	}
   2004 	if !(y >= lim) {
   2005 		goto __43
   2006 	}
   2007 	if !(!(lim&uint64(1) != 0) && !(neg != 0)) {
   2008 		goto __44
   2009 	}
   2010 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   2011 	return lim - uint64(1)
   2012 	goto __45
   2013 __44:
   2014 	if !(y > lim) {
   2015 		goto __46
   2016 	}
   2017 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34
   2018 	return lim
   2019 __46:
   2020 	;
   2021 __45:
   2022 	;
   2023 __43:
   2024 	;
   2025 	return y ^ uint64(neg) - uint64(neg)
   2026 }
   2027 
   2028 // The shcnt field stores the number of bytes read so far, offset by
   2029 // the value of buf-rpos at the last function call (__shlim or __shgetc),
   2030 // so that between calls the inline shcnt macro can add rpos-buf to get
   2031 // the actual count.
   2032 
   2033 func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */
   2034 	(*FILE)(unsafe.Pointer(f)).Fshlim = lim
   2035 	(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf) - int64((*FILE)(unsafe.Pointer(f)).Frpos)) / 1
   2036 	// If lim is nonzero, rend must be a valid pointer.
   2037 	if lim != 0 && (int64((*FILE)(unsafe.Pointer(f)).Frend)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 > lim {
   2038 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr(lim)
   2039 	} else {
   2040 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
   2041 	}
   2042 }
   2043 
   2044 func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */
   2045 	var c int32
   2046 	var cnt off_t = (*FILE)(unsafe.Pointer(f)).Fshcnt + (int64((*FILE)(unsafe.Pointer(f)).Frpos)-int64((*FILE)(unsafe.Pointer(f)).Fbuf))/1
   2047 	if (*FILE)(unsafe.Pointer(f)).Fshlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).Fshlim || AssignInt32(&c, X__uflow(tls, f)) < 0 {
   2048 		(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 + cnt
   2049 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos
   2050 		(*FILE)(unsafe.Pointer(f)).Fshlim = int64(-1)
   2051 		return -1
   2052 	}
   2053 	cnt++
   2054 	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 {
   2055 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frpos + uintptr((*FILE)(unsafe.Pointer(f)).Fshlim-cnt)
   2056 	} else {
   2057 		(*FILE)(unsafe.Pointer(f)).Fshend = (*FILE)(unsafe.Pointer(f)).Frend
   2058 	}
   2059 	(*FILE)(unsafe.Pointer(f)).Fshcnt = (int64((*FILE)(unsafe.Pointer(f)).Fbuf)-int64((*FILE)(unsafe.Pointer(f)).Frpos))/1 + cnt
   2060 	if (*FILE)(unsafe.Pointer(f)).Frpos <= (*FILE)(unsafe.Pointer(f)).Fbuf {
   2061 		*(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).Frpos + UintptrFromInt32(-1))) = uint8(c)
   2062 	}
   2063 	return c
   2064 }
   2065 
   2066 type lconv = struct {
   2067 	Fdecimal_point      uintptr
   2068 	Fthousands_sep      uintptr
   2069 	Fgrouping           uintptr
   2070 	Fint_curr_symbol    uintptr
   2071 	Fcurrency_symbol    uintptr
   2072 	Fmon_decimal_point  uintptr
   2073 	Fmon_thousands_sep  uintptr
   2074 	Fmon_grouping       uintptr
   2075 	Fpositive_sign      uintptr
   2076 	Fnegative_sign      uintptr
   2077 	Fint_frac_digits    int8
   2078 	Ffrac_digits        int8
   2079 	Fp_cs_precedes      int8
   2080 	Fp_sep_by_space     int8
   2081 	Fn_cs_precedes      int8
   2082 	Fn_sep_by_space     int8
   2083 	Fp_sign_posn        int8
   2084 	Fn_sign_posn        int8
   2085 	Fint_p_cs_precedes  int8
   2086 	Fint_p_sep_by_space int8
   2087 	Fint_n_cs_precedes  int8
   2088 	Fint_n_sep_by_space int8
   2089 	Fint_p_sign_posn    int8
   2090 	Fint_n_sign_posn    int8
   2091 	F__ccgo_pad1        [2]byte
   2092 } /* locale.h:24:1 */
   2093 
   2094 // Support signed or unsigned plain-char
   2095 
   2096 // Implementation choices...
   2097 
   2098 // Arbitrary numbers...
   2099 
   2100 // POSIX/SUS requirements follow. These numbers come directly
   2101 // from SUS and have nothing to do with the host system.
   2102 
   2103 var posix_lconv = lconv{Fdecimal_point: ts + 23, Fthousands_sep: ts + 13, Fgrouping: ts + 13, Fint_curr_symbol: ts + 13, Fcurrency_symbol: ts + 13, Fmon_decimal_point: ts + 13, Fmon_thousands_sep: ts + 13, Fmon_grouping: ts + 13, Fpositive_sign: ts + 13, Fnegative_sign: ts + 13, Fint_frac_digits: Int8FromInt32(255), Ffrac_digits: Int8FromInt32(255), Fp_cs_precedes: Int8FromInt32(255), Fp_sep_by_space: Int8FromInt32(255), Fn_cs_precedes: Int8FromInt32(255), Fn_sep_by_space: Int8FromInt32(255), Fp_sign_posn: Int8FromInt32(255), Fn_sign_posn: Int8FromInt32(255), Fint_p_cs_precedes: Int8FromInt32(255), Fint_p_sep_by_space: Int8FromInt32(255), Fint_n_cs_precedes: Int8FromInt32(255), Fint_n_sep_by_space: Int8FromInt32(255), Fint_p_sign_posn: Int8FromInt32(255), Fint_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */
   2104 
   2105 func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */
   2106 	return uintptr(unsafe.Pointer(&posix_lconv))
   2107 }
   2108 
   2109 func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */
   2110 	bp := tls.Alloc(8)
   2111 	defer tls.Free(8)
   2112 
   2113 	*(*struct{ Ff float64 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float64 }) {
   2114 		*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
   2115 		return r
   2116 	}()
   2117 	var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
   2118 	if !(e != 0) {
   2119 		if *(*uint64_t)(unsafe.Pointer(bp))<<1 != 0 {
   2120 			return 3
   2121 		}
   2122 		return 2
   2123 	}
   2124 	if e == 0x7ff {
   2125 		if *(*uint64_t)(unsafe.Pointer(bp))<<12 != 0 {
   2126 			return 0
   2127 		}
   2128 		return 1
   2129 	}
   2130 	return 4
   2131 }
   2132 
   2133 func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */
   2134 	bp := tls.Alloc(4)
   2135 	defer tls.Free(4)
   2136 
   2137 	*(*struct{ Ff float32 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float32 }) {
   2138 		*(*float32)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
   2139 		return r
   2140 	}()
   2141 	var e int32 = int32(*(*uint32_t)(unsafe.Pointer(bp)) >> 23 & uint32_t(0xff))
   2142 	if !(e != 0) {
   2143 		if *(*uint32_t)(unsafe.Pointer(bp))<<1 != 0 {
   2144 			return 3
   2145 		}
   2146 		return 2
   2147 	}
   2148 	if e == 0xff {
   2149 		if *(*uint32_t)(unsafe.Pointer(bp))<<9 != 0 {
   2150 			return 0
   2151 		}
   2152 		return 1
   2153 	}
   2154 	return 4
   2155 }
   2156 
   2157 func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */
   2158 	return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24
   2159 }
   2160 
   2161 func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */
   2162 	return X__fpclassify(tls, x)
   2163 }
   2164 
   2165 func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */
   2166 	return Xcopysign(tls, x, y)
   2167 }
   2168 
   2169 func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */
   2170 	return Xfabs(tls, x)
   2171 }
   2172 
   2173 func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */
   2174 	return Xfmod(tls, x, y)
   2175 }
   2176 
   2177 func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */
   2178 	return X__builtin_nanf(tls, ts+13)
   2179 }
   2180 
   2181 var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */
   2182 
   2183 func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */
   2184 	bp := tls.Alloc(8)
   2185 	defer tls.Free(8)
   2186 
   2187 	*(*struct{ Ff float64 })(unsafe.Pointer(bp)) = func() (r struct{ Ff float64 }) {
   2188 		*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x
   2189 		return r
   2190 	}()
   2191 	var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff))
   2192 	var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63)
   2193 	var y double_t
   2194 
   2195 	if e >= 0x3ff+52 {
   2196 		return x
   2197 	}
   2198 	if s != 0 {
   2199 		y = x - toint + toint
   2200 	} else {
   2201 		y = x + toint - toint
   2202 	}
   2203 	if y == float64(0) {
   2204 		if s != 0 {
   2205 			return -Float64FromFloat64(0.0)
   2206 		}
   2207 		return float64(0)
   2208 	}
   2209 	return y
   2210 }
   2211 
   2212 func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */
   2213 	bp := tls.Alloc(8)
   2214 	defer tls.Free(8)
   2215 
   2216 	// var u struct {Ff float64;} at bp, 8
   2217 
   2218 	var y double_t = x
   2219 
   2220 	if n > 1023 {
   2221 		y = y * 0x1p1023
   2222 		n = n - 1023
   2223 		if n > 1023 {
   2224 			y = y * 0x1p1023
   2225 			n = n - 1023
   2226 			if n > 1023 {
   2227 				n = 1023
   2228 			}
   2229 		}
   2230 	} else if n < -1022 {
   2231 		// make sure final n < -53 to avoid double
   2232 		// 		   rounding in the subnormal range
   2233 		y = y * (float64(0x1p-1022) * 0x1p53)
   2234 		n = n + (1022 - 53)
   2235 		if n < -1022 {
   2236 			y = y * (float64(0x1p-1022) * 0x1p53)
   2237 			n = n + (1022 - 53)
   2238 			if n < -1022 {
   2239 				n = -1022
   2240 			}
   2241 		}
   2242 	}
   2243 	*(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52
   2244 	x = y * *(*float64)(unsafe.Pointer(bp))
   2245 	return x
   2246 }
   2247 
   2248 func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */
   2249 	return Xscalbn(tls, x, n)
   2250 }
   2251 
   2252 type max_align_t = struct {
   2253 	F__ll int64
   2254 	F__ld float64
   2255 } /* alltypes.h:49:54 */
   2256 
   2257 type imaxdiv_t = struct {
   2258 	Fquot intmax_t
   2259 	Frem  intmax_t
   2260 } /* inttypes.h:14:40 */
   2261 
   2262 type iovec = struct {
   2263 	Fiov_base uintptr
   2264 	Fiov_len  size_t
   2265 } /* alltypes.h:363:1 */
   2266 
   2267 type socklen_t = uint32 /* alltypes.h:369:18 */
   2268 
   2269 type sa_family_t = uint16 /* alltypes.h:374:24 */
   2270 
   2271 type msghdr = struct {
   2272 	Fmsg_name       uintptr
   2273 	Fmsg_namelen    socklen_t
   2274 	F__ccgo_pad1    [4]byte
   2275 	Fmsg_iov        uintptr
   2276 	Fmsg_iovlen     int32
   2277 	F__pad1         int32
   2278 	Fmsg_control    uintptr
   2279 	Fmsg_controllen socklen_t
   2280 	F__pad2         int32
   2281 	Fmsg_flags      int32
   2282 	F__ccgo_pad2    [4]byte
   2283 } /* socket.h:22:1 */
   2284 
   2285 type cmsghdr = struct {
   2286 	Fcmsg_len   socklen_t
   2287 	F__pad1     int32
   2288 	Fcmsg_level int32
   2289 	Fcmsg_type  int32
   2290 } /* socket.h:44:1 */
   2291 
   2292 type linger = struct {
   2293 	Fl_onoff  int32
   2294 	Fl_linger int32
   2295 } /* socket.h:74:1 */
   2296 
   2297 type sockaddr = struct {
   2298 	Fsa_family sa_family_t
   2299 	Fsa_data   [14]int8
   2300 } /* socket.h:367:1 */
   2301 
   2302 type sockaddr_storage = struct {
   2303 	Fss_family    sa_family_t
   2304 	F__ss_padding [118]int8
   2305 	F__ss_align   uint64
   2306 } /* socket.h:372:1 */
   2307 
   2308 type in_port_t = uint16_t                  /* in.h:12:18 */
   2309 type in_addr_t = uint32_t                  /* in.h:13:18 */
   2310 type in_addr = struct{ Fs_addr in_addr_t } /* in.h:14:1 */
   2311 
   2312 type sockaddr_in = struct {
   2313 	Fsin_family sa_family_t
   2314 	Fsin_port   in_port_t
   2315 	Fsin_addr   struct{ Fs_addr in_addr_t }
   2316 	Fsin_zero   [8]uint8_t
   2317 } /* in.h:16:1 */
   2318 
   2319 type in6_addr = struct {
   2320 	F__in6_union struct {
   2321 		F__ccgo_pad1 [0]uint32
   2322 		F__s6_addr   [16]uint8_t
   2323 	}
   2324 } /* in.h:23:1 */
   2325 
   2326 type sockaddr_in6 = struct {
   2327 	Fsin6_family   sa_family_t
   2328 	Fsin6_port     in_port_t
   2329 	Fsin6_flowinfo uint32_t
   2330 	Fsin6_addr     struct {
   2331 		F__in6_union struct {
   2332 			F__ccgo_pad1 [0]uint32
   2333 			F__s6_addr   [16]uint8_t
   2334 		}
   2335 	}
   2336 	Fsin6_scope_id uint32_t
   2337 } /* in.h:34:1 */
   2338 
   2339 type ipv6_mreq = struct {
   2340 	Fipv6mr_multiaddr struct {
   2341 		F__in6_union struct {
   2342 			F__ccgo_pad1 [0]uint32
   2343 			F__s6_addr   [16]uint8_t
   2344 		}
   2345 	}
   2346 	Fipv6mr_interface uint32
   2347 } /* in.h:42:1 */
   2348 
   2349 type ip_opts = struct {
   2350 	Fip_dst  struct{ Fs_addr in_addr_t }
   2351 	Fip_opts [40]int8
   2352 } /* in.h:229:1 */
   2353 
   2354 type ip_mreq = struct {
   2355 	Fimr_multiaddr struct{ Fs_addr in_addr_t }
   2356 	Fimr_interface struct{ Fs_addr in_addr_t }
   2357 } /* in.h:247:1 */
   2358 
   2359 type ip_mreqn = struct {
   2360 	Fimr_multiaddr struct{ Fs_addr in_addr_t }
   2361 	Fimr_address   struct{ Fs_addr in_addr_t }
   2362 	Fimr_ifindex   int32
   2363 } /* in.h:252:1 */
   2364 
   2365 type ip_mreq_source = struct {
   2366 	Fimr_multiaddr  struct{ Fs_addr in_addr_t }
   2367 	Fimr_interface  struct{ Fs_addr in_addr_t }
   2368 	Fimr_sourceaddr struct{ Fs_addr in_addr_t }
   2369 } /* in.h:258:1 */
   2370 
   2371 type ip_msfilter = struct {
   2372 	Fimsf_multiaddr struct{ Fs_addr in_addr_t }
   2373 	Fimsf_interface struct{ Fs_addr in_addr_t }
   2374 	Fimsf_fmode     uint32_t
   2375 	Fimsf_numsrc    uint32_t
   2376 	Fimsf_slist     [1]struct{ Fs_addr in_addr_t }
   2377 } /* in.h:264:1 */
   2378 
   2379 type group_req = struct {
   2380 	Fgr_interface uint32_t
   2381 	F__ccgo_pad1  [4]byte
   2382 	Fgr_group     struct {
   2383 		Fss_family    sa_family_t
   2384 		F__ss_padding [118]int8
   2385 		F__ss_align   uint64
   2386 	}
   2387 } /* in.h:275:1 */
   2388 
   2389 type group_source_req = struct {
   2390 	Fgsr_interface uint32_t
   2391 	F__ccgo_pad1   [4]byte
   2392 	Fgsr_group     struct {
   2393 		Fss_family    sa_family_t
   2394 		F__ss_padding [118]int8
   2395 		F__ss_align   uint64
   2396 	}
   2397 	Fgsr_source struct {
   2398 		Fss_family    sa_family_t
   2399 		F__ss_padding [118]int8
   2400 		F__ss_align   uint64
   2401 	}
   2402 } /* in.h:280:1 */
   2403 
   2404 type group_filter = struct {
   2405 	Fgf_interface uint32_t
   2406 	F__ccgo_pad1  [4]byte
   2407 	Fgf_group     struct {
   2408 		Fss_family    sa_family_t
   2409 		F__ss_padding [118]int8
   2410 		F__ss_align   uint64
   2411 	}
   2412 	Fgf_fmode  uint32_t
   2413 	Fgf_numsrc uint32_t
   2414 	Fgf_slist  [1]struct {
   2415 		Fss_family    sa_family_t
   2416 		F__ss_padding [118]int8
   2417 		F__ss_align   uint64
   2418 	}
   2419 } /* in.h:286:1 */
   2420 
   2421 type in_pktinfo = struct {
   2422 	Fipi_ifindex  int32
   2423 	Fipi_spec_dst struct{ Fs_addr in_addr_t }
   2424 	Fipi_addr     struct{ Fs_addr in_addr_t }
   2425 } /* in.h:297:1 */
   2426 
   2427 type in6_pktinfo = struct {
   2428 	Fipi6_addr struct {
   2429 		F__in6_union struct {
   2430 			F__ccgo_pad1 [0]uint32
   2431 			F__s6_addr   [16]uint8_t
   2432 		}
   2433 	}
   2434 	Fipi6_ifindex uint32
   2435 } /* in.h:303:1 */
   2436 
   2437 type ip6_mtuinfo = struct {
   2438 	Fip6m_addr struct {
   2439 		Fsin6_family   sa_family_t
   2440 		Fsin6_port     in_port_t
   2441 		Fsin6_flowinfo uint32_t
   2442 		Fsin6_addr     struct {
   2443 			F__in6_union struct {
   2444 				F__ccgo_pad1 [0]uint32
   2445 				F__s6_addr   [16]uint8_t
   2446 			}
   2447 		}
   2448 		Fsin6_scope_id uint32_t
   2449 	}
   2450 	Fip6m_mtu uint32_t
   2451 } /* in.h:308:1 */
   2452 
   2453 type addrinfo = struct {
   2454 	Fai_flags     int32
   2455 	Fai_family    int32
   2456 	Fai_socktype  int32
   2457 	Fai_protocol  int32
   2458 	Fai_addrlen   socklen_t
   2459 	F__ccgo_pad1  [4]byte
   2460 	Fai_addr      uintptr
   2461 	Fai_canonname uintptr
   2462 	Fai_next      uintptr
   2463 } /* netdb.h:16:1 */
   2464 
   2465 // Legacy functions follow (marked OBsolete in SUS)
   2466 
   2467 type netent = struct {
   2468 	Fn_name     uintptr
   2469 	Fn_aliases  uintptr
   2470 	Fn_addrtype int32
   2471 	Fn_net      uint32_t
   2472 } /* netdb.h:62:1 */
   2473 
   2474 type hostent = struct {
   2475 	Fh_name      uintptr
   2476 	Fh_aliases   uintptr
   2477 	Fh_addrtype  int32
   2478 	Fh_length    int32
   2479 	Fh_addr_list uintptr
   2480 } /* netdb.h:69:1 */
   2481 
   2482 type servent = struct {
   2483 	Fs_name      uintptr
   2484 	Fs_aliases   uintptr
   2485 	Fs_port      int32
   2486 	F__ccgo_pad1 [4]byte
   2487 	Fs_proto     uintptr
   2488 } /* netdb.h:78:1 */
   2489 
   2490 type protoent = struct {
   2491 	Fp_name      uintptr
   2492 	Fp_aliases   uintptr
   2493 	Fp_proto     int32
   2494 	F__ccgo_pad1 [4]byte
   2495 } /* netdb.h:85:1 */
   2496 
   2497 type aibuf = struct {
   2498 	Fai struct {
   2499 		Fai_flags     int32
   2500 		Fai_family    int32
   2501 		Fai_socktype  int32
   2502 		Fai_protocol  int32
   2503 		Fai_addrlen   socklen_t
   2504 		F__ccgo_pad1  [4]byte
   2505 		Fai_addr      uintptr
   2506 		Fai_canonname uintptr
   2507 		Fai_next      uintptr
   2508 	}
   2509 	Fsa struct {
   2510 		Fsin struct {
   2511 			Fsin_family sa_family_t
   2512 			Fsin_port   in_port_t
   2513 			Fsin_addr   struct{ Fs_addr in_addr_t }
   2514 			Fsin_zero   [8]uint8_t
   2515 		}
   2516 		F__ccgo_pad1 [12]byte
   2517 	}
   2518 	Flock        [1]int32
   2519 	Fslot        int16
   2520 	Fref         int16
   2521 	F__ccgo_pad1 [4]byte
   2522 } /* lookup.h:10:1 */
   2523 
   2524 type sa = struct {
   2525 	Fsin struct {
   2526 		Fsin_family sa_family_t
   2527 		Fsin_port   in_port_t
   2528 		Fsin_addr   struct{ Fs_addr in_addr_t }
   2529 		Fsin_zero   [8]uint8_t
   2530 	}
   2531 	F__ccgo_pad1 [12]byte
   2532 } /* lookup.h:10:1 */
   2533 
   2534 type address = struct {
   2535 	Ffamily  int32
   2536 	Fscopeid uint32
   2537 	Faddr    [16]uint8_t
   2538 	Fsortkey int32
   2539 } /* lookup.h:20:1 */
   2540 
   2541 type service = struct {
   2542 	Fport     uint16_t
   2543 	Fproto    uint8
   2544 	Fsocktype uint8
   2545 } /* lookup.h:27:1 */
   2546 
   2547 type resolvconf = struct {
   2548 	Fns [3]struct {
   2549 		Ffamily  int32
   2550 		Fscopeid uint32
   2551 		Faddr    [16]uint8_t
   2552 		Fsortkey int32
   2553 	}
   2554 	Fnns      uint32
   2555 	Fattempts uint32
   2556 	Fndots    uint32
   2557 	Ftimeout  uint32
   2558 } /* lookup.h:34:1 */
   2559 
   2560 func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */
   2561 	var cnt size_t
   2562 	cnt = uint64(1)
   2563 __1:
   2564 	if !((*addrinfo)(unsafe.Pointer(p)).Fai_next != 0) {
   2565 		goto __3
   2566 	}
   2567 	goto __2
   2568 __2:
   2569 	cnt++
   2570 	p = (*addrinfo)(unsafe.Pointer(p)).Fai_next
   2571 	goto __1
   2572 	goto __3
   2573 __3:
   2574 	;
   2575 	var b uintptr = p - uintptr(uint64(uintptr(0)))
   2576 	b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).Fslot)
   2577 	//TODO LOCK(b->lock);
   2578 	if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) {
   2579 		Xfree(tls, b)
   2580 	}
   2581 	//TODO else UNLOCK(b->lock);
   2582 }
   2583 
   2584 type time_t = int64 /* alltypes.h:93:16 */
   2585 
   2586 type clockid_t = int32 /* alltypes.h:222:13 */
   2587 
   2588 type timespec = struct {
   2589 	Ftv_sec  time_t
   2590 	Ftv_nsec int64
   2591 } /* alltypes.h:237:1 */
   2592 
   2593 type pthread_t = uintptr /* alltypes.h:281:26 */
   2594 
   2595 type pthread_once_t = int32 /* alltypes.h:287:13 */
   2596 
   2597 type pthread_key_t = uint32 /* alltypes.h:292:18 */
   2598 
   2599 type pthread_spinlock_t = int32 /* alltypes.h:297:13 */
   2600 
   2601 type pthread_mutexattr_t = struct{ F__attr uint32 } /* alltypes.h:302:37 */
   2602 
   2603 type pthread_condattr_t = struct{ F__attr uint32 } /* alltypes.h:307:37 */
   2604 
   2605 type pthread_barrierattr_t = struct{ F__attr uint32 } /* alltypes.h:312:37 */
   2606 
   2607 type pthread_rwlockattr_t = struct{ F__attr [2]uint32 } /* alltypes.h:317:40 */
   2608 
   2609 type __sigset_t = struct{ F__bits [16]uint64 } /* alltypes.h:357:9 */
   2610 
   2611 type sigset_t = __sigset_t /* alltypes.h:357:71 */
   2612 
   2613 type pthread_attr_t = struct {
   2614 	F__u struct {
   2615 		F__ccgo_pad1 [0]uint64
   2616 		F__i         [14]int32
   2617 	}
   2618 } /* alltypes.h:380:147 */
   2619 
   2620 type pthread_mutex_t = struct {
   2621 	F__u struct {
   2622 		F__ccgo_pad1 [0]uint64
   2623 		F__i         [10]int32
   2624 	}
   2625 } /* alltypes.h:385:157 */
   2626 
   2627 type pthread_cond_t = struct {
   2628 	F__u struct {
   2629 		F__ccgo_pad1 [0]uint64
   2630 		F__i         [12]int32
   2631 	}
   2632 } /* alltypes.h:395:112 */
   2633 
   2634 type pthread_rwlock_t = struct {
   2635 	F__u struct {
   2636 		F__ccgo_pad1 [0]uint64
   2637 		F__i         [14]int32
   2638 	}
   2639 } /* alltypes.h:405:139 */
   2640 
   2641 type pthread_barrier_t = struct {
   2642 	F__u struct {
   2643 		F__ccgo_pad1 [0]uint64
   2644 		F__i         [8]int32
   2645 	}
   2646 } /* alltypes.h:410:137 */
   2647 
   2648 type sched_param = struct {
   2649 	Fsched_priority int32
   2650 	F__reserved1    int32
   2651 	F__reserved2    [2]struct {
   2652 		F__reserved1 time_t
   2653 		F__reserved2 int64
   2654 	}
   2655 	F__reserved3 int32
   2656 	F__ccgo_pad1 [4]byte
   2657 } /* sched.h:19:1 */
   2658 
   2659 type timer_t = uintptr /* alltypes.h:217:14 */
   2660 
   2661 type clock_t = int64 /* alltypes.h:227:14 */
   2662 
   2663 type tm = struct {
   2664 	Ftm_sec      int32
   2665 	Ftm_min      int32
   2666 	Ftm_hour     int32
   2667 	Ftm_mday     int32
   2668 	Ftm_mon      int32
   2669 	Ftm_year     int32
   2670 	Ftm_wday     int32
   2671 	Ftm_yday     int32
   2672 	Ftm_isdst    int32
   2673 	F__ccgo_pad1 [4]byte
   2674 	Ftm_gmtoff   int64
   2675 	Ftm_zone     uintptr
   2676 } /* time.h:38:1 */
   2677 
   2678 type itimerspec = struct {
   2679 	Fit_interval struct {
   2680 		Ftv_sec  time_t
   2681 		Ftv_nsec int64
   2682 	}
   2683 	Fit_value struct {
   2684 		Ftv_sec  time_t
   2685 		Ftv_nsec int64
   2686 	}
   2687 } /* time.h:80:1 */
   2688 
   2689 type __ptcb = struct {
   2690 	F__f    uintptr
   2691 	F__x    uintptr
   2692 	F__next uintptr
   2693 } /* pthread.h:206:1 */
   2694 
   2695 func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */
   2696 	bp := tls.Alloc(1608)
   2697 	defer tls.Free(1608)
   2698 
   2699 	// var ports [2]service at bp, 8
   2700 
   2701 	// var addrs [48]address at bp+8, 1344
   2702 
   2703 	// var canon [256]int8 at bp+1352, 256
   2704 
   2705 	var outcanon uintptr
   2706 	var nservs int32
   2707 	var naddrs int32
   2708 	var nais int32
   2709 	var canon_len int32
   2710 	var i int32
   2711 	var j int32
   2712 	var k int32
   2713 	var family int32 = 0
   2714 	var flags int32 = 0
   2715 	var proto int32 = 0
   2716 	var socktype int32 = 0
   2717 	var out uintptr
   2718 
   2719 	if !(host != 0) && !(serv != 0) {
   2720 		return -2
   2721 	}
   2722 
   2723 	if hint != 0 {
   2724 		family = (*addrinfo)(unsafe.Pointer(hint)).Fai_family
   2725 		flags = (*addrinfo)(unsafe.Pointer(hint)).Fai_flags
   2726 		proto = (*addrinfo)(unsafe.Pointer(hint)).Fai_protocol
   2727 		socktype = (*addrinfo)(unsafe.Pointer(hint)).Fai_socktype
   2728 
   2729 		var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400
   2730 		if flags&mask != flags {
   2731 			return -1
   2732 		}
   2733 
   2734 		switch family {
   2735 		case 2:
   2736 			fallthrough
   2737 		case 10:
   2738 			fallthrough
   2739 		case 0:
   2740 			break
   2741 			fallthrough
   2742 		default:
   2743 			return -6
   2744 		}
   2745 	}
   2746 
   2747 	if flags&0x20 != 0 {
   2748 		Xabort(tls) //TODO-
   2749 		// 	/* Define the "an address is configured" condition for address
   2750 		// 	 * families via ability to create a socket for the family plus
   2751 		// 	 * routability of the loopback address for the family. */
   2752 		// 	static const struct sockaddr_in lo4 = {
   2753 		// 		.sin_family = AF_INET, .sin_port = 65535,
   2754 		// 		.sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN
   2755 		// 			? 0x7f000001 : 0x0100007f
   2756 		// 	};
   2757 		// 	static const struct sockaddr_in6 lo6 = {
   2758 		// 		.sin6_family = AF_INET6, .sin6_port = 65535,
   2759 		// 		.sin6_addr = IN6ADDR_LOOPBACK_INIT
   2760 		// 	};
   2761 		// 	int tf[2] = { AF_INET, AF_INET6 };
   2762 		// 	const void *ta[2] = { &lo4, &lo6 };
   2763 		// 	socklen_t tl[2] = { sizeof lo4, sizeof lo6 };
   2764 		// 	for (i=0; i<2; i++) {
   2765 		// 		if (family==tf[1-i]) continue;
   2766 		// 		int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM,
   2767 		// 			IPPROTO_UDP);
   2768 		// 		if (s>=0) {
   2769 		// 			int cs;
   2770 		// 			pthread_setcancelstate(
   2771 		// 				PTHREAD_CANCEL_DISABLE, &cs);
   2772 		// 			int r = connect(s, ta[i], tl[i]);
   2773 		// 			pthread_setcancelstate(cs, 0);
   2774 		// 			close(s);
   2775 		// 			if (!r) continue;
   2776 		// 		}
   2777 		// 		switch (errno) {
   2778 		// 		case EADDRNOTAVAIL:
   2779 		// 		case EAFNOSUPPORT:
   2780 		// 		case EHOSTUNREACH:
   2781 		// 		case ENETDOWN:
   2782 		// 		case ENETUNREACH:
   2783 		// 			break;
   2784 		// 		default:
   2785 		// 			return EAI_SYSTEM;
   2786 		// 		}
   2787 		// 		if (family == tf[i]) return EAI_NONAME;
   2788 		// 		family = tf[1-i];
   2789 		// 	}
   2790 	}
   2791 
   2792 	nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags)
   2793 	if nservs < 0 {
   2794 		return nservs
   2795 	}
   2796 
   2797 	naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags)
   2798 	if naddrs < 0 {
   2799 		return naddrs
   2800 	}
   2801 
   2802 	nais = nservs * naddrs
   2803 	canon_len = int32(Xstrlen(tls, bp+1352))
   2804 	out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1))
   2805 	if !(out != 0) {
   2806 		return -10
   2807 	}
   2808 
   2809 	if canon_len != 0 {
   2810 		outcanon = out + uintptr(nais)*88
   2811 		Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1))
   2812 	} else {
   2813 		outcanon = uintptr(0)
   2814 	}
   2815 
   2816 	for k = AssignInt32(&i, 0); i < naddrs; i++ {
   2817 		j = 0
   2818 	__1:
   2819 		if !(j < nservs) {
   2820 			goto __3
   2821 		}
   2822 		{
   2823 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fslot = int16(k)
   2824 			//TODO out[k].ai = (struct addrinfo){
   2825 			//TODO 	.ai_family = addrs[i].family,
   2826 			//TODO 	.ai_socktype = ports[j].socktype,
   2827 			//TODO 	.ai_protocol = ports[j].proto,
   2828 			//TODO 	.ai_addrlen = addrs[i].family == AF_INET
   2829 			//TODO 		? sizeof(struct sockaddr_in)
   2830 			//TODO 		: sizeof(struct sockaddr_in6),
   2831 			//TODO 	.ai_addr = (void *)&out[k].sa,
   2832 			//TODO 	.ai_canonname = outcanon };
   2833 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily
   2834 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fsocktype)
   2835 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).Fproto)
   2836 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_addrlen = func() uint32 {
   2837 				if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).Ffamily == 2 {
   2838 					return uint32(unsafe.Sizeof(sockaddr_in{}))
   2839 				}
   2840 				return uint32(unsafe.Sizeof(sockaddr_in6{}))
   2841 			}()
   2842 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_addr = out + uintptr(k)*88 + 48
   2843 			(*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).Fai.Fai_canonname = outcanon
   2844 			if k != 0 {
   2845 				(*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).Fai.Fai_next = out + uintptr(k)*88
   2846 			}
   2847 			switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Ffamily {
   2848 			case 2:
   2849 				(*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin_family = sa_family_t(2)
   2850 				(*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
   2851 				Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4))
   2852 				break
   2853 			case 10:
   2854 				(*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin6_family = sa_family_t(10)
   2855 				(*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).Fport)
   2856 				(*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).Fsin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).Fscopeid
   2857 				Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16))
   2858 				break
   2859 			}
   2860 
   2861 		}
   2862 		goto __2
   2863 	__2:
   2864 		j++
   2865 		k++
   2866 		goto __1
   2867 		goto __3
   2868 	__3:
   2869 	}
   2870 	(*aibuf)(unsafe.Pointer(out)).Fref = int16(nais)
   2871 	*(*uintptr)(unsafe.Pointer(res)) = out
   2872 	return 0
   2873 }
   2874 
   2875 type ucred = struct {
   2876 	Fpid pid_t
   2877 	Fuid uid_t
   2878 	Fgid gid_t
   2879 } /* socket.h:57:1 */
   2880 
   2881 type mmsghdr = struct {
   2882 	Fmsg_hdr struct {
   2883 		Fmsg_name       uintptr
   2884 		Fmsg_namelen    socklen_t
   2885 		F__ccgo_pad1    [4]byte
   2886 		Fmsg_iov        uintptr
   2887 		Fmsg_iovlen     int32
   2888 		F__pad1         int32
   2889 		Fmsg_control    uintptr
   2890 		Fmsg_controllen socklen_t
   2891 		F__pad2         int32
   2892 		Fmsg_flags      int32
   2893 		F__ccgo_pad2    [4]byte
   2894 	}
   2895 	Fmsg_len     uint32
   2896 	F__ccgo_pad1 [4]byte
   2897 } /* socket.h:63:1 */
   2898 
   2899 func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */
   2900 	bp := tls.Alloc(8)
   2901 	defer tls.Free(8)
   2902 
   2903 	var size size_t = uint64(63)
   2904 	// var res uintptr at bp, 8
   2905 
   2906 	var err int32
   2907 	for __ccgo := true; __ccgo; __ccgo = err == 34 {
   2908 		Xfree(tls, _sh)
   2909 		_sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1)))
   2910 		if !(_sh != 0) {
   2911 			*(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
   2912 			return uintptr(0)
   2913 		}
   2914 		err = Xgethostbyaddr_r(tls, a, l, af, _sh,
   2915 			_sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
   2916 	}
   2917 	if err != 0 {
   2918 		return uintptr(0)
   2919 	}
   2920 	return _sh
   2921 }
   2922 
   2923 var _sh uintptr /* gethostbyaddr.c:9:24: */
   2924 
   2925 func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */
   2926 	bp := tls.Alloc(28)
   2927 	defer tls.Free(28)
   2928 
   2929 	//TODO union {
   2930 	//TODO 	struct sockaddr_in sin;
   2931 	//TODO 	struct sockaddr_in6 sin6;
   2932 	//TODO } sa = { .sin.sin_family = af };
   2933 	*(*struct {
   2934 		Fsin         sockaddr_in
   2935 		F__ccgo_pad1 [12]byte
   2936 	})(unsafe.Pointer(bp)) = struct {
   2937 		Fsin         sockaddr_in
   2938 		F__ccgo_pad1 [12]byte
   2939 	}{} //TODO-
   2940 	(*sockaddr_in)(unsafe.Pointer(bp)).Fsin_family = sa_family_t(af) //TODO-
   2941 	var sl socklen_t
   2942 	if af == 10 {
   2943 		sl = uint32(unsafe.Sizeof(sockaddr_in6{}))
   2944 	} else {
   2945 		sl = uint32(unsafe.Sizeof(sockaddr_in{}))
   2946 	}
   2947 	var i int32
   2948 
   2949 	*(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
   2950 
   2951 	// Load address argument into sockaddr structure
   2952 	if af == 10 && l == socklen_t(16) {
   2953 		Xmemcpy(tls, bp+8, a, uint64(16))
   2954 	} else if af == 2 && l == socklen_t(4) {
   2955 		Xmemcpy(tls, bp+4, a, uint64(4))
   2956 	} else {
   2957 		*(*int32)(unsafe.Pointer(err)) = 3
   2958 		return 22
   2959 	}
   2960 
   2961 	// Align buffer and check for space for pointers and ip address
   2962 	i = int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)))
   2963 	if !(i != 0) {
   2964 		i = int32(unsafe.Sizeof(uintptr(0)))
   2965 	}
   2966 	if buflen <= uint64(5)*uint64(unsafe.Sizeof(uintptr(0)))-uint64(i)+uint64(l) {
   2967 		return 34
   2968 	}
   2969 	buf += uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i))
   2970 	buflen = buflen - (uint64(5)*uint64(unsafe.Sizeof(uintptr(0))) - uint64(i) + uint64(l))
   2971 
   2972 	(*hostent)(unsafe.Pointer(h)).Fh_addr_list = buf
   2973 	buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))
   2974 	(*hostent)(unsafe.Pointer(h)).Fh_aliases = buf
   2975 	buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0))))
   2976 
   2977 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list)) = buf
   2978 	Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list)), a, uint64(l))
   2979 	buf += uintptr(l)
   2980 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + 1*8)) = uintptr(0)
   2981 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases)) = buf
   2982 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)) = uintptr(0)
   2983 
   2984 	switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) {
   2985 	case -3:
   2986 		*(*int32)(unsafe.Pointer(err)) = 2
   2987 		return 11
   2988 	case -12:
   2989 		return 34
   2990 	default:
   2991 		fallthrough
   2992 	case -10:
   2993 		fallthrough
   2994 	case -11:
   2995 		fallthrough
   2996 	case -4:
   2997 		*(*int32)(unsafe.Pointer(err)) = 3
   2998 		return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
   2999 	case 0:
   3000 		break
   3001 	}
   3002 
   3003 	(*hostent)(unsafe.Pointer(h)).Fh_addrtype = af
   3004 	(*hostent)(unsafe.Pointer(h)).Fh_length = int32(l)
   3005 	(*hostent)(unsafe.Pointer(h)).Fh_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases))
   3006 	*(*uintptr)(unsafe.Pointer(res)) = h
   3007 	return 0
   3008 }
   3009 
   3010 func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */
   3011 	return Xgethostbyname2(tls, name, 2)
   3012 }
   3013 
   3014 func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */
   3015 	bp := tls.Alloc(8)
   3016 	defer tls.Free(8)
   3017 
   3018 	var size size_t = uint64(63)
   3019 	// var res uintptr at bp, 8
   3020 
   3021 	var err int32
   3022 	for __ccgo := true; __ccgo; __ccgo = err == 34 {
   3023 		Xfree(tls, _sh1)
   3024 		_sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1)))
   3025 		if !(_sh1 != 0) {
   3026 			*(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3
   3027 			return uintptr(0)
   3028 		}
   3029 		err = Xgethostbyname2_r(tls, name, af, _sh1,
   3030 			_sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls))
   3031 	}
   3032 	if err != 0 {
   3033 		return uintptr(0)
   3034 	}
   3035 	return _sh1
   3036 }
   3037 
   3038 var _sh1 uintptr /* gethostbyname2.c:10:24: */
   3039 
   3040 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: */
   3041 	bp := tls.Alloc(1600)
   3042 	defer tls.Free(1600)
   3043 
   3044 	// var addrs [48]address at bp, 1344
   3045 
   3046 	// var canon [256]int8 at bp+1344, 256
   3047 
   3048 	var i int32
   3049 	var cnt int32
   3050 	var align size_t
   3051 	var need size_t
   3052 
   3053 	*(*uintptr)(unsafe.Pointer(res)) = uintptr(0)
   3054 	cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02)
   3055 	if cnt < 0 {
   3056 		switch cnt {
   3057 		case -2:
   3058 			*(*int32)(unsafe.Pointer(err)) = 1
   3059 			return 2
   3060 			fallthrough
   3061 		case -3:
   3062 			*(*int32)(unsafe.Pointer(err)) = 2
   3063 			return 11
   3064 			fallthrough
   3065 		default:
   3066 			fallthrough
   3067 		case -4:
   3068 			*(*int32)(unsafe.Pointer(err)) = 3
   3069 			return 74
   3070 			fallthrough
   3071 		case -10:
   3072 			fallthrough
   3073 		case -11:
   3074 			*(*int32)(unsafe.Pointer(err)) = 3
   3075 			return *(*int32)(unsafe.Pointer(X___errno_location(tls)))
   3076 		}
   3077 	}
   3078 
   3079 	(*hostent)(unsafe.Pointer(h)).Fh_addrtype = af
   3080 	(*hostent)(unsafe.Pointer(h)).Fh_length = func() int32 {
   3081 		if af == 10 {
   3082 			return 16
   3083 		}
   3084 		return 4
   3085 	}()
   3086 
   3087 	// Align buffer
   3088 	align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))
   3089 
   3090 	need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0)))
   3091 	need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).Fh_length))
   3092 	need = need + (Xstrlen(tls, name) + uint64(1))
   3093 	need = need + (Xstrlen(tls, bp+1344) + uint64(1))
   3094 	need = need + align
   3095 
   3096 	if need > buflen {
   3097 		return 34
   3098 	}
   3099 
   3100 	buf += uintptr(align)
   3101 	(*hostent)(unsafe.Pointer(h)).Fh_aliases = buf
   3102 	buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0))))
   3103 	(*hostent)(unsafe.Pointer(h)).Fh_addr_list = buf
   3104 	buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0))))
   3105 
   3106 	for i = 0; i < cnt; i++ {
   3107 		*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)) = buf
   3108 		buf += uintptr((*hostent)(unsafe.Pointer(h)).Fh_length)
   3109 		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))
   3110 	}
   3111 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_addr_list + uintptr(i)*8)) = uintptr(0)
   3112 
   3113 	(*hostent)(unsafe.Pointer(h)).Fh_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).Fh_aliases, buf)
   3114 	Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, bp+1344)
   3115 	buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).Fh_name) + uint64(1))
   3116 
   3117 	if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).Fh_name, name) != 0 {
   3118 		*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)) = buf
   3119 		Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)), name)
   3120 		buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8))) + uint64(1))
   3121 	} else {
   3122 		*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 1*8)) = uintptr(0)
   3123 	}
   3124 
   3125 	*(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).Fh_aliases + 2*8)) = uintptr(0)
   3126 
   3127 	*(*uintptr)(unsafe.Pointer(res)) = h
   3128 	return 0
   3129 }
   3130 
   3131 type if_nameindex = struct {
   3132 	Fif_index    uint32
   3133 	F__ccgo_pad1 [4]byte
   3134 	Fif_name     uintptr
   3135 } /* if.h:12:1 */
   3136 
   3137 type ifaddr = struct {
   3138 	Fifa_addr struct {
   3139 		Fsa_family sa_family_t
   3140 		Fsa_data   [14]int8
   3141 	}
   3142 	Fifa_ifu struct {
   3143 		Fifu_broadaddr struct {
   3144 			Fsa_family sa_family_t
   3145 			Fsa_data   [14]int8
   3146 		}
   3147 	}
   3148 	Fifa_ifp  uintptr
   3149 	Fifa_next uintptr
   3150 } /* if.h:51:1 */
   3151 
   3152 type ifmap = struct {
   3153 	Fmem_start   uint64
   3154 	Fmem_end     uint64
   3155 	Fbase_addr   uint16
   3156 	Firq         uint8
   3157 	Fdma         uint8
   3158 	Fport        uint8
   3159 	F__ccgo_pad1 [3]byte
   3160 } /* if.h:64:1 */
   3161 
   3162 type ifreq = struct {
   3163 	Fifr_ifrn struct{ Fifrn_name [16]int8 }
   3164 	Fifr_ifru struct {
   3165 		F__ccgo_pad1 [0]uint64
   3166 		Fifru_addr   struct {
   3167 			Fsa_family sa_family_t
   3168 			Fsa_data   [14]int8
   3169 		}
   3170 		F__ccgo_pad2 [8]byte
   3171 	}
   3172 } /* if.h:76:1 */
   3173 
   3174 type ifconf = struct {
   3175 	Fifc_len     int32
   3176 	F__ccgo_pad1 [4]byte
   3177 	Fifc_ifcu    struct{ Fifcu_buf uintptr }
   3178 } /* if.h:116:1 */
   3179 
   3180 type ns_sect = uint32 /* nameser.h:37:3 */
   3181 
   3182 type __ns_msg = struct {
   3183 	F_msg        uintptr
   3184 	F_eom        uintptr
   3185 	F_id         uint16_t
   3186 	F_flags      uint16_t
   3187 	F_counts     [4]uint16_t
   3188 	F__ccgo_pad1 [4]byte
   3189 	F_sections   [4]uintptr
   3190 	F_sect       ns_sect
   3191 	F_rrnum      int32
   3192 	F_msg_ptr    uintptr
   3193 } /* nameser.h:39:9 */
   3194 
   3195 type ns_msg = __ns_msg /* nameser.h:46:3 */
   3196 
   3197 type _ns_flagdata = struct {
   3198 	Fmask  int32
   3199 	Fshift int32
   3200 } /* nameser.h:48:1 */
   3201 
   3202 type __ns_rr = struct {
   3203 	Fname        [1025]int8
   3204 	F__ccgo_pad1 [1]byte
   3205 	Ftype        uint16_t
   3206 	Frr_class    uint16_t
   3207 	F__ccgo_pad2 [2]byte
   3208 	Fttl         uint32_t
   3209 	Frdlength    uint16_t
   3210 	F__ccgo_pad3 [2]byte
   3211 	Frdata       uintptr
   3212 } /* nameser.h:59:9 */
   3213 
   3214 type ns_rr = __ns_rr /* nameser.h:66:3 */
   3215 
   3216 type ns_flag = uint32 /* nameser.h:87:3 */
   3217 
   3218 type ns_opcode = uint32 /* nameser.h:96:3 */
   3219 
   3220 type ns_rcode = uint32 /* nameser.h:115:3 */
   3221 
   3222 type ns_update_operation = uint32 /* nameser.h:121:3 */
   3223 
   3224 type ns_tsig_key1 = struct {
   3225 	Fname        [1025]int8
   3226 	Falg         [1025]int8
   3227 	F__ccgo_pad1 [6]byte
   3228 	Fdata        uintptr
   3229 	Flen         int32
   3230 	F__ccgo_pad2 [4]byte
   3231 } /* nameser.h:123:1 */
   3232 
   3233 type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */
   3234 
   3235 type ns_tcp_tsig_state1 = struct {
   3236 	Fcounter     int32
   3237 	F__ccgo_pad1 [4]byte
   3238 	Fkey         uintptr
   3239 	Fctx         uintptr
   3240 	Fsig         [512]uint8
   3241 	Fsiglen      int32
   3242 	F__ccgo_pad2 [4]byte
   3243 } /* nameser.h:130:1 */
   3244 
   3245 type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */
   3246 
   3247 type ns_type = uint32 /* nameser.h:200:3 */
   3248 
   3249 type ns_class = uint32 /* nameser.h:219:3 */
   3250 
   3251 type ns_key_types = uint32 /* nameser.h:226:3 */
   3252 
   3253 type ns_cert_types = uint32 /* nameser.h:234:3 */
   3254 
   3255 type HEADER = struct {
   3256 	F__ccgo_pad1 [0]uint32
   3257 	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 */
   3258 	Fqdcount     uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */
   3259 	Fnscount     uint32 /* unsigned nscount: 16, unsigned arcount: 16 */
   3260 } /* nameser.h:353:3 */
   3261 
   3262 // unused; purely for broken apps
   3263 type __res_state = struct {
   3264 	Fretrans     int32
   3265 	Fretry       int32
   3266 	Foptions     uint64
   3267 	Fnscount     int32
   3268 	Fnsaddr_list [3]struct {
   3269 		Fsin_family sa_family_t
   3270 		Fsin_port   in_port_t
   3271 		Fsin_addr   struct{ Fs_addr in_addr_t }
   3272 		Fsin_zero   [8]uint8_t
   3273 	}
   3274 	Fid          uint16
   3275 	F__ccgo_pad1 [2]byte
   3276 	Fdnsrch      [7]uintptr
   3277 	Fdefdname    [256]int8
   3278 	Fpfcode      uint64
   3279 	Fndots       uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */
   3280 	F__ccgo_pad2 [4]byte
   3281 	Fsort_list   [10]struct {
   3282 		Faddr struct{ Fs_addr in_addr_t }
   3283 		Fmask uint32_t
   3284 	}
   3285 	Fqhook       uintptr
   3286 	Frhook       uintptr
   3287 	Fres_h_errno int32
   3288 	F_vcsock     int32
   3289 	F_flags      uint32
   3290 	F__ccgo_pad3 [4]byte
   3291 	F_u          struct {
   3292 		F__ccgo_pad1 [0]uint64
   3293 		Fpad         [52]int8
   3294 		F__ccgo_pad2 [4]byte
   3295 	}
   3296 } /* resolv.h:26:9 */
   3297 
   3298 // unused; purely for broken apps
   3299 type res_state = uintptr /* resolv.h:62:3 */
   3300 
   3301 type res_sym = struct {
   3302 	Fnumber      int32
   3303 	F__ccgo_pad1 [4]byte
   3304 	Fname        uintptr
   3305 	Fhumanname   uintptr
   3306 } /* resolv.h:70:1 */
   3307 
   3308 func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */
   3309 	p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0))))
   3310 	*(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0)
   3311 	for __ccgo := true; __ccgo; __ccgo = x != 0 {
   3312 		*(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(uint32('0') + x%uint32(10))
   3313 		x = x / uint32(10)
   3314 	}
   3315 	return p
   3316 }
   3317 
   3318 func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */
   3319 	bp := tls.Alloc(32)
   3320 	defer tls.Free(32)
   3321 
   3322 	Xsprintf(tls, s, ts+25,
   3323 		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)))))
   3324 }
   3325 
   3326 func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */
   3327 	var i int32
   3328 	for i = 15; i >= 0; i-- {
   3329 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15]
   3330 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.')
   3331 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4]
   3332 		*(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.')
   3333 	}
   3334 	Xstrcpy(tls, s, ts+50)
   3335 }
   3336 
   3337 var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */
   3338 
   3339 func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */
   3340 	bp := tls.Alloc(556)
   3341 	defer tls.Free(556)
   3342 
   3343 	// var line [512]int8 at bp+16, 512
   3344 
   3345 	var p uintptr
   3346 	var z uintptr
   3347 	var _buf [1032]uint8
   3348 	_ = _buf
   3349 	// var atmp [16]uint8 at bp, 16
   3350 
   3351 	// var iplit address at bp+528, 28
   3352 
   3353 	//TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
   3354 	var f uintptr = Xfopen(tls, ts+76, ts+87)
   3355 	if !(f != 0) {
   3356 		return
   3357 	}
   3358 	if family == 2 {
   3359 		Xmemcpy(tls, bp+uintptr(12), a, uint64(4))
   3360 		Xmemcpy(tls, bp, ts+90, uint64(12))
   3361 		a = bp /* &atmp[0] */
   3362 	}
   3363 	for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]int8{})), f) != 0 {
   3364 		if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 {
   3365 			*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n')
   3366 			*(*int8)(unsafe.Pointer(p)) = int8(0)
   3367 		}
   3368 
   3369 		for p = bp + 16; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ {
   3370 		}
   3371 		*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0)
   3372 		if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 {
   3373 			continue
   3374 		}
   3375 
   3376 		if (*address)(unsafe.Pointer(bp+528)).Ffamily == 2 {
   3377 			Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4))
   3378 			Xmemcpy(tls, bp+528+8, ts+90, uint64(12))
   3379 			(*address)(unsafe.Pointer(bp + 528 /* &iplit */)).Fscopeid = uint32(0)
   3380 		}
   3381 
   3382 		if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).Fscopeid != scopeid {
   3383 			continue
   3384 		}
   3385 
   3386 		for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ {
   3387 		}
   3388 		for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ {
   3389 		}
   3390 		*(*int8)(unsafe.Pointer(z)) = int8(0)
   3391 		if (int64(z)-int64(p))/1 < int64(256) {
   3392 			Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1)))
   3393 			break
   3394 		}
   3395 	}
   3396 	//TODO __fclose_ca(f);
   3397 	Xfclose(tls, f)
   3398 }
   3399 
   3400 func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */
   3401 	Xabort(tls) //TODO-
   3402 	// unsigned long svport;
   3403 	// char line[128], *p, *z;
   3404 	// unsigned char _buf[1032];
   3405 	// FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
   3406 	// if (!f) return;
   3407 	// while (fgets(line, sizeof line, f)) {
   3408 	// 	if ((p=strchr(line, '#'))) *p++='\n', *p=0;
   3409 
   3410 	// 	for (p=line; *p && !isspace(*p); p++);
   3411 	// 	if (!*p) continue;
   3412 	// 	*p++ = 0;
   3413 	// 	svport = strtoul(p, &z, 10);
   3414 
   3415 	// 	if (svport != port || z==p) continue;
   3416 	// 	if (dgram && strncmp(z, "/udp", 4)) continue;
   3417 	// 	if (!dgram && strncmp(z, "/tcp", 4)) continue;
   3418 	// 	if (p-line > 32) continue;
   3419 
   3420 	// 	memcpy(buf, line, p-line);
   3421 	// 	break;
   3422 	// }
   3423 	// __fclose_ca(f);
   3424 }
   3425 
   3426 func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */
   3427 	bp := tls.Alloc(347)
   3428 	defer tls.Free(347)
   3429 
   3430 	// var ptr [78]int8 at bp, 78
   3431 
   3432 	// var buf [256]int8 at bp+78, 256
   3433 
   3434 	// var num [13]int8 at bp+334, 13
   3435 
   3436 	var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).Fsa_family)
   3437 	var a uintptr
   3438 	var scopeid uint32
   3439 
   3440 	switch af {
   3441 	case 2:
   3442 		a = sa1 + 4
   3443 		if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{})) {
   3444 			return -6
   3445 		}
   3446 		mkptr4(tls, bp, a)
   3447 		scopeid = uint32(0)
   3448 		break
   3449 	case 10:
   3450 		a = sa1 + 8
   3451 		if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{})) {
   3452 			return -6
   3453 		}
   3454 		if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 {
   3455 			mkptr6(tls, bp, a)
   3456 		} else {
   3457 			mkptr4(tls, bp, a+uintptr(12))
   3458 		}
   3459 		scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).Fsin6_scope_id
   3460 		break
   3461 	default:
   3462 		return -6
   3463 	}
   3464 
   3465 	if node != 0 && nodelen != 0 {
   3466 		*(*int8)(unsafe.Pointer(bp + 78)) = int8(0)
   3467 		if !(flags&0x01 != 0) {
   3468 			reverse_hosts(tls, bp+78, a, scopeid, af)
   3469 		}
   3470 		if !(int32(*(*int8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) {
   3471 			Xabort(tls) //TODO-
   3472 			// unsigned char query[18+PTR_MAX], reply[512];
   3473 			// int qlen = __res_mkquery(0, ptr, 1, RR_PTR,
   3474 			// 	0, 0, 0, query, sizeof query);
   3475 			// query[3] = 0; /* don't need AD flag */
   3476 			// int rlen = __res_send(query, qlen, reply, sizeof reply);
   3477 			// buf[0] = 0;
   3478 			// if (rlen > 0)
   3479 			// 	__dns_parse(reply, rlen, dns_parse_callback, buf);
   3480 		}
   3481 		if !(int32(*(*int8)(unsafe.Pointer(bp + 78))) != 0) {
   3482 			if flags&0x08 != 0 {
   3483 				return -2
   3484 			}
   3485 			Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]int8{})))
   3486 			if scopeid != 0 {
   3487 				Xabort(tls) //TODO-
   3488 				// char *p = 0, tmp[IF_NAMESIZE+1];
   3489 				// if (!(flags & NI_NUMERICSCOPE) &&
   3490 				//     (IN6_IS_ADDR_LINKLOCAL(a) ||
   3491 				//      IN6_IS_ADDR_MC_LINKLOCAL(a)))
   3492 				// 	p = if_indextoname(scopeid, tmp+1);
   3493 				// if (!p)
   3494 				// 	p = itoa(num, scopeid);
   3495 				// *--p = '%';
   3496 				// strcat(buf, p);
   3497 			}
   3498 		}
   3499 		if Xstrlen(tls, bp+78) >= size_t(nodelen) {
   3500 			return -12
   3501 		}
   3502 		Xstrcpy(tls, node, bp+78)
   3503 	}
   3504 
   3505 	if serv != 0 && servlen != 0 {
   3506 		var p uintptr = bp + 78 /* buf */
   3507 		var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).Fsin_port))
   3508 		*(*int8)(unsafe.Pointer(bp + 78)) = int8(0)
   3509 		if !(flags&0x02 != 0) {
   3510 			reverse_services(tls, bp+78, port, flags&0x10)
   3511 		}
   3512 		if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) {
   3513 			p = itoa(tls, bp+334, uint32(port))
   3514 		}
   3515 		if Xstrlen(tls, p) >= size_t(servlen) {
   3516 			return -12
   3517 		}
   3518 		Xstrcpy(tls, serv, p)
   3519 	}
   3520 
   3521 	return 0
   3522 }
   3523 
   3524 var Xh_errno int32 /* h_errno.c:4:5: */
   3525 
   3526 func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */
   3527 	return uintptr(unsafe.Pointer(&Xh_errno))
   3528 }
   3529 
   3530 func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */
   3531 	bp := tls.Alloc(40)
   3532 	defer tls.Free(40)
   3533 
   3534 	var s uintptr = s0
   3535 	var d uintptr = dest
   3536 	*(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)}
   3537 	// var z uintptr at bp+32, 8
   3538 
   3539 	var i int32
   3540 
   3541 	for i = 0; i < 4; i++ {
   3542 		*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0)
   3543 		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 {
   3544 			if 0 != 0 {
   3545 				return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s))))
   3546 			}
   3547 			return Bool32(uint32(*(*int8)(unsafe.Pointer(s)))-uint32('0') < uint32(10))
   3548 		}() != 0) {
   3549 			return 0
   3550 		}
   3551 		if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) {
   3552 			break
   3553 		}
   3554 		s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1)
   3555 	}
   3556 	if i == 4 {
   3557 		return 0
   3558 	}
   3559 	switch i {
   3560 	case 0:
   3561 		*(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff)
   3562 		AssignShrPtrUint64(bp, int(24))
   3563 		fallthrough
   3564 	case 1:
   3565 		*(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff)
   3566 		AssignShrPtrUint64(bp+1*8, int(16))
   3567 		fallthrough
   3568 	case 2:
   3569 		*(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff)
   3570 		AssignShrPtrUint64(bp+2*8, int(8))
   3571 	}
   3572 	for i = 0; i < 4; i++ {
   3573 		if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) {
   3574 			return 0
   3575 		}
   3576 		*(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)))
   3577 	}
   3578 	return 1
   3579 }
   3580 
   3581 func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */
   3582 	bp := tls.Alloc(276)
   3583 	defer tls.Free(276)
   3584 
   3585 	var a uintptr = a0
   3586 	var i int32
   3587 	var j int32
   3588 	var max int32
   3589 	var best int32
   3590 	// var buf [100]int8 at bp+176, 100
   3591 
   3592 	switch af {
   3593 	case 2:
   3594 		if socklen_t(Xsnprintf(tls, s, uint64(l), ts+103, 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 {
   3595 			return s
   3596 		}
   3597 		break
   3598 	case 10:
   3599 		if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 {
   3600 			Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})),
   3601 				ts+115,
   3602 				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))),
   3603 					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))),
   3604 					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))),
   3605 					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)))))
   3606 		} else {
   3607 			Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})),
   3608 				ts+139,
   3609 				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))),
   3610 					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))),
   3611 					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))),
   3612 					int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15)))))
   3613 		}
   3614 		// Replace longest /(^0|:)[:0]{2,}/ with "::"
   3615 		i = AssignInt32(&best, 0)
   3616 		max = 2
   3617 		for ; *(*int8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ {
   3618 			if i != 0 && int32(*(*int8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' {
   3619 				continue
   3620 			}
   3621 			j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169))
   3622 			if j > max {
   3623 				best = i
   3624 				max = j
   3625 			}
   3626 		}
   3627 		if max > 3 {
   3628 			*(*int8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrInt8(bp+176+uintptr(best+1), int8(':'))
   3629 			Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1))
   3630 		}
   3631 		if Xstrlen(tls, bp+176) < size_t(l) {
   3632 			Xstrcpy(tls, s, bp+176)
   3633 			return s
   3634 		}
   3635 		break
   3636 	default:
   3637 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
   3638 		return uintptr(0)
   3639 	}
   3640 	*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28
   3641 	return uintptr(0)
   3642 }
   3643 
   3644 func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */
   3645 	if c-uint32('0') < uint32(10) {
   3646 		return int32(c - uint32('0'))
   3647 	}
   3648 	c = c | uint32(32)
   3649 	if c-uint32('a') < uint32(6) {
   3650 		return int32(c - uint32('a') + uint32(10))
   3651 	}
   3652 	return -1
   3653 }
   3654 
   3655 func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */
   3656 	bp := tls.Alloc(16)
   3657 	defer tls.Free(16)
   3658 
   3659 	// var ip [8]uint16_t at bp, 16
   3660 
   3661 	var a uintptr = a0
   3662 	var i int32
   3663 	var j int32
   3664 	var v int32
   3665 	var d int32
   3666 	var brk int32 = -1
   3667 	var need_v4 int32 = 0
   3668 
   3669 	if af == 2 {
   3670 		for i = 0; i < 4; i++ {
   3671 			for v = AssignInt32(&j, 0); j < 3 && func() int32 {
   3672 				if 0 != 0 {
   3673 					return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))
   3674 				}
   3675 				return Bool32(uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10))
   3676 			}() != 0; j++ {
   3677 				v = 10*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - '0'
   3678 			}
   3679 			if j == 0 || j > 1 && int32(*(*int8)(unsafe.Pointer(s))) == '0' || v > 255 {
   3680 				return 0
   3681 			}
   3682 			*(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v)
   3683 			if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 {
   3684 				return 1
   3685 			}
   3686 			if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' {
   3687 				return 0
   3688 			}
   3689 			s += uintptr(j + 1)
   3690 		}
   3691 		return 0
   3692 	} else if af != 10 {
   3693 		*(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97
   3694 		return -1
   3695 	}
   3696 
   3697 	if int32(*(*int8)(unsafe.Pointer(s))) == ':' && int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' {
   3698 		return 0
   3699 	}
   3700 
   3701 	for i = 0; ; i++ {
   3702 		if int32(*(*int8)(unsafe.Pointer(s))) == ':' && brk < 0 {
   3703 			brk = i
   3704 			*(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0)
   3705 			if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) {
   3706 				break
   3707 			}
   3708 			if i == 7 {
   3709 				return 0
   3710 			}
   3711 			continue
   3712 		}
   3713 		for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ {
   3714 			v = 16*v + d
   3715 		}
   3716 		if j == 0 {
   3717 			return 0
   3718 		}
   3719 		*(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v)
   3720 		if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) {
   3721 			break
   3722 		}
   3723 		if i == 7 {
   3724 			return 0
   3725 		}
   3726 		if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' {
   3727 			if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 {
   3728 				return 0
   3729 			}
   3730 			need_v4 = 1
   3731 			i++
   3732 			break
   3733 		}
   3734 		s += uintptr(j + 1)
   3735 	}
   3736 	if brk >= 0 {
   3737 		Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk)))
   3738 		for j = 0; j < 7-i; j++ {
   3739 			*(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0)
   3740 		}
   3741 	}
   3742 	for j = 0; j < 8; j++ {
   3743 		*(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8)
   3744 		*(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2)))
   3745 	}
   3746 	if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 {
   3747 		return 0
   3748 	}
   3749 	return 1
   3750 }
   3751 
   3752 func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */
   3753 	bp := tls.Alloc(96)
   3754 	defer tls.Free(96)
   3755 
   3756 	// var a4 in_addr at bp, 4
   3757 
   3758 	// var a6 in6_addr at bp+68, 16
   3759 
   3760 	if X__inet_aton(tls, name, bp) > 0 {
   3761 		if family == 10 { // wrong family
   3762 			return -2
   3763 		}
   3764 		Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{})))
   3765 		(*address)(unsafe.Pointer(buf)).Ffamily = 2
   3766 		(*address)(unsafe.Pointer(buf)).Fscopeid = uint32(0)
   3767 		return 1
   3768 	}
   3769 	// var tmp [64]int8 at bp+4, 64
   3770 
   3771 	var p uintptr = Xstrchr(tls, name, '%')
   3772 	// var z uintptr at bp+88, 8
   3773 
   3774 	var scopeid uint64 = uint64(0)
   3775 	if p != 0 && (int64(p)-int64(name))/1 < int64(64) {
   3776 		Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1))
   3777 		*(*int8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = int8(0)
   3778 		name = bp + 4 /* &tmp[0] */
   3779 	}
   3780 
   3781 	if Xinet_pton(tls, 10, name, bp+68) <= 0 {
   3782 		return 0
   3783 	}
   3784 	if family == 2 { // wrong family
   3785 		return -2
   3786 	}
   3787 
   3788 	Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{})))
   3789 	(*address)(unsafe.Pointer(buf)).Ffamily = 10
   3790 	if p != 0 {
   3791 		if func() int32 {
   3792 			if 0 != 0 {
   3793 				return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1)))))
   3794 			}
   3795 			return Bool32(uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10))
   3796 		}() != 0 {
   3797 			scopeid = Xstrtoull(tls, p, bp+88, 10)
   3798 		} else {
   3799 			*(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1)
   3800 		}
   3801 		if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 {
   3802 			Xabort(tls) //TODO-
   3803 			// if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
   3804 			//     !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
   3805 			// 	return EAI_NONAME;
   3806 			// scopeid = if_nametoindex(p);
   3807 			// if (!scopeid) return EAI_NONAME;
   3808 		}
   3809 		if scopeid > uint64(0xffffffff) {
   3810 			return -2
   3811 		}
   3812 	}
   3813 	(*address)(unsafe.Pointer(buf)).Fscopeid = uint32(scopeid)
   3814 	return 1
   3815 }
   3816 
   3817 type mode_t = uint32 /* alltypes.h:160:18 */
   3818 
   3819 type flock = struct {
   3820 	Fl_type      int16
   3821 	Fl_whence    int16
   3822 	F__ccgo_pad1 [4]byte
   3823 	Fl_start     off_t
   3824 	Fl_len       off_t
   3825 	Fl_pid       pid_t
   3826 	F__ccgo_pad2 [4]byte
   3827 } /* fcntl.h:24:1 */
   3828 
   3829 func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */
   3830 	var s uintptr
   3831 	//TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0;
   3832 	if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) {
   3833 		return 0
   3834 	}
   3835 	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++ {
   3836 	}
   3837 	return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0))
   3838 }
   3839 
   3840 var Xzero_struct_address address /* lookup_name.c:27:16: */
   3841 
   3842 func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */
   3843 	var cnt int32 = 0
   3844 	if name != 0 {
   3845 		return 0
   3846 	}
   3847 	if flags&0x01 != 0 {
   3848 		//TODO if (family != AF_INET6)
   3849 		//TODO 	buf[cnt++] = (struct address){ .family = AF_INET };
   3850 		if family != 10 {
   3851 			var x = Xzero_struct_address
   3852 			x.Ffamily = 2
   3853 			*(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
   3854 		}
   3855 		//TODO if (family != AF_INET)
   3856 		//TODO 	buf[cnt++] = (struct address){ .family = AF_INET6 };
   3857 		if family != 2 {
   3858 			var x = Xzero_struct_address
   3859 			x.Ffamily = 10
   3860 			*(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x
   3861 		}
   3862 	} else {
   3863 		Xabort(tls) //TODO-
   3864 		// 	if (family != AF_INET6)
   3865 		// 		buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
   3866 		// 	if (family != AF_INET)
   3867 		// 		buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
   3868 	}
   3869 	return cnt
   3870 }
   3871 
   3872 func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */
   3873 	return X__lookup_ipliteral(tls, buf, name, family)
   3874 }
   3875 
   3876 func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */
   3877 	bp := tls.Alloc(512)
   3878 	defer tls.Free(512)
   3879 
   3880 	// var line [512]int8 at bp, 512
   3881 
   3882 	var l size_t = Xstrlen(tls, name)
   3883 	var cnt int32 = 0
   3884 	var badfam int32 = 0
   3885 	var _buf [1032]uint8
   3886 	_ = _buf
   3887 	//TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf);
   3888 	var _f FILE
   3889 	_ = _f
   3890 	var f uintptr = Xfopen(tls, ts+76, ts+87)
   3891 	if !(f != 0) {
   3892 		switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) {
   3893 		case 2:
   3894 			fallthrough
   3895 		case 20:
   3896 			fallthrough
   3897 		case 13:
   3898 			return 0
   3899 			fallthrough
   3900 		default:
   3901 			return -11
   3902 		}
   3903 	}
   3904 	for Xfgets(tls, bp, int32(unsafe.Sizeof([512]int8{})), f) != 0 && cnt < 48 {
   3905 		var p uintptr
   3906 		var z uintptr
   3907 
   3908 		if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 {
   3909 			*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n')
   3910 			*(*int8)(unsafe.Pointer(p)) = int8(0)
   3911 		}
   3912 		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++ {
   3913 		}
   3914 		if !(p != 0) {
   3915 			continue
   3916 		}
   3917 
   3918 		// Isolate IP address to parse
   3919 		for p = bp; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ {
   3920 		}
   3921 		*(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0)
   3922 		switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) {
   3923 		case 1:
   3924 			cnt++
   3925 			break
   3926 		case 0:
   3927 			continue
   3928 		default:
   3929 			badfam = -2
   3930 			continue
   3931 		}
   3932 
   3933 		// Extract first name as canonical name
   3934 		for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ {
   3935 		}
   3936 		for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ {
   3937 		}
   3938 		*(*int8)(unsafe.Pointer(z)) = int8(0)
   3939 		if is_valid_hostname(tls, p) != 0 {
   3940 			Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1)))
   3941 		}
   3942 	}
   3943 	//TODO __fclose_ca(f);
   3944 	Xfclose(tls, f)
   3945 	if cnt != 0 {
   3946 		return cnt
   3947 	}
   3948 	return badfam
   3949 }
   3950 
   3951 type dpc_ctx = struct {
   3952 	Faddrs       uintptr
   3953 	Fcanon       uintptr
   3954 	Fcnt         int32
   3955 	F__ccgo_pad1 [4]byte
   3956 } /* lookup_name.c:112:1 */
   3957 
   3958 func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */
   3959 	return -1 //TODO-
   3960 	Xabort(tls)
   3961 	return int32(0) //TODO-
   3962 	// char search[256];
   3963 	// struct resolvconf conf;
   3964 	// size_t l, dots;
   3965 	// char *p, *z;
   3966 
   3967 	// if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1;
   3968 
   3969 	// /* Count dots, suppress search when >=ndots or name ends in
   3970 	//  * a dot, which is an explicit request for global scope. */
   3971 	// for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++;
   3972 	// if (dots >= conf.ndots || name[l-1]=='.') *search = 0;
   3973 
   3974 	// /* Strip final dot for canon, fail if multiple trailing dots. */
   3975 	// if (name[l-1]=='.') l--;
   3976 	// if (!l || name[l-1]=='.') return EAI_NONAME;
   3977 
   3978 	// /* This can never happen; the caller already checked length. */
   3979 	// if (l >= 256) return EAI_NONAME;
   3980 
   3981 	// /* Name with search domain appended is setup in canon[]. This both
   3982 	//  * provides the desired default canonical name (if the requested
   3983 	//  * name is not a CNAME record) and serves as a buffer for passing
   3984 	//  * the full requested name to name_from_dns. */
   3985 	// memcpy(canon, name, l);
   3986 	// canon[l] = '.';
   3987 
   3988 	// for (p=search; *p; p=z) {
   3989 	// 	for (; isspace(*p); p++);
   3990 	// 	for (z=p; *z && !isspace(*z); z++);
   3991 	// 	if (z==p) break;
   3992 	// 	if (z-p < 256 - l - 1) {
   3993 	// 		memcpy(canon+l+1, p, z-p);
   3994 	// 		canon[z-p+1+l] = 0;
   3995 	// 		int cnt = name_from_dns(buf, canon, canon, family, &conf);
   3996 	// 		if (cnt) return cnt;
   3997 	// 	}
   3998 	// }
   3999 
   4000 	// canon[l] = 0;
   4001 	// return name_from_dns(buf, canon, name, family, &conf);
   4002 }
   4003 
   4004 type policy = struct {
   4005 	Faddr  [16]uint8
   4006 	Flen   uint8
   4007 	Fmask  uint8
   4008 	Fprec  uint8
   4009 	Flabel uint8
   4010 } /* lookup_name.c:237:14 */
   4011 
   4012 var defpolicy = [6]policy{
   4013 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), Flen: uint8(15), Fmask: uint8(0xff), Fprec: uint8(50)},
   4014 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), Flen: uint8(11), Fmask: uint8(0xff), Fprec: uint8(35), Flabel: uint8(4)},
   4015 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), Flen: uint8(1), Fmask: uint8(0xff), Fprec: uint8(30), Flabel: uint8(2)},
   4016 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), Flen: uint8(3), Fmask: uint8(0xff), Fprec: uint8(5), Flabel: uint8(5)},
   4017 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), Fmask: uint8(0xfe), Fprec: uint8(3), Flabel: uint8(13)},
   4018 	// Last rule must match all addresses to stop loop.
   4019 	{Faddr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), Fprec: uint8(40), Flabel: uint8(1)},
   4020 } /* lookup_name.c:241:3 */
   4021 
   4022 func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */
   4023 	var i int32
   4024 	for i = 0; ; i++ {
   4025 		if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].Flen)) != 0 {
   4026 			continue
   4027 		}
   4028 		if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].Flen))))&int32(defpolicy[i].Fmask) !=
   4029 			int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].Flen)))) {
   4030 			continue
   4031 		}
   4032 		return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20
   4033 	}
   4034 	return uintptr(0)
   4035 }
   4036 
   4037 func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */
   4038 	return int32((*policy)(unsafe.Pointer(policyof(tls, a))).Flabel)
   4039 }
   4040 
   4041 func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */
   4042 	if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff {
   4043 		return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15
   4044 	}
   4045 	if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 {
   4046 		return 2
   4047 	}
   4048 	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 {
   4049 		return 2
   4050 	}
   4051 	if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 {
   4052 		return 5
   4053 	}
   4054 	return 14
   4055 }
   4056 
   4057 func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */
   4058 	// FIXME: The common prefix length should be limited to no greater
   4059 	// than the nominal length of the prefix portion of the source
   4060 	// address. However the definition of the source prefix length is
   4061 	// not clear and thus this limiting is not yet implemented.
   4062 	var i uint32
   4063 	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++ {
   4064 	}
   4065 	return int32(i)
   4066 }
   4067 
   4068 func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */
   4069 	var a uintptr = _a
   4070 	var b uintptr = _b
   4071 	return (*address)(unsafe.Pointer(b)).Fsortkey - (*address)(unsafe.Pointer(a)).Fsortkey
   4072 }
   4073 
   4074 func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */
   4075 	bp := tls.Alloc(92)
   4076 	defer tls.Free(92)
   4077 
   4078 	var cnt int32 = 0
   4079 	var i int32
   4080 	var j int32
   4081 	_ = j
   4082 
   4083 	*(*int8)(unsafe.Pointer(canon)) = int8(0)
   4084 	if name != 0 {
   4085 		// reject empty name and check len so it fits into temp bufs
   4086 		var l size_t = Xstrnlen(tls, name, uint64(255))
   4087 		if l-uint64(1) >= uint64(254) {
   4088 			return -2
   4089 		}
   4090 		Xmemcpy(tls, canon, name, l+uint64(1))
   4091 	}
   4092 
   4093 	// Procedurally, a request for v6 addresses with the v4-mapped
   4094 	// flag set is like a request for unspecified family, followed
   4095 	// by filtering of the results.
   4096 	if flags&0x08 != 0 {
   4097 		if family == 10 {
   4098 			family = 0
   4099 		} else {
   4100 			flags = flags - 0x08
   4101 		}
   4102 	}
   4103 
   4104 	// Try each backend until there's at least one result.
   4105 	cnt = name_from_null(tls, buf, name, family, flags)
   4106 	if !(cnt != 0) {
   4107 		cnt = name_from_numeric(tls, buf, name, family)
   4108 	}
   4109 	if !(cnt != 0) && !(flags&0x04 != 0) {
   4110 		cnt = name_from_hosts(tls, buf, canon, name, family)
   4111 		if !(cnt != 0) {
   4112 			cnt = name_from_dns_search(tls, buf, canon, name, family)
   4113 		}
   4114 	}
   4115 	if cnt <= 0 {
   4116 		if cnt != 0 {
   4117 			return cnt
   4118 		}
   4119 		return -2
   4120 	}
   4121 
   4122 	// Filter/transform results for v4-mapped lookup, if requested.
   4123 	if flags&0x08 != 0 {
   4124 		Xabort(tls) //TODO-
   4125 		// 	if (!(flags & AI_ALL)) {
   4126 		// 		/* If any v6 results exist, remove v4 results. */
   4127 		// 		for (i=0; i<cnt && buf[i].family != AF_INET6; i++);
   4128 		// 		if (i<cnt) {
   4129 		// 			for (j=0; i<cnt; i++) {
   4130 		// 				if (buf[i].family == AF_INET6)
   4131 		// 					buf[j++] = buf[i];
   4132 		// 			}
   4133 		// 			cnt = i = j;
   4134 		// 		}
   4135 		// 	}
   4136 		// 	/* Translate any remaining v4 results to v6 */
   4137 		// 	for (i=0; i<cnt; i++) {
   4138 		// 		if (buf[i].family != AF_INET) continue;
   4139 		// 		memcpy(buf[i].addr+12, buf[i].addr, 4);
   4140 		// 		memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
   4141 		// 		buf[i].family = AF_INET6;
   4142 		// 	}
   4143 	}
   4144 
   4145 	// No further processing is needed if there are fewer than 2
   4146 	// results or if there are only IPv4 results.
   4147 	if cnt < 2 || family == 2 {
   4148 		return cnt
   4149 	}
   4150 	for i = 0; i < cnt; i++ {
   4151 		if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).Ffamily != 2 {
   4152 			break
   4153 		}
   4154 	}
   4155 	if i == cnt {
   4156 		return cnt
   4157 	}
   4158 	var cs int32
   4159 	_ = cs
   4160 	//TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
   4161 
   4162 	// The following implements a subset of RFC 3484/6724 destination
   4163 	// address selection by generating a single 31-bit sort key for
   4164 	// each address. Rules 3, 4, and 7 are omitted for having
   4165 	// excessive runtime and code size cost and dubious benefit.
   4166 	// So far the label/precedence table cannot be customized.
   4167 	for i = 0; i < cnt; i++ {
   4168 		var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).Ffamily
   4169 		var key int32 = 0
   4170 		*(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{}
   4171 		*(*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}
   4172 		*(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{}
   4173 		*(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{Fsin_family: sa_family_t(2), Fsin_port: in_port_t(65535)}
   4174 		var sa1 uintptr
   4175 		var da uintptr
   4176 		// var salen socklen_t at bp+88, 4
   4177 
   4178 		var dalen socklen_t
   4179 		if family == 10 {
   4180 			Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint64(16))
   4181 			da = bp /* &da6 */
   4182 			dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
   4183 			sa1 = bp + 28 /* &sa6 */
   4184 			*(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{}))
   4185 		} else {
   4186 			Xmemcpy(tls, bp+28+8,
   4187 				ts+90, uint64(12))
   4188 			Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4))
   4189 			Xmemcpy(tls, bp+8,
   4190 				ts+90, uint64(12))
   4191 			Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4))
   4192 			Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint64(4))
   4193 			da = bp + 56 /* &da4 */
   4194 			dalen = socklen_t(unsafe.Sizeof(sockaddr_in{}))
   4195 			sa1 = bp + 72 /* &sa4 */
   4196 			*(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{}))
   4197 		}
   4198 		var dpolicy uintptr = policyof(tls, bp+8)
   4199 		var dscope int32 = scopeof(tls, bp+8)
   4200 		var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Flabel)
   4201 		var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).Fprec)
   4202 		var prefixlen int32 = 0
   4203 		var fd int32 = Xsocket(tls, family, 2|02000000, 17)
   4204 		if fd >= 0 {
   4205 			if !(Xconnect(tls, fd, da, dalen) != 0) {
   4206 				key = key | 0x40000000
   4207 				if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) {
   4208 					if family == 2 {
   4209 						Xmemcpy(tls,
   4210 							bp+28+8+uintptr(12),
   4211 							bp+72+4, uint64(4))
   4212 					}
   4213 					if dscope == scopeof(tls, bp+28+8) {
   4214 						key = key | 0x20000000
   4215 					}
   4216 					if dlabel == labelof(tls, bp+28+8) {
   4217 						key = key | 0x10000000
   4218 					}
   4219 					prefixlen = prefixmatch(tls, bp+28+8,
   4220 						bp+8)
   4221 				}
   4222 			}
   4223 			Xclose(tls, fd)
   4224 		}
   4225 		key = key | dprec<<20
   4226 		key = key | (15-dscope)<<16
   4227 		key = key | prefixlen<<8
   4228 		key = key | (48-i)<<0
   4229 		(*address)(unsafe.Pointer(buf + uintptr(i)*28)).Fsortkey = key
   4230 	}
   4231 	Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct {
   4232 		f func(*TLS, uintptr, uintptr) int32
   4233 	}{addrcmp})))
   4234 
   4235 	//TODO pthread_setcancelstate(cs, 0);
   4236 
   4237 	return cnt
   4238 }
   4239 
   4240 func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */
   4241 	bp := tls.Alloc(8)
   4242 	defer tls.Free(8)
   4243 
   4244 	var line [128]int8
   4245 	_ = line
   4246 	var cnt int32 = 0
   4247 	var p uintptr
   4248 	_ = p
   4249 	*(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */
   4250 	var port uint64 = uint64(0)
   4251 
   4252 	switch socktype {
   4253 	case 1:
   4254 		switch proto {
   4255 		case 0:
   4256 			proto = 6
   4257 			fallthrough
   4258 		case 6:
   4259 			break
   4260 		default:
   4261 			return -8
   4262 		}
   4263 		break
   4264 	case 2:
   4265 		switch proto {
   4266 		case 0:
   4267 			proto = 17
   4268 			fallthrough
   4269 		case 17:
   4270 			break
   4271 		default:
   4272 			return -8
   4273 		}
   4274 		fallthrough
   4275 	case 0:
   4276 		break
   4277 	default:
   4278 		if name != 0 {
   4279 			return -8
   4280 		}
   4281 		(*service)(unsafe.Pointer(buf)).Fport = uint16_t(0)
   4282 		(*service)(unsafe.Pointer(buf)).Fproto = uint8(proto)
   4283 		(*service)(unsafe.Pointer(buf)).Fsocktype = uint8(socktype)
   4284 		return 1
   4285 	}
   4286 
   4287 	if name != 0 {
   4288 		if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) {
   4289 			return -8
   4290 		}
   4291 		port = Xstrtoul(tls, name, bp, 10)
   4292 	}
   4293 	if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) {
   4294 		if port > uint64(65535) {
   4295 			return -8
   4296 		}
   4297 		if proto != 17 {
   4298 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
   4299 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(1)
   4300 			(*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(6)
   4301 		}
   4302 		if proto != 6 {
   4303 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fport = uint16_t(port)
   4304 			(*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).Fsocktype = uint8(2)
   4305 			(*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).Fproto = uint8(17)
   4306 		}
   4307 		return cnt
   4308 	}
   4309 
   4310 	if flags&0x400 != 0 {
   4311 		return -2
   4312 	}
   4313 
   4314 	var l size_t = Xstrlen(tls, name)
   4315 	_ = l
   4316 
   4317 	Xabort(tls) //TODO-
   4318 	// unsigned char _buf[1032];
   4319 	// FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf);
   4320 	// if (!f) switch (errno) {
   4321 	// case ENOENT:
   4322 	// case ENOTDIR:
   4323 	// case EACCES:
   4324 	// 	return EAI_SERVICE;
   4325 	// default:
   4326 	// 	return EAI_SYSTEM;
   4327 	// }
   4328 
   4329 	Xabort(tls) //TODO-
   4330 	// while (fgets(line, sizeof line, f) && cnt < MAXSERVS) {
   4331 	// 	if ((p=strchr(line, '#'))) *p++='\n', *p=0;
   4332 
   4333 	// 	/* Find service name */
   4334 	// 	for(p=line; (p=strstr(p, name)); p++) {
   4335 	// 		if (p>line && !isspace(p[-1])) continue;
   4336 	// 		if (p[l] && !isspace(p[l])) continue;
   4337 	// 		break;
   4338 	// 	}
   4339 	// 	if (!p) continue;
   4340 
   4341 	// 	/* Skip past canonical name at beginning of line */
   4342 	// 	for (p=line; *p && !isspace(*p); p++);
   4343 
   4344 	// 	port = strtoul(p, &z, 10);
   4345 	// 	if (port > 65535 || z==p) continue;
   4346 	// 	if (!strncmp(z, "/udp", 4)) {
   4347 	// 		if (proto == IPPROTO_TCP) continue;
   4348 	// 		buf[cnt].port = port;
   4349 	// 		buf[cnt].socktype = SOCK_DGRAM;
   4350 	// 		buf[cnt++].proto = IPPROTO_UDP;
   4351 	// 	}
   4352 	// 	if (!strncmp(z, "/tcp", 4)) {
   4353 	// 		if (proto == IPPROTO_UDP) continue;
   4354 	// 		buf[cnt].port = port;
   4355 	// 		buf[cnt].socktype = SOCK_STREAM;
   4356 	// 		buf[cnt++].proto = IPPROTO_TCP;
   4357 	// 	}
   4358 	// }
   4359 	// __fclose_ca(f);
   4360 	// return cnt > 0 ? cnt : EAI_SERVICE;
   4361 	Xabort(tls)
   4362 	return int32(0) //TODO-
   4363 }
   4364 
   4365 func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */
   4366 	x = x ^ x>>11
   4367 	x = x ^ x<<7&0x9D2C5680
   4368 	x = x ^ x<<15&0xEFC60000
   4369 	x = x ^ x>>18
   4370 	return x
   4371 }
   4372 
   4373 func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */
   4374 	return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2))
   4375 }
   4376 
   4377 func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */
   4378 	*(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).Fmode - 1
   4379 	if (*FILE)(unsafe.Pointer(f)).Fwpos != (*FILE)(unsafe.Pointer(f)).Fwbase {
   4380 		(*struct {
   4381 			f func(*TLS, uintptr, uintptr, size_t) size_t
   4382 		})(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fwrite})).f(tls, f, uintptr(0), uint64(0))
   4383 	}
   4384 	(*FILE)(unsafe.Pointer(f)).Fwpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0)))
   4385 	if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(4) != 0 {
   4386 		*(*uint32)(unsafe.Pointer(f)) |= uint32(32)
   4387 		return -1
   4388 	}
   4389 	(*FILE)(unsafe.Pointer(f)).Frpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).Fbuf+uintptr((*FILE)(unsafe.Pointer(f)).Fbuf_size))
   4390 	if (*FILE)(unsafe.Pointer(f)).Fflags&uint32(16) != 0 {
   4391 		return -1
   4392 	}
   4393 	return 0
   4394 }
   4395 
   4396 func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */
   4397 	X__builtin_abort(tls) //TODO-
   4398 	// __stdio_exit_needed();
   4399 }
   4400 
   4401 // This function assumes it will never be called if there is already
   4402 // data buffered for reading.
   4403 
   4404 func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */
   4405 	bp := tls.Alloc(1)
   4406 	defer tls.Free(1)
   4407 
   4408 	// var c uint8 at bp, 1
   4409 
   4410 	if !(X__toread(tls, f) != 0) && (*struct {
   4411 		f func(*TLS, uintptr, uintptr, size_t) size_t
   4412 	})(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).Fread})).f(tls, f, bp, uint64(1)) == uint64(1) {
   4413 		return int32(*(*uint8)(unsafe.Pointer(bp)))
   4414 	}
   4415 	return -1
   4416 }
   4417 
   4418 func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */
   4419 	var try uintptr
   4420 	var sign int32
   4421 	for nel > uint64(0) {
   4422 		try = base + uintptr(width*(nel/uint64(2)))
   4423 		sign = (*struct {
   4424 			f func(*TLS, uintptr, uintptr) int32
   4425 		})(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try)
   4426 		if sign < 0 {
   4427 			nel = nel / uint64(2)
   4428 		} else if sign > 0 {
   4429 			base = try + uintptr(width)
   4430 			nel = nel - (nel/uint64(2) + uint64(1))
   4431 		} else {
   4432 			return try
   4433 		}
   4434 	}
   4435 	return uintptr(0)
   4436 }
   4437 
   4438 func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */
   4439 	bp := tls.Alloc(232)
   4440 	defer tls.Free(232)
   4441 
   4442 	// var f FILE at bp, 232
   4443 
   4444 	(*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+8, s)
   4445 	(*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
   4446 	X__shlim(tls, bp, int64(0))
   4447 	var y float64 = X__floatscan(tls, bp, prec, 1)
   4448 	var cnt off_t = (*FILE)(unsafe.Pointer(bp)).Fshcnt + (int64((*FILE)(unsafe.Pointer(bp)).Frpos)-int64((*FILE)(unsafe.Pointer(bp)).Fbuf))/1
   4449 	if p != 0 {
   4450 		*(*uintptr)(unsafe.Pointer(p)) = func() uintptr {
   4451 			if cnt != 0 {
   4452 				return s + uintptr(cnt)
   4453 			}
   4454 			return s
   4455 		}()
   4456 	}
   4457 	return y
   4458 }
   4459 
   4460 func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */
   4461 	return float32(strtox(tls, s, p, 0))
   4462 }
   4463 
   4464 func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */
   4465 	return strtox(tls, s, p, 1)
   4466 }
   4467 
   4468 func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */
   4469 	return strtox(tls, s, p, 2)
   4470 }
   4471 
   4472 func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */
   4473 	bp := tls.Alloc(232)
   4474 	defer tls.Free(232)
   4475 
   4476 	// var f FILE at bp, 232
   4477 
   4478 	(*FILE)(unsafe.Pointer(bp)).Fbuf = AssignPtrUintptr(bp+8, s)
   4479 	(*FILE)(unsafe.Pointer(bp)).Frend = UintptrFromInt32(-1)
   4480 	X__shlim(tls, bp, int64(0))
   4481 	var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim)
   4482 	if p != 0 {
   4483 		var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).Fshcnt + (int64((*FILE)(unsafe.Pointer(bp)).Frpos)-int64((*FILE)(unsafe.Pointer(bp)).Fbuf))/1)
   4484 		*(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt)
   4485 	}
   4486 	return y
   4487 }
   4488 
   4489 func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */
   4490 	return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))
   4491 }
   4492 
   4493 func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */
   4494 	return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1))))
   4495 }
   4496 
   4497 func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */
   4498 	return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)))
   4499 }
   4500 
   4501 func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */
   4502 	return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1))))
   4503 }
   4504 
   4505 func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */
   4506 	return intmax_t(Xstrtoll(tls, s, p, base))
   4507 }
   4508 
   4509 func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */
   4510 	return uintmax_t(Xstrtoull(tls, s, p, base))
   4511 }
   4512 
   4513 // Support signed or unsigned plain-char
   4514 
   4515 // Implementation choices...
   4516 
   4517 // Arbitrary numbers...
   4518 
   4519 // POSIX/SUS requirements follow. These numbers come directly
   4520 // from SUS and have nothing to do with the host system.
   4521 
   4522 func X__strchrnul(tls *TLS, s uintptr, c int32) uintptr { /* strchrnul.c:10:6: */
   4523 	c = int32(uint8(c))
   4524 	if !(c != 0) {
   4525 		return s + uintptr(Xstrlen(tls, s))
   4526 	}
   4527 	var w uintptr
   4528 	for ; uintptr_t(s)%uintptr_t(unsafe.Sizeof(size_t(0))) != 0; s++ {
   4529 		if !(int32(*(*int8)(unsafe.Pointer(s))) != 0) || int32(*(*uint8)(unsafe.Pointer(s))) == c {
   4530 			return s
   4531 		}
   4532 	}
   4533 	var k size_t = Uint64(Uint64FromInt32(-1)) / uint64(255) * size_t(c)
   4534 	for w = s; !((*(*uint64)(unsafe.Pointer(w))-Uint64(Uint64FromInt32(-1))/uint64(255)) & ^*(*uint64)(unsafe.Pointer(w)) & (Uint64(Uint64FromInt32(-1))/uint64(255)*uint64(255/2+1)) != 0) && !((*(*uint64)(unsafe.Pointer(w))^k-Uint64(Uint64FromInt32(-1))/uint64(255)) & ^(*(*uint64)(unsafe.Pointer(w))^k) & (Uint64(Uint64FromInt32(-1))/uint64(255)*uint64(255/2+1)) != 0); w += 8 {
   4535 	}
   4536 	s = w
   4537 	for ; *(*int8)(unsafe.Pointer(s)) != 0 && int32(*(*uint8)(unsafe.Pointer(s))) != c; s++ {
   4538 	}
   4539 	return s
   4540 }
   4541 
   4542 func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */
   4543 	var l size_t = Xstrlen(tls, s)
   4544 	var d uintptr = Xmalloc(tls, l+uint64(1))
   4545 	if !(d != 0) {
   4546 		return uintptr(0)
   4547 	}
   4548 	return Xmemcpy(tls, d, s, l+uint64(1))
   4549 }
   4550 
   4551 func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */
   4552 	var l size_t = Xstrnlen(tls, d, n)
   4553 	if l == n {
   4554 		return l + Xstrlen(tls, s)
   4555 	}
   4556 	return l + Xstrlcpy(tls, d+uintptr(l), s, n-l)
   4557 }
   4558 
   4559 // Support signed or unsigned plain-char
   4560 
   4561 // Implementation choices...
   4562 
   4563 // Arbitrary numbers...
   4564 
   4565 // POSIX/SUS requirements follow. These numbers come directly
   4566 // from SUS and have nothing to do with the host system.
   4567 
   4568 func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */
   4569 	var d0 uintptr
   4570 	var wd uintptr
   4571 	var ws uintptr
   4572 	d0 = d
   4573 
   4574 	if !!(int32(PostDecUint64(&n, 1)) != 0) {
   4575 		goto __1
   4576 	}
   4577 	goto finish
   4578 __1:
   4579 	;
   4580 	if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) == uintptr_t(d)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1))) {
   4581 		goto __2
   4582 	}
   4583 __3:
   4584 	if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) != 0 && n != 0 && AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0) {
   4585 		goto __5
   4586 	}
   4587 	goto __4
   4588 __4:
   4589 	n--
   4590 	s++
   4591 	d++
   4592 	goto __3
   4593 	goto __5
   4594 __5:
   4595 	;
   4596 	if !(n != 0 && *(*int8)(unsafe.Pointer(s)) != 0) {
   4597 		goto __6
   4598 	}
   4599 	wd = d
   4600 	ws = s
   4601 __7:
   4602 	if !(n >= size_t(unsafe.Sizeof(size_t(0))) && !((*(*uint64)(unsafe.Pointer(ws))-Uint64(Uint64FromInt32(-1))/uint64(255)) & ^*(*uint64)(unsafe.Pointer(ws)) & (Uint64(Uint64FromInt32(-1))/uint64(255)*uint64(255/2+1)) != 0)) {
   4603 		goto __9
   4604 	}
   4605 	*(*size_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws))
   4606 	goto __8
   4607 __8:
   4608 	n = n - size_t(unsafe.Sizeof(size_t(0)))
   4609 	ws += 8
   4610 	wd += 8
   4611 	goto __7
   4612 	goto __9
   4613 __9:
   4614 	;
   4615 	d = wd
   4616 	s = ws
   4617 __6:
   4618 	;
   4619 __2:
   4620 	;
   4621 __10:
   4622 	if !(n != 0 && AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0) {
   4623 		goto __12
   4624 	}
   4625 	goto __11
   4626 __11:
   4627 	n--
   4628 	s++
   4629 	d++
   4630 	goto __10
   4631 	goto __12
   4632 __12:
   4633 	;
   4634 	*(*int8)(unsafe.Pointer(d)) = int8(0)
   4635 finish:
   4636 	return size_t((int64(d)-int64(d0))/1) + Xstrlen(tls, s)
   4637 }
   4638 
   4639 func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */
   4640 	var l uintptr = _l
   4641 	var r uintptr = _r
   4642 	if !(int32(PostDecUint64(&n, 1)) != 0) {
   4643 		return 0
   4644 	}
   4645 __1:
   4646 	if !(*(*uint8)(unsafe.Pointer(l)) != 0 && *(*uint8)(unsafe.Pointer(r)) != 0 && n != 0 && (int32(*(*uint8)(unsafe.Pointer(l))) == int32(*(*uint8)(unsafe.Pointer(r))) || Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) == Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))))) {
   4647 		goto __3
   4648 	}
   4649 	goto __2
   4650 __2:
   4651 	l++
   4652 	r++
   4653 	n--
   4654 	goto __1
   4655 	goto __3
   4656 __3:
   4657 	;
   4658 	return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r))))
   4659 }
   4660 
   4661 func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */
   4662 	return Xstrncasecmp(tls, l, r, n)
   4663 }
   4664 
   4665 func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */
   4666 	var a uintptr = d
   4667 	d += uintptr(Xstrlen(tls, d))
   4668 	for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 {
   4669 		n--
   4670 		*(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1)))
   4671 	}
   4672 	*(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = int8(0)
   4673 	return a
   4674 }
   4675 
   4676 func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */
   4677 	var p uintptr = Xmemchr(tls, s, 0, n)
   4678 	if p != 0 {
   4679 		return uint64((int64(p) - int64(s)) / 1)
   4680 	}
   4681 	return n
   4682 }
   4683 
   4684 func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */
   4685 	bp := tls.Alloc(32)
   4686 	defer tls.Free(32)
   4687 
   4688 	var a uintptr = s
   4689 	*(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)}
   4690 
   4691 	if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) {
   4692 		return uint64(0)
   4693 	}
   4694 	if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) {
   4695 		for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ {
   4696 		}
   4697 		return size_t((int64(s) - int64(a)) / 1)
   4698 	}
   4699 
   4700 	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++ {
   4701 	}
   4702 	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++ {
   4703 	}
   4704 	return size_t((int64(s) - int64(a)) / 1)
   4705 }
   4706 
   4707 func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */
   4708 	if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) {
   4709 		return uintptr(0)
   4710 	}
   4711 	s += uintptr(Xstrspn(tls, s, sep))
   4712 	if !(int32(*(*int8)(unsafe.Pointer(s))) != 0) {
   4713 		return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0))
   4714 	}
   4715 	_sp = s + uintptr(Xstrcspn(tls, s, sep))
   4716 	if *(*int8)(unsafe.Pointer(_sp)) != 0 {
   4717 		*(*int8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = int8(0)
   4718 	} else {
   4719 		_sp = uintptr(0)
   4720 	}
   4721 	return s
   4722 }
   4723 
   4724 var _sp uintptr /* strtok.c:5:14: */
   4725 
   4726 func init() {
   4727 	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_CurrentRuneLocale)) + 0)) = uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) // table.c:1940:35:
   4728 	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&X_CurrentRuneLocale)) + 0)) = uintptr(unsafe.Pointer(&X_DefaultRuneLocale)) // table.c:1940:35:
   4729 }
   4730 
   4731 var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00.\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"
   4732 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data