musl_linux_amd64.go (194828B)
1 // Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/__ctype_b_loc.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.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/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.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/gethostbyname_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/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.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 src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.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 const ( /* pthread_impl.h:58:1: */ 355 DT_EXITING = 0 356 DT_JOINABLE = 1 357 DT_DETACHED = 2 358 ) 359 360 type ptrdiff_t = int64 /* <builtin>:3:26 */ 361 362 type size_t = uint64 /* <builtin>:9:23 */ 363 364 type wchar_t = int32 /* <builtin>:15:24 */ 365 366 type uint16_t = uint16 /* alltypes.h:126:25 */ 367 368 type uint32_t = uint32 /* alltypes.h:131:25 */ 369 370 type uint64_t = uint64 /* alltypes.h:136:25 */ 371 372 func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ 373 return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24 374 } 375 376 var table = [384]uint16{ 377 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 378 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 379 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 380 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 381 uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), 382 uint16((0x200/256 | 0x200*256) % 65536), uint16((0x320/256 | 0x320*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), 383 uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), 384 uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), 385 uint16((0x160/256 | 0x160*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), 386 uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), 387 uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), 388 uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), 389 uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), 390 uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), 391 uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), 392 uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), 393 uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), 394 uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), 395 uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), 396 uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), 397 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 398 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 399 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 400 uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), 401 } /* __ctype_b_loc.c:9:29 */ 402 403 var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */ 404 405 func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */ 406 return uintptr(unsafe.Pointer(&ptable)) 407 } 408 409 func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ 410 return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5)) 411 } 412 413 type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:343:9 */ 414 415 type locale_t = uintptr /* alltypes.h:343:32 */ 416 417 func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ 418 return Bool32(func() int32 { 419 if 0 != 0 { 420 return Xisalpha(tls, c) 421 } 422 return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) 423 }() != 0 || func() int32 { 424 if 0 != 0 { 425 return Xisdigit(tls, c) 426 } 427 return Bool32(uint32(c)-uint32('0') < uint32(10)) 428 }() != 0) 429 } 430 431 func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */ 432 return Xisalnum(tls, c) 433 } 434 435 func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */ 436 return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) 437 } 438 439 func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */ 440 return Xisalpha(tls, c) 441 } 442 443 func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */ 444 return Bool32(uint32(c)-uint32('0') < uint32(10)) 445 } 446 447 func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */ 448 return Xisdigit(tls, c) 449 } 450 451 func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */ 452 return Bool32(uint32(c)-uint32('a') < uint32(26)) 453 } 454 455 func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */ 456 return Xislower(tls, c) 457 } 458 459 func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ 460 return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) 461 } 462 463 func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */ 464 return Xisprint(tls, c) 465 } 466 467 func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */ 468 return Bool32(uint32(c)-uint32('A') < uint32(26)) 469 } 470 471 func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */ 472 return Xisupper(tls, c) 473 } 474 475 func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */ 476 return Bool32(func() int32 { 477 if 0 != 0 { 478 return Xisdigit(tls, c) 479 } 480 return Bool32(uint32(c)-uint32('0') < uint32(10)) 481 }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6)) 482 } 483 484 func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */ 485 return Xisxdigit(tls, c) 486 } 487 488 type off_t = int64 /* alltypes.h:162:16 */ 489 490 type ino_t = uint64 /* alltypes.h:167:25 */ 491 492 type dirent = struct { 493 d_ino ino_t 494 d_off off_t 495 d_reclen uint16 496 d_type uint8 497 d_name [256]int8 498 _ [5]byte 499 } /* dirent.h:5:1 */ 500 501 type __dirstream = struct { 502 tell off_t 503 fd int32 504 buf_pos int32 505 buf_end int32 506 lock [1]int32 507 buf [2048]int8 508 } /* dirent.h:20:9 */ 509 510 type DIR = __dirstream /* dirent.h:20:28 */ 511 512 type ssize_t = int64 /* alltypes.h:65:15 */ 513 514 type intptr_t = int64 /* alltypes.h:70:15 */ 515 516 type pid_t = int32 /* alltypes.h:235:13 */ 517 518 type uid_t = uint32 /* alltypes.h:245:18 */ 519 520 type gid_t = uint32 /* alltypes.h:250:18 */ 521 522 type useconds_t = uint32 /* alltypes.h:260:18 */ 523 524 type div_t = struct { 525 quot int32 526 rem int32 527 } /* stdlib.h:62:35 */ 528 type ldiv_t = struct { 529 quot int64 530 rem int64 531 } /* stdlib.h:63:36 */ 532 type lldiv_t = struct { 533 quot int64 534 rem int64 535 } /* stdlib.h:64:41 */ 536 537 func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */ 538 var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd) 539 Xfree(tls, dir) 540 return ret 541 } 542 543 type mode_t = uint32 /* alltypes.h:152:18 */ 544 545 type iovec = struct { 546 iov_base uintptr 547 iov_len size_t 548 } /* alltypes.h:355:1 */ 549 550 type flock = struct { 551 l_type int16 552 l_whence int16 553 _ [4]byte 554 l_start off_t 555 l_len off_t 556 l_pid pid_t 557 _ [4]byte 558 } /* fcntl.h:24:1 */ 559 560 type file_handle = struct { 561 _ [0]uint32 562 handle_bytes uint32 563 handle_type int32 564 } /* fcntl.h:167:1 */ 565 566 type f_owner_ex = struct { 567 __type int32 568 pid pid_t 569 } /* fcntl.h:172:1 */ 570 571 type syscall_arg_t = int64 /* syscall.h:22:14 */ 572 573 func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */ 574 var fd int32 575 var dir uintptr 576 577 if AssignInt32(&fd, Xopen(tls, name, 00|0200000|02000000, 0)) < 0 { 578 return uintptr(0) 579 } 580 if !(int32(AssignUintptr(&dir, Xcalloc(tls, uint64(1), uint64(unsafe.Sizeof(DIR{}))))) != 0) { 581 X__syscall1(tls, int64(3), int64(fd)) 582 return uintptr(0) 583 } 584 (*DIR)(unsafe.Pointer(dir)).fd = fd 585 return dir 586 } 587 588 type max_align_t = struct { 589 __ll int64 590 __ld float64 591 } /* alltypes.h:41:54 */ 592 593 type dirstream_buf_alignment_check = [1]int8 /* readdir.c:7:14 */ 594 595 func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */ 596 var de uintptr 597 598 if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end { 599 var len int32 = int32(X__syscall3(tls, int64(217), int64((*DIR)(unsafe.Pointer(dir)).fd), int64(dir+24), int64(unsafe.Sizeof([2048]int8{})))) 600 if len <= 0 { 601 if len < 0 && len != -2 { 602 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = -len 603 } 604 return uintptr(0) 605 } 606 (*DIR)(unsafe.Pointer(dir)).buf_end = len 607 (*DIR)(unsafe.Pointer(dir)).buf_pos = 0 608 } 609 de = dir + 24 + uintptr((*DIR)(unsafe.Pointer(dir)).buf_pos) 610 *(*int32)(unsafe.Pointer(dir + 12)) += int32((*dirent)(unsafe.Pointer(de)).d_reclen) 611 (*DIR)(unsafe.Pointer(dir)).tell = (*dirent)(unsafe.Pointer(de)).d_off 612 return de 613 } 614 615 type uintptr_t = uint64 /* alltypes.h:55:24 */ 616 617 type int8_t = int8 /* alltypes.h:96:25 */ 618 619 type int16_t = int16 /* alltypes.h:101:25 */ 620 621 type int32_t = int32 /* alltypes.h:106:25 */ 622 623 type int64_t = int64 /* alltypes.h:111:25 */ 624 625 type intmax_t = int64 /* alltypes.h:116:25 */ 626 627 type uint8_t = uint8 /* alltypes.h:121:25 */ 628 629 type uintmax_t = uint64 /* alltypes.h:146:25 */ 630 631 type int_fast8_t = int8_t /* stdint.h:22:16 */ 632 type int_fast64_t = int64_t /* stdint.h:23:17 */ 633 634 type int_least8_t = int8_t /* stdint.h:25:17 */ 635 type int_least16_t = int16_t /* stdint.h:26:17 */ 636 type int_least32_t = int32_t /* stdint.h:27:17 */ 637 type int_least64_t = int64_t /* stdint.h:28:17 */ 638 639 type uint_fast8_t = uint8_t /* stdint.h:30:17 */ 640 type uint_fast64_t = uint64_t /* stdint.h:31:18 */ 641 642 type uint_least8_t = uint8_t /* stdint.h:33:18 */ 643 type uint_least16_t = uint16_t /* stdint.h:34:18 */ 644 type uint_least32_t = uint32_t /* stdint.h:35:18 */ 645 type uint_least64_t = uint64_t /* stdint.h:36:18 */ 646 647 type int_fast16_t = int32_t /* stdint.h:1:17 */ 648 type int_fast32_t = int32_t /* stdint.h:2:17 */ 649 type uint_fast16_t = uint32_t /* stdint.h:3:18 */ 650 type uint_fast32_t = uint32_t /* stdint.h:4:18 */ 651 652 type _IO_FILE = struct { 653 flags uint32 654 _ [4]byte 655 rpos uintptr 656 rend uintptr 657 close uintptr 658 wend uintptr 659 wpos uintptr 660 mustbezero_1 uintptr 661 wbase uintptr 662 read uintptr 663 write uintptr 664 seek uintptr 665 buf uintptr 666 buf_size size_t 667 prev uintptr 668 next uintptr 669 fd int32 670 pipe_pid int32 671 lockcount int64 672 mode int32 673 lock int32 674 lbf int32 675 _ [4]byte 676 cookie uintptr 677 off off_t 678 getln_buf uintptr 679 mustbezero_2 uintptr 680 shend uintptr 681 shlim off_t 682 shcnt off_t 683 prev_locked uintptr 684 next_locked uintptr 685 locale uintptr 686 } /* alltypes.h:320:9 */ 687 688 type FILE = _IO_FILE /* alltypes.h:320:25 */ 689 690 type va_list = uintptr /* alltypes.h:326:27 */ 691 692 type _G_fpos64_t = struct { 693 _ [0]uint64 694 __opaque [16]int8 695 } /* stdio.h:54:9 */ 696 697 type fpos_t = _G_fpos64_t /* stdio.h:58:3 */ 698 699 type float_t = float32 /* alltypes.h:29:15 */ 700 701 type double_t = float64 /* alltypes.h:34:16 */ 702 703 func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ 704 bp := tls.Alloc(4) 705 defer tls.Free(4) 706 707 // var __u struct {__f float32;} at bp, 4 708 709 *(*float32)(unsafe.Pointer(bp)) = __f 710 return *(*uint32)(unsafe.Pointer(bp)) 711 } 712 713 func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ 714 bp := tls.Alloc(8) 715 defer tls.Free(8) 716 717 // var __u struct {__f float64;} at bp, 8 718 719 *(*float64)(unsafe.Pointer(bp)) = __f 720 return *(*uint64)(unsafe.Pointer(bp)) 721 } 722 723 type __pthread = struct { 724 self uintptr 725 dtv uintptr 726 prev uintptr 727 next uintptr 728 sysinfo uintptr_t 729 canary uintptr_t 730 canary2 uintptr_t 731 tid int32 732 errno_val int32 733 detach_state int32 734 cancel int32 735 canceldisable uint8 736 cancelasync uint8 737 tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */ 738 _ [5]byte 739 map_base uintptr 740 map_size size_t 741 stack uintptr 742 stack_size size_t 743 guard_size size_t 744 result uintptr 745 cancelbuf uintptr 746 tsd uintptr 747 robust_list struct { 748 head uintptr 749 off int64 750 pending uintptr 751 } 752 timer_id int32 753 _ [4]byte 754 locale locale_t 755 killlock [1]int32 756 _ [4]byte 757 dlerror_buf uintptr 758 stdio_locks uintptr 759 canary_at_end uintptr_t 760 dtv_copy uintptr 761 } /* alltypes.h:273:9 */ 762 763 func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ 764 var c int32 765 var x int32 766 var y int64 767 var neg int32 = 0 768 769 c = func() int32 { 770 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 771 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 772 } 773 return X__shgetc(tls, f) 774 }() 775 if c == '+' || c == '-' { 776 neg = Bool32(c == '-') 777 c = func() int32 { 778 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 779 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 780 } 781 return X__shgetc(tls, f) 782 }() 783 if uint32(c-'0') >= 10 && pok != 0 { 784 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 785 (*FILE)(unsafe.Pointer(f)).rpos-- 786 } else { 787 } 788 } 789 } 790 if uint32(c-'0') >= 10 { 791 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 792 (*FILE)(unsafe.Pointer(f)).rpos-- 793 } else { 794 } 795 return -0x7fffffffffffffff - int64(1) 796 } 797 for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 { 798 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 799 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 800 } 801 return X__shgetc(tls, f) 802 }() { 803 x = 10*x + c - '0' 804 } 805 for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 { 806 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 807 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 808 } 809 return X__shgetc(tls, f) 810 }() { 811 y = int64(10)*y + int64(c) - int64('0') 812 } 813 for ; uint32(c-'0') < 10; c = func() int32 { 814 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 815 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 816 } 817 return X__shgetc(tls, f) 818 }() { 819 } 820 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 821 (*FILE)(unsafe.Pointer(f)).rpos-- 822 } else { 823 } 824 if neg != 0 { 825 return -y 826 } 827 return y 828 } 829 830 func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */ 831 bp := tls.Alloc(512) 832 defer tls.Free(512) 833 834 // var x [128]uint32_t at bp, 512 835 836 var i int32 837 var j int32 838 var k int32 839 var a int32 840 var z int32 841 var lrp int64 = int64(0) 842 var dc int64 = int64(0) 843 var e10 int64 = int64(0) 844 var lnz int32 = 0 845 var gotdig int32 = 0 846 var gotrad int32 = 0 847 var rp int32 848 var e2 int32 849 var emax int32 = -emin - bits + 3 850 var denormal int32 = 0 851 var y float64 852 var frac float64 = float64(0) 853 var bias float64 = float64(0) 854 855 j = 0 856 k = 0 857 858 // Don't let leading zeros consume buffer space 859 for ; c == '0'; c = func() int32 { 860 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 861 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 862 } 863 return X__shgetc(tls, f) 864 }() { 865 gotdig = 1 866 } 867 if c == '.' { 868 gotrad = 1 869 for c = func() int32 { 870 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 871 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 872 } 873 return X__shgetc(tls, f) 874 }(); c == '0'; c = func() int32 { 875 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 876 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 877 } 878 return X__shgetc(tls, f) 879 }() { 880 gotdig = 1 881 lrp-- 882 } 883 } 884 885 *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0) 886 for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 { 887 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 888 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 889 } 890 return X__shgetc(tls, f) 891 }() { 892 if c == '.' { 893 if gotrad != 0 { 894 break 895 } 896 gotrad = 1 897 lrp = dc 898 } else if k < 128-3 { 899 dc++ 900 if c != '0' { 901 lnz = int32(dc) 902 } 903 if j != 0 { 904 *(*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') 905 } else { 906 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0') 907 } 908 if PreIncInt32(&j, 1) == 9 { 909 k++ 910 j = 0 911 } 912 gotdig = 1 913 } else { 914 dc++ 915 if c != '0' { 916 lnz = (128 - 4) * 9 917 *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1) 918 } 919 } 920 } 921 if !(gotrad != 0) { 922 lrp = dc 923 } 924 925 if gotdig != 0 && c|32 == 'e' { 926 e10 = scanexp(tls, f, pok) 927 if e10 == -0x7fffffffffffffff-int64(1) { 928 if pok != 0 { 929 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 930 (*FILE)(unsafe.Pointer(f)).rpos-- 931 } else { 932 } 933 } else { 934 X__shlim(tls, f, int64(0)) 935 return float64(0) 936 } 937 e10 = int64(0) 938 } 939 lrp = lrp + e10 940 } else if c >= 0 { 941 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 942 (*FILE)(unsafe.Pointer(f)).rpos-- 943 } else { 944 } 945 } 946 if !(gotdig != 0) { 947 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 948 X__shlim(tls, f, int64(0)) 949 return float64(0) 950 } 951 952 // Handle zero specially to avoid nasty special cases later 953 if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) { 954 return float64(sign) * 0.0 955 } 956 957 // Optimize small integers (w/no exponent) and over/under-flow 958 if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) { 959 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) 960 } 961 if lrp > int64(-emin/2) { 962 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 963 return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 964 } 965 if lrp < int64(emin-2*53) { 966 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 967 return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 968 } 969 970 // Align incomplete final B1B digit 971 if j != 0 { 972 for ; j < 9; j++ { 973 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10) 974 } 975 k++ 976 j = 0 977 } 978 979 a = 0 980 z = k 981 e2 = 0 982 rp = int32(lrp) 983 984 // Optimize small to mid-size integers (even in exp. notation) 985 if lnz < 9 && lnz <= rp && rp < 18 { 986 if rp == 9 { 987 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) 988 } 989 if rp < 9 { 990 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp]) 991 } 992 var bitlim int32 = bits - 3*(rp-9) 993 if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) { 994 return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10]) 995 } 996 } 997 998 // Drop trailing zeros 999 for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- { 1000 } 1001 1002 // Align radix point to B1B digit boundary 1003 if rp%9 != 0 { 1004 var rpm9 int32 1005 if rp >= 0 { 1006 rpm9 = rp % 9 1007 } else { 1008 rpm9 = rp%9 + 9 1009 } 1010 var p10 int32 = _sp10s[8-rpm9] 1011 var carry uint32_t = uint32_t(0) 1012 for k = a; k != z; k++ { 1013 var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10) 1014 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry 1015 carry = uint32_t(1000000000/p10) * tmp 1016 if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 1017 a = (a + 1) & (128 - 1) 1018 rp = rp - 9 1019 } 1020 } 1021 if carry != 0 { 1022 *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry 1023 } 1024 rp = rp + (9 - rpm9) 1025 } 1026 1027 // Upscale until desired number of bits are left of radix point 1028 for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] { 1029 var carry uint32_t = uint32_t(0) 1030 e2 = e2 - 29 1031 for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) { 1032 var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry) 1033 if tmp > uint64(1000000000) { 1034 carry = uint32_t(tmp / uint64(1000000000)) 1035 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000)) 1036 } else { 1037 carry = uint32_t(0) 1038 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp) 1039 } 1040 if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 1041 z = k 1042 } 1043 if k == a { 1044 break 1045 } 1046 } 1047 if carry != 0 { 1048 rp = rp + 9 1049 a = (a - 1) & (128 - 1) 1050 if a == z { 1051 z = (z - 1) & (128 - 1) 1052 *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) 1053 } 1054 *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry 1055 } 1056 } 1057 1058 // Downscale until exactly number of bits are left of radix point 1059 for { 1060 var carry uint32_t = uint32_t(0) 1061 var sh int32 = 1 1062 for i = 0; i < 2; i++ { 1063 k = (a + i) & (128 - 1) 1064 if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] { 1065 i = 2 1066 break 1067 } 1068 if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] { 1069 break 1070 } 1071 } 1072 if i == 2 && rp == 9*2 { 1073 break 1074 } 1075 // FIXME: find a way to compute optimal sh 1076 if rp > 9+9*2 { 1077 sh = 9 1078 } 1079 e2 = e2 + sh 1080 for k = a; k != z; k = (k + 1) & (128 - 1) { 1081 var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<<sh-1) 1082 *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))>>sh + carry 1083 carry = uint32_t(int32(1000000000)>>sh) * tmp 1084 if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { 1085 a = (a + 1) & (128 - 1) 1086 i-- 1087 rp = rp - 9 1088 } 1089 } 1090 if carry != 0 { 1091 if (z+1)&(128-1) != a { 1092 *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry 1093 z = (z + 1) & (128 - 1) 1094 } else { 1095 *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1) 1096 } 1097 } 1098 } 1099 1100 // Assemble desired bits into floating point variable 1101 for y = float64(AssignInt32(&i, 0)); i < 2; i++ { 1102 if (a+i)&(128-1) == z { 1103 *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0) 1104 } 1105 y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))) 1106 } 1107 1108 y = y * float64(sign) 1109 1110 // Limit precision for denormal results 1111 if bits > 53+e2-emin { 1112 bits = 53 + e2 - emin 1113 if bits < 0 { 1114 bits = 0 1115 } 1116 denormal = 1 1117 } 1118 1119 // Calculate bias term to force rounding, move out lower bits 1120 if bits < 53 { 1121 bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y) 1122 frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits)) 1123 y = y - frac 1124 y = y + bias 1125 } 1126 1127 // Process tail of decimal input so it can affect rounding 1128 if (a+i)&(128-1) != z { 1129 var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) 1130 if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) { 1131 frac = frac + 0.25*float64(sign) 1132 } else if t > uint32_t(500000000) { 1133 frac = frac + 0.75*float64(sign) 1134 } else if t == uint32_t(500000000) { 1135 if (a+i+1)&(128-1) == z { 1136 frac = frac + 0.5*float64(sign) 1137 } else { 1138 frac = frac + 0.75*float64(sign) 1139 } 1140 } 1141 if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) { 1142 frac += 1 1143 } 1144 } 1145 1146 y = y + frac 1147 y = y - bias 1148 1149 if (e2+53)&0x7fffffff > emax-5 { 1150 if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 { 1151 if denormal != 0 && bits == 53+e2-emin { 1152 denormal = 0 1153 } 1154 y = y * 0.5 1155 e2++ 1156 } 1157 if e2+53 > emax || denormal != 0 && frac != 0 { 1158 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1159 } 1160 } 1161 1162 return Xscalbnl(tls, y, e2) 1163 } 1164 1165 var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */ 1166 var _sp10s = [8]int32{10, 100, 1000, 10000, 1167 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */ 1168 1169 func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */ 1170 var x uint32_t = uint32_t(0) 1171 var y float64 = float64(0) 1172 var scale float64 = float64(1) 1173 var bias float64 = float64(0) 1174 var gottail int32 = 0 1175 var gotrad int32 = 0 1176 var gotdig int32 = 0 1177 var rp int64 = int64(0) 1178 var dc int64 = int64(0) 1179 var e2 int64 = int64(0) 1180 var d int32 1181 var c int32 1182 1183 c = func() int32 { 1184 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1185 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1186 } 1187 return X__shgetc(tls, f) 1188 }() 1189 1190 // Skip leading zeros 1191 for ; c == '0'; c = func() int32 { 1192 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1193 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1194 } 1195 return X__shgetc(tls, f) 1196 }() { 1197 gotdig = 1 1198 } 1199 1200 if c == '.' { 1201 gotrad = 1 1202 c = func() int32 { 1203 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1204 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1205 } 1206 return X__shgetc(tls, f) 1207 }() 1208 // Count zeros after the radix point before significand 1209 rp = int64(0) 1210 __1: 1211 if !(c == '0') { 1212 goto __3 1213 } 1214 gotdig = 1 1215 goto __2 1216 __2: 1217 c = func() int32 { 1218 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1219 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1220 } 1221 return X__shgetc(tls, f) 1222 }() 1223 rp-- 1224 goto __1 1225 goto __3 1226 __3: 1227 } 1228 1229 for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 { 1230 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1231 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1232 } 1233 return X__shgetc(tls, f) 1234 }() { 1235 if c == '.' { 1236 if gotrad != 0 { 1237 break 1238 } 1239 rp = dc 1240 gotrad = 1 1241 } else { 1242 gotdig = 1 1243 if c > '9' { 1244 d = c | 32 + 10 - 'a' 1245 } else { 1246 d = c - '0' 1247 } 1248 if dc < int64(8) { 1249 x = x*uint32_t(16) + uint32_t(d) 1250 } else if dc < int64(53/4+1) { 1251 y = y + float64(d)*AssignDivFloat64(&scale, float64(16)) 1252 } else if d != 0 && !(gottail != 0) { 1253 y = y + 0.5*scale 1254 gottail = 1 1255 } 1256 dc++ 1257 } 1258 } 1259 if !(gotdig != 0) { 1260 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1261 (*FILE)(unsafe.Pointer(f)).rpos-- 1262 } else { 1263 } 1264 if pok != 0 { 1265 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1266 (*FILE)(unsafe.Pointer(f)).rpos-- 1267 } else { 1268 } 1269 if gotrad != 0 { 1270 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1271 (*FILE)(unsafe.Pointer(f)).rpos-- 1272 } else { 1273 } 1274 } 1275 } else { 1276 X__shlim(tls, f, int64(0)) 1277 } 1278 return float64(sign) * 0.0 1279 } 1280 if !(gotrad != 0) { 1281 rp = dc 1282 } 1283 for dc < int64(8) { 1284 x = x * uint32_t(16) 1285 dc++ 1286 } 1287 if c|32 == 'p' { 1288 e2 = scanexp(tls, f, pok) 1289 if e2 == -0x7fffffffffffffff-int64(1) { 1290 if pok != 0 { 1291 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1292 (*FILE)(unsafe.Pointer(f)).rpos-- 1293 } else { 1294 } 1295 } else { 1296 X__shlim(tls, f, int64(0)) 1297 return float64(0) 1298 } 1299 e2 = int64(0) 1300 } 1301 } else { 1302 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1303 (*FILE)(unsafe.Pointer(f)).rpos-- 1304 } else { 1305 } 1306 } 1307 e2 = e2 + (int64(4)*rp - int64(32)) 1308 1309 if !(x != 0) { 1310 return float64(sign) * 0.0 1311 } 1312 if e2 > int64(-emin) { 1313 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1314 return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 1315 } 1316 if e2 < int64(emin-2*53) { 1317 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1318 return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 1319 } 1320 1321 for x < 0x80000000 { 1322 if y >= 0.5 { 1323 x = x + (x + uint32_t(1)) 1324 y = y + (y - float64(1)) 1325 } else { 1326 x = x + x 1327 y = y + y 1328 } 1329 e2-- 1330 } 1331 1332 if int64(bits) > int64(32)+e2-int64(emin) { 1333 bits = int32(int64(32) + e2 - int64(emin)) 1334 if bits < 0 { 1335 bits = 0 1336 } 1337 } 1338 1339 if bits < 53 { 1340 bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign)) 1341 } 1342 1343 if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) { 1344 x++ 1345 y = float64(0) 1346 } 1347 1348 y = bias + float64(sign)*float64(x) + float64(sign)*y 1349 y = y - bias 1350 1351 if !(y != 0) { 1352 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1353 } 1354 1355 return Xscalbnl(tls, y, int32(e2)) 1356 } 1357 1358 func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */ 1359 var sign int32 = 1 1360 var i size_t 1361 var bits int32 1362 var emin int32 1363 var c int32 1364 1365 switch prec { 1366 case 0: 1367 bits = 24 1368 emin = -125 - bits 1369 break 1370 case 1: 1371 bits = 53 1372 emin = -1021 - bits 1373 break 1374 case 2: 1375 bits = 53 1376 emin = -1021 - bits 1377 break 1378 default: 1379 return float64(0) 1380 } 1381 1382 for __isspace(tls, AssignInt32(&c, func() int32 { 1383 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1384 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1385 } 1386 return X__shgetc(tls, f) 1387 }())) != 0 { 1388 } 1389 1390 if c == '+' || c == '-' { 1391 sign = sign - 2*Bool32(c == '-') 1392 c = func() int32 { 1393 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1394 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1395 } 1396 return X__shgetc(tls, f) 1397 }() 1398 } 1399 1400 for i = uint64(0); i < uint64(8) && c|32 == int32(*(*int8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i)))); i++ { 1401 if i < uint64(7) { 1402 c = func() int32 { 1403 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1404 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1405 } 1406 return X__shgetc(tls, f) 1407 }() 1408 } 1409 } 1410 if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 { 1411 if i != uint64(8) { 1412 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1413 (*FILE)(unsafe.Pointer(f)).rpos-- 1414 } else { 1415 } 1416 if pok != 0 { 1417 for ; i > uint64(3); i-- { 1418 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1419 (*FILE)(unsafe.Pointer(f)).rpos-- 1420 } else { 1421 } 1422 } 1423 } 1424 } 1425 return float64(float32(sign) * X__builtin_inff(tls)) 1426 } 1427 if !(i != 0) { 1428 for i = uint64(0); i < uint64(3) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i)))); i++ { 1429 if i < uint64(2) { 1430 c = func() int32 { 1431 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1432 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1433 } 1434 return X__shgetc(tls, f) 1435 }() 1436 } 1437 } 1438 } 1439 if i == uint64(3) { 1440 if func() int32 { 1441 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1442 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1443 } 1444 return X__shgetc(tls, f) 1445 }() != '(' { 1446 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1447 (*FILE)(unsafe.Pointer(f)).rpos-- 1448 } else { 1449 } 1450 return float64(X__builtin_nanf(tls, ts+13)) 1451 } 1452 for i = uint64(1); ; i++ { 1453 c = func() int32 { 1454 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1455 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1456 } 1457 return X__shgetc(tls, f) 1458 }() 1459 if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' { 1460 continue 1461 } 1462 if c == ')' { 1463 return float64(X__builtin_nanf(tls, ts+13)) 1464 } 1465 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1466 (*FILE)(unsafe.Pointer(f)).rpos-- 1467 } else { 1468 } 1469 if !(pok != 0) { 1470 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1471 X__shlim(tls, f, int64(0)) 1472 return float64(0) 1473 } 1474 for PostDecUint64(&i, 1) != 0 { 1475 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1476 (*FILE)(unsafe.Pointer(f)).rpos-- 1477 } else { 1478 } 1479 } 1480 return float64(X__builtin_nanf(tls, ts+13)) 1481 } 1482 return float64(X__builtin_nanf(tls, ts+13)) 1483 } 1484 1485 if i != 0 { 1486 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1487 (*FILE)(unsafe.Pointer(f)).rpos-- 1488 } else { 1489 } 1490 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1491 X__shlim(tls, f, int64(0)) 1492 return float64(0) 1493 } 1494 1495 if c == '0' { 1496 c = func() int32 { 1497 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1498 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1499 } 1500 return X__shgetc(tls, f) 1501 }() 1502 if c|32 == 'x' { 1503 return hexfloat(tls, f, bits, emin, sign, pok) 1504 } 1505 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1506 (*FILE)(unsafe.Pointer(f)).rpos-- 1507 } else { 1508 } 1509 c = '0' 1510 } 1511 1512 return decfloat(tls, f, c, bits, emin, sign, pok) 1513 } 1514 1515 // Lookup table for digit values. -1==255>=36 -> invalid 1516 var table1 = [257]uint8{Uint8FromInt32(-1), 1517 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), 1518 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), 1519 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), 1520 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), 1521 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), 1522 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), 1523 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), 1524 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), 1525 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), 1526 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), 1527 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), 1528 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), 1529 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), 1530 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), 1531 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), 1532 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), 1533 } /* intscan.c:7:28 */ 1534 1535 func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */ 1536 var val uintptr 1537 var c int32 1538 var neg int32 1539 var x uint32 1540 var y uint64 1541 var bs int32 1542 val = uintptr(unsafe.Pointer(&table1)) + uintptr(1) 1543 neg = 0 1544 if !(base > uint32(36) || base == uint32(1)) { 1545 goto __1 1546 } 1547 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1548 return uint64(0) 1549 __1: 1550 ; 1551 __2: 1552 if !(__isspace(tls, AssignInt32(&c, func() int32 { 1553 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1554 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1555 } 1556 return X__shgetc(tls, f) 1557 }())) != 0) { 1558 goto __3 1559 } 1560 goto __2 1561 __3: 1562 ; 1563 if !(c == '+' || c == '-') { 1564 goto __4 1565 } 1566 neg = -Bool32(c == '-') 1567 c = func() int32 { 1568 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1569 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1570 } 1571 return X__shgetc(tls, f) 1572 }() 1573 __4: 1574 ; 1575 if !((base == uint32(0) || base == uint32(16)) && c == '0') { 1576 goto __5 1577 } 1578 c = func() int32 { 1579 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1580 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1581 } 1582 return X__shgetc(tls, f) 1583 }() 1584 if !(c|32 == 'x') { 1585 goto __7 1586 } 1587 c = func() int32 { 1588 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1589 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1590 } 1591 return X__shgetc(tls, f) 1592 }() 1593 if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) { 1594 goto __9 1595 } 1596 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1597 (*FILE)(unsafe.Pointer(f)).rpos-- 1598 } else { 1599 } 1600 if !(pok != 0) { 1601 goto __10 1602 } 1603 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1604 (*FILE)(unsafe.Pointer(f)).rpos-- 1605 } else { 1606 } 1607 goto __11 1608 __10: 1609 X__shlim(tls, f, int64(0)) 1610 __11: 1611 ; 1612 return uint64(0) 1613 __9: 1614 ; 1615 base = uint32(16) 1616 goto __8 1617 __7: 1618 if !(base == uint32(0)) { 1619 goto __12 1620 } 1621 base = uint32(8) 1622 __12: 1623 ; 1624 __8: 1625 ; 1626 goto __6 1627 __5: 1628 if !(base == uint32(0)) { 1629 goto __13 1630 } 1631 base = uint32(10) 1632 __13: 1633 ; 1634 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) { 1635 goto __14 1636 } 1637 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1638 (*FILE)(unsafe.Pointer(f)).rpos-- 1639 } else { 1640 } 1641 X__shlim(tls, f, int64(0)) 1642 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 1643 return uint64(0) 1644 __14: 1645 ; 1646 __6: 1647 ; 1648 if !(base == uint32(10)) { 1649 goto __15 1650 } 1651 x = uint32(0) 1652 __17: 1653 if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) { 1654 goto __19 1655 } 1656 x = x*uint32(10) + uint32(c-'0') 1657 goto __18 1658 __18: 1659 c = func() int32 { 1660 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1661 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1662 } 1663 return X__shgetc(tls, f) 1664 }() 1665 goto __17 1666 goto __19 1667 __19: 1668 ; 1669 y = uint64(x) 1670 __20: 1671 if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) { 1672 goto __22 1673 } 1674 y = y*uint64(10) + uint64(c-'0') 1675 goto __21 1676 __21: 1677 c = func() int32 { 1678 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1679 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1680 } 1681 return X__shgetc(tls, f) 1682 }() 1683 goto __20 1684 goto __22 1685 __22: 1686 ; 1687 if !(uint32(c-'0') >= 10) { 1688 goto __23 1689 } 1690 goto done 1691 __23: 1692 ; 1693 goto __16 1694 __15: 1695 if !!(base&(base-uint32(1)) != 0) { 1696 goto __24 1697 } 1698 bs = int32(*(*int8)(unsafe.Pointer(ts + 14 + uintptr(uint32(0x17)*base>>5&uint32(7))))) 1699 x = uint32(0) 1700 __26: 1701 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) { 1702 goto __28 1703 } 1704 x = x<<bs | uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1705 goto __27 1706 __27: 1707 c = func() int32 { 1708 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1709 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1710 } 1711 return X__shgetc(tls, f) 1712 }() 1713 goto __26 1714 goto __28 1715 __28: 1716 ; 1717 y = uint64(x) 1718 __29: 1719 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && y <= uint64(2*uint64(0x7fffffffffffffff)+uint64(1))>>bs) { 1720 goto __31 1721 } 1722 y = y<<bs | uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1723 goto __30 1724 __30: 1725 c = func() int32 { 1726 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1727 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1728 } 1729 return X__shgetc(tls, f) 1730 }() 1731 goto __29 1732 goto __31 1733 __31: 1734 ; 1735 goto __25 1736 __24: 1737 x = uint32(0) 1738 __32: 1739 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(36)-uint32(1)) { 1740 goto __34 1741 } 1742 x = x*base + uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1743 goto __33 1744 __33: 1745 c = func() int32 { 1746 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1747 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1748 } 1749 return X__shgetc(tls, f) 1750 }() 1751 goto __32 1752 goto __34 1753 __34: 1754 ; 1755 y = uint64(x) 1756 __35: 1757 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))))) { 1758 goto __37 1759 } 1760 y = y*uint64(base) + uint64(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) 1761 goto __36 1762 __36: 1763 c = func() int32 { 1764 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1765 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1766 } 1767 return X__shgetc(tls, f) 1768 }() 1769 goto __35 1770 goto __37 1771 __37: 1772 ; 1773 __25: 1774 ; 1775 __16: 1776 ; 1777 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { 1778 goto __38 1779 } 1780 __39: 1781 if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base) { 1782 goto __41 1783 } 1784 goto __40 1785 __40: 1786 c = func() int32 { 1787 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 1788 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 1789 } 1790 return X__shgetc(tls, f) 1791 }() 1792 goto __39 1793 goto __41 1794 __41: 1795 ; 1796 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1797 y = lim 1798 if !(lim&uint64(1) != 0) { 1799 goto __42 1800 } 1801 neg = 0 1802 __42: 1803 ; 1804 __38: 1805 ; 1806 done: 1807 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 1808 (*FILE)(unsafe.Pointer(f)).rpos-- 1809 } else { 1810 } 1811 if !(y >= lim) { 1812 goto __43 1813 } 1814 if !(!(lim&uint64(1) != 0) && !(neg != 0)) { 1815 goto __44 1816 } 1817 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1818 return lim - uint64(1) 1819 goto __45 1820 __44: 1821 if !(y > lim) { 1822 goto __46 1823 } 1824 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 1825 return lim 1826 __46: 1827 ; 1828 __45: 1829 ; 1830 __43: 1831 ; 1832 return y ^ uint64(neg) - uint64(neg) 1833 } 1834 1835 // The shcnt field stores the number of bytes read so far, offset by 1836 // the value of buf-rpos at the last function call (__shlim or __shgetc), 1837 // so that between calls the inline shcnt macro can add rpos-buf to get 1838 // the actual count. 1839 1840 func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */ 1841 (*FILE)(unsafe.Pointer(f)).shlim = lim 1842 (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1 1843 // If lim is nonzero, rend must be a valid pointer. 1844 if lim != 0 && (int64((*FILE)(unsafe.Pointer(f)).rend)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 > lim { 1845 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr(lim) 1846 } else { 1847 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend 1848 } 1849 } 1850 1851 func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */ 1852 var c int32 1853 var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 1854 if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 { 1855 (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 + cnt 1856 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos 1857 (*FILE)(unsafe.Pointer(f)).shlim = int64(-1) 1858 return -1 1859 } 1860 cnt++ 1861 if (*FILE)(unsafe.Pointer(f)).shlim != 0 && (int64((*FILE)(unsafe.Pointer(f)).rend)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 > (*FILE)(unsafe.Pointer(f)).shlim-cnt { 1862 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr((*FILE)(unsafe.Pointer(f)).shlim-cnt) 1863 } else { 1864 (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend 1865 } 1866 (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 + cnt 1867 if (*FILE)(unsafe.Pointer(f)).rpos <= (*FILE)(unsafe.Pointer(f)).buf { 1868 *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).rpos + UintptrFromInt32(-1))) = uint8(c) 1869 } 1870 return c 1871 } 1872 1873 type lconv = struct { 1874 decimal_point uintptr 1875 thousands_sep uintptr 1876 grouping uintptr 1877 int_curr_symbol uintptr 1878 currency_symbol uintptr 1879 mon_decimal_point uintptr 1880 mon_thousands_sep uintptr 1881 mon_grouping uintptr 1882 positive_sign uintptr 1883 negative_sign uintptr 1884 int_frac_digits int8 1885 frac_digits int8 1886 p_cs_precedes int8 1887 p_sep_by_space int8 1888 n_cs_precedes int8 1889 n_sep_by_space int8 1890 p_sign_posn int8 1891 n_sign_posn int8 1892 int_p_cs_precedes int8 1893 int_p_sep_by_space int8 1894 int_n_cs_precedes int8 1895 int_n_sep_by_space int8 1896 int_p_sign_posn int8 1897 int_n_sign_posn int8 1898 _ [2]byte 1899 } /* locale.h:24:1 */ 1900 1901 // Support signed or unsigned plain-char 1902 1903 // Implementation choices... 1904 1905 // Arbitrary numbers... 1906 1907 // POSIX/SUS requirements follow. These numbers come directly 1908 // from SUS and have nothing to do with the host system. 1909 1910 var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: Int8FromInt32(255), frac_digits: Int8FromInt32(255), p_cs_precedes: Int8FromInt32(255), p_sep_by_space: Int8FromInt32(255), n_cs_precedes: Int8FromInt32(255), n_sep_by_space: Int8FromInt32(255), p_sign_posn: Int8FromInt32(255), n_sign_posn: Int8FromInt32(255), int_p_cs_precedes: Int8FromInt32(255), int_p_sep_by_space: Int8FromInt32(255), int_n_cs_precedes: Int8FromInt32(255), int_n_sep_by_space: Int8FromInt32(255), int_p_sign_posn: Int8FromInt32(255), int_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */ 1911 1912 func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */ 1913 return uintptr(unsafe.Pointer(&posix_lconv)) 1914 } 1915 1916 func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */ 1917 bp := tls.Alloc(8) 1918 defer tls.Free(8) 1919 1920 *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) { 1921 *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 1922 return r 1923 }() 1924 var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) 1925 if !(e != 0) { 1926 if *(*uint64_t)(unsafe.Pointer(bp))<<1 != 0 { 1927 return 3 1928 } 1929 return 2 1930 } 1931 if e == 0x7ff { 1932 if *(*uint64_t)(unsafe.Pointer(bp))<<12 != 0 { 1933 return 0 1934 } 1935 return 1 1936 } 1937 return 4 1938 } 1939 1940 func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */ 1941 bp := tls.Alloc(4) 1942 defer tls.Free(4) 1943 1944 *(*struct{ f float32 })(unsafe.Pointer(bp)) = func() (r struct{ f float32 }) { 1945 *(*float32)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 1946 return r 1947 }() 1948 var e int32 = int32(*(*uint32_t)(unsafe.Pointer(bp)) >> 23 & uint32_t(0xff)) 1949 if !(e != 0) { 1950 if *(*uint32_t)(unsafe.Pointer(bp))<<1 != 0 { 1951 return 3 1952 } 1953 return 2 1954 } 1955 if e == 0xff { 1956 if *(*uint32_t)(unsafe.Pointer(bp))<<9 != 0 { 1957 return 0 1958 } 1959 return 1 1960 } 1961 return 4 1962 } 1963 1964 func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */ 1965 return X__fpclassify(tls, x) 1966 } 1967 1968 func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */ 1969 return Xcopysign(tls, x, y) 1970 } 1971 1972 func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */ 1973 return Xfabs(tls, x) 1974 } 1975 1976 func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */ 1977 return Xfmod(tls, x, y) 1978 } 1979 1980 func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ 1981 return X__builtin_nanf(tls, ts+13) 1982 } 1983 1984 var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */ 1985 1986 func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ 1987 bp := tls.Alloc(8) 1988 defer tls.Free(8) 1989 1990 *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) { 1991 *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x 1992 return r 1993 }() 1994 var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) 1995 var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63) 1996 var y double_t 1997 1998 if e >= 0x3ff+52 { 1999 return x 2000 } 2001 if s != 0 { 2002 y = x - toint + toint 2003 } else { 2004 y = x + toint - toint 2005 } 2006 if y == float64(0) { 2007 if s != 0 { 2008 return -Float64FromFloat64(0.0) 2009 } 2010 return float64(0) 2011 } 2012 return y 2013 } 2014 2015 func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ 2016 bp := tls.Alloc(8) 2017 defer tls.Free(8) 2018 2019 // var u struct {f float64;} at bp, 8 2020 2021 var y double_t = x 2022 2023 if n > 1023 { 2024 y = y * 0x1p1023 2025 n = n - 1023 2026 if n > 1023 { 2027 y = y * 0x1p1023 2028 n = n - 1023 2029 if n > 1023 { 2030 n = 1023 2031 } 2032 } 2033 } else if n < -1022 { 2034 // make sure final n < -53 to avoid double 2035 // rounding in the subnormal range 2036 y = y * (float64(0x1p-1022) * 0x1p53) 2037 n = n + (1022 - 53) 2038 if n < -1022 { 2039 y = y * (float64(0x1p-1022) * 0x1p53) 2040 n = n + (1022 - 53) 2041 if n < -1022 { 2042 n = -1022 2043 } 2044 } 2045 } 2046 *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52 2047 x = y * *(*float64)(unsafe.Pointer(bp)) 2048 return x 2049 } 2050 2051 func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ 2052 return Xscalbn(tls, x, n) 2053 } 2054 2055 // Support signed or unsigned plain-char 2056 2057 // Implementation choices... 2058 2059 // Arbitrary numbers... 2060 2061 // POSIX/SUS requirements follow. These numbers come directly 2062 // from SUS and have nothing to do with the host system. 2063 2064 type __locale_map = struct { 2065 __map uintptr 2066 map_size size_t 2067 name [24]int8 2068 next uintptr 2069 } /* alltypes.h:343:9 */ 2070 2071 type tls_module = struct { 2072 next uintptr 2073 image uintptr 2074 len size_t 2075 size size_t 2076 align size_t 2077 offset size_t 2078 } /* libc.h:14:1 */ 2079 2080 type __libc = struct { 2081 can_do_threads int8 2082 threaded int8 2083 secure int8 2084 need_locks int8 2085 threads_minus_1 int32 2086 auxv uintptr 2087 tls_head uintptr 2088 tls_size size_t 2089 tls_align size_t 2090 tls_cnt size_t 2091 page_size size_t 2092 global_locale struct{ cat [6]uintptr } 2093 } /* libc.h:20:1 */ 2094 2095 type time_t = int64 /* alltypes.h:85:16 */ 2096 2097 type clockid_t = int32 /* alltypes.h:214:13 */ 2098 2099 type timespec = struct { 2100 tv_sec time_t 2101 tv_nsec int64 2102 } /* alltypes.h:229:1 */ 2103 2104 type pthread_t = uintptr /* alltypes.h:273:26 */ 2105 2106 type pthread_once_t = int32 /* alltypes.h:279:13 */ 2107 2108 type pthread_key_t = uint32 /* alltypes.h:284:18 */ 2109 2110 type pthread_spinlock_t = int32 /* alltypes.h:289:13 */ 2111 2112 type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:294:37 */ 2113 2114 type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:299:37 */ 2115 2116 type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:304:37 */ 2117 2118 type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:309:40 */ 2119 2120 type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:349:9 */ 2121 2122 type sigset_t = __sigset_t /* alltypes.h:349:71 */ 2123 2124 type pthread_attr_t = struct { 2125 __u struct { 2126 _ [0]uint64 2127 __i [14]int32 2128 } 2129 } /* alltypes.h:372:147 */ 2130 2131 type pthread_mutex_t = struct { 2132 __u struct { 2133 _ [0]uint64 2134 __i [10]int32 2135 } 2136 } /* alltypes.h:377:157 */ 2137 2138 type pthread_cond_t = struct { 2139 __u struct { 2140 _ [0]uint64 2141 __i [12]int32 2142 } 2143 } /* alltypes.h:387:112 */ 2144 2145 type pthread_rwlock_t = struct { 2146 __u struct { 2147 _ [0]uint64 2148 __i [14]int32 2149 } 2150 } /* alltypes.h:397:139 */ 2151 2152 type pthread_barrier_t = struct { 2153 __u struct { 2154 _ [0]uint64 2155 __i [8]int32 2156 } 2157 } /* alltypes.h:402:137 */ 2158 2159 type sched_param = struct { 2160 sched_priority int32 2161 __reserved1 int32 2162 __reserved2 [2]struct { 2163 __reserved1 time_t 2164 __reserved2 int64 2165 } 2166 __reserved3 int32 2167 _ [4]byte 2168 } /* sched.h:19:1 */ 2169 2170 type timer_t = uintptr /* alltypes.h:209:14 */ 2171 2172 type clock_t = int64 /* alltypes.h:219:14 */ 2173 2174 type tm = struct { 2175 tm_sec int32 2176 tm_min int32 2177 tm_hour int32 2178 tm_mday int32 2179 tm_mon int32 2180 tm_year int32 2181 tm_wday int32 2182 tm_yday int32 2183 tm_isdst int32 2184 _ [4]byte 2185 tm_gmtoff int64 2186 tm_zone uintptr 2187 } /* time.h:38:1 */ 2188 2189 type itimerspec = struct { 2190 it_interval struct { 2191 tv_sec time_t 2192 tv_nsec int64 2193 } 2194 it_value struct { 2195 tv_sec time_t 2196 tv_nsec int64 2197 } 2198 } /* time.h:80:1 */ 2199 2200 type sigevent = struct { 2201 sigev_value struct { 2202 _ [0]uint64 2203 sival_int int32 2204 _ [4]byte 2205 } 2206 sigev_signo int32 2207 sigev_notify int32 2208 sigev_notify_function uintptr 2209 sigev_notify_attributes uintptr 2210 __pad [32]int8 2211 } /* time.h:107:1 */ 2212 2213 type __ptcb = struct { 2214 __f uintptr 2215 __x uintptr 2216 __next uintptr 2217 } /* alltypes.h:273:9 */ 2218 2219 type sigaltstack = struct { 2220 ss_sp uintptr 2221 ss_flags int32 2222 _ [4]byte 2223 ss_size size_t 2224 } /* signal.h:44:9 */ 2225 2226 type stack_t = sigaltstack /* signal.h:44:28 */ 2227 2228 type greg_t = int64 /* signal.h:59:19 */ 2229 type gregset_t = [23]int64 /* signal.h:59:27 */ 2230 type _fpstate = struct { 2231 cwd uint16 2232 swd uint16 2233 ftw uint16 2234 fop uint16 2235 rip uint64 2236 rdp uint64 2237 mxcsr uint32 2238 mxcr_mask uint32 2239 _st [8]struct { 2240 significand [4]uint16 2241 exponent uint16 2242 padding [3]uint16 2243 } 2244 _xmm [16]struct{ element [4]uint32 } 2245 padding [24]uint32 2246 } /* signal.h:60:9 */ 2247 2248 type fpregset_t = uintptr /* signal.h:71:3 */ 2249 type sigcontext = struct { 2250 r8 uint64 2251 r9 uint64 2252 r10 uint64 2253 r11 uint64 2254 r12 uint64 2255 r13 uint64 2256 r14 uint64 2257 r15 uint64 2258 rdi uint64 2259 rsi uint64 2260 rbp uint64 2261 rbx uint64 2262 rdx uint64 2263 rax uint64 2264 rcx uint64 2265 rsp uint64 2266 rip uint64 2267 eflags uint64 2268 cs uint16 2269 gs uint16 2270 fs uint16 2271 __pad0 uint16 2272 err uint64 2273 trapno uint64 2274 oldmask uint64 2275 cr2 uint64 2276 fpstate uintptr 2277 __reserved1 [8]uint64 2278 } /* signal.h:72:1 */ 2279 2280 type mcontext_t = struct { 2281 gregs gregset_t 2282 fpregs fpregset_t 2283 __reserved1 [8]uint64 2284 } /* signal.h:84:3 */ 2285 2286 type __ucontext = struct { 2287 uc_flags uint64 2288 uc_link uintptr 2289 uc_stack stack_t 2290 uc_mcontext mcontext_t 2291 uc_sigmask sigset_t 2292 __fpregs_mem [64]uint64 2293 } /* signal.h:97:9 */ 2294 2295 type ucontext_t = __ucontext /* signal.h:104:3 */ 2296 2297 type sigval = struct { 2298 _ [0]uint64 2299 sival_int int32 2300 _ [4]byte 2301 } /* time.h:107:1 */ 2302 2303 type siginfo_t = struct { 2304 si_signo int32 2305 si_errno int32 2306 si_code int32 2307 _ [4]byte 2308 __si_fields struct { 2309 _ [0]uint64 2310 __pad [112]int8 2311 } 2312 } /* signal.h:145:3 */ 2313 2314 type sigaction = struct { 2315 __sa_handler struct{ sa_handler uintptr } 2316 sa_mask sigset_t 2317 sa_flags int32 2318 _ [4]byte 2319 sa_restorer uintptr 2320 } /* signal.h:167:1 */ 2321 2322 type sig_t = uintptr /* signal.h:251:14 */ 2323 2324 type sig_atomic_t = int32 /* signal.h:269:13 */ 2325 2326 func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:2:19: */ 2327 panic(`arch/x86_64/atomic_arch.h:4:2: assembler statements not supported`) 2328 return t 2329 } 2330 2331 func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic_arch.h:20:19: */ 2332 panic(`arch/x86_64/atomic_arch.h:22:2: assembler statements not supported`) 2333 return v 2334 } 2335 2336 func a_or(tls *TLS, p uintptr, v int32) { /* atomic_arch.h:46:20: */ 2337 panic(`arch/x86_64/atomic_arch.h:48:2: assembler statements not supported`) 2338 } 2339 2340 func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic_arch.h:62:20: */ 2341 panic(`arch/x86_64/atomic_arch.h:64:2: assembler statements not supported`) 2342 } 2343 2344 func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic_arch.h:112:19: */ 2345 panic(`arch/x86_64/atomic_arch.h:114:2: assembler statements not supported`) 2346 return int32(x) 2347 } 2348 2349 func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ 2350 return int32(_sdebruijn328[x&-x*uint32_t(0x076be629)>>27]) 2351 } 2352 2353 var _sdebruijn328 = [32]int8{ 2354 int8(0), int8(1), int8(23), int8(2), int8(29), int8(24), int8(19), int8(3), int8(30), int8(27), int8(25), int8(11), int8(20), int8(8), int8(4), int8(13), 2355 int8(31), int8(22), int8(28), int8(18), int8(26), int8(10), int8(7), int8(12), int8(21), int8(17), int8(9), int8(6), int8(16), int8(5), int8(15), int8(14), 2356 } /* atomic.h:261:20 */ 2357 2358 type __timer = struct { 2359 timerid int32 2360 _ [4]byte 2361 thread pthread_t 2362 } /* pthread_impl.h:64:1 */ 2363 2364 func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */ 2365 var self uintptr 2366 panic(`arch/x86_64/pthread_arch.h:4:2: assembler statements not supported`) 2367 return self 2368 } 2369 2370 func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */ 2371 if priv != 0 { 2372 priv = 128 2373 } 2374 if cnt < 0 { 2375 cnt = 0x7fffffff 2376 } 2377 _ = Bool32(X__syscall3(tls, int64(202), int64(addr), int64(1|priv), int64(cnt)) != int64(-38) || X__syscall3(tls, int64(202), int64(addr), int64(1), int64(cnt)) != 0) 2378 } 2379 2380 func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ 2381 if priv != 0 { 2382 priv = 128 2383 } 2384 _ = Bool32(X__syscall4(tls, int64(202), int64(addr), int64(0|priv), int64(val), int64(0)) != int64(-38) || X__syscall4(tls, int64(202), int64(addr), int64(0), int64(val), int64(0)) != 0) 2385 } 2386 2387 var X__fsmu8 = [51]uint32_t{ 2388 func() uint32 { 2389 if 0x2 < 2 { 2390 return Uint32FromInt32(-1) 2391 } 2392 return func() uint32 { 2393 if Int32(0x80) == Int32(0x80) { 2394 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2395 } 2396 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2397 }()<<23 | uint32_t(0x2) 2398 }(), func() uint32 { 2399 if 0x3 < 2 { 2400 return Uint32FromInt32(-1) 2401 } 2402 return func() uint32 { 2403 if Int32(0x80) == Int32(0x80) { 2404 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2405 } 2406 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2407 }()<<23 | uint32_t(0x3) 2408 }(), func() uint32 { 2409 if 0x4 < 2 { 2410 return Uint32FromInt32(-1) 2411 } 2412 return func() uint32 { 2413 if Int32(0x80) == Int32(0x80) { 2414 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2415 } 2416 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2417 }()<<23 | uint32_t(0x4) 2418 }(), func() uint32 { 2419 if 0x5 < 2 { 2420 return Uint32FromInt32(-1) 2421 } 2422 return func() uint32 { 2423 if Int32(0x80) == Int32(0x80) { 2424 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2425 } 2426 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2427 }()<<23 | uint32_t(0x5) 2428 }(), func() uint32 { 2429 if 0x6 < 2 { 2430 return Uint32FromInt32(-1) 2431 } 2432 return func() uint32 { 2433 if Int32(0x80) == Int32(0x80) { 2434 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2435 } 2436 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2437 }()<<23 | uint32_t(0x6) 2438 }(), func() uint32 { 2439 if 0x7 < 2 { 2440 return Uint32FromInt32(-1) 2441 } 2442 return func() uint32 { 2443 if Int32(0x80) == Int32(0x80) { 2444 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2445 } 2446 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2447 }()<<23 | uint32_t(0x7) 2448 }(), 2449 func() uint32 { 2450 if 0x8 < 2 { 2451 return Uint32FromInt32(-1) 2452 } 2453 return func() uint32 { 2454 if Int32(0x80) == Int32(0x80) { 2455 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2456 } 2457 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2458 }()<<23 | uint32_t(0x8) 2459 }(), func() uint32 { 2460 if 0x9 < 2 { 2461 return Uint32FromInt32(-1) 2462 } 2463 return func() uint32 { 2464 if Int32(0x80) == Int32(0x80) { 2465 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2466 } 2467 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2468 }()<<23 | uint32_t(0x9) 2469 }(), func() uint32 { 2470 if 0xa < 2 { 2471 return Uint32FromInt32(-1) 2472 } 2473 return func() uint32 { 2474 if Int32(0x80) == Int32(0x80) { 2475 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2476 } 2477 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2478 }()<<23 | uint32_t(0xa) 2479 }(), func() uint32 { 2480 if 0xb < 2 { 2481 return Uint32FromInt32(-1) 2482 } 2483 return func() uint32 { 2484 if Int32(0x80) == Int32(0x80) { 2485 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2486 } 2487 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2488 }()<<23 | uint32_t(0xb) 2489 }(), func() uint32 { 2490 if 0xc < 2 { 2491 return Uint32FromInt32(-1) 2492 } 2493 return func() uint32 { 2494 if Int32(0x80) == Int32(0x80) { 2495 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2496 } 2497 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2498 }()<<23 | uint32_t(0xc) 2499 }(), func() uint32 { 2500 if 0xd < 2 { 2501 return Uint32FromInt32(-1) 2502 } 2503 return func() uint32 { 2504 if Int32(0x80) == Int32(0x80) { 2505 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2506 } 2507 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2508 }()<<23 | uint32_t(0xd) 2509 }(), func() uint32 { 2510 if 0xe < 2 { 2511 return Uint32FromInt32(-1) 2512 } 2513 return func() uint32 { 2514 if Int32(0x80) == Int32(0x80) { 2515 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2516 } 2517 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2518 }()<<23 | uint32_t(0xe) 2519 }(), func() uint32 { 2520 if 0xf < 2 { 2521 return Uint32FromInt32(-1) 2522 } 2523 return func() uint32 { 2524 if Int32(0x80) == Int32(0x80) { 2525 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2526 } 2527 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2528 }()<<23 | uint32_t(0xf) 2529 }(), 2530 func() uint32 { 2531 if 0x0+16 < 2 { 2532 return Uint32FromInt32(-1) 2533 } 2534 return func() uint32 { 2535 if Int32(0x80) == Int32(0x80) { 2536 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2537 } 2538 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2539 }()<<23 | uint32_t(0x0+16) 2540 }(), func() uint32 { 2541 if 0x1+16 < 2 { 2542 return Uint32FromInt32(-1) 2543 } 2544 return func() uint32 { 2545 if Int32(0x80) == Int32(0x80) { 2546 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2547 } 2548 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2549 }()<<23 | uint32_t(0x1+16) 2550 }(), func() uint32 { 2551 if 0x2+16 < 2 { 2552 return Uint32FromInt32(-1) 2553 } 2554 return func() uint32 { 2555 if Int32(0x80) == Int32(0x80) { 2556 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2557 } 2558 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2559 }()<<23 | uint32_t(0x2+16) 2560 }(), func() uint32 { 2561 if 0x3+16 < 2 { 2562 return Uint32FromInt32(-1) 2563 } 2564 return func() uint32 { 2565 if Int32(0x80) == Int32(0x80) { 2566 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2567 } 2568 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2569 }()<<23 | uint32_t(0x3+16) 2570 }(), func() uint32 { 2571 if 0x4+16 < 2 { 2572 return Uint32FromInt32(-1) 2573 } 2574 return func() uint32 { 2575 if Int32(0x80) == Int32(0x80) { 2576 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2577 } 2578 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2579 }()<<23 | uint32_t(0x4+16) 2580 }(), func() uint32 { 2581 if 0x5+16 < 2 { 2582 return Uint32FromInt32(-1) 2583 } 2584 return func() uint32 { 2585 if Int32(0x80) == Int32(0x80) { 2586 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2587 } 2588 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2589 }()<<23 | uint32_t(0x5+16) 2590 }(), func() uint32 { 2591 if 0x6+16 < 2 { 2592 return Uint32FromInt32(-1) 2593 } 2594 return func() uint32 { 2595 if Int32(0x80) == Int32(0x80) { 2596 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2597 } 2598 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2599 }()<<23 | uint32_t(0x6+16) 2600 }(), func() uint32 { 2601 if 0x7+16 < 2 { 2602 return Uint32FromInt32(-1) 2603 } 2604 return func() uint32 { 2605 if Int32(0x80) == Int32(0x80) { 2606 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2607 } 2608 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2609 }()<<23 | uint32_t(0x7+16) 2610 }(), 2611 func() uint32 { 2612 if 0x8+16 < 2 { 2613 return Uint32FromInt32(-1) 2614 } 2615 return func() uint32 { 2616 if Int32(0x80) == Int32(0x80) { 2617 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2618 } 2619 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2620 }()<<23 | uint32_t(0x8+16) 2621 }(), func() uint32 { 2622 if 0x9+16 < 2 { 2623 return Uint32FromInt32(-1) 2624 } 2625 return func() uint32 { 2626 if Int32(0x80) == Int32(0x80) { 2627 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2628 } 2629 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2630 }()<<23 | uint32_t(0x9+16) 2631 }(), func() uint32 { 2632 if 0xa+16 < 2 { 2633 return Uint32FromInt32(-1) 2634 } 2635 return func() uint32 { 2636 if Int32(0x80) == Int32(0x80) { 2637 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2638 } 2639 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2640 }()<<23 | uint32_t(0xa+16) 2641 }(), func() uint32 { 2642 if 0xb+16 < 2 { 2643 return Uint32FromInt32(-1) 2644 } 2645 return func() uint32 { 2646 if Int32(0x80) == Int32(0x80) { 2647 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2648 } 2649 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2650 }()<<23 | uint32_t(0xb+16) 2651 }(), func() uint32 { 2652 if 0xc+16 < 2 { 2653 return Uint32FromInt32(-1) 2654 } 2655 return func() uint32 { 2656 if Int32(0x80) == Int32(0x80) { 2657 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2658 } 2659 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2660 }()<<23 | uint32_t(0xc+16) 2661 }(), func() uint32 { 2662 if 0xd+16 < 2 { 2663 return Uint32FromInt32(-1) 2664 } 2665 return func() uint32 { 2666 if Int32(0x80) == Int32(0x80) { 2667 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2668 } 2669 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2670 }()<<23 | uint32_t(0xd+16) 2671 }(), func() uint32 { 2672 if 0xe+16 < 2 { 2673 return Uint32FromInt32(-1) 2674 } 2675 return func() uint32 { 2676 if Int32(0x80) == Int32(0x80) { 2677 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2678 } 2679 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2680 }()<<23 | uint32_t(0xe+16) 2681 }(), func() uint32 { 2682 if 0xf+16 < 2 { 2683 return Uint32FromInt32(-1) 2684 } 2685 return func() uint32 { 2686 if Int32(0x80) == Int32(0x80) { 2687 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2688 } 2689 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2690 }()<<23 | uint32_t(0xf+16) 2691 }(), 2692 func() uint32 { 2693 if 0x0 == 0 { 2694 return func() uint32 { 2695 if Int32(0xa0) == Int32(0x80) { 2696 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2697 } 2698 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2699 }() << 23 2700 } 2701 return func() uint32 { 2702 if 0x0 == 0xd { 2703 return func() uint32 { 2704 if Int32(0x80) == Int32(0x80) { 2705 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2706 } 2707 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2708 }() << 23 2709 } 2710 return func() uint32 { 2711 if Int32(0x80) == Int32(0x80) { 2712 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2713 } 2714 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2715 }() << 23 2716 }() 2717 }() | uint32_t(func() uint32 { 2718 if Int32(0x80) == Int32(0x80) { 2719 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2720 } 2721 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2722 }()<<23)>>6 | uint32_t(0x0), func() uint32 { 2723 if 0x1 == 0 { 2724 return func() uint32 { 2725 if Int32(0xa0) == Int32(0x80) { 2726 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2727 } 2728 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2729 }() << 23 2730 } 2731 return func() uint32 { 2732 if 0x1 == 0xd { 2733 return func() uint32 { 2734 if Int32(0x80) == Int32(0x80) { 2735 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2736 } 2737 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2738 }() << 23 2739 } 2740 return func() uint32 { 2741 if Int32(0x80) == Int32(0x80) { 2742 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2743 } 2744 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2745 }() << 23 2746 }() 2747 }() | uint32_t(func() uint32 { 2748 if Int32(0x80) == Int32(0x80) { 2749 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2750 } 2751 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2752 }()<<23)>>6 | uint32_t(0x1), func() uint32 { 2753 if 0x2 == 0 { 2754 return func() uint32 { 2755 if Int32(0xa0) == Int32(0x80) { 2756 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2757 } 2758 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2759 }() << 23 2760 } 2761 return func() uint32 { 2762 if 0x2 == 0xd { 2763 return func() uint32 { 2764 if Int32(0x80) == Int32(0x80) { 2765 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2766 } 2767 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2768 }() << 23 2769 } 2770 return func() uint32 { 2771 if Int32(0x80) == Int32(0x80) { 2772 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2773 } 2774 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2775 }() << 23 2776 }() 2777 }() | uint32_t(func() uint32 { 2778 if Int32(0x80) == Int32(0x80) { 2779 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2780 } 2781 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2782 }()<<23)>>6 | uint32_t(0x2), func() uint32 { 2783 if 0x3 == 0 { 2784 return func() uint32 { 2785 if Int32(0xa0) == Int32(0x80) { 2786 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2787 } 2788 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2789 }() << 23 2790 } 2791 return func() uint32 { 2792 if 0x3 == 0xd { 2793 return func() uint32 { 2794 if Int32(0x80) == Int32(0x80) { 2795 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2796 } 2797 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2798 }() << 23 2799 } 2800 return func() uint32 { 2801 if Int32(0x80) == Int32(0x80) { 2802 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2803 } 2804 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2805 }() << 23 2806 }() 2807 }() | uint32_t(func() uint32 { 2808 if Int32(0x80) == Int32(0x80) { 2809 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2810 } 2811 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2812 }()<<23)>>6 | uint32_t(0x3), func() uint32 { 2813 if 0x4 == 0 { 2814 return func() uint32 { 2815 if Int32(0xa0) == Int32(0x80) { 2816 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2817 } 2818 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2819 }() << 23 2820 } 2821 return func() uint32 { 2822 if 0x4 == 0xd { 2823 return func() uint32 { 2824 if Int32(0x80) == Int32(0x80) { 2825 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2826 } 2827 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2828 }() << 23 2829 } 2830 return func() uint32 { 2831 if Int32(0x80) == Int32(0x80) { 2832 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2833 } 2834 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2835 }() << 23 2836 }() 2837 }() | uint32_t(func() uint32 { 2838 if Int32(0x80) == Int32(0x80) { 2839 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2840 } 2841 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2842 }()<<23)>>6 | uint32_t(0x4), func() uint32 { 2843 if 0x5 == 0 { 2844 return func() uint32 { 2845 if Int32(0xa0) == Int32(0x80) { 2846 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2847 } 2848 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2849 }() << 23 2850 } 2851 return func() uint32 { 2852 if 0x5 == 0xd { 2853 return func() uint32 { 2854 if Int32(0x80) == Int32(0x80) { 2855 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2856 } 2857 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2858 }() << 23 2859 } 2860 return func() uint32 { 2861 if Int32(0x80) == Int32(0x80) { 2862 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2863 } 2864 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2865 }() << 23 2866 }() 2867 }() | uint32_t(func() uint32 { 2868 if Int32(0x80) == Int32(0x80) { 2869 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2870 } 2871 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2872 }()<<23)>>6 | uint32_t(0x5), func() uint32 { 2873 if 0x6 == 0 { 2874 return func() uint32 { 2875 if Int32(0xa0) == Int32(0x80) { 2876 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2877 } 2878 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2879 }() << 23 2880 } 2881 return func() uint32 { 2882 if 0x6 == 0xd { 2883 return func() uint32 { 2884 if Int32(0x80) == Int32(0x80) { 2885 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2886 } 2887 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2888 }() << 23 2889 } 2890 return func() uint32 { 2891 if Int32(0x80) == Int32(0x80) { 2892 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2893 } 2894 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2895 }() << 23 2896 }() 2897 }() | uint32_t(func() uint32 { 2898 if Int32(0x80) == Int32(0x80) { 2899 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2900 } 2901 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2902 }()<<23)>>6 | uint32_t(0x6), func() uint32 { 2903 if 0x7 == 0 { 2904 return func() uint32 { 2905 if Int32(0xa0) == Int32(0x80) { 2906 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2907 } 2908 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2909 }() << 23 2910 } 2911 return func() uint32 { 2912 if 0x7 == 0xd { 2913 return func() uint32 { 2914 if Int32(0x80) == Int32(0x80) { 2915 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2916 } 2917 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2918 }() << 23 2919 } 2920 return func() uint32 { 2921 if Int32(0x80) == Int32(0x80) { 2922 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2923 } 2924 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2925 }() << 23 2926 }() 2927 }() | uint32_t(func() uint32 { 2928 if Int32(0x80) == Int32(0x80) { 2929 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2930 } 2931 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2932 }()<<23)>>6 | uint32_t(0x7), 2933 func() uint32 { 2934 if 0x8 == 0 { 2935 return func() uint32 { 2936 if Int32(0xa0) == Int32(0x80) { 2937 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2938 } 2939 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2940 }() << 23 2941 } 2942 return func() uint32 { 2943 if 0x8 == 0xd { 2944 return func() uint32 { 2945 if Int32(0x80) == Int32(0x80) { 2946 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2947 } 2948 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2949 }() << 23 2950 } 2951 return func() uint32 { 2952 if Int32(0x80) == Int32(0x80) { 2953 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2954 } 2955 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2956 }() << 23 2957 }() 2958 }() | uint32_t(func() uint32 { 2959 if Int32(0x80) == Int32(0x80) { 2960 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2961 } 2962 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2963 }()<<23)>>6 | uint32_t(0x8), func() uint32 { 2964 if 0x9 == 0 { 2965 return func() uint32 { 2966 if Int32(0xa0) == Int32(0x80) { 2967 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2968 } 2969 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2970 }() << 23 2971 } 2972 return func() uint32 { 2973 if 0x9 == 0xd { 2974 return func() uint32 { 2975 if Int32(0x80) == Int32(0x80) { 2976 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2977 } 2978 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2979 }() << 23 2980 } 2981 return func() uint32 { 2982 if Int32(0x80) == Int32(0x80) { 2983 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2984 } 2985 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2986 }() << 23 2987 }() 2988 }() | uint32_t(func() uint32 { 2989 if Int32(0x80) == Int32(0x80) { 2990 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2991 } 2992 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2993 }()<<23)>>6 | uint32_t(0x9), func() uint32 { 2994 if 0xa == 0 { 2995 return func() uint32 { 2996 if Int32(0xa0) == Int32(0x80) { 2997 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2998 } 2999 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3000 }() << 23 3001 } 3002 return func() uint32 { 3003 if 0xa == 0xd { 3004 return func() uint32 { 3005 if Int32(0x80) == Int32(0x80) { 3006 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3007 } 3008 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3009 }() << 23 3010 } 3011 return func() uint32 { 3012 if Int32(0x80) == Int32(0x80) { 3013 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3014 } 3015 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3016 }() << 23 3017 }() 3018 }() | uint32_t(func() uint32 { 3019 if Int32(0x80) == Int32(0x80) { 3020 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3021 } 3022 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3023 }()<<23)>>6 | uint32_t(0xa), func() uint32 { 3024 if 0xb == 0 { 3025 return func() uint32 { 3026 if Int32(0xa0) == Int32(0x80) { 3027 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3028 } 3029 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3030 }() << 23 3031 } 3032 return func() uint32 { 3033 if 0xb == 0xd { 3034 return func() uint32 { 3035 if Int32(0x80) == Int32(0x80) { 3036 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3037 } 3038 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3039 }() << 23 3040 } 3041 return func() uint32 { 3042 if Int32(0x80) == Int32(0x80) { 3043 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3044 } 3045 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3046 }() << 23 3047 }() 3048 }() | uint32_t(func() uint32 { 3049 if Int32(0x80) == Int32(0x80) { 3050 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3051 } 3052 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3053 }()<<23)>>6 | uint32_t(0xb), func() uint32 { 3054 if 0xc == 0 { 3055 return func() uint32 { 3056 if Int32(0xa0) == Int32(0x80) { 3057 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3058 } 3059 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3060 }() << 23 3061 } 3062 return func() uint32 { 3063 if 0xc == 0xd { 3064 return func() uint32 { 3065 if Int32(0x80) == Int32(0x80) { 3066 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3067 } 3068 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3069 }() << 23 3070 } 3071 return func() uint32 { 3072 if Int32(0x80) == Int32(0x80) { 3073 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3074 } 3075 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3076 }() << 23 3077 }() 3078 }() | uint32_t(func() uint32 { 3079 if Int32(0x80) == Int32(0x80) { 3080 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3081 } 3082 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3083 }()<<23)>>6 | uint32_t(0xc), func() uint32 { 3084 if 0xd == 0 { 3085 return func() uint32 { 3086 if Int32(0xa0) == Int32(0x80) { 3087 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3088 } 3089 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3090 }() << 23 3091 } 3092 return func() uint32 { 3093 if 0xd == 0xd { 3094 return func() uint32 { 3095 if Int32(0x80) == Int32(0x80) { 3096 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3097 } 3098 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3099 }() << 23 3100 } 3101 return func() uint32 { 3102 if Int32(0x80) == Int32(0x80) { 3103 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3104 } 3105 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3106 }() << 23 3107 }() 3108 }() | uint32_t(func() uint32 { 3109 if Int32(0x80) == Int32(0x80) { 3110 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3111 } 3112 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3113 }()<<23)>>6 | uint32_t(0xd), func() uint32 { 3114 if 0xe == 0 { 3115 return func() uint32 { 3116 if Int32(0xa0) == Int32(0x80) { 3117 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3118 } 3119 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3120 }() << 23 3121 } 3122 return func() uint32 { 3123 if 0xe == 0xd { 3124 return func() uint32 { 3125 if Int32(0x80) == Int32(0x80) { 3126 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3127 } 3128 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3129 }() << 23 3130 } 3131 return func() uint32 { 3132 if Int32(0x80) == Int32(0x80) { 3133 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3134 } 3135 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3136 }() << 23 3137 }() 3138 }() | uint32_t(func() uint32 { 3139 if Int32(0x80) == Int32(0x80) { 3140 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3141 } 3142 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3143 }()<<23)>>6 | uint32_t(0xe), func() uint32 { 3144 if 0xf == 0 { 3145 return func() uint32 { 3146 if Int32(0xa0) == Int32(0x80) { 3147 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3148 } 3149 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3150 }() << 23 3151 } 3152 return func() uint32 { 3153 if 0xf == 0xd { 3154 return func() uint32 { 3155 if Int32(0x80) == Int32(0x80) { 3156 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3157 } 3158 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3159 }() << 23 3160 } 3161 return func() uint32 { 3162 if Int32(0x80) == Int32(0x80) { 3163 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3164 } 3165 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3166 }() << 23 3167 }() 3168 }() | uint32_t(func() uint32 { 3169 if Int32(0x80) == Int32(0x80) { 3170 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3171 } 3172 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3173 }()<<23)>>6 | uint32_t(0xf), 3174 func() uint32 { 3175 if 0x0 >= 5 { 3176 return uint32(0) 3177 } 3178 return func() uint32 { 3179 if 0x0 == 0 { 3180 return func() uint32 { 3181 if Int32(0x90) == Int32(0x80) { 3182 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3183 } 3184 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3185 }() << 23 3186 } 3187 return func() uint32 { 3188 if 0x0 == 4 { 3189 return func() uint32 { 3190 if Int32(0x80) == Int32(0x80) { 3191 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3192 } 3193 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3194 }() << 23 3195 } 3196 return func() uint32 { 3197 if Int32(0x80) == Int32(0x80) { 3198 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3199 } 3200 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3201 }() << 23 3202 }() 3203 }() 3204 }() | uint32_t(func() uint32 { 3205 if Int32(0x80) == Int32(0x80) { 3206 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3207 } 3208 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3209 }()<<23)>>6 | uint32_t(func() uint32 { 3210 if Int32(0x80) == Int32(0x80) { 3211 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3212 } 3213 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3214 }()<<23)>>12 | uint32_t(0x0), func() uint32 { 3215 if 0x1 >= 5 { 3216 return uint32(0) 3217 } 3218 return func() uint32 { 3219 if 0x1 == 0 { 3220 return func() uint32 { 3221 if Int32(0x90) == Int32(0x80) { 3222 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3223 } 3224 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3225 }() << 23 3226 } 3227 return func() uint32 { 3228 if 0x1 == 4 { 3229 return func() uint32 { 3230 if Int32(0x80) == Int32(0x80) { 3231 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3232 } 3233 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3234 }() << 23 3235 } 3236 return func() uint32 { 3237 if Int32(0x80) == Int32(0x80) { 3238 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3239 } 3240 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3241 }() << 23 3242 }() 3243 }() 3244 }() | uint32_t(func() uint32 { 3245 if Int32(0x80) == Int32(0x80) { 3246 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3247 } 3248 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3249 }()<<23)>>6 | uint32_t(func() uint32 { 3250 if Int32(0x80) == Int32(0x80) { 3251 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3252 } 3253 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3254 }()<<23)>>12 | uint32_t(0x1), func() uint32 { 3255 if 0x2 >= 5 { 3256 return uint32(0) 3257 } 3258 return func() uint32 { 3259 if 0x2 == 0 { 3260 return func() uint32 { 3261 if Int32(0x90) == Int32(0x80) { 3262 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3263 } 3264 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3265 }() << 23 3266 } 3267 return func() uint32 { 3268 if 0x2 == 4 { 3269 return func() uint32 { 3270 if Int32(0x80) == Int32(0x80) { 3271 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3272 } 3273 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3274 }() << 23 3275 } 3276 return func() uint32 { 3277 if Int32(0x80) == Int32(0x80) { 3278 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3279 } 3280 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3281 }() << 23 3282 }() 3283 }() 3284 }() | uint32_t(func() uint32 { 3285 if Int32(0x80) == Int32(0x80) { 3286 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3287 } 3288 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3289 }()<<23)>>6 | uint32_t(func() uint32 { 3290 if Int32(0x80) == Int32(0x80) { 3291 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3292 } 3293 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3294 }()<<23)>>12 | uint32_t(0x2), func() uint32 { 3295 if 0x3 >= 5 { 3296 return uint32(0) 3297 } 3298 return func() uint32 { 3299 if 0x3 == 0 { 3300 return func() uint32 { 3301 if Int32(0x90) == Int32(0x80) { 3302 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3303 } 3304 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3305 }() << 23 3306 } 3307 return func() uint32 { 3308 if 0x3 == 4 { 3309 return func() uint32 { 3310 if Int32(0x80) == Int32(0x80) { 3311 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3312 } 3313 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3314 }() << 23 3315 } 3316 return func() uint32 { 3317 if Int32(0x80) == Int32(0x80) { 3318 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3319 } 3320 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3321 }() << 23 3322 }() 3323 }() 3324 }() | uint32_t(func() uint32 { 3325 if Int32(0x80) == Int32(0x80) { 3326 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3327 } 3328 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3329 }()<<23)>>6 | uint32_t(func() uint32 { 3330 if Int32(0x80) == Int32(0x80) { 3331 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3332 } 3333 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3334 }()<<23)>>12 | uint32_t(0x3), func() uint32 { 3335 if 0x4 >= 5 { 3336 return uint32(0) 3337 } 3338 return func() uint32 { 3339 if 0x4 == 0 { 3340 return func() uint32 { 3341 if Int32(0x90) == Int32(0x80) { 3342 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3343 } 3344 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3345 }() << 23 3346 } 3347 return func() uint32 { 3348 if 0x4 == 4 { 3349 return func() uint32 { 3350 if Int32(0x80) == Int32(0x80) { 3351 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3352 } 3353 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3354 }() << 23 3355 } 3356 return func() uint32 { 3357 if Int32(0x80) == Int32(0x80) { 3358 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3359 } 3360 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3361 }() << 23 3362 }() 3363 }() 3364 }() | uint32_t(func() uint32 { 3365 if Int32(0x80) == Int32(0x80) { 3366 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3367 } 3368 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3369 }()<<23)>>6 | uint32_t(func() uint32 { 3370 if Int32(0x80) == Int32(0x80) { 3371 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3372 } 3373 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3374 }()<<23)>>12 | uint32_t(0x4), 3375 } /* internal.c:18:16 */ 3376 3377 type wint_t = uint32 /* alltypes.h:198:18 */ 3378 3379 type wctype_t = uint64 /* alltypes.h:203:23 */ 3380 3381 type __mbstate_t = struct { 3382 __opaque1 uint32 3383 __opaque2 uint32 3384 } /* alltypes.h:337:9 */ 3385 3386 type mbstate_t = __mbstate_t /* alltypes.h:337:63 */ 3387 3388 func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */ 3389 bp := tls.Alloc(4) 3390 defer tls.Free(4) 3391 3392 var c uint32 3393 var s uintptr 3394 var N uint32 3395 // var dummy wchar_t at bp, 4 3396 s = src 3397 N = uint32(n) 3398 3399 if !!(st != 0) { 3400 goto __1 3401 } 3402 st = uintptr(unsafe.Pointer(&_sinternal_state)) 3403 __1: 3404 ; 3405 c = *(*uint32)(unsafe.Pointer(st)) 3406 3407 if !!(s != 0) { 3408 goto __2 3409 } 3410 if !(c != 0) { 3411 goto __4 3412 } 3413 goto ilseq 3414 __4: 3415 ; 3416 return uint64(0) 3417 goto __3 3418 __2: 3419 if !!(wc != 0) { 3420 goto __5 3421 } 3422 wc = bp /* &dummy */ 3423 __5: 3424 ; 3425 __3: 3426 ; 3427 3428 if !!(n != 0) { 3429 goto __6 3430 } 3431 return Uint64FromInt32(-2) 3432 __6: 3433 ; 3434 if !!(c != 0) { 3435 goto __7 3436 } 3437 if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) { 3438 goto __8 3439 } 3440 return BoolUint64(!!(AssignPtrInt32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s)))) != 0)) 3441 __8: 3442 ; 3443 if !(func() int32 { 3444 if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) { 3445 return 4 3446 } 3447 return 1 3448 }() == 1) { 3449 goto __9 3450 } 3451 *(*wchar_t)(unsafe.Pointer(wc)) = 0xdfff & int32(int8(*(*uint8)(unsafe.Pointer(s)))) 3452 return 1 3453 __9: 3454 ; 3455 if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0xc2 > 0xf4-0xc2) { 3456 goto __10 3457 } 3458 goto ilseq 3459 __10: 3460 ; 3461 c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0xc2] 3462 n-- 3463 __7: 3464 ; 3465 3466 if !(n != 0) { 3467 goto __11 3468 } 3469 if !((int32(*(*uint8)(unsafe.Pointer(s)))>>3-0x10|(int32(*(*uint8)(unsafe.Pointer(s)))>>3+int32_t(c)>>26))&CplInt32(7) != 0) { 3470 goto __12 3471 } 3472 goto ilseq 3473 __12: 3474 ; 3475 loop: 3476 c = c<<6 | uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0x80) 3477 n-- 3478 if !!(c&(uint32(1)<<31) != 0) { 3479 goto __13 3480 } 3481 *(*uint32)(unsafe.Pointer(st)) = uint32(0) 3482 *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(c) 3483 return size_t(N) - n 3484 __13: 3485 ; 3486 if !(n != 0) { 3487 goto __14 3488 } 3489 if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0x80 >= uint32(0x40)) { 3490 goto __15 3491 } 3492 goto ilseq 3493 __15: 3494 ; 3495 goto loop 3496 __14: 3497 ; 3498 __11: 3499 ; 3500 3501 *(*uint32)(unsafe.Pointer(st)) = c 3502 return Uint64FromInt32(-2) 3503 ilseq: 3504 *(*uint32)(unsafe.Pointer(st)) = uint32(0) 3505 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84 3506 return Uint64FromInt32(-1) 3507 } 3508 3509 var _sinternal_state uint32 /* mbrtowc.c:8:18: */ 3510 3511 func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */ 3512 return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0)) 3513 } 3514 3515 type imaxdiv_t = struct { 3516 quot intmax_t 3517 rem intmax_t 3518 } /* inttypes.h:14:40 */ 3519 3520 type socklen_t = uint32 /* alltypes.h:361:18 */ 3521 3522 type sa_family_t = uint16 /* alltypes.h:366:24 */ 3523 3524 type msghdr = struct { 3525 msg_name uintptr 3526 msg_namelen socklen_t 3527 _ [4]byte 3528 msg_iov uintptr 3529 msg_iovlen int32 3530 __pad1 int32 3531 msg_control uintptr 3532 msg_controllen socklen_t 3533 __pad2 int32 3534 msg_flags int32 3535 _ [4]byte 3536 } /* socket.h:22:1 */ 3537 3538 type cmsghdr = struct { 3539 cmsg_len socklen_t 3540 __pad1 int32 3541 cmsg_level int32 3542 cmsg_type int32 3543 } /* socket.h:44:1 */ 3544 3545 type linger = struct { 3546 l_onoff int32 3547 l_linger int32 3548 } /* socket.h:74:1 */ 3549 3550 type sockaddr = struct { 3551 sa_family sa_family_t 3552 sa_data [14]int8 3553 } /* socket.h:367:1 */ 3554 3555 type sockaddr_storage = struct { 3556 ss_family sa_family_t 3557 __ss_padding [118]int8 3558 __ss_align uint64 3559 } /* socket.h:372:1 */ 3560 3561 type in_port_t = uint16_t /* in.h:12:18 */ 3562 type in_addr_t = uint32_t /* in.h:13:18 */ 3563 type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */ 3564 3565 type sockaddr_in = struct { 3566 sin_family sa_family_t 3567 sin_port in_port_t 3568 sin_addr struct{ s_addr in_addr_t } 3569 sin_zero [8]uint8_t 3570 } /* in.h:16:1 */ 3571 3572 type in6_addr = struct { 3573 __in6_union struct { 3574 _ [0]uint32 3575 __s6_addr [16]uint8_t 3576 } 3577 } /* in.h:23:1 */ 3578 3579 type sockaddr_in6 = struct { 3580 sin6_family sa_family_t 3581 sin6_port in_port_t 3582 sin6_flowinfo uint32_t 3583 sin6_addr struct { 3584 __in6_union struct { 3585 _ [0]uint32 3586 __s6_addr [16]uint8_t 3587 } 3588 } 3589 sin6_scope_id uint32_t 3590 } /* in.h:34:1 */ 3591 3592 type ipv6_mreq = struct { 3593 ipv6mr_multiaddr struct { 3594 __in6_union struct { 3595 _ [0]uint32 3596 __s6_addr [16]uint8_t 3597 } 3598 } 3599 ipv6mr_interface uint32 3600 } /* in.h:42:1 */ 3601 3602 type ip_opts = struct { 3603 ip_dst struct{ s_addr in_addr_t } 3604 ip_opts [40]int8 3605 } /* in.h:229:1 */ 3606 3607 type ip_mreq = struct { 3608 imr_multiaddr struct{ s_addr in_addr_t } 3609 imr_interface struct{ s_addr in_addr_t } 3610 } /* in.h:247:1 */ 3611 3612 type ip_mreqn = struct { 3613 imr_multiaddr struct{ s_addr in_addr_t } 3614 imr_address struct{ s_addr in_addr_t } 3615 imr_ifindex int32 3616 } /* in.h:252:1 */ 3617 3618 type ip_mreq_source = struct { 3619 imr_multiaddr struct{ s_addr in_addr_t } 3620 imr_interface struct{ s_addr in_addr_t } 3621 imr_sourceaddr struct{ s_addr in_addr_t } 3622 } /* in.h:258:1 */ 3623 3624 type ip_msfilter = struct { 3625 imsf_multiaddr struct{ s_addr in_addr_t } 3626 imsf_interface struct{ s_addr in_addr_t } 3627 imsf_fmode uint32_t 3628 imsf_numsrc uint32_t 3629 imsf_slist [1]struct{ s_addr in_addr_t } 3630 } /* in.h:264:1 */ 3631 3632 type group_req = struct { 3633 gr_interface uint32_t 3634 _ [4]byte 3635 gr_group struct { 3636 ss_family sa_family_t 3637 __ss_padding [118]int8 3638 __ss_align uint64 3639 } 3640 } /* in.h:275:1 */ 3641 3642 type group_source_req = struct { 3643 gsr_interface uint32_t 3644 _ [4]byte 3645 gsr_group struct { 3646 ss_family sa_family_t 3647 __ss_padding [118]int8 3648 __ss_align uint64 3649 } 3650 gsr_source struct { 3651 ss_family sa_family_t 3652 __ss_padding [118]int8 3653 __ss_align uint64 3654 } 3655 } /* in.h:280:1 */ 3656 3657 type group_filter = struct { 3658 gf_interface uint32_t 3659 _ [4]byte 3660 gf_group struct { 3661 ss_family sa_family_t 3662 __ss_padding [118]int8 3663 __ss_align uint64 3664 } 3665 gf_fmode uint32_t 3666 gf_numsrc uint32_t 3667 gf_slist [1]struct { 3668 ss_family sa_family_t 3669 __ss_padding [118]int8 3670 __ss_align uint64 3671 } 3672 } /* in.h:286:1 */ 3673 3674 type in_pktinfo = struct { 3675 ipi_ifindex int32 3676 ipi_spec_dst struct{ s_addr in_addr_t } 3677 ipi_addr struct{ s_addr in_addr_t } 3678 } /* in.h:297:1 */ 3679 3680 type in6_pktinfo = struct { 3681 ipi6_addr struct { 3682 __in6_union struct { 3683 _ [0]uint32 3684 __s6_addr [16]uint8_t 3685 } 3686 } 3687 ipi6_ifindex uint32 3688 } /* in.h:303:1 */ 3689 3690 type ip6_mtuinfo = struct { 3691 ip6m_addr struct { 3692 sin6_family sa_family_t 3693 sin6_port in_port_t 3694 sin6_flowinfo uint32_t 3695 sin6_addr struct { 3696 __in6_union struct { 3697 _ [0]uint32 3698 __s6_addr [16]uint8_t 3699 } 3700 } 3701 sin6_scope_id uint32_t 3702 } 3703 ip6m_mtu uint32_t 3704 } /* in.h:308:1 */ 3705 3706 type addrinfo = struct { 3707 ai_flags int32 3708 ai_family int32 3709 ai_socktype int32 3710 ai_protocol int32 3711 ai_addrlen socklen_t 3712 _ [4]byte 3713 ai_addr uintptr 3714 ai_canonname uintptr 3715 ai_next uintptr 3716 } /* netdb.h:16:1 */ 3717 3718 // Legacy functions follow (marked OBsolete in SUS) 3719 3720 type netent = struct { 3721 n_name uintptr 3722 n_aliases uintptr 3723 n_addrtype int32 3724 n_net uint32_t 3725 } /* netdb.h:62:1 */ 3726 3727 type hostent = struct { 3728 h_name uintptr 3729 h_aliases uintptr 3730 h_addrtype int32 3731 h_length int32 3732 h_addr_list uintptr 3733 } /* netdb.h:69:1 */ 3734 3735 type servent = struct { 3736 s_name uintptr 3737 s_aliases uintptr 3738 s_port int32 3739 _ [4]byte 3740 s_proto uintptr 3741 } /* netdb.h:78:1 */ 3742 3743 type protoent = struct { 3744 p_name uintptr 3745 p_aliases uintptr 3746 p_proto int32 3747 _ [4]byte 3748 } /* netdb.h:85:1 */ 3749 3750 type aibuf = struct { 3751 ai struct { 3752 ai_flags int32 3753 ai_family int32 3754 ai_socktype int32 3755 ai_protocol int32 3756 ai_addrlen socklen_t 3757 _ [4]byte 3758 ai_addr uintptr 3759 ai_canonname uintptr 3760 ai_next uintptr 3761 } 3762 sa struct { 3763 sin struct { 3764 sin_family sa_family_t 3765 sin_port in_port_t 3766 sin_addr struct{ s_addr in_addr_t } 3767 sin_zero [8]uint8_t 3768 } 3769 _ [12]byte 3770 } 3771 lock [1]int32 3772 slot int16 3773 ref int16 3774 _ [4]byte 3775 } /* lookup.h:10:1 */ 3776 3777 type sa = struct { 3778 sin struct { 3779 sin_family sa_family_t 3780 sin_port in_port_t 3781 sin_addr struct{ s_addr in_addr_t } 3782 sin_zero [8]uint8_t 3783 } 3784 _ [12]byte 3785 } /* lookup.h:10:1 */ 3786 3787 type address = struct { 3788 family int32 3789 scopeid uint32 3790 addr [16]uint8_t 3791 sortkey int32 3792 } /* lookup.h:20:1 */ 3793 3794 type service = struct { 3795 port uint16_t 3796 proto uint8 3797 socktype uint8 3798 } /* lookup.h:27:1 */ 3799 3800 type resolvconf = struct { 3801 ns [3]struct { 3802 family int32 3803 scopeid uint32 3804 addr [16]uint8_t 3805 sortkey int32 3806 } 3807 nns uint32 3808 attempts uint32 3809 ndots uint32 3810 timeout uint32 3811 } /* lookup.h:34:1 */ 3812 3813 func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ 3814 var cnt size_t 3815 cnt = uint64(1) 3816 __1: 3817 if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) { 3818 goto __3 3819 } 3820 goto __2 3821 __2: 3822 cnt++ 3823 p = (*addrinfo)(unsafe.Pointer(p)).ai_next 3824 goto __1 3825 goto __3 3826 __3: 3827 ; 3828 var b uintptr = p - uintptr(uint64(uintptr(0))) 3829 b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).slot) 3830 //TODO LOCK(b->lock); 3831 if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) { 3832 Xfree(tls, b) 3833 } 3834 //TODO else UNLOCK(b->lock); 3835 } 3836 3837 func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ 3838 bp := tls.Alloc(1608) 3839 defer tls.Free(1608) 3840 3841 // var ports [2]service at bp, 8 3842 3843 // var addrs [48]address at bp+8, 1344 3844 3845 // var canon [256]int8 at bp+1352, 256 3846 3847 var outcanon uintptr 3848 var nservs int32 3849 var naddrs int32 3850 var nais int32 3851 var canon_len int32 3852 var i int32 3853 var j int32 3854 var k int32 3855 var family int32 = 0 3856 var flags int32 = 0 3857 var proto int32 = 0 3858 var socktype int32 = 0 3859 var out uintptr 3860 3861 if !(host != 0) && !(serv != 0) { 3862 return -2 3863 } 3864 3865 if hint != 0 { 3866 family = (*addrinfo)(unsafe.Pointer(hint)).ai_family 3867 flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags 3868 proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol 3869 socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype 3870 3871 var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400 3872 if flags&mask != flags { 3873 return -1 3874 } 3875 3876 switch family { 3877 case 2: 3878 fallthrough 3879 case 10: 3880 fallthrough 3881 case 0: 3882 break 3883 fallthrough 3884 default: 3885 return -6 3886 } 3887 } 3888 3889 if flags&0x20 != 0 { 3890 Xabort(tls) //TODO- 3891 // /* Define the "an address is configured" condition for address 3892 // * families via ability to create a socket for the family plus 3893 // * routability of the loopback address for the family. */ 3894 // static const struct sockaddr_in lo4 = { 3895 // .sin_family = AF_INET, .sin_port = 65535, 3896 // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN 3897 // ? 0x7f000001 : 0x0100007f 3898 // }; 3899 // static const struct sockaddr_in6 lo6 = { 3900 // .sin6_family = AF_INET6, .sin6_port = 65535, 3901 // .sin6_addr = IN6ADDR_LOOPBACK_INIT 3902 // }; 3903 // int tf[2] = { AF_INET, AF_INET6 }; 3904 // const void *ta[2] = { &lo4, &lo6 }; 3905 // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; 3906 // for (i=0; i<2; i++) { 3907 // if (family==tf[1-i]) continue; 3908 // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, 3909 // IPPROTO_UDP); 3910 // if (s>=0) { 3911 // int cs; 3912 // pthread_setcancelstate( 3913 // PTHREAD_CANCEL_DISABLE, &cs); 3914 // int r = connect(s, ta[i], tl[i]); 3915 // pthread_setcancelstate(cs, 0); 3916 // close(s); 3917 // if (!r) continue; 3918 // } 3919 // switch (errno) { 3920 // case EADDRNOTAVAIL: 3921 // case EAFNOSUPPORT: 3922 // case EHOSTUNREACH: 3923 // case ENETDOWN: 3924 // case ENETUNREACH: 3925 // break; 3926 // default: 3927 // return EAI_SYSTEM; 3928 // } 3929 // if (family == tf[i]) return EAI_NONAME; 3930 // family = tf[1-i]; 3931 // } 3932 } 3933 3934 nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags) 3935 if nservs < 0 { 3936 return nservs 3937 } 3938 3939 naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags) 3940 if naddrs < 0 { 3941 return naddrs 3942 } 3943 3944 nais = nservs * naddrs 3945 canon_len = int32(Xstrlen(tls, bp+1352)) 3946 out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1)) 3947 if !(out != 0) { 3948 return -10 3949 } 3950 3951 if canon_len != 0 { 3952 outcanon = out + uintptr(nais)*88 3953 Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1)) 3954 } else { 3955 outcanon = uintptr(0) 3956 } 3957 3958 for k = AssignInt32(&i, 0); i < naddrs; i++ { 3959 j = 0 3960 __1: 3961 if !(j < nservs) { 3962 goto __3 3963 } 3964 { 3965 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k) 3966 //TODO out[k].ai = (struct addrinfo){ 3967 //TODO .ai_family = addrs[i].family, 3968 //TODO .ai_socktype = ports[j].socktype, 3969 //TODO .ai_protocol = ports[j].proto, 3970 //TODO .ai_addrlen = addrs[i].family == AF_INET 3971 //TODO ? sizeof(struct sockaddr_in) 3972 //TODO : sizeof(struct sockaddr_in6), 3973 //TODO .ai_addr = (void *)&out[k].sa, 3974 //TODO .ai_canonname = outcanon }; 3975 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family 3976 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).socktype) 3977 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).proto) 3978 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 { 3979 if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).family == 2 { 3980 return uint32(unsafe.Sizeof(sockaddr_in{})) 3981 } 3982 return uint32(unsafe.Sizeof(sockaddr_in6{})) 3983 }() 3984 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = out + uintptr(k)*88 + 48 3985 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon 3986 if k != 0 { 3987 (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).ai.ai_next = out + uintptr(k)*88 3988 } 3989 switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family { 3990 case 2: 3991 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_family = sa_family_t(2) 3992 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) 3993 Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4)) 3994 break 3995 case 10: 3996 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_family = sa_family_t(10) 3997 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) 3998 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).scopeid 3999 Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16)) 4000 break 4001 } 4002 4003 } 4004 goto __2 4005 __2: 4006 j++ 4007 k++ 4008 goto __1 4009 goto __3 4010 __3: 4011 } 4012 (*aibuf)(unsafe.Pointer(out)).ref = int16(nais) 4013 *(*uintptr)(unsafe.Pointer(res)) = out 4014 return 0 4015 } 4016 4017 type ucred = struct { 4018 pid pid_t 4019 uid uid_t 4020 gid gid_t 4021 } /* socket.h:57:1 */ 4022 4023 type mmsghdr = struct { 4024 msg_hdr struct { 4025 msg_name uintptr 4026 msg_namelen socklen_t 4027 _ [4]byte 4028 msg_iov uintptr 4029 msg_iovlen int32 4030 __pad1 int32 4031 msg_control uintptr 4032 msg_controllen socklen_t 4033 __pad2 int32 4034 msg_flags int32 4035 _ [4]byte 4036 } 4037 msg_len uint32 4038 _ [4]byte 4039 } /* socket.h:63:1 */ 4040 4041 func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ 4042 bp := tls.Alloc(8) 4043 defer tls.Free(8) 4044 4045 var size size_t = uint64(63) 4046 // var res uintptr at bp, 8 4047 4048 var err int32 4049 for __ccgo := true; __ccgo; __ccgo = err == 34 { 4050 Xfree(tls, _sh) 4051 _sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) 4052 if !(_sh != 0) { 4053 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 4054 return uintptr(0) 4055 } 4056 err = Xgethostbyaddr_r(tls, a, l, af, _sh, 4057 _sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 4058 } 4059 if err != 0 { 4060 return uintptr(0) 4061 } 4062 return _sh 4063 } 4064 4065 var _sh uintptr /* gethostbyaddr.c:9:24: */ 4066 4067 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: */ 4068 bp := tls.Alloc(28) 4069 defer tls.Free(28) 4070 4071 //TODO union { 4072 //TODO struct sockaddr_in sin; 4073 //TODO struct sockaddr_in6 sin6; 4074 //TODO } sa = { .sin.sin_family = af }; 4075 *(*struct { 4076 sin sockaddr_in 4077 _ [12]byte 4078 })(unsafe.Pointer(bp)) = struct { 4079 sin sockaddr_in 4080 _ [12]byte 4081 }{} //TODO- 4082 (*sockaddr_in)(unsafe.Pointer(bp)).sin_family = sa_family_t(af) //TODO- 4083 var sl socklen_t 4084 if af == 10 { 4085 sl = uint32(unsafe.Sizeof(sockaddr_in6{})) 4086 } else { 4087 sl = uint32(unsafe.Sizeof(sockaddr_in{})) 4088 } 4089 var i int32 4090 4091 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 4092 4093 // Load address argument into sockaddr structure 4094 if af == 10 && l == socklen_t(16) { 4095 Xmemcpy(tls, bp+8, a, uint64(16)) 4096 } else if af == 2 && l == socklen_t(4) { 4097 Xmemcpy(tls, bp+4, a, uint64(4)) 4098 } else { 4099 *(*int32)(unsafe.Pointer(err)) = 3 4100 return 22 4101 } 4102 4103 // Align buffer and check for space for pointers and ip address 4104 i = int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))) 4105 if !(i != 0) { 4106 i = int32(unsafe.Sizeof(uintptr(0))) 4107 } 4108 if buflen <= uint64(5)*uint64(unsafe.Sizeof(uintptr(0)))-uint64(i)+uint64(l) { 4109 return 34 4110 } 4111 buf += uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i)) 4112 buflen = buflen - (uint64(5)*uint64(unsafe.Sizeof(uintptr(0))) - uint64(i) + uint64(l)) 4113 4114 (*hostent)(unsafe.Pointer(h)).h_addr_list = buf 4115 buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) 4116 (*hostent)(unsafe.Pointer(h)).h_aliases = buf 4117 buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) 4118 4119 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf 4120 Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) 4121 buf += uintptr(l) 4122 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) 4123 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf 4124 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) 4125 4126 switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { 4127 case -3: 4128 *(*int32)(unsafe.Pointer(err)) = 2 4129 return 11 4130 case -12: 4131 return 34 4132 default: 4133 fallthrough 4134 case -10: 4135 fallthrough 4136 case -11: 4137 fallthrough 4138 case -4: 4139 *(*int32)(unsafe.Pointer(err)) = 3 4140 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 4141 case 0: 4142 break 4143 } 4144 4145 (*hostent)(unsafe.Pointer(h)).h_addrtype = af 4146 (*hostent)(unsafe.Pointer(h)).h_length = int32(l) 4147 (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) 4148 *(*uintptr)(unsafe.Pointer(res)) = h 4149 return 0 4150 } 4151 4152 func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ 4153 return Xgethostbyname2(tls, name, 2) 4154 } 4155 4156 func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ 4157 bp := tls.Alloc(8) 4158 defer tls.Free(8) 4159 4160 var size size_t = uint64(63) 4161 // var res uintptr at bp, 8 4162 4163 var err int32 4164 for __ccgo := true; __ccgo; __ccgo = err == 34 { 4165 Xfree(tls, _sh1) 4166 _sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) 4167 if !(_sh1 != 0) { 4168 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 4169 return uintptr(0) 4170 } 4171 err = Xgethostbyname2_r(tls, name, af, _sh1, 4172 _sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 4173 } 4174 if err != 0 { 4175 return uintptr(0) 4176 } 4177 return _sh1 4178 } 4179 4180 var _sh1 uintptr /* gethostbyname2.c:10:24: */ 4181 4182 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: */ 4183 bp := tls.Alloc(1600) 4184 defer tls.Free(1600) 4185 4186 // var addrs [48]address at bp, 1344 4187 4188 // var canon [256]int8 at bp+1344, 256 4189 4190 var i int32 4191 var cnt int32 4192 var align size_t 4193 var need size_t 4194 4195 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 4196 cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02) 4197 if cnt < 0 { 4198 switch cnt { 4199 case -2: 4200 *(*int32)(unsafe.Pointer(err)) = 1 4201 return 2 4202 fallthrough 4203 case -3: 4204 *(*int32)(unsafe.Pointer(err)) = 2 4205 return 11 4206 fallthrough 4207 default: 4208 fallthrough 4209 case -4: 4210 *(*int32)(unsafe.Pointer(err)) = 3 4211 return 74 4212 fallthrough 4213 case -10: 4214 fallthrough 4215 case -11: 4216 *(*int32)(unsafe.Pointer(err)) = 3 4217 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 4218 } 4219 } 4220 4221 (*hostent)(unsafe.Pointer(h)).h_addrtype = af 4222 (*hostent)(unsafe.Pointer(h)).h_length = func() int32 { 4223 if af == 10 { 4224 return 16 4225 } 4226 return 4 4227 }() 4228 4229 // Align buffer 4230 align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)) 4231 4232 need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0))) 4233 need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).h_length)) 4234 need = need + (Xstrlen(tls, name) + uint64(1)) 4235 need = need + (Xstrlen(tls, bp+1344) + uint64(1)) 4236 need = need + align 4237 4238 if need > buflen { 4239 return 34 4240 } 4241 4242 buf += uintptr(align) 4243 (*hostent)(unsafe.Pointer(h)).h_aliases = buf 4244 buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0)))) 4245 (*hostent)(unsafe.Pointer(h)).h_addr_list = buf 4246 buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0)))) 4247 4248 for i = 0; i < cnt; i++ { 4249 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf 4250 buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length) 4251 Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)), bp+uintptr(i)*28+8, uint64((*hostent)(unsafe.Pointer(h)).h_length)) 4252 } 4253 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0) 4254 4255 (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf) 4256 Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344) 4257 buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1)) 4258 4259 if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 { 4260 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf 4261 Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name) 4262 buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1)) 4263 } else { 4264 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) 4265 } 4266 4267 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0) 4268 4269 *(*uintptr)(unsafe.Pointer(res)) = h 4270 return 0 4271 } 4272 4273 func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ 4274 return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) 4275 } 4276 4277 type if_nameindex = struct { 4278 if_index uint32 4279 _ [4]byte 4280 if_name uintptr 4281 } /* if.h:12:1 */ 4282 4283 type ifaddr = struct { 4284 ifa_addr struct { 4285 sa_family sa_family_t 4286 sa_data [14]int8 4287 } 4288 ifa_ifu struct { 4289 ifu_broadaddr struct { 4290 sa_family sa_family_t 4291 sa_data [14]int8 4292 } 4293 } 4294 ifa_ifp uintptr 4295 ifa_next uintptr 4296 } /* if.h:51:1 */ 4297 4298 type ifmap = struct { 4299 mem_start uint64 4300 mem_end uint64 4301 base_addr uint16 4302 irq uint8 4303 dma uint8 4304 port uint8 4305 _ [3]byte 4306 } /* if.h:64:1 */ 4307 4308 type ifreq = struct { 4309 ifr_ifrn struct{ ifrn_name [16]int8 } 4310 ifr_ifru struct { 4311 _ [0]uint64 4312 ifru_addr struct { 4313 sa_family sa_family_t 4314 sa_data [14]int8 4315 } 4316 _ [8]byte 4317 } 4318 } /* if.h:76:1 */ 4319 4320 type ifconf = struct { 4321 ifc_len int32 4322 _ [4]byte 4323 ifc_ifcu struct{ ifcu_buf uintptr } 4324 } /* if.h:116:1 */ 4325 4326 type ns_sect = uint32 /* nameser.h:37:3 */ 4327 4328 type __ns_msg = struct { 4329 _msg uintptr 4330 _eom uintptr 4331 _id uint16_t 4332 _flags uint16_t 4333 _counts [4]uint16_t 4334 _ [4]byte 4335 _sections [4]uintptr 4336 _sect ns_sect 4337 _rrnum int32 4338 _msg_ptr uintptr 4339 } /* nameser.h:39:9 */ 4340 4341 type ns_msg = __ns_msg /* nameser.h:46:3 */ 4342 4343 type _ns_flagdata = struct { 4344 mask int32 4345 shift int32 4346 } /* nameser.h:48:1 */ 4347 4348 type __ns_rr = struct { 4349 name [1025]int8 4350 _ [1]byte 4351 __type uint16_t 4352 rr_class uint16_t 4353 _ [2]byte 4354 ttl uint32_t 4355 rdlength uint16_t 4356 _ [2]byte 4357 rdata uintptr 4358 } /* nameser.h:59:9 */ 4359 4360 type ns_rr = __ns_rr /* nameser.h:66:3 */ 4361 4362 type ns_flag = uint32 /* nameser.h:87:3 */ 4363 4364 type ns_opcode = uint32 /* nameser.h:96:3 */ 4365 4366 type ns_rcode = uint32 /* nameser.h:115:3 */ 4367 4368 type ns_update_operation = uint32 /* nameser.h:121:3 */ 4369 4370 type ns_tsig_key1 = struct { 4371 name [1025]int8 4372 alg [1025]int8 4373 _ [6]byte 4374 data uintptr 4375 len int32 4376 _ [4]byte 4377 } /* nameser.h:123:1 */ 4378 4379 type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ 4380 4381 type ns_tcp_tsig_state1 = struct { 4382 counter int32 4383 _ [4]byte 4384 key uintptr 4385 ctx uintptr 4386 sig [512]uint8 4387 siglen int32 4388 _ [4]byte 4389 } /* nameser.h:130:1 */ 4390 4391 type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ 4392 4393 type ns_type = uint32 /* nameser.h:200:3 */ 4394 4395 type ns_class = uint32 /* nameser.h:219:3 */ 4396 4397 type ns_key_types = uint32 /* nameser.h:226:3 */ 4398 4399 type ns_cert_types = uint32 /* nameser.h:234:3 */ 4400 4401 type HEADER = struct { 4402 _ [0]uint32 4403 id 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 */ 4404 qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ 4405 nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ 4406 } /* nameser.h:353:3 */ 4407 4408 // unused; purely for broken apps 4409 type __res_state = struct { 4410 retrans int32 4411 retry int32 4412 options uint64 4413 nscount int32 4414 nsaddr_list [3]struct { 4415 sin_family sa_family_t 4416 sin_port in_port_t 4417 sin_addr struct{ s_addr in_addr_t } 4418 sin_zero [8]uint8_t 4419 } 4420 id uint16 4421 _ [2]byte 4422 dnsrch [7]uintptr 4423 defdname [256]int8 4424 pfcode uint64 4425 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ 4426 _ [4]byte 4427 sort_list [10]struct { 4428 addr struct{ s_addr in_addr_t } 4429 mask uint32_t 4430 } 4431 qhook uintptr 4432 rhook uintptr 4433 res_h_errno int32 4434 _vcsock int32 4435 _flags uint32 4436 _ [4]byte 4437 _u struct { 4438 _ [0]uint64 4439 pad [52]int8 4440 _ [4]byte 4441 } 4442 } /* resolv.h:26:9 */ 4443 4444 // unused; purely for broken apps 4445 type res_state = uintptr /* resolv.h:62:3 */ 4446 4447 type res_sym = struct { 4448 number int32 4449 _ [4]byte 4450 name uintptr 4451 humanname uintptr 4452 } /* resolv.h:70:1 */ 4453 4454 func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ 4455 p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0)))) 4456 *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0) 4457 for __ccgo := true; __ccgo; __ccgo = x != 0 { 4458 *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(uint32('0') + x%uint32(10)) 4459 x = x / uint32(10) 4460 } 4461 return p 4462 } 4463 4464 func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ 4465 bp := tls.Alloc(32) 4466 defer tls.Free(32) 4467 4468 Xsprintf(tls, s, ts+25, 4469 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))))) 4470 } 4471 4472 func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ 4473 var i int32 4474 for i = 15; i >= 0; i-- { 4475 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15] 4476 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') 4477 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4] 4478 *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') 4479 } 4480 Xstrcpy(tls, s, ts+50) 4481 } 4482 4483 var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */ 4484 4485 func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ 4486 bp := tls.Alloc(556) 4487 defer tls.Free(556) 4488 4489 // var line [512]int8 at bp+16, 512 4490 4491 var p uintptr 4492 var z uintptr 4493 var _buf [1032]uint8 4494 _ = _buf 4495 // var atmp [16]uint8 at bp, 16 4496 4497 // var iplit address at bp+528, 28 4498 4499 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 4500 var f uintptr = Xfopen(tls, ts+76, ts+87) 4501 if !(f != 0) { 4502 return 4503 } 4504 if family == 2 { 4505 Xmemcpy(tls, bp+uintptr(12), a, uint64(4)) 4506 Xmemcpy(tls, bp, ts+90, uint64(12)) 4507 a = bp /* &atmp[0] */ 4508 } 4509 for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]int8{})), f) != 0 { 4510 if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 { 4511 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') 4512 *(*int8)(unsafe.Pointer(p)) = int8(0) 4513 } 4514 4515 for p = bp + 16; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { 4516 } 4517 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) 4518 if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 { 4519 continue 4520 } 4521 4522 if (*address)(unsafe.Pointer(bp+528)).family == 2 { 4523 Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4)) 4524 Xmemcpy(tls, bp+528+8, ts+90, uint64(12)) 4525 (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0) 4526 } 4527 4528 if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).scopeid != scopeid { 4529 continue 4530 } 4531 4532 for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ { 4533 } 4534 for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { 4535 } 4536 *(*int8)(unsafe.Pointer(z)) = int8(0) 4537 if (int64(z)-int64(p))/1 < int64(256) { 4538 Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1))) 4539 break 4540 } 4541 } 4542 //TODO __fclose_ca(f); 4543 Xfclose(tls, f) 4544 } 4545 4546 func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ 4547 Xabort(tls) //TODO- 4548 // unsigned long svport; 4549 // char line[128], *p, *z; 4550 // unsigned char _buf[1032]; 4551 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 4552 // if (!f) return; 4553 // while (fgets(line, sizeof line, f)) { 4554 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 4555 4556 // for (p=line; *p && !isspace(*p); p++); 4557 // if (!*p) continue; 4558 // *p++ = 0; 4559 // svport = strtoul(p, &z, 10); 4560 4561 // if (svport != port || z==p) continue; 4562 // if (dgram && strncmp(z, "/udp", 4)) continue; 4563 // if (!dgram && strncmp(z, "/tcp", 4)) continue; 4564 // if (p-line > 32) continue; 4565 4566 // memcpy(buf, line, p-line); 4567 // break; 4568 // } 4569 // __fclose_ca(f); 4570 } 4571 4572 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: */ 4573 bp := tls.Alloc(347) 4574 defer tls.Free(347) 4575 4576 // var ptr [78]int8 at bp, 78 4577 4578 // var buf [256]int8 at bp+78, 256 4579 4580 // var num [13]int8 at bp+334, 13 4581 4582 var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) 4583 var a uintptr 4584 var scopeid uint32 4585 4586 switch af { 4587 case 2: 4588 a = sa1 + 4 4589 if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{})) { 4590 return -6 4591 } 4592 mkptr4(tls, bp, a) 4593 scopeid = uint32(0) 4594 break 4595 case 10: 4596 a = sa1 + 8 4597 if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{})) { 4598 return -6 4599 } 4600 if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { 4601 mkptr6(tls, bp, a) 4602 } else { 4603 mkptr4(tls, bp, a+uintptr(12)) 4604 } 4605 scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id 4606 break 4607 default: 4608 return -6 4609 } 4610 4611 if node != 0 && nodelen != 0 { 4612 *(*int8)(unsafe.Pointer(bp + 78)) = int8(0) 4613 if !(flags&0x01 != 0) { 4614 reverse_hosts(tls, bp+78, a, scopeid, af) 4615 } 4616 if !(int32(*(*int8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) { 4617 Xabort(tls) //TODO- 4618 // unsigned char query[18+PTR_MAX], reply[512]; 4619 // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, 4620 // 0, 0, 0, query, sizeof query); 4621 // query[3] = 0; /* don't need AD flag */ 4622 // int rlen = __res_send(query, qlen, reply, sizeof reply); 4623 // buf[0] = 0; 4624 // if (rlen > 0) 4625 // __dns_parse(reply, rlen, dns_parse_callback, buf); 4626 } 4627 if !(int32(*(*int8)(unsafe.Pointer(bp + 78))) != 0) { 4628 if flags&0x08 != 0 { 4629 return -2 4630 } 4631 Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]int8{}))) 4632 if scopeid != 0 { 4633 Xabort(tls) //TODO- 4634 // char *p = 0, tmp[IF_NAMESIZE+1]; 4635 // if (!(flags & NI_NUMERICSCOPE) && 4636 // (IN6_IS_ADDR_LINKLOCAL(a) || 4637 // IN6_IS_ADDR_MC_LINKLOCAL(a))) 4638 // p = if_indextoname(scopeid, tmp+1); 4639 // if (!p) 4640 // p = itoa(num, scopeid); 4641 // *--p = '%'; 4642 // strcat(buf, p); 4643 } 4644 } 4645 if Xstrlen(tls, bp+78) >= size_t(nodelen) { 4646 return -12 4647 } 4648 Xstrcpy(tls, node, bp+78) 4649 } 4650 4651 if serv != 0 && servlen != 0 { 4652 var p uintptr = bp + 78 /* buf */ 4653 var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) 4654 *(*int8)(unsafe.Pointer(bp + 78)) = int8(0) 4655 if !(flags&0x02 != 0) { 4656 reverse_services(tls, bp+78, port, flags&0x10) 4657 } 4658 if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { 4659 p = itoa(tls, bp+334, uint32(port)) 4660 } 4661 if Xstrlen(tls, p) >= size_t(servlen) { 4662 return -12 4663 } 4664 Xstrcpy(tls, serv, p) 4665 } 4666 4667 return 0 4668 } 4669 4670 var Xh_errno int32 /* h_errno.c:4:5: */ 4671 4672 func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ 4673 return uintptr(unsafe.Pointer(&Xh_errno)) 4674 } 4675 4676 func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ 4677 bp := tls.Alloc(40) 4678 defer tls.Free(40) 4679 4680 var s uintptr = s0 4681 var d uintptr = dest 4682 *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)} 4683 // var z uintptr at bp+32, 8 4684 4685 var i int32 4686 4687 for i = 0; i < 4; i++ { 4688 *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0) 4689 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 { 4690 if 0 != 0 { 4691 return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s)))) 4692 } 4693 return Bool32(uint32(*(*int8)(unsafe.Pointer(s)))-uint32('0') < uint32(10)) 4694 }() != 0) { 4695 return 0 4696 } 4697 if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) { 4698 break 4699 } 4700 s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1) 4701 } 4702 if i == 4 { 4703 return 0 4704 } 4705 switch i { 4706 case 0: 4707 *(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff) 4708 AssignShrPtrUint64(bp, int(24)) 4709 fallthrough 4710 case 1: 4711 *(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff) 4712 AssignShrPtrUint64(bp+1*8, int(16)) 4713 fallthrough 4714 case 2: 4715 *(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff) 4716 AssignShrPtrUint64(bp+2*8, int(8)) 4717 } 4718 for i = 0; i < 4; i++ { 4719 if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) { 4720 return 0 4721 } 4722 *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8))) 4723 } 4724 return 1 4725 } 4726 4727 func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ 4728 bp := tls.Alloc(276) 4729 defer tls.Free(276) 4730 4731 var a uintptr = a0 4732 var i int32 4733 var j int32 4734 var max int32 4735 var best int32 4736 // var buf [100]int8 at bp+176, 100 4737 4738 switch af { 4739 case 2: 4740 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 { 4741 return s 4742 } 4743 break 4744 case 10: 4745 if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { 4746 Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})), 4747 ts+115, 4748 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))), 4749 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))), 4750 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))), 4751 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))))) 4752 } else { 4753 Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})), 4754 ts+139, 4755 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))), 4756 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))), 4757 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))), 4758 int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) 4759 } 4760 // Replace longest /(^0|:)[:0]{2,}/ with "::" 4761 i = AssignInt32(&best, 0) 4762 max = 2 4763 for ; *(*int8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ { 4764 if i != 0 && int32(*(*int8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' { 4765 continue 4766 } 4767 j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169)) 4768 if j > max { 4769 best = i 4770 max = j 4771 } 4772 } 4773 if max > 3 { 4774 *(*int8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrInt8(bp+176+uintptr(best+1), int8(':')) 4775 Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1)) 4776 } 4777 if Xstrlen(tls, bp+176) < size_t(l) { 4778 Xstrcpy(tls, s, bp+176) 4779 return s 4780 } 4781 break 4782 default: 4783 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 4784 return uintptr(0) 4785 } 4786 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28 4787 return uintptr(0) 4788 } 4789 4790 func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ 4791 if c-uint32('0') < uint32(10) { 4792 return int32(c - uint32('0')) 4793 } 4794 c = c | uint32(32) 4795 if c-uint32('a') < uint32(6) { 4796 return int32(c - uint32('a') + uint32(10)) 4797 } 4798 return -1 4799 } 4800 4801 func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ 4802 bp := tls.Alloc(16) 4803 defer tls.Free(16) 4804 4805 // var ip [8]uint16_t at bp, 16 4806 4807 var a uintptr = a0 4808 var i int32 4809 var j int32 4810 var v int32 4811 var d int32 4812 var brk int32 = -1 4813 var need_v4 int32 = 0 4814 4815 if af == 2 { 4816 for i = 0; i < 4; i++ { 4817 for v = AssignInt32(&j, 0); j < 3 && func() int32 { 4818 if 0 != 0 { 4819 return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) 4820 } 4821 return Bool32(uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10)) 4822 }() != 0; j++ { 4823 v = 10*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - '0' 4824 } 4825 if j == 0 || j > 1 && int32(*(*int8)(unsafe.Pointer(s))) == '0' || v > 255 { 4826 return 0 4827 } 4828 *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) 4829 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 { 4830 return 1 4831 } 4832 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' { 4833 return 0 4834 } 4835 s += uintptr(j + 1) 4836 } 4837 return 0 4838 } else if af != 10 { 4839 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 4840 return -1 4841 } 4842 4843 if int32(*(*int8)(unsafe.Pointer(s))) == ':' && int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' { 4844 return 0 4845 } 4846 4847 for i = 0; ; i++ { 4848 if int32(*(*int8)(unsafe.Pointer(s))) == ':' && brk < 0 { 4849 brk = i 4850 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0) 4851 if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { 4852 break 4853 } 4854 if i == 7 { 4855 return 0 4856 } 4857 continue 4858 } 4859 for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ { 4860 v = 16*v + d 4861 } 4862 if j == 0 { 4863 return 0 4864 } 4865 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v) 4866 if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) { 4867 break 4868 } 4869 if i == 7 { 4870 return 0 4871 } 4872 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' { 4873 if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 { 4874 return 0 4875 } 4876 need_v4 = 1 4877 i++ 4878 break 4879 } 4880 s += uintptr(j + 1) 4881 } 4882 if brk >= 0 { 4883 Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk))) 4884 for j = 0; j < 7-i; j++ { 4885 *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0) 4886 } 4887 } 4888 for j = 0; j < 8; j++ { 4889 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8) 4890 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) 4891 } 4892 if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 { 4893 return 0 4894 } 4895 return 1 4896 } 4897 4898 func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ 4899 bp := tls.Alloc(96) 4900 defer tls.Free(96) 4901 4902 // var a4 in_addr at bp, 4 4903 4904 // var a6 in6_addr at bp+68, 16 4905 4906 if X__inet_aton(tls, name, bp) > 0 { 4907 if family == 10 { // wrong family 4908 return -2 4909 } 4910 Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{}))) 4911 (*address)(unsafe.Pointer(buf)).family = 2 4912 (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) 4913 return 1 4914 } 4915 // var tmp [64]int8 at bp+4, 64 4916 4917 var p uintptr = Xstrchr(tls, name, '%') 4918 // var z uintptr at bp+88, 8 4919 4920 var scopeid uint64 = uint64(0) 4921 if p != 0 && (int64(p)-int64(name))/1 < int64(64) { 4922 Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1)) 4923 *(*int8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = int8(0) 4924 name = bp + 4 /* &tmp[0] */ 4925 } 4926 4927 if Xinet_pton(tls, 10, name, bp+68) <= 0 { 4928 return 0 4929 } 4930 if family == 2 { // wrong family 4931 return -2 4932 } 4933 4934 Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{}))) 4935 (*address)(unsafe.Pointer(buf)).family = 10 4936 if p != 0 { 4937 if func() int32 { 4938 if 0 != 0 { 4939 return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) 4940 } 4941 return Bool32(uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10)) 4942 }() != 0 { 4943 scopeid = Xstrtoull(tls, p, bp+88, 10) 4944 } else { 4945 *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1) 4946 } 4947 if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 { 4948 Xabort(tls) //TODO- 4949 // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && 4950 // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) 4951 // return EAI_NONAME; 4952 // scopeid = if_nametoindex(p); 4953 // if (!scopeid) return EAI_NONAME; 4954 } 4955 if scopeid > uint64(0xffffffff) { 4956 return -2 4957 } 4958 } 4959 (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid) 4960 return 1 4961 } 4962 4963 func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ 4964 var s uintptr 4965 //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; 4966 if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) { 4967 return 0 4968 } 4969 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++ { 4970 } 4971 return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) 4972 } 4973 4974 var Xzero_struct_address address /* lookup_name.c:27:16: */ 4975 4976 func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ 4977 var cnt int32 = 0 4978 if name != 0 { 4979 return 0 4980 } 4981 if flags&0x01 != 0 { 4982 //TODO if (family != AF_INET6) 4983 //TODO buf[cnt++] = (struct address){ .family = AF_INET }; 4984 if family != 10 { 4985 var x = Xzero_struct_address 4986 x.family = 2 4987 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 4988 } 4989 //TODO if (family != AF_INET) 4990 //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; 4991 if family != 2 { 4992 var x = Xzero_struct_address 4993 x.family = 10 4994 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 4995 } 4996 } else { 4997 Xabort(tls) //TODO- 4998 // if (family != AF_INET6) 4999 // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; 5000 // if (family != AF_INET) 5001 // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; 5002 } 5003 return cnt 5004 } 5005 5006 func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ 5007 return X__lookup_ipliteral(tls, buf, name, family) 5008 } 5009 5010 func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ 5011 bp := tls.Alloc(512) 5012 defer tls.Free(512) 5013 5014 // var line [512]int8 at bp, 512 5015 5016 var l size_t = Xstrlen(tls, name) 5017 var cnt int32 = 0 5018 var badfam int32 = 0 5019 var _buf [1032]uint8 5020 _ = _buf 5021 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 5022 var _f FILE 5023 _ = _f 5024 var f uintptr = Xfopen(tls, ts+76, ts+87) 5025 if !(f != 0) { 5026 switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { 5027 case 2: 5028 fallthrough 5029 case 20: 5030 fallthrough 5031 case 13: 5032 return 0 5033 fallthrough 5034 default: 5035 return -11 5036 } 5037 } 5038 for Xfgets(tls, bp, int32(unsafe.Sizeof([512]int8{})), f) != 0 && cnt < 48 { 5039 var p uintptr 5040 var z uintptr 5041 5042 if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 { 5043 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') 5044 *(*int8)(unsafe.Pointer(p)) = int8(0) 5045 } 5046 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++ { 5047 } 5048 if !(p != 0) { 5049 continue 5050 } 5051 5052 // Isolate IP address to parse 5053 for p = bp; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { 5054 } 5055 *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) 5056 switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) { 5057 case 1: 5058 cnt++ 5059 break 5060 case 0: 5061 continue 5062 default: 5063 badfam = -2 5064 continue 5065 } 5066 5067 // Extract first name as canonical name 5068 for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ { 5069 } 5070 for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { 5071 } 5072 *(*int8)(unsafe.Pointer(z)) = int8(0) 5073 if is_valid_hostname(tls, p) != 0 { 5074 Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1))) 5075 } 5076 } 5077 //TODO __fclose_ca(f); 5078 Xfclose(tls, f) 5079 if cnt != 0 { 5080 return cnt 5081 } 5082 return badfam 5083 } 5084 5085 type dpc_ctx = struct { 5086 addrs uintptr 5087 canon uintptr 5088 cnt int32 5089 _ [4]byte 5090 } /* lookup_name.c:112:1 */ 5091 5092 func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ 5093 return -1 //TODO- 5094 Xabort(tls) 5095 return int32(0) //TODO- 5096 // char search[256]; 5097 // struct resolvconf conf; 5098 // size_t l, dots; 5099 // char *p, *z; 5100 5101 // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; 5102 5103 // /* Count dots, suppress search when >=ndots or name ends in 5104 // * a dot, which is an explicit request for global scope. */ 5105 // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; 5106 // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; 5107 5108 // /* Strip final dot for canon, fail if multiple trailing dots. */ 5109 // if (name[l-1]=='.') l--; 5110 // if (!l || name[l-1]=='.') return EAI_NONAME; 5111 5112 // /* This can never happen; the caller already checked length. */ 5113 // if (l >= 256) return EAI_NONAME; 5114 5115 // /* Name with search domain appended is setup in canon[]. This both 5116 // * provides the desired default canonical name (if the requested 5117 // * name is not a CNAME record) and serves as a buffer for passing 5118 // * the full requested name to name_from_dns. */ 5119 // memcpy(canon, name, l); 5120 // canon[l] = '.'; 5121 5122 // for (p=search; *p; p=z) { 5123 // for (; isspace(*p); p++); 5124 // for (z=p; *z && !isspace(*z); z++); 5125 // if (z==p) break; 5126 // if (z-p < 256 - l - 1) { 5127 // memcpy(canon+l+1, p, z-p); 5128 // canon[z-p+1+l] = 0; 5129 // int cnt = name_from_dns(buf, canon, canon, family, &conf); 5130 // if (cnt) return cnt; 5131 // } 5132 // } 5133 5134 // canon[l] = 0; 5135 // return name_from_dns(buf, canon, name, family, &conf); 5136 } 5137 5138 type policy = struct { 5139 addr [16]uint8 5140 len uint8 5141 mask uint8 5142 prec uint8 5143 label uint8 5144 } /* lookup_name.c:237:14 */ 5145 5146 var defpolicy = [6]policy{ 5147 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)}, 5148 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)}, 5149 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)}, 5150 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)}, 5151 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)}, 5152 // Last rule must match all addresses to stop loop. 5153 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), prec: uint8(40), label: uint8(1)}, 5154 } /* lookup_name.c:241:3 */ 5155 5156 func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ 5157 var i int32 5158 for i = 0; ; i++ { 5159 if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].len)) != 0 { 5160 continue 5161 } 5162 if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].len))))&int32(defpolicy[i].mask) != 5163 int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].len)))) { 5164 continue 5165 } 5166 return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 5167 } 5168 return uintptr(0) 5169 } 5170 5171 func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ 5172 return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label) 5173 } 5174 5175 func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ 5176 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff { 5177 return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15 5178 } 5179 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 { 5180 return 2 5181 } 5182 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 { 5183 return 2 5184 } 5185 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 { 5186 return 5 5187 } 5188 return 14 5189 } 5190 5191 func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ 5192 // FIXME: The common prefix length should be limited to no greater 5193 // than the nominal length of the prefix portion of the source 5194 // address. However the definition of the source prefix length is 5195 // not clear and thus this limiting is not yet implemented. 5196 var i uint32 5197 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++ { 5198 } 5199 return int32(i) 5200 } 5201 5202 func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ 5203 var a uintptr = _a 5204 var b uintptr = _b 5205 return (*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey 5206 } 5207 5208 func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ 5209 bp := tls.Alloc(92) 5210 defer tls.Free(92) 5211 5212 var cnt int32 = 0 5213 var i int32 5214 var j int32 5215 _ = j 5216 5217 *(*int8)(unsafe.Pointer(canon)) = int8(0) 5218 if name != 0 { 5219 // reject empty name and check len so it fits into temp bufs 5220 var l size_t = Xstrnlen(tls, name, uint64(255)) 5221 if l-uint64(1) >= uint64(254) { 5222 return -2 5223 } 5224 Xmemcpy(tls, canon, name, l+uint64(1)) 5225 } 5226 5227 // Procedurally, a request for v6 addresses with the v4-mapped 5228 // flag set is like a request for unspecified family, followed 5229 // by filtering of the results. 5230 if flags&0x08 != 0 { 5231 if family == 10 { 5232 family = 0 5233 } else { 5234 flags = flags - 0x08 5235 } 5236 } 5237 5238 // Try each backend until there's at least one result. 5239 cnt = name_from_null(tls, buf, name, family, flags) 5240 if !(cnt != 0) { 5241 cnt = name_from_numeric(tls, buf, name, family) 5242 } 5243 if !(cnt != 0) && !(flags&0x04 != 0) { 5244 cnt = name_from_hosts(tls, buf, canon, name, family) 5245 if !(cnt != 0) { 5246 cnt = name_from_dns_search(tls, buf, canon, name, family) 5247 } 5248 } 5249 if cnt <= 0 { 5250 if cnt != 0 { 5251 return cnt 5252 } 5253 return -2 5254 } 5255 5256 // Filter/transform results for v4-mapped lookup, if requested. 5257 if flags&0x08 != 0 { 5258 Xabort(tls) //TODO- 5259 // if (!(flags & AI_ALL)) { 5260 // /* If any v6 results exist, remove v4 results. */ 5261 // for (i=0; i<cnt && buf[i].family != AF_INET6; i++); 5262 // if (i<cnt) { 5263 // for (j=0; i<cnt; i++) { 5264 // if (buf[i].family == AF_INET6) 5265 // buf[j++] = buf[i]; 5266 // } 5267 // cnt = i = j; 5268 // } 5269 // } 5270 // /* Translate any remaining v4 results to v6 */ 5271 // for (i=0; i<cnt; i++) { 5272 // if (buf[i].family != AF_INET) continue; 5273 // memcpy(buf[i].addr+12, buf[i].addr, 4); 5274 // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12); 5275 // buf[i].family = AF_INET6; 5276 // } 5277 } 5278 5279 // No further processing is needed if there are fewer than 2 5280 // results or if there are only IPv4 results. 5281 if cnt < 2 || family == 2 { 5282 return cnt 5283 } 5284 for i = 0; i < cnt; i++ { 5285 if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).family != 2 { 5286 break 5287 } 5288 } 5289 if i == cnt { 5290 return cnt 5291 } 5292 var cs int32 5293 _ = cs 5294 //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); 5295 5296 // The following implements a subset of RFC 3484/6724 destination 5297 // address selection by generating a single 31-bit sort key for 5298 // each address. Rules 3, 4, and 7 are omitted for having 5299 // excessive runtime and code size cost and dubious benefit. 5300 // So far the label/precedence table cannot be customized. 5301 for i = 0; i < cnt; i++ { 5302 var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).family 5303 var key int32 = 0 5304 *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{} 5305 *(*sockaddr_in6)(unsafe.Pointer(bp /* da6 */)) = sockaddr_in6{sin6_family: sa_family_t(10), sin6_port: in_port_t(65535), sin6_scope_id: (*address)(unsafe.Pointer(buf + uintptr(i)*28)).scopeid} 5306 *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{} 5307 *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{sin_family: sa_family_t(2), sin_port: in_port_t(65535)} 5308 var sa1 uintptr 5309 var da uintptr 5310 // var salen socklen_t at bp+88, 4 5311 5312 var dalen socklen_t 5313 if family == 10 { 5314 Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint64(16)) 5315 da = bp /* &da6 */ 5316 dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 5317 sa1 = bp + 28 /* &sa6 */ 5318 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 5319 } else { 5320 Xmemcpy(tls, bp+28+8, 5321 ts+90, uint64(12)) 5322 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) 5323 Xmemcpy(tls, bp+8, 5324 ts+90, uint64(12)) 5325 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) 5326 Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint64(4)) 5327 da = bp + 56 /* &da4 */ 5328 dalen = socklen_t(unsafe.Sizeof(sockaddr_in{})) 5329 sa1 = bp + 72 /* &sa4 */ 5330 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{})) 5331 } 5332 var dpolicy uintptr = policyof(tls, bp+8) 5333 var dscope int32 = scopeof(tls, bp+8) 5334 var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).label) 5335 var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).prec) 5336 var prefixlen int32 = 0 5337 var fd int32 = Xsocket(tls, family, 2|02000000, 17) 5338 if fd >= 0 { 5339 if !(Xconnect(tls, fd, da, dalen) != 0) { 5340 key = key | 0x40000000 5341 if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) { 5342 if family == 2 { 5343 Xmemcpy(tls, 5344 bp+28+8+uintptr(12), 5345 bp+72+4, uint64(4)) 5346 } 5347 if dscope == scopeof(tls, bp+28+8) { 5348 key = key | 0x20000000 5349 } 5350 if dlabel == labelof(tls, bp+28+8) { 5351 key = key | 0x10000000 5352 } 5353 prefixlen = prefixmatch(tls, bp+28+8, 5354 bp+8) 5355 } 5356 } 5357 Xclose(tls, fd) 5358 } 5359 key = key | dprec<<20 5360 key = key | (15-dscope)<<16 5361 key = key | prefixlen<<8 5362 key = key | (48-i)<<0 5363 (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key 5364 } 5365 Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { 5366 f func(*TLS, uintptr, uintptr) int32 5367 }{addrcmp}))) 5368 5369 //TODO pthread_setcancelstate(cs, 0); 5370 5371 return cnt 5372 } 5373 5374 func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ 5375 bp := tls.Alloc(8) 5376 defer tls.Free(8) 5377 5378 var line [128]int8 5379 _ = line 5380 var cnt int32 = 0 5381 var p uintptr 5382 _ = p 5383 *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */ 5384 var port uint64 = uint64(0) 5385 5386 switch socktype { 5387 case 1: 5388 switch proto { 5389 case 0: 5390 proto = 6 5391 fallthrough 5392 case 6: 5393 break 5394 default: 5395 return -8 5396 } 5397 break 5398 case 2: 5399 switch proto { 5400 case 0: 5401 proto = 17 5402 fallthrough 5403 case 17: 5404 break 5405 default: 5406 return -8 5407 } 5408 fallthrough 5409 case 0: 5410 break 5411 default: 5412 if name != 0 { 5413 return -8 5414 } 5415 (*service)(unsafe.Pointer(buf)).port = uint16_t(0) 5416 (*service)(unsafe.Pointer(buf)).proto = uint8(proto) 5417 (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype) 5418 return 1 5419 } 5420 5421 if name != 0 { 5422 if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) { 5423 return -8 5424 } 5425 port = Xstrtoul(tls, name, bp, 10) 5426 } 5427 if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) { 5428 if port > uint64(65535) { 5429 return -8 5430 } 5431 if proto != 17 { 5432 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) 5433 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1) 5434 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6) 5435 } 5436 if proto != 6 { 5437 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) 5438 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2) 5439 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17) 5440 } 5441 return cnt 5442 } 5443 5444 if flags&0x400 != 0 { 5445 return -2 5446 } 5447 5448 var l size_t = Xstrlen(tls, name) 5449 _ = l 5450 5451 Xabort(tls) //TODO- 5452 // unsigned char _buf[1032]; 5453 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 5454 // if (!f) switch (errno) { 5455 // case ENOENT: 5456 // case ENOTDIR: 5457 // case EACCES: 5458 // return EAI_SERVICE; 5459 // default: 5460 // return EAI_SYSTEM; 5461 // } 5462 5463 Xabort(tls) //TODO- 5464 // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { 5465 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 5466 5467 // /* Find service name */ 5468 // for(p=line; (p=strstr(p, name)); p++) { 5469 // if (p>line && !isspace(p[-1])) continue; 5470 // if (p[l] && !isspace(p[l])) continue; 5471 // break; 5472 // } 5473 // if (!p) continue; 5474 5475 // /* Skip past canonical name at beginning of line */ 5476 // for (p=line; *p && !isspace(*p); p++); 5477 5478 // port = strtoul(p, &z, 10); 5479 // if (port > 65535 || z==p) continue; 5480 // if (!strncmp(z, "/udp", 4)) { 5481 // if (proto == IPPROTO_TCP) continue; 5482 // buf[cnt].port = port; 5483 // buf[cnt].socktype = SOCK_DGRAM; 5484 // buf[cnt++].proto = IPPROTO_UDP; 5485 // } 5486 // if (!strncmp(z, "/tcp", 4)) { 5487 // if (proto == IPPROTO_UDP) continue; 5488 // buf[cnt].port = port; 5489 // buf[cnt].socktype = SOCK_STREAM; 5490 // buf[cnt++].proto = IPPROTO_TCP; 5491 // } 5492 // } 5493 // __fclose_ca(f); 5494 // return cnt > 0 ? cnt : EAI_SERVICE; 5495 Xabort(tls) 5496 return int32(0) //TODO- 5497 } 5498 5499 func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */ 5500 x = x ^ x>>11 5501 x = x ^ x<<7&0x9D2C5680 5502 x = x ^ x<<15&0xEFC60000 5503 x = x ^ x>>18 5504 return x 5505 } 5506 5507 func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */ 5508 return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2)) 5509 } 5510 5511 func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */ 5512 var owner int32 = (*FILE)(unsafe.Pointer(f)).lock 5513 var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid 5514 if owner&CplInt32(0x40000000) == tid { 5515 return 0 5516 } 5517 owner = a_cas(tls, f+140, 0, tid) 5518 if !(owner != 0) { 5519 return 1 5520 } 5521 for AssignInt32(&owner, a_cas(tls, f+140, 0, tid|0x40000000)) != 0 { 5522 if owner&0x40000000 != 0 || a_cas(tls, f+140, owner, owner|0x40000000) == owner { 5523 __futexwait(tls, f+140, owner|0x40000000, 1) 5524 } 5525 } 5526 return 1 5527 } 5528 5529 func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */ 5530 if a_swap(tls, f+140, 0)&0x40000000 != 0 { 5531 __wake(tls, f+140, 1, 1) 5532 } 5533 } 5534 5535 func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ 5536 *(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1 5537 if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { 5538 (*struct { 5539 f func(*TLS, uintptr, uintptr, size_t) size_t 5540 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).write})).f(tls, f, uintptr(0), uint64(0)) 5541 } 5542 (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0))) 5543 if (*FILE)(unsafe.Pointer(f)).flags&uint32(4) != 0 { 5544 *(*uint32)(unsafe.Pointer(f)) |= uint32(32) 5545 return -1 5546 } 5547 (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).buf+uintptr((*FILE)(unsafe.Pointer(f)).buf_size)) 5548 if (*FILE)(unsafe.Pointer(f)).flags&uint32(16) != 0 { 5549 return -1 5550 } 5551 return 0 5552 } 5553 5554 func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ 5555 X__builtin_abort(tls) //TODO- 5556 // __stdio_exit_needed(); 5557 } 5558 5559 // This function assumes it will never be called if there is already 5560 // data buffered for reading. 5561 5562 func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ 5563 bp := tls.Alloc(1) 5564 defer tls.Free(1) 5565 5566 // var c uint8 at bp, 1 5567 5568 if !(X__toread(tls, f) != 0) && (*struct { 5569 f func(*TLS, uintptr, uintptr, size_t) size_t 5570 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).read})).f(tls, f, bp, uint64(1)) == uint64(1) { 5571 return int32(*(*uint8)(unsafe.Pointer(bp))) 5572 } 5573 return -1 5574 } 5575 5576 func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */ 5577 var ret int32 5578 var ap va_list 5579 _ = ap 5580 ap = va 5581 ret = Xvsscanf(tls, s, fmt, ap) 5582 _ = ap 5583 return ret 5584 } 5585 5586 type wctrans_t = uintptr /* wctype.h:20:19 */ 5587 5588 func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */ 5589 if !(dest != 0) { 5590 return 5591 } 5592 switch size { 5593 case -2: 5594 *(*int8)(unsafe.Pointer(dest)) = int8(i) 5595 break 5596 case -1: 5597 *(*int16)(unsafe.Pointer(dest)) = int16(i) 5598 break 5599 case 0: 5600 *(*int32)(unsafe.Pointer(dest)) = int32(i) 5601 break 5602 case 1: 5603 *(*int64)(unsafe.Pointer(dest)) = int64(i) 5604 break 5605 case 3: 5606 *(*int64)(unsafe.Pointer(dest)) = int64(i) 5607 break 5608 } 5609 } 5610 5611 func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */ 5612 var p uintptr 5613 var i uint32 5614 var ap2 va_list 5615 _ = ap2 5616 ap2 = ap 5617 for i = n; i > uint32(1); i-- { 5618 VaUintptr(&ap2) 5619 } 5620 p = VaUintptr(&ap2) 5621 _ = ap2 5622 return p 5623 } 5624 5625 func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */ 5626 bp := tls.Alloc(276) 5627 defer tls.Free(276) 5628 5629 var width int32 5630 var size int32 5631 var alloc int32 5632 var base int32 5633 var p uintptr 5634 var c int32 5635 var t int32 5636 var s uintptr 5637 var wcs uintptr 5638 // var st mbstate_t at bp+268, 8 5639 5640 var dest uintptr 5641 var invert int32 5642 var matches int32 5643 var x uint64 5644 var y float64 5645 var pos off_t 5646 // var scanset [257]uint8 at bp, 257 5647 5648 var i size_t 5649 var k size_t 5650 // var wc wchar_t at bp+260, 4 5651 5652 var __need_unlock int32 5653 var tmp uintptr 5654 var tmp1 uintptr 5655 alloc = 0 5656 dest = uintptr(0) 5657 matches = 0 5658 pos = int64(0) 5659 __need_unlock = func() int32 { 5660 if (*FILE)(unsafe.Pointer(f)).lock >= 0 { 5661 return X__lockfile(tls, f) 5662 } 5663 return 0 5664 }() 5665 5666 if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { 5667 goto __1 5668 } 5669 X__toread(tls, f) 5670 __1: 5671 ; 5672 if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { 5673 goto __2 5674 } 5675 goto input_fail 5676 __2: 5677 ; 5678 5679 p = fmt 5680 __3: 5681 if !(*(*uint8)(unsafe.Pointer(p)) != 0) { 5682 goto __5 5683 } 5684 5685 alloc = 0 5686 5687 if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) { 5688 goto __6 5689 } 5690 __7: 5691 if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) { 5692 goto __8 5693 } 5694 p++ 5695 goto __7 5696 __8: 5697 ; 5698 X__shlim(tls, f, int64(0)) 5699 __9: 5700 if !(__isspace(tls, func() int32 { 5701 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5702 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5703 } 5704 return X__shgetc(tls, f) 5705 }()) != 0) { 5706 goto __10 5707 } 5708 goto __9 5709 __10: 5710 ; 5711 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 5712 (*FILE)(unsafe.Pointer(f)).rpos-- 5713 } else { 5714 } 5715 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 5716 goto __4 5717 __6: 5718 ; 5719 if !(int32(*(*uint8)(unsafe.Pointer(p))) != '%' || int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%') { 5720 goto __11 5721 } 5722 X__shlim(tls, f, int64(0)) 5723 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') { 5724 goto __12 5725 } 5726 p++ 5727 __14: 5728 if !(__isspace(tls, AssignInt32(&c, func() int32 { 5729 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5730 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5731 } 5732 return X__shgetc(tls, f) 5733 }())) != 0) { 5734 goto __15 5735 } 5736 goto __14 5737 __15: 5738 ; 5739 goto __13 5740 __12: 5741 c = func() int32 { 5742 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5743 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5744 } 5745 return X__shgetc(tls, f) 5746 }() 5747 __13: 5748 ; 5749 if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) { 5750 goto __16 5751 } 5752 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 5753 (*FILE)(unsafe.Pointer(f)).rpos-- 5754 } else { 5755 } 5756 if !(c < 0) { 5757 goto __17 5758 } 5759 goto input_fail 5760 __17: 5761 ; 5762 goto match_fail 5763 __16: 5764 ; 5765 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 5766 goto __4 5767 __11: 5768 ; 5769 5770 p++ 5771 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') { 5772 goto __18 5773 } 5774 dest = uintptr(0) 5775 p++ 5776 goto __19 5777 __18: 5778 if !(func() int32 { 5779 if 0 != 0 { 5780 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) 5781 } 5782 return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) 5783 }() != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$') { 5784 goto __20 5785 } 5786 dest = arg_n(tls, ap, uint32(int32(*(*uint8)(unsafe.Pointer(p)))-'0')) 5787 p += uintptr(2) 5788 goto __21 5789 __20: 5790 dest = VaUintptr(&ap) 5791 __21: 5792 ; 5793 __19: 5794 ; 5795 5796 width = 0 5797 __22: 5798 if !(func() int32 { 5799 if 0 != 0 { 5800 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) 5801 } 5802 return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) 5803 }() != 0) { 5804 goto __24 5805 } 5806 width = 10*width + int32(*(*uint8)(unsafe.Pointer(p))) - '0' 5807 goto __23 5808 __23: 5809 p++ 5810 goto __22 5811 goto __24 5812 __24: 5813 ; 5814 5815 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') { 5816 goto __25 5817 } 5818 wcs = uintptr(0) 5819 s = uintptr(0) 5820 alloc = BoolInt32(!!(dest != 0)) 5821 p++ 5822 goto __26 5823 __25: 5824 alloc = 0 5825 __26: 5826 ; 5827 5828 size = 0 5829 switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) { 5830 case 'h': 5831 goto __28 5832 case 'l': 5833 goto __29 5834 case 'j': 5835 goto __30 5836 case 'z': 5837 goto __31 5838 case 't': 5839 goto __32 5840 case 'L': 5841 goto __33 5842 case 'd': 5843 goto __34 5844 case 'i': 5845 goto __35 5846 case 'o': 5847 goto __36 5848 case 'u': 5849 goto __37 5850 case 'x': 5851 goto __38 5852 case 'a': 5853 goto __39 5854 case 'e': 5855 goto __40 5856 case 'f': 5857 goto __41 5858 case 'g': 5859 goto __42 5860 case 'A': 5861 goto __43 5862 case 'E': 5863 goto __44 5864 case 'F': 5865 goto __45 5866 case 'G': 5867 goto __46 5868 case 'X': 5869 goto __47 5870 case 's': 5871 goto __48 5872 case 'c': 5873 goto __49 5874 case '[': 5875 goto __50 5876 case 'S': 5877 goto __51 5878 case 'C': 5879 goto __52 5880 case 'p': 5881 goto __53 5882 case 'n': 5883 goto __54 5884 default: 5885 goto __55 5886 } 5887 goto __27 5888 __28: 5889 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') { 5890 goto __56 5891 } 5892 p++ 5893 size = -2 5894 goto __57 5895 __56: 5896 size = -1 5897 __57: 5898 ; 5899 goto __27 5900 __29: 5901 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') { 5902 goto __58 5903 } 5904 p++ 5905 size = 3 5906 goto __59 5907 __58: 5908 size = 1 5909 __59: 5910 ; 5911 goto __27 5912 __30: 5913 size = 3 5914 goto __27 5915 __31: 5916 __32: 5917 size = 1 5918 goto __27 5919 __33: 5920 size = 2 5921 goto __27 5922 __34: 5923 __35: 5924 __36: 5925 __37: 5926 __38: 5927 __39: 5928 __40: 5929 __41: 5930 __42: 5931 __43: 5932 __44: 5933 __45: 5934 __46: 5935 __47: 5936 __48: 5937 __49: 5938 __50: 5939 __51: 5940 __52: 5941 __53: 5942 __54: 5943 p-- 5944 goto __27 5945 __55: 5946 goto fmt_fail 5947 __27: 5948 ; 5949 5950 t = int32(*(*uint8)(unsafe.Pointer(p))) 5951 5952 // C or S 5953 if !(t&0x2f == 3) { 5954 goto __60 5955 } 5956 t = t | 32 5957 size = 1 5958 __60: 5959 ; 5960 5961 switch t { 5962 case 'c': 5963 goto __62 5964 case '[': 5965 goto __63 5966 case 'n': 5967 goto __64 5968 default: 5969 goto __65 5970 } 5971 goto __61 5972 __62: 5973 if !(width < 1) { 5974 goto __66 5975 } 5976 width = 1 5977 __66: 5978 ; 5979 __63: 5980 goto __61 5981 __64: 5982 store_int(tls, dest, size, uint64(pos)) 5983 // do not increment match count, etc! 5984 goto __4 5985 __65: 5986 X__shlim(tls, f, int64(0)) 5987 __67: 5988 if !(__isspace(tls, func() int32 { 5989 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5990 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5991 } 5992 return X__shgetc(tls, f) 5993 }()) != 0) { 5994 goto __68 5995 } 5996 goto __67 5997 __68: 5998 ; 5999 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6000 (*FILE)(unsafe.Pointer(f)).rpos-- 6001 } else { 6002 } 6003 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 6004 __61: 6005 ; 6006 6007 X__shlim(tls, f, int64(width)) 6008 if !(func() int32 { 6009 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6010 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6011 } 6012 return X__shgetc(tls, f) 6013 }() < 0) { 6014 goto __69 6015 } 6016 goto input_fail 6017 __69: 6018 ; 6019 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6020 (*FILE)(unsafe.Pointer(f)).rpos-- 6021 } else { 6022 } 6023 6024 switch t { 6025 case 's': 6026 goto __71 6027 case 'c': 6028 goto __72 6029 case '[': 6030 goto __73 6031 case 'p': 6032 goto __74 6033 case 'X': 6034 goto __75 6035 case 'x': 6036 goto __76 6037 case 'o': 6038 goto __77 6039 case 'd': 6040 goto __78 6041 case 'u': 6042 goto __79 6043 case 'i': 6044 goto __80 6045 case 'a': 6046 goto __81 6047 case 'A': 6048 goto __82 6049 case 'e': 6050 goto __83 6051 case 'E': 6052 goto __84 6053 case 'f': 6054 goto __85 6055 case 'F': 6056 goto __86 6057 case 'g': 6058 goto __87 6059 case 'G': 6060 goto __88 6061 } 6062 goto __70 6063 __71: 6064 __72: 6065 __73: 6066 if !(t == 'c' || t == 's') { 6067 goto __89 6068 } 6069 Xmemset(tls, bp, -1, uint64(unsafe.Sizeof([257]uint8{}))) 6070 *(*uint8)(unsafe.Pointer(bp)) = uint8(0) 6071 if !(t == 's') { 6072 goto __91 6073 } 6074 *(*uint8)(unsafe.Pointer(bp + 10)) = uint8(0) 6075 *(*uint8)(unsafe.Pointer(bp + 11)) = uint8(0) 6076 *(*uint8)(unsafe.Pointer(bp + 12)) = uint8(0) 6077 *(*uint8)(unsafe.Pointer(bp + 13)) = uint8(0) 6078 *(*uint8)(unsafe.Pointer(bp + 14)) = uint8(0) 6079 *(*uint8)(unsafe.Pointer(bp + 33)) = uint8(0) 6080 __91: 6081 ; 6082 goto __90 6083 __89: 6084 if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') { 6085 goto __92 6086 } 6087 p++ 6088 invert = 1 6089 goto __93 6090 __92: 6091 invert = 0 6092 __93: 6093 ; 6094 Xmemset(tls, bp, invert, uint64(unsafe.Sizeof([257]uint8{}))) 6095 *(*uint8)(unsafe.Pointer(bp)) = uint8(0) 6096 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') { 6097 goto __94 6098 } 6099 p++ 6100 *(*uint8)(unsafe.Pointer(bp + 46)) = uint8(1 - invert) 6101 goto __95 6102 __94: 6103 if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') { 6104 goto __96 6105 } 6106 p++ 6107 *(*uint8)(unsafe.Pointer(bp + 94)) = uint8(1 - invert) 6108 __96: 6109 ; 6110 __95: 6111 ; 6112 __97: 6113 if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') { 6114 goto __99 6115 } 6116 if !!(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { 6117 goto __100 6118 } 6119 goto fmt_fail 6120 __100: 6121 ; 6122 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-' && *(*uint8)(unsafe.Pointer(p + 1)) != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']') { 6123 goto __101 6124 } 6125 c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1)))) 6126 __102: 6127 if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) { 6128 goto __104 6129 } 6130 *(*uint8)(unsafe.Pointer(bp + uintptr(1+c))) = uint8(1 - invert) 6131 goto __103 6132 __103: 6133 c++ 6134 goto __102 6135 goto __104 6136 __104: 6137 ; 6138 __101: 6139 ; 6140 *(*uint8)(unsafe.Pointer(bp + uintptr(1+int32(*(*uint8)(unsafe.Pointer(p)))))) = uint8(1 - invert) 6141 goto __98 6142 __98: 6143 p++ 6144 goto __97 6145 goto __99 6146 __99: 6147 ; 6148 __90: 6149 ; 6150 wcs = uintptr(0) 6151 s = uintptr(0) 6152 i = uint64(0) 6153 if t == 'c' { 6154 k = uint64(uint32(width) + 1) 6155 } else { 6156 k = uint64(31) 6157 } 6158 if !(size == 1) { 6159 goto __105 6160 } 6161 if !(alloc != 0) { 6162 goto __107 6163 } 6164 wcs = Xmalloc(tls, k*size_t(unsafe.Sizeof(wchar_t(0)))) 6165 if !!(wcs != 0) { 6166 goto __109 6167 } 6168 goto alloc_fail 6169 __109: 6170 ; 6171 goto __108 6172 __107: 6173 wcs = dest 6174 __108: 6175 ; 6176 *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{} 6177 __110: 6178 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6179 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6180 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6181 } 6182 return X__shgetc(tls, f) 6183 }())+1))) != 0) { 6184 goto __111 6185 } 6186 switch Xmbrtowc(tls, bp+260, func() uintptr { *(*int8)(unsafe.Pointer(bp + 264)) = int8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) { 6187 case Uint64FromInt32(-1): 6188 goto __113 6189 case Uint64FromInt32(-2): 6190 goto __114 6191 } 6192 goto __112 6193 __113: 6194 goto input_fail 6195 __114: 6196 goto __110 6197 __112: 6198 ; 6199 if !(wcs != 0) { 6200 goto __115 6201 } 6202 *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint64(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */)) 6203 __115: 6204 ; 6205 if !(alloc != 0 && i == k) { 6206 goto __116 6207 } 6208 k = k + (k + uint64(1)) 6209 tmp = Xrealloc(tls, wcs, k*size_t(unsafe.Sizeof(wchar_t(0)))) 6210 if !!(tmp != 0) { 6211 goto __117 6212 } 6213 goto alloc_fail 6214 __117: 6215 ; 6216 wcs = tmp 6217 __116: 6218 ; 6219 goto __110 6220 __111: 6221 ; 6222 if !!(Xmbsinit(tls, bp+268) != 0) { 6223 goto __118 6224 } 6225 goto input_fail 6226 __118: 6227 ; 6228 goto __106 6229 __105: 6230 if !(alloc != 0) { 6231 goto __119 6232 } 6233 s = Xmalloc(tls, k) 6234 if !!(s != 0) { 6235 goto __121 6236 } 6237 goto alloc_fail 6238 __121: 6239 ; 6240 __122: 6241 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6242 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6243 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6244 } 6245 return X__shgetc(tls, f) 6246 }())+1))) != 0) { 6247 goto __123 6248 } 6249 *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = int8(c) 6250 if !(i == k) { 6251 goto __124 6252 } 6253 k = k + (k + uint64(1)) 6254 tmp1 = Xrealloc(tls, s, k) 6255 if !!(tmp1 != 0) { 6256 goto __125 6257 } 6258 goto alloc_fail 6259 __125: 6260 ; 6261 s = tmp1 6262 __124: 6263 ; 6264 goto __122 6265 __123: 6266 ; 6267 goto __120 6268 __119: 6269 if !(AssignUintptr(&s, dest) != 0) { 6270 goto __126 6271 } 6272 __128: 6273 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6274 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6275 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6276 } 6277 return X__shgetc(tls, f) 6278 }())+1))) != 0) { 6279 goto __129 6280 } 6281 *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = int8(c) 6282 goto __128 6283 __129: 6284 ; 6285 goto __127 6286 __126: 6287 __130: 6288 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6289 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6290 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6291 } 6292 return X__shgetc(tls, f) 6293 }())+1))) != 0) { 6294 goto __131 6295 } 6296 goto __130 6297 __131: 6298 ; 6299 __127: 6300 ; 6301 __120: 6302 ; 6303 __106: 6304 ; 6305 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6306 (*FILE)(unsafe.Pointer(f)).rpos-- 6307 } else { 6308 } 6309 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6310 goto __132 6311 } 6312 goto match_fail 6313 __132: 6314 ; 6315 if !(t == 'c' && (*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != off_t(width)) { 6316 goto __133 6317 } 6318 goto match_fail 6319 __133: 6320 ; 6321 if !(alloc != 0) { 6322 goto __134 6323 } 6324 if !(size == 1) { 6325 goto __135 6326 } 6327 *(*uintptr)(unsafe.Pointer(dest)) = wcs 6328 goto __136 6329 __135: 6330 *(*uintptr)(unsafe.Pointer(dest)) = s 6331 __136: 6332 ; 6333 __134: 6334 ; 6335 if !(t != 'c') { 6336 goto __137 6337 } 6338 if !(wcs != 0) { 6339 goto __138 6340 } 6341 *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = 0 6342 __138: 6343 ; 6344 if !(s != 0) { 6345 goto __139 6346 } 6347 *(*int8)(unsafe.Pointer(s + uintptr(i))) = int8(0) 6348 __139: 6349 ; 6350 __137: 6351 ; 6352 goto __70 6353 __74: 6354 __75: 6355 __76: 6356 base = 16 6357 goto int_common 6358 __77: 6359 base = 8 6360 goto int_common 6361 __78: 6362 __79: 6363 base = 10 6364 goto int_common 6365 __80: 6366 base = 0 6367 int_common: 6368 x = X__intscan(tls, f, uint32(base), 0, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6369 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6370 goto __140 6371 } 6372 goto match_fail 6373 __140: 6374 ; 6375 if !(t == 'p' && dest != 0) { 6376 goto __141 6377 } 6378 *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x)) 6379 goto __142 6380 __141: 6381 store_int(tls, dest, size, x) 6382 __142: 6383 ; 6384 goto __70 6385 __81: 6386 __82: 6387 __83: 6388 __84: 6389 __85: 6390 __86: 6391 __87: 6392 __88: 6393 y = X__floatscan(tls, f, size, 0) 6394 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6395 goto __143 6396 } 6397 goto match_fail 6398 __143: 6399 ; 6400 if !(dest != 0) { 6401 goto __144 6402 } 6403 switch size { 6404 case 0: 6405 goto __146 6406 case 1: 6407 goto __147 6408 case 2: 6409 goto __148 6410 } 6411 goto __145 6412 __146: 6413 *(*float32)(unsafe.Pointer(dest)) = float32(y) 6414 goto __145 6415 __147: 6416 *(*float64)(unsafe.Pointer(dest)) = y 6417 goto __145 6418 __148: 6419 *(*float64)(unsafe.Pointer(dest)) = y 6420 goto __145 6421 __145: 6422 ; 6423 __144: 6424 ; 6425 goto __70 6426 __70: 6427 ; 6428 6429 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 6430 if !(dest != 0) { 6431 goto __149 6432 } 6433 matches++ 6434 __149: 6435 ; 6436 goto __4 6437 __4: 6438 p++ 6439 goto __3 6440 goto __5 6441 __5: 6442 ; 6443 if !(0 != 0) { 6444 goto __150 6445 } 6446 fmt_fail: 6447 alloc_fail: 6448 input_fail: 6449 if !!(matches != 0) { 6450 goto __151 6451 } 6452 matches-- 6453 __151: 6454 ; 6455 match_fail: 6456 if !(alloc != 0) { 6457 goto __152 6458 } 6459 Xfree(tls, s) 6460 Xfree(tls, wcs) 6461 __152: 6462 ; 6463 __150: 6464 ; 6465 __153: 6466 if !(__need_unlock != 0) { 6467 goto __156 6468 } 6469 X__unlockfile(tls, f) 6470 __156: 6471 ; 6472 goto __154 6473 __154: 6474 if 0 != 0 { 6475 goto __153 6476 } 6477 goto __155 6478 __155: 6479 ; 6480 return matches 6481 } 6482 6483 func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */ 6484 var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie 6485 var k size_t = len + uint64(256) 6486 var end uintptr = Xmemchr(tls, src, 0, k) 6487 if end != 0 { 6488 k = size_t((int64(end) - int64(src)) / 1) 6489 } 6490 if k < len { 6491 len = k 6492 } 6493 Xmemcpy(tls, buf, src, len) 6494 (*FILE)(unsafe.Pointer(f)).rpos = src + uintptr(len) 6495 (*FILE)(unsafe.Pointer(f)).rend = src + uintptr(k) 6496 (*FILE)(unsafe.Pointer(f)).cookie = src + uintptr(k) 6497 return len 6498 } 6499 6500 func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */ 6501 bp := tls.Alloc(232) 6502 defer tls.Free(232) 6503 6504 *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct { 6505 f func(*TLS, uintptr, uintptr, size_t) size_t 6506 }{string_read})), buf: s, lock: -1, cookie: s} 6507 return Xvfscanf(tls, bp, fmt, ap) 6508 } 6509 6510 func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */ 6511 var try uintptr 6512 var sign int32 6513 for nel > uint64(0) { 6514 try = base + uintptr(width*(nel/uint64(2))) 6515 sign = (*struct { 6516 f func(*TLS, uintptr, uintptr) int32 6517 })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try) 6518 if sign < 0 { 6519 nel = nel / uint64(2) 6520 } else if sign > 0 { 6521 base = try + uintptr(width) 6522 nel = nel - (nel/uint64(2) + uint64(1)) 6523 } else { 6524 return try 6525 } 6526 } 6527 return uintptr(0) 6528 } 6529 6530 func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ 6531 bp := tls.Alloc(232) 6532 defer tls.Free(232) 6533 6534 // var f FILE at bp, 232 6535 6536 (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) 6537 (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) 6538 X__shlim(tls, bp, int64(0)) 6539 var y float64 = X__floatscan(tls, bp, prec, 1) 6540 var cnt off_t = (*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1 6541 if p != 0 { 6542 *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { 6543 if cnt != 0 { 6544 return s + uintptr(cnt) 6545 } 6546 return s 6547 }() 6548 } 6549 return y 6550 } 6551 6552 func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ 6553 return float32(strtox(tls, s, p, 0)) 6554 } 6555 6556 func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ 6557 return strtox(tls, s, p, 1) 6558 } 6559 6560 func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ 6561 return strtox(tls, s, p, 2) 6562 } 6563 6564 func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ 6565 bp := tls.Alloc(232) 6566 defer tls.Free(232) 6567 6568 // var f FILE at bp, 232 6569 6570 (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) 6571 (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) 6572 X__shlim(tls, bp, int64(0)) 6573 var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim) 6574 if p != 0 { 6575 var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1) 6576 *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt) 6577 } 6578 return y 6579 } 6580 6581 func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ 6582 return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6583 } 6584 6585 func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ 6586 return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1)))) 6587 } 6588 6589 func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */ 6590 return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))) 6591 } 6592 6593 func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */ 6594 return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1)))) 6595 } 6596 6597 func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ 6598 return intmax_t(Xstrtoll(tls, s, p, base)) 6599 } 6600 6601 func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ 6602 return uintmax_t(Xstrtoull(tls, s, p, base)) 6603 } 6604 6605 func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ 6606 var l size_t = Xstrlen(tls, s) 6607 var d uintptr = Xmalloc(tls, l+uint64(1)) 6608 if !(d != 0) { 6609 return uintptr(0) 6610 } 6611 return Xmemcpy(tls, d, s, l+uint64(1)) 6612 } 6613 6614 func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */ 6615 var l size_t = Xstrnlen(tls, d, n) 6616 if l == n { 6617 return l + Xstrlen(tls, s) 6618 } 6619 return l + Xstrlcpy(tls, d+uintptr(l), s, n-l) 6620 } 6621 6622 // Support signed or unsigned plain-char 6623 6624 // Implementation choices... 6625 6626 // Arbitrary numbers... 6627 6628 // POSIX/SUS requirements follow. These numbers come directly 6629 // from SUS and have nothing to do with the host system. 6630 6631 func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */ 6632 var d0 uintptr 6633 var wd uintptr 6634 var ws uintptr 6635 d0 = d 6636 6637 if !!(int32(PostDecUint64(&n, 1)) != 0) { 6638 goto __1 6639 } 6640 goto finish 6641 __1: 6642 ; 6643 if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) == uintptr_t(d)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1))) { 6644 goto __2 6645 } 6646 __3: 6647 if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) != 0 && n != 0 && AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0) { 6648 goto __5 6649 } 6650 goto __4 6651 __4: 6652 n-- 6653 s++ 6654 d++ 6655 goto __3 6656 goto __5 6657 __5: 6658 ; 6659 if !(n != 0 && *(*int8)(unsafe.Pointer(s)) != 0) { 6660 goto __6 6661 } 6662 wd = d 6663 ws = s 6664 __7: 6665 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)) { 6666 goto __9 6667 } 6668 *(*size_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) 6669 goto __8 6670 __8: 6671 n = n - size_t(unsafe.Sizeof(size_t(0))) 6672 ws += 8 6673 wd += 8 6674 goto __7 6675 goto __9 6676 __9: 6677 ; 6678 d = wd 6679 s = ws 6680 __6: 6681 ; 6682 __2: 6683 ; 6684 __10: 6685 if !(n != 0 && AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0) { 6686 goto __12 6687 } 6688 goto __11 6689 __11: 6690 n-- 6691 s++ 6692 d++ 6693 goto __10 6694 goto __12 6695 __12: 6696 ; 6697 *(*int8)(unsafe.Pointer(d)) = int8(0) 6698 finish: 6699 return size_t((int64(d)-int64(d0))/1) + Xstrlen(tls, s) 6700 } 6701 6702 func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */ 6703 var l uintptr = _l 6704 var r uintptr = _r 6705 if !(int32(PostDecUint64(&n, 1)) != 0) { 6706 return 0 6707 } 6708 __1: 6709 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)))))) { 6710 goto __3 6711 } 6712 goto __2 6713 __2: 6714 l++ 6715 r++ 6716 n-- 6717 goto __1 6718 goto __3 6719 __3: 6720 ; 6721 return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))) 6722 } 6723 6724 func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */ 6725 return Xstrncasecmp(tls, l, r, n) 6726 } 6727 6728 func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */ 6729 var a uintptr = d 6730 d += uintptr(Xstrlen(tls, d)) 6731 for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 { 6732 n-- 6733 *(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) 6734 } 6735 *(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = int8(0) 6736 return a 6737 } 6738 6739 func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ 6740 var p uintptr = Xmemchr(tls, s, 0, n) 6741 if p != 0 { 6742 return uint64((int64(p) - int64(s)) / 1) 6743 } 6744 return n 6745 } 6746 6747 func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ 6748 bp := tls.Alloc(32) 6749 defer tls.Free(32) 6750 6751 var a uintptr = s 6752 *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} 6753 6754 if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { 6755 return uint64(0) 6756 } 6757 if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { 6758 for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { 6759 } 6760 return size_t((int64(s) - int64(a)) / 1) 6761 } 6762 6763 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++ { 6764 } 6765 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++ { 6766 } 6767 return size_t((int64(s) - int64(a)) / 1) 6768 } 6769 6770 func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ 6771 if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) { 6772 return uintptr(0) 6773 } 6774 s += uintptr(Xstrspn(tls, s, sep)) 6775 if !(int32(*(*int8)(unsafe.Pointer(s))) != 0) { 6776 return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0)) 6777 } 6778 _sp = s + uintptr(Xstrcspn(tls, s, sep)) 6779 if *(*int8)(unsafe.Pointer(_sp)) != 0 { 6780 *(*int8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = int8(0) 6781 } else { 6782 _sp = uintptr(0) 6783 } 6784 return s 6785 } 6786 6787 var _sp uintptr /* strtok.c:5:14: */ 6788 6789 func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ 6790 return *(*int32)(unsafe.Pointer(a + 6*4)) 6791 } 6792 6793 func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ 6794 *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4)) 6795 return 0 6796 } 6797 6798 // 6799 // int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) 6800 // { 6801 // *size = a->_a_guardsize; 6802 // return 0; 6803 // } 6804 // 6805 // int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) 6806 // { 6807 // *inherit = a->_a_sched; 6808 // return 0; 6809 // } 6810 // 6811 // int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) 6812 // { 6813 // param->sched_priority = a->_a_prio; 6814 // return 0; 6815 // } 6816 // 6817 // int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) 6818 // { 6819 // *policy = a->_a_policy; 6820 // return 0; 6821 // } 6822 // 6823 // int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) 6824 // { 6825 // *scope = PTHREAD_SCOPE_SYSTEM; 6826 // return 0; 6827 // } 6828 // 6829 // int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) 6830 // { 6831 // if (!a->_a_stackaddr) 6832 // return EINVAL; 6833 // *size = a->_a_stacksize; 6834 // *addr = (void *)(a->_a_stackaddr - *size); 6835 // return 0; 6836 // } 6837 // 6838 // int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) 6839 // { 6840 // *size = a->_a_stacksize; 6841 // return 0; 6842 // } 6843 // 6844 // int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) 6845 // { 6846 // *pshared = !!a->__attr; 6847 // return 0; 6848 // } 6849 // 6850 // int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) 6851 // { 6852 // *clk = a->__attr & 0x7fffffff; 6853 // return 0; 6854 // } 6855 // 6856 // int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) 6857 // { 6858 // *pshared = a->__attr>>31; 6859 // return 0; 6860 // } 6861 // 6862 // int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) 6863 // { 6864 // *protocol = PTHREAD_PRIO_NONE; 6865 // return 0; 6866 // } 6867 // int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) 6868 // { 6869 // *pshared = a->__attr / 128U % 2; 6870 // return 0; 6871 // } 6872 // 6873 // int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) 6874 // { 6875 // *robust = a->__attr / 4U % 2; 6876 // return 0; 6877 // } 6878 6879 func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ 6880 return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3)) 6881 } 6882 6883 // int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) 6884 // { 6885 // *type = a->__attr & 3; 6886 // return 0; 6887 // } 6888 // 6889 // int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) 6890 // { 6891 // *pshared = a->__attr[0]; 6892 // return 0; 6893 // } 6894 6895 func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ 6896 if uint32(state) > 1 { 6897 return 22 6898 } 6899 *(*int32)(unsafe.Pointer(a + 6*4)) = state 6900 return 0 6901 } 6902 6903 func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ 6904 return *(*int32)(unsafe.Pointer(m)) & 15 6905 } 6906 6907 // int __pthread_mutex_lock(pthread_mutex_t *m) 6908 // { 6909 // if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL 6910 // && !a_cas(&m->_m_lock, 0, EBUSY)) 6911 // return 0; 6912 // 6913 // return __pthread_mutex_timedlock(m, 0); 6914 // } 6915 // 6916 // weak_alias(__pthread_mutex_lock, pthread_mutex_lock); 6917 6918 func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ 6919 return 0 6920 } 6921 6922 func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ 6923 *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} 6924 return 0 6925 } 6926 6927 func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ 6928 if uint32(type1) > uint32(2) { 6929 return 22 6930 } 6931 (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr&Uint32FromInt32(CplInt32(3)) | uint32(type1) 6932 return 0 6933 } 6934 6935 func init() { 6936 *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = uintptr(unsafe.Pointer(&table)) + uintptr(128)*2 // __ctype_b_loc.c:36:45: 6937 } 6938 6939 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" 6940 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data