musl_linux_arm64.go (196707B)
1 // Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_arm64.go -pkgname libc -static-locals-prefix _s -Iarch/aarch64 -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 = uint32 /* <builtin>:15:24 */ 365 366 type uint16_t = uint16 /* alltypes.h:134:25 */ 367 368 type uint32_t = uint32 /* alltypes.h:139:25 */ 369 370 type uint64_t = uint64 /* alltypes.h:144: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:351:9 */ 414 415 type locale_t = uintptr /* alltypes.h:351: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:170:16 */ 489 490 type ino_t = uint64 /* alltypes.h:175: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]uint8 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]uint8 508 } /* dirent.h:20:9 */ 509 510 type DIR = __dirstream /* dirent.h:20:28 */ 511 512 type ssize_t = int64 /* alltypes.h:73:15 */ 513 514 type intptr_t = int64 /* alltypes.h:78:15 */ 515 516 type pid_t = int32 /* alltypes.h:243:13 */ 517 518 type uid_t = uint32 /* alltypes.h:253:18 */ 519 520 type gid_t = uint32 /* alltypes.h:258:18 */ 521 522 type useconds_t = uint32 /* alltypes.h:268: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:160:18 */ 544 545 type iovec = struct { 546 iov_base uintptr 547 iov_len size_t 548 } /* alltypes.h:363: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|040000|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(57), 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:49:54 */ 592 593 type dirstream_buf_alignment_check = [1]uint8 /* 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(61), int64((*DIR)(unsafe.Pointer(dir)).fd), int64(dir+24), int64(unsafe.Sizeof([2048]uint8{})))) 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:63:24 */ 616 617 type int8_t = int8 /* alltypes.h:104:25 */ 618 619 type int16_t = int16 /* alltypes.h:109:25 */ 620 621 type int32_t = int32 /* alltypes.h:114:25 */ 622 623 type int64_t = int64 /* alltypes.h:119:25 */ 624 625 type intmax_t = int64 /* alltypes.h:124:25 */ 626 627 type uint8_t = uint8 /* alltypes.h:129:25 */ 628 629 type uintmax_t = uint64 /* alltypes.h:154: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:328:9 */ 687 688 type FILE = _IO_FILE /* alltypes.h:328:25 */ 689 690 type va_list = uintptr /* alltypes.h:334:27 */ 691 692 type _G_fpos64_t = struct { 693 _ [0]uint64 694 __opaque [16]uint8 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:38:15 */ 700 701 type double_t = float64 /* alltypes.h:43: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:281: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(*(*uint8)(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(*(*uint8)(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(*(*uint8)(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 uint8 1885 frac_digits uint8 1886 p_cs_precedes uint8 1887 p_sep_by_space uint8 1888 n_cs_precedes uint8 1889 n_sep_by_space uint8 1890 p_sign_posn uint8 1891 n_sign_posn uint8 1892 int_p_cs_precedes uint8 1893 int_p_sep_by_space uint8 1894 int_n_cs_precedes uint8 1895 int_n_sep_by_space uint8 1896 int_p_sign_posn uint8 1897 int_n_sign_posn uint8 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: uint8(255), frac_digits: uint8(255), p_cs_precedes: uint8(255), p_sep_by_space: uint8(255), n_cs_precedes: uint8(255), n_sep_by_space: uint8(255), p_sign_posn: uint8(255), n_sign_posn: uint8(255), int_p_cs_precedes: uint8(255), int_p_sep_by_space: uint8(255), int_n_cs_precedes: uint8(255), int_n_sep_by_space: uint8(255), int_p_sign_posn: uint8(255), int_n_sign_posn: uint8(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]uint8 2068 next uintptr 2069 } /* alltypes.h:351: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 uint8 2082 threaded uint8 2083 secure uint8 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:93:16 */ 2096 2097 type clockid_t = int32 /* alltypes.h:222:13 */ 2098 2099 type timespec = struct { 2100 tv_sec time_t 2101 tv_nsec int64 2102 } /* alltypes.h:237:1 */ 2103 2104 type pthread_t = uintptr /* alltypes.h:281:26 */ 2105 2106 type pthread_once_t = int32 /* alltypes.h:287:13 */ 2107 2108 type pthread_key_t = uint32 /* alltypes.h:292:18 */ 2109 2110 type pthread_spinlock_t = int32 /* alltypes.h:297:13 */ 2111 2112 type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:302:37 */ 2113 2114 type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:307:37 */ 2115 2116 type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:312:37 */ 2117 2118 type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:317:40 */ 2119 2120 type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:357:9 */ 2121 2122 type sigset_t = __sigset_t /* alltypes.h:357:71 */ 2123 2124 type pthread_attr_t = struct { 2125 __u struct { 2126 _ [0]uint64 2127 __i [14]int32 2128 } 2129 } /* alltypes.h:380:147 */ 2130 2131 type pthread_mutex_t = struct { 2132 __u struct { 2133 _ [0]uint64 2134 __i [10]int32 2135 } 2136 } /* alltypes.h:385:157 */ 2137 2138 type pthread_cond_t = struct { 2139 __u struct { 2140 _ [0]uint64 2141 __i [12]int32 2142 } 2143 } /* alltypes.h:395:112 */ 2144 2145 type pthread_rwlock_t = struct { 2146 __u struct { 2147 _ [0]uint64 2148 __i [14]int32 2149 } 2150 } /* alltypes.h:405:139 */ 2151 2152 type pthread_barrier_t = struct { 2153 __u struct { 2154 _ [0]uint64 2155 __i [8]int32 2156 } 2157 } /* alltypes.h:410: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:217:14 */ 2171 2172 type clock_t = int64 /* alltypes.h:227: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]uint8 2211 } /* time.h:107:1 */ 2212 2213 type __ptcb = struct { 2214 __f uintptr 2215 __x uintptr 2216 __next uintptr 2217 } /* alltypes.h:281: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 = uint64 /* signal.h:10:23 */ 2229 type gregset_t = [34]uint64 /* signal.h:11:23 */ 2230 2231 type fpregset_t = struct { 2232 vregs [32]float64 2233 fpsr uint32 2234 fpcr uint32 2235 } /* signal.h:17:3 */ 2236 type sigcontext = struct { 2237 fault_address uint64 2238 regs [31]uint64 2239 sp uint64 2240 pc uint64 2241 pstate uint64 2242 __reserved [256]float64 2243 } /* signal.h:18:9 */ 2244 2245 type mcontext_t = sigcontext /* signal.h:23:3 */ 2246 2247 type _aarch64_ctx = struct { 2248 magic uint32 2249 size uint32 2250 } /* signal.h:29:1 */ 2251 2252 type fpsimd_context = struct { 2253 head struct { 2254 magic uint32 2255 size uint32 2256 } 2257 fpsr uint32 2258 fpcr uint32 2259 vregs [32]float64 2260 } /* signal.h:33:1 */ 2261 2262 type esr_context = struct { 2263 head struct { 2264 magic uint32 2265 size uint32 2266 } 2267 esr uint64 2268 } /* signal.h:39:1 */ 2269 2270 type extra_context = struct { 2271 head struct { 2272 magic uint32 2273 size uint32 2274 } 2275 datap uint64 2276 size uint32 2277 __reserved [3]uint32 2278 } /* signal.h:43:1 */ 2279 2280 type sve_context = struct { 2281 head struct { 2282 magic uint32 2283 size uint32 2284 } 2285 vl uint16 2286 __reserved [3]uint16 2287 } /* signal.h:49:1 */ 2288 2289 type __ucontext = struct { 2290 uc_flags uint64 2291 uc_link uintptr 2292 uc_stack stack_t 2293 uc_sigmask sigset_t 2294 uc_mcontext mcontext_t 2295 } /* signal.h:99:9 */ 2296 2297 type ucontext_t = __ucontext /* signal.h:105:3 */ 2298 2299 type sigval = struct { 2300 _ [0]uint64 2301 sival_int int32 2302 _ [4]byte 2303 } /* time.h:107:1 */ 2304 2305 type siginfo_t = struct { 2306 si_signo int32 2307 si_errno int32 2308 si_code int32 2309 _ [4]byte 2310 __si_fields struct { 2311 _ [0]uint64 2312 __pad [112]uint8 2313 } 2314 } /* signal.h:145:3 */ 2315 2316 type sigaction = struct { 2317 __sa_handler struct{ sa_handler uintptr } 2318 sa_mask sigset_t 2319 sa_flags int32 2320 _ [4]byte 2321 sa_restorer uintptr 2322 } /* signal.h:167:1 */ 2323 2324 type sig_t = uintptr /* signal.h:251:14 */ 2325 2326 type sig_atomic_t = int32 /* signal.h:269:13 */ 2327 2328 func a_ll(tls *TLS, p uintptr) int32 { /* atomic_arch.h:2:19: */ 2329 var v int32 2330 panic(`arch/aarch64/atomic_arch.h:5:2: assembler statements not supported`) 2331 return v 2332 } 2333 2334 func a_sc(tls *TLS, p uintptr, v int32) int32 { /* atomic_arch.h:10:19: */ 2335 var r int32 2336 panic(`arch/aarch64/atomic_arch.h:13:2: assembler statements not supported`) 2337 return BoolInt32(!(r != 0)) 2338 } 2339 2340 func a_barrier(tls *TLS) { /* atomic_arch.h:18:20: */ 2341 panic(`arch/aarch64/atomic_arch.h:20:2: assembler statements not supported`) 2342 } 2343 2344 func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:24:19: */ 2345 var old int32 2346 for ok := true; ok; ok = !(a_sc(tls, p, s) != 0) { 2347 old = a_ll(tls, p) 2348 if old != t { 2349 a_barrier(tls) 2350 break 2351 } 2352 } 2353 return old 2354 } 2355 2356 func a_ll_p(tls *TLS, p uintptr) uintptr { /* atomic_arch.h:38:20: */ 2357 var v uintptr 2358 panic(`arch/aarch64/atomic_arch.h:41:2: assembler statements not supported`) 2359 return v 2360 } 2361 2362 func a_sc_p(tls *TLS, p uintptr, v uintptr) int32 { /* atomic_arch.h:46:19: */ 2363 var r int32 2364 panic(`arch/aarch64/atomic_arch.h:49:2: assembler statements not supported`) 2365 return BoolInt32(!(r != 0)) 2366 } 2367 2368 func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic_arch.h:68:19: */ 2369 panic(`arch/aarch64/atomic_arch.h:70:2: assembler statements not supported`) 2370 return int32(x) 2371 } 2372 2373 func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:33:19: */ 2374 var old int32 2375 2376 for ok := true; ok; ok = !(a_sc(tls, p, v) != 0) { 2377 old = a_ll(tls, p) 2378 } 2379 2380 return old 2381 } 2382 2383 func a_fetch_add(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:46:19: */ 2384 var old int32 2385 2386 for ok := true; ok; ok = !(a_sc(tls, p, int32(uint32(old)+uint32(v))) != 0) { 2387 old = a_ll(tls, p) 2388 } 2389 2390 return old 2391 } 2392 2393 func a_fetch_and(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:59:19: */ 2394 var old int32 2395 2396 for ok := true; ok; ok = !(a_sc(tls, p, old&v) != 0) { 2397 old = a_ll(tls, p) 2398 } 2399 2400 return old 2401 } 2402 2403 func a_fetch_or(tls *TLS, p uintptr, v int32) int32 { /* atomic.h:72:19: */ 2404 var old int32 2405 2406 for ok := true; ok; ok = !(a_sc(tls, p, old|v) != 0) { 2407 old = a_ll(tls, p) 2408 } 2409 2410 return old 2411 } 2412 2413 func a_and(tls *TLS, p uintptr, v int32) { /* atomic.h:151:20: */ 2414 a_fetch_and(tls, p, v) 2415 } 2416 2417 func a_or(tls *TLS, p uintptr, v int32) { /* atomic.h:159:20: */ 2418 a_fetch_or(tls, p, v) 2419 } 2420 2421 func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic.h:220:20: */ 2422 bp := tls.Alloc(8) 2423 defer tls.Free(8) 2424 2425 *(*struct{ v uint64_t })(unsafe.Pointer(bp)) = func() (r struct{ v uint64_t }) { 2426 *(*uint64_t)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = v 2427 return r 2428 }() 2429 if *(*uint32_t)(unsafe.Pointer(bp)) != 0 { 2430 a_or(tls, p, int32(*(*uint32_t)(unsafe.Pointer(bp)))) 2431 } 2432 if *(*uint32_t)(unsafe.Pointer(bp + 1*4)) != 0 { 2433 a_or(tls, p+uintptr(1)*4, int32(*(*uint32_t)(unsafe.Pointer(bp + 1*4)))) 2434 } 2435 } 2436 2437 func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ 2438 return int32(_sdebruijn328[x&-x*uint32_t(0x076be629)>>27]) 2439 } 2440 2441 var _sdebruijn328 = [32]uint8{ 2442 uint8(0), uint8(1), uint8(23), uint8(2), uint8(29), uint8(24), uint8(19), uint8(3), uint8(30), uint8(27), uint8(25), uint8(11), uint8(20), uint8(8), uint8(4), uint8(13), 2443 uint8(31), uint8(22), uint8(28), uint8(18), uint8(26), uint8(10), uint8(7), uint8(12), uint8(21), uint8(17), uint8(9), uint8(6), uint8(16), uint8(5), uint8(15), uint8(14), 2444 } /* atomic.h:261:20 */ 2445 2446 type __timer = struct { 2447 timerid int32 2448 _ [4]byte 2449 thread pthread_t 2450 } /* pthread_impl.h:64:1 */ 2451 2452 func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */ 2453 var self uintptr 2454 panic(`arch/aarch64/pthread_arch.h:4:2: assembler statements not supported`) 2455 return self - uintptr(uint64(unsafe.Sizeof(__pthread{}))) 2456 } 2457 2458 func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */ 2459 if priv != 0 { 2460 priv = 128 2461 } 2462 if cnt < 0 { 2463 cnt = 0x7fffffff 2464 } 2465 _ = Bool32(X__syscall3(tls, int64(98), int64(addr), int64(1|priv), int64(cnt)) != int64(-38) || X__syscall3(tls, int64(98), int64(addr), int64(1), int64(cnt)) != 0) 2466 } 2467 2468 func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ 2469 if priv != 0 { 2470 priv = 128 2471 } 2472 _ = Bool32(X__syscall4(tls, int64(98), int64(addr), int64(0|priv), int64(val), int64(0)) != int64(-38) || X__syscall4(tls, int64(98), int64(addr), int64(0), int64(val), int64(0)) != 0) 2473 } 2474 2475 var X__fsmu8 = [51]uint32_t{ 2476 func() uint32 { 2477 if 0x2 < 2 { 2478 return Uint32FromInt32(-1) 2479 } 2480 return func() uint32 { 2481 if Int32(0x80) == Int32(0x80) { 2482 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2483 } 2484 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2485 }()<<23 | uint32_t(0x2) 2486 }(), func() uint32 { 2487 if 0x3 < 2 { 2488 return Uint32FromInt32(-1) 2489 } 2490 return func() uint32 { 2491 if Int32(0x80) == Int32(0x80) { 2492 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2493 } 2494 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2495 }()<<23 | uint32_t(0x3) 2496 }(), func() uint32 { 2497 if 0x4 < 2 { 2498 return Uint32FromInt32(-1) 2499 } 2500 return func() uint32 { 2501 if Int32(0x80) == Int32(0x80) { 2502 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2503 } 2504 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2505 }()<<23 | uint32_t(0x4) 2506 }(), func() uint32 { 2507 if 0x5 < 2 { 2508 return Uint32FromInt32(-1) 2509 } 2510 return func() uint32 { 2511 if Int32(0x80) == Int32(0x80) { 2512 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2513 } 2514 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2515 }()<<23 | uint32_t(0x5) 2516 }(), func() uint32 { 2517 if 0x6 < 2 { 2518 return Uint32FromInt32(-1) 2519 } 2520 return func() uint32 { 2521 if Int32(0x80) == Int32(0x80) { 2522 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2523 } 2524 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2525 }()<<23 | uint32_t(0x6) 2526 }(), func() uint32 { 2527 if 0x7 < 2 { 2528 return Uint32FromInt32(-1) 2529 } 2530 return func() uint32 { 2531 if Int32(0x80) == Int32(0x80) { 2532 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2533 } 2534 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2535 }()<<23 | uint32_t(0x7) 2536 }(), 2537 func() uint32 { 2538 if 0x8 < 2 { 2539 return Uint32FromInt32(-1) 2540 } 2541 return func() uint32 { 2542 if Int32(0x80) == Int32(0x80) { 2543 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2544 } 2545 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2546 }()<<23 | uint32_t(0x8) 2547 }(), func() uint32 { 2548 if 0x9 < 2 { 2549 return Uint32FromInt32(-1) 2550 } 2551 return func() uint32 { 2552 if Int32(0x80) == Int32(0x80) { 2553 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2554 } 2555 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2556 }()<<23 | uint32_t(0x9) 2557 }(), func() uint32 { 2558 if 0xa < 2 { 2559 return Uint32FromInt32(-1) 2560 } 2561 return func() uint32 { 2562 if Int32(0x80) == Int32(0x80) { 2563 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2564 } 2565 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2566 }()<<23 | uint32_t(0xa) 2567 }(), func() uint32 { 2568 if 0xb < 2 { 2569 return Uint32FromInt32(-1) 2570 } 2571 return func() uint32 { 2572 if Int32(0x80) == Int32(0x80) { 2573 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2574 } 2575 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2576 }()<<23 | uint32_t(0xb) 2577 }(), func() uint32 { 2578 if 0xc < 2 { 2579 return Uint32FromInt32(-1) 2580 } 2581 return func() uint32 { 2582 if Int32(0x80) == Int32(0x80) { 2583 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2584 } 2585 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2586 }()<<23 | uint32_t(0xc) 2587 }(), func() uint32 { 2588 if 0xd < 2 { 2589 return Uint32FromInt32(-1) 2590 } 2591 return func() uint32 { 2592 if Int32(0x80) == Int32(0x80) { 2593 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2594 } 2595 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2596 }()<<23 | uint32_t(0xd) 2597 }(), func() uint32 { 2598 if 0xe < 2 { 2599 return Uint32FromInt32(-1) 2600 } 2601 return func() uint32 { 2602 if Int32(0x80) == Int32(0x80) { 2603 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2604 } 2605 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2606 }()<<23 | uint32_t(0xe) 2607 }(), func() uint32 { 2608 if 0xf < 2 { 2609 return Uint32FromInt32(-1) 2610 } 2611 return func() uint32 { 2612 if Int32(0x80) == Int32(0x80) { 2613 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2614 } 2615 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2616 }()<<23 | uint32_t(0xf) 2617 }(), 2618 func() uint32 { 2619 if 0x0+16 < 2 { 2620 return Uint32FromInt32(-1) 2621 } 2622 return func() uint32 { 2623 if Int32(0x80) == Int32(0x80) { 2624 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2625 } 2626 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2627 }()<<23 | uint32_t(0x0+16) 2628 }(), func() uint32 { 2629 if 0x1+16 < 2 { 2630 return Uint32FromInt32(-1) 2631 } 2632 return func() uint32 { 2633 if Int32(0x80) == Int32(0x80) { 2634 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2635 } 2636 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2637 }()<<23 | uint32_t(0x1+16) 2638 }(), func() uint32 { 2639 if 0x2+16 < 2 { 2640 return Uint32FromInt32(-1) 2641 } 2642 return func() uint32 { 2643 if Int32(0x80) == Int32(0x80) { 2644 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2645 } 2646 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2647 }()<<23 | uint32_t(0x2+16) 2648 }(), func() uint32 { 2649 if 0x3+16 < 2 { 2650 return Uint32FromInt32(-1) 2651 } 2652 return func() uint32 { 2653 if Int32(0x80) == Int32(0x80) { 2654 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2655 } 2656 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2657 }()<<23 | uint32_t(0x3+16) 2658 }(), func() uint32 { 2659 if 0x4+16 < 2 { 2660 return Uint32FromInt32(-1) 2661 } 2662 return func() uint32 { 2663 if Int32(0x80) == Int32(0x80) { 2664 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2665 } 2666 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2667 }()<<23 | uint32_t(0x4+16) 2668 }(), func() uint32 { 2669 if 0x5+16 < 2 { 2670 return Uint32FromInt32(-1) 2671 } 2672 return func() uint32 { 2673 if Int32(0x80) == Int32(0x80) { 2674 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2675 } 2676 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2677 }()<<23 | uint32_t(0x5+16) 2678 }(), func() uint32 { 2679 if 0x6+16 < 2 { 2680 return Uint32FromInt32(-1) 2681 } 2682 return func() uint32 { 2683 if Int32(0x80) == Int32(0x80) { 2684 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2685 } 2686 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2687 }()<<23 | uint32_t(0x6+16) 2688 }(), func() uint32 { 2689 if 0x7+16 < 2 { 2690 return Uint32FromInt32(-1) 2691 } 2692 return func() uint32 { 2693 if Int32(0x80) == Int32(0x80) { 2694 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2695 } 2696 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2697 }()<<23 | uint32_t(0x7+16) 2698 }(), 2699 func() uint32 { 2700 if 0x8+16 < 2 { 2701 return Uint32FromInt32(-1) 2702 } 2703 return func() uint32 { 2704 if Int32(0x80) == Int32(0x80) { 2705 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2706 } 2707 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2708 }()<<23 | uint32_t(0x8+16) 2709 }(), func() uint32 { 2710 if 0x9+16 < 2 { 2711 return Uint32FromInt32(-1) 2712 } 2713 return func() uint32 { 2714 if Int32(0x80) == Int32(0x80) { 2715 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2716 } 2717 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2718 }()<<23 | uint32_t(0x9+16) 2719 }(), func() uint32 { 2720 if 0xa+16 < 2 { 2721 return Uint32FromInt32(-1) 2722 } 2723 return func() uint32 { 2724 if Int32(0x80) == Int32(0x80) { 2725 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2726 } 2727 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2728 }()<<23 | uint32_t(0xa+16) 2729 }(), func() uint32 { 2730 if 0xb+16 < 2 { 2731 return Uint32FromInt32(-1) 2732 } 2733 return func() uint32 { 2734 if Int32(0x80) == Int32(0x80) { 2735 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2736 } 2737 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2738 }()<<23 | uint32_t(0xb+16) 2739 }(), func() uint32 { 2740 if 0xc+16 < 2 { 2741 return Uint32FromInt32(-1) 2742 } 2743 return func() uint32 { 2744 if Int32(0x80) == Int32(0x80) { 2745 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2746 } 2747 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2748 }()<<23 | uint32_t(0xc+16) 2749 }(), func() uint32 { 2750 if 0xd+16 < 2 { 2751 return Uint32FromInt32(-1) 2752 } 2753 return func() uint32 { 2754 if Int32(0x80) == Int32(0x80) { 2755 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2756 } 2757 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2758 }()<<23 | uint32_t(0xd+16) 2759 }(), func() uint32 { 2760 if 0xe+16 < 2 { 2761 return Uint32FromInt32(-1) 2762 } 2763 return func() uint32 { 2764 if Int32(0x80) == Int32(0x80) { 2765 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2766 } 2767 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2768 }()<<23 | uint32_t(0xe+16) 2769 }(), func() uint32 { 2770 if 0xf+16 < 2 { 2771 return Uint32FromInt32(-1) 2772 } 2773 return func() uint32 { 2774 if Int32(0x80) == Int32(0x80) { 2775 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2776 } 2777 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2778 }()<<23 | uint32_t(0xf+16) 2779 }(), 2780 func() uint32 { 2781 if 0x0 == 0 { 2782 return func() uint32 { 2783 if Int32(0xa0) == Int32(0x80) { 2784 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2785 } 2786 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2787 }() << 23 2788 } 2789 return func() uint32 { 2790 if 0x0 == 0xd { 2791 return func() uint32 { 2792 if Int32(0x80) == Int32(0x80) { 2793 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2794 } 2795 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2796 }() << 23 2797 } 2798 return func() uint32 { 2799 if Int32(0x80) == Int32(0x80) { 2800 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2801 } 2802 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2803 }() << 23 2804 }() 2805 }() | uint32_t(func() uint32 { 2806 if Int32(0x80) == Int32(0x80) { 2807 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2808 } 2809 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2810 }()<<23)>>6 | uint32_t(0x0), func() uint32 { 2811 if 0x1 == 0 { 2812 return func() uint32 { 2813 if Int32(0xa0) == Int32(0x80) { 2814 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2815 } 2816 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2817 }() << 23 2818 } 2819 return func() uint32 { 2820 if 0x1 == 0xd { 2821 return func() uint32 { 2822 if Int32(0x80) == Int32(0x80) { 2823 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2824 } 2825 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2826 }() << 23 2827 } 2828 return func() uint32 { 2829 if Int32(0x80) == Int32(0x80) { 2830 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2831 } 2832 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2833 }() << 23 2834 }() 2835 }() | uint32_t(func() uint32 { 2836 if Int32(0x80) == Int32(0x80) { 2837 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2838 } 2839 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2840 }()<<23)>>6 | uint32_t(0x1), func() uint32 { 2841 if 0x2 == 0 { 2842 return func() uint32 { 2843 if Int32(0xa0) == Int32(0x80) { 2844 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2845 } 2846 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2847 }() << 23 2848 } 2849 return func() uint32 { 2850 if 0x2 == 0xd { 2851 return func() uint32 { 2852 if Int32(0x80) == Int32(0x80) { 2853 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2854 } 2855 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2856 }() << 23 2857 } 2858 return func() uint32 { 2859 if Int32(0x80) == Int32(0x80) { 2860 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2861 } 2862 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2863 }() << 23 2864 }() 2865 }() | uint32_t(func() uint32 { 2866 if Int32(0x80) == Int32(0x80) { 2867 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2868 } 2869 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2870 }()<<23)>>6 | uint32_t(0x2), func() uint32 { 2871 if 0x3 == 0 { 2872 return func() uint32 { 2873 if Int32(0xa0) == Int32(0x80) { 2874 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2875 } 2876 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2877 }() << 23 2878 } 2879 return func() uint32 { 2880 if 0x3 == 0xd { 2881 return func() uint32 { 2882 if Int32(0x80) == Int32(0x80) { 2883 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2884 } 2885 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2886 }() << 23 2887 } 2888 return func() uint32 { 2889 if Int32(0x80) == Int32(0x80) { 2890 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2891 } 2892 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2893 }() << 23 2894 }() 2895 }() | uint32_t(func() uint32 { 2896 if Int32(0x80) == Int32(0x80) { 2897 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2898 } 2899 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2900 }()<<23)>>6 | uint32_t(0x3), func() uint32 { 2901 if 0x4 == 0 { 2902 return func() uint32 { 2903 if Int32(0xa0) == Int32(0x80) { 2904 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2905 } 2906 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2907 }() << 23 2908 } 2909 return func() uint32 { 2910 if 0x4 == 0xd { 2911 return func() uint32 { 2912 if Int32(0x80) == Int32(0x80) { 2913 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2914 } 2915 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2916 }() << 23 2917 } 2918 return func() uint32 { 2919 if Int32(0x80) == Int32(0x80) { 2920 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2921 } 2922 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2923 }() << 23 2924 }() 2925 }() | uint32_t(func() uint32 { 2926 if Int32(0x80) == Int32(0x80) { 2927 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2928 } 2929 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2930 }()<<23)>>6 | uint32_t(0x4), func() uint32 { 2931 if 0x5 == 0 { 2932 return func() uint32 { 2933 if Int32(0xa0) == Int32(0x80) { 2934 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2935 } 2936 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2937 }() << 23 2938 } 2939 return func() uint32 { 2940 if 0x5 == 0xd { 2941 return func() uint32 { 2942 if Int32(0x80) == Int32(0x80) { 2943 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2944 } 2945 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2946 }() << 23 2947 } 2948 return func() uint32 { 2949 if Int32(0x80) == Int32(0x80) { 2950 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2951 } 2952 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2953 }() << 23 2954 }() 2955 }() | uint32_t(func() uint32 { 2956 if Int32(0x80) == Int32(0x80) { 2957 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2958 } 2959 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2960 }()<<23)>>6 | uint32_t(0x5), func() uint32 { 2961 if 0x6 == 0 { 2962 return func() uint32 { 2963 if Int32(0xa0) == Int32(0x80) { 2964 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2965 } 2966 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2967 }() << 23 2968 } 2969 return func() uint32 { 2970 if 0x6 == 0xd { 2971 return func() uint32 { 2972 if Int32(0x80) == Int32(0x80) { 2973 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 2974 } 2975 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2976 }() << 23 2977 } 2978 return func() uint32 { 2979 if Int32(0x80) == Int32(0x80) { 2980 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2981 } 2982 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2983 }() << 23 2984 }() 2985 }() | uint32_t(func() uint32 { 2986 if Int32(0x80) == Int32(0x80) { 2987 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2988 } 2989 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 2990 }()<<23)>>6 | uint32_t(0x6), func() uint32 { 2991 if 0x7 == 0 { 2992 return func() uint32 { 2993 if Int32(0xa0) == Int32(0x80) { 2994 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 2995 } 2996 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 2997 }() << 23 2998 } 2999 return func() uint32 { 3000 if 0x7 == 0xd { 3001 return func() uint32 { 3002 if Int32(0x80) == Int32(0x80) { 3003 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3004 } 3005 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3006 }() << 23 3007 } 3008 return func() uint32 { 3009 if Int32(0x80) == Int32(0x80) { 3010 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3011 } 3012 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3013 }() << 23 3014 }() 3015 }() | uint32_t(func() uint32 { 3016 if Int32(0x80) == Int32(0x80) { 3017 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3018 } 3019 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3020 }()<<23)>>6 | uint32_t(0x7), 3021 func() uint32 { 3022 if 0x8 == 0 { 3023 return func() uint32 { 3024 if Int32(0xa0) == Int32(0x80) { 3025 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3026 } 3027 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3028 }() << 23 3029 } 3030 return func() uint32 { 3031 if 0x8 == 0xd { 3032 return func() uint32 { 3033 if Int32(0x80) == Int32(0x80) { 3034 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3035 } 3036 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3037 }() << 23 3038 } 3039 return func() uint32 { 3040 if Int32(0x80) == Int32(0x80) { 3041 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3042 } 3043 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3044 }() << 23 3045 }() 3046 }() | uint32_t(func() uint32 { 3047 if Int32(0x80) == Int32(0x80) { 3048 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3049 } 3050 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3051 }()<<23)>>6 | uint32_t(0x8), func() uint32 { 3052 if 0x9 == 0 { 3053 return func() uint32 { 3054 if Int32(0xa0) == Int32(0x80) { 3055 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3056 } 3057 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3058 }() << 23 3059 } 3060 return func() uint32 { 3061 if 0x9 == 0xd { 3062 return func() uint32 { 3063 if Int32(0x80) == Int32(0x80) { 3064 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3065 } 3066 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3067 }() << 23 3068 } 3069 return func() uint32 { 3070 if Int32(0x80) == Int32(0x80) { 3071 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3072 } 3073 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3074 }() << 23 3075 }() 3076 }() | uint32_t(func() uint32 { 3077 if Int32(0x80) == Int32(0x80) { 3078 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3079 } 3080 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3081 }()<<23)>>6 | uint32_t(0x9), func() uint32 { 3082 if 0xa == 0 { 3083 return func() uint32 { 3084 if Int32(0xa0) == Int32(0x80) { 3085 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3086 } 3087 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3088 }() << 23 3089 } 3090 return func() uint32 { 3091 if 0xa == 0xd { 3092 return func() uint32 { 3093 if Int32(0x80) == Int32(0x80) { 3094 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3095 } 3096 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3097 }() << 23 3098 } 3099 return func() uint32 { 3100 if Int32(0x80) == Int32(0x80) { 3101 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3102 } 3103 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3104 }() << 23 3105 }() 3106 }() | uint32_t(func() uint32 { 3107 if Int32(0x80) == Int32(0x80) { 3108 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3109 } 3110 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3111 }()<<23)>>6 | uint32_t(0xa), func() uint32 { 3112 if 0xb == 0 { 3113 return func() uint32 { 3114 if Int32(0xa0) == Int32(0x80) { 3115 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3116 } 3117 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3118 }() << 23 3119 } 3120 return func() uint32 { 3121 if 0xb == 0xd { 3122 return func() uint32 { 3123 if Int32(0x80) == Int32(0x80) { 3124 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3125 } 3126 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3127 }() << 23 3128 } 3129 return func() uint32 { 3130 if Int32(0x80) == Int32(0x80) { 3131 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3132 } 3133 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3134 }() << 23 3135 }() 3136 }() | uint32_t(func() uint32 { 3137 if Int32(0x80) == Int32(0x80) { 3138 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3139 } 3140 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3141 }()<<23)>>6 | uint32_t(0xb), func() uint32 { 3142 if 0xc == 0 { 3143 return func() uint32 { 3144 if Int32(0xa0) == Int32(0x80) { 3145 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3146 } 3147 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3148 }() << 23 3149 } 3150 return func() uint32 { 3151 if 0xc == 0xd { 3152 return func() uint32 { 3153 if Int32(0x80) == Int32(0x80) { 3154 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3155 } 3156 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3157 }() << 23 3158 } 3159 return func() uint32 { 3160 if Int32(0x80) == Int32(0x80) { 3161 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3162 } 3163 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3164 }() << 23 3165 }() 3166 }() | uint32_t(func() uint32 { 3167 if Int32(0x80) == Int32(0x80) { 3168 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3169 } 3170 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3171 }()<<23)>>6 | uint32_t(0xc), func() uint32 { 3172 if 0xd == 0 { 3173 return func() uint32 { 3174 if Int32(0xa0) == Int32(0x80) { 3175 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3176 } 3177 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3178 }() << 23 3179 } 3180 return func() uint32 { 3181 if 0xd == 0xd { 3182 return func() uint32 { 3183 if Int32(0x80) == Int32(0x80) { 3184 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3185 } 3186 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3187 }() << 23 3188 } 3189 return func() uint32 { 3190 if Int32(0x80) == Int32(0x80) { 3191 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3192 } 3193 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3194 }() << 23 3195 }() 3196 }() | uint32_t(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)>>6 | uint32_t(0xd), func() uint32 { 3202 if 0xe == 0 { 3203 return func() uint32 { 3204 if Int32(0xa0) == Int32(0x80) { 3205 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3206 } 3207 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3208 }() << 23 3209 } 3210 return func() uint32 { 3211 if 0xe == 0xd { 3212 return func() uint32 { 3213 if Int32(0x80) == Int32(0x80) { 3214 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3215 } 3216 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3217 }() << 23 3218 } 3219 return func() uint32 { 3220 if Int32(0x80) == Int32(0x80) { 3221 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3222 } 3223 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3224 }() << 23 3225 }() 3226 }() | uint32_t(func() uint32 { 3227 if Int32(0x80) == Int32(0x80) { 3228 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3229 } 3230 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3231 }()<<23)>>6 | uint32_t(0xe), func() uint32 { 3232 if 0xf == 0 { 3233 return func() uint32 { 3234 if Int32(0xa0) == Int32(0x80) { 3235 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3236 } 3237 return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) 3238 }() << 23 3239 } 3240 return func() uint32 { 3241 if 0xf == 0xd { 3242 return func() uint32 { 3243 if Int32(0x80) == Int32(0x80) { 3244 return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) 3245 } 3246 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3247 }() << 23 3248 } 3249 return 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 3255 }() 3256 }() | uint32_t(func() uint32 { 3257 if Int32(0x80) == Int32(0x80) { 3258 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3259 } 3260 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3261 }()<<23)>>6 | uint32_t(0xf), 3262 func() uint32 { 3263 if 0x0 >= 5 { 3264 return uint32(0) 3265 } 3266 return func() uint32 { 3267 if 0x0 == 0 { 3268 return func() uint32 { 3269 if Int32(0x90) == Int32(0x80) { 3270 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3271 } 3272 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3273 }() << 23 3274 } 3275 return func() uint32 { 3276 if 0x0 == 4 { 3277 return func() uint32 { 3278 if Int32(0x80) == Int32(0x80) { 3279 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3280 } 3281 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3282 }() << 23 3283 } 3284 return 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 3290 }() 3291 }() 3292 }() | uint32_t(func() uint32 { 3293 if Int32(0x80) == Int32(0x80) { 3294 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3295 } 3296 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3297 }()<<23)>>6 | uint32_t(func() uint32 { 3298 if Int32(0x80) == Int32(0x80) { 3299 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3300 } 3301 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3302 }()<<23)>>12 | uint32_t(0x0), func() uint32 { 3303 if 0x1 >= 5 { 3304 return uint32(0) 3305 } 3306 return func() uint32 { 3307 if 0x1 == 0 { 3308 return func() uint32 { 3309 if Int32(0x90) == Int32(0x80) { 3310 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3311 } 3312 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3313 }() << 23 3314 } 3315 return func() uint32 { 3316 if 0x1 == 4 { 3317 return func() uint32 { 3318 if Int32(0x80) == Int32(0x80) { 3319 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3320 } 3321 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3322 }() << 23 3323 } 3324 return 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 3330 }() 3331 }() 3332 }() | uint32_t(func() uint32 { 3333 if Int32(0x80) == Int32(0x80) { 3334 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3335 } 3336 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3337 }()<<23)>>6 | uint32_t(func() uint32 { 3338 if Int32(0x80) == Int32(0x80) { 3339 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3340 } 3341 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3342 }()<<23)>>12 | uint32_t(0x1), func() uint32 { 3343 if 0x2 >= 5 { 3344 return uint32(0) 3345 } 3346 return func() uint32 { 3347 if 0x2 == 0 { 3348 return func() uint32 { 3349 if Int32(0x90) == Int32(0x80) { 3350 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3351 } 3352 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3353 }() << 23 3354 } 3355 return func() uint32 { 3356 if 0x2 == 4 { 3357 return func() uint32 { 3358 if Int32(0x80) == Int32(0x80) { 3359 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3360 } 3361 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3362 }() << 23 3363 } 3364 return 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 3370 }() 3371 }() 3372 }() | uint32_t(func() uint32 { 3373 if Int32(0x80) == Int32(0x80) { 3374 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3375 } 3376 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3377 }()<<23)>>6 | uint32_t(func() uint32 { 3378 if Int32(0x80) == Int32(0x80) { 3379 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3380 } 3381 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3382 }()<<23)>>12 | uint32_t(0x2), func() uint32 { 3383 if 0x3 >= 5 { 3384 return uint32(0) 3385 } 3386 return func() uint32 { 3387 if 0x3 == 0 { 3388 return func() uint32 { 3389 if Int32(0x90) == Int32(0x80) { 3390 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3391 } 3392 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3393 }() << 23 3394 } 3395 return func() uint32 { 3396 if 0x3 == 4 { 3397 return func() uint32 { 3398 if Int32(0x80) == Int32(0x80) { 3399 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3400 } 3401 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3402 }() << 23 3403 } 3404 return func() uint32 { 3405 if Int32(0x80) == Int32(0x80) { 3406 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3407 } 3408 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3409 }() << 23 3410 }() 3411 }() 3412 }() | uint32_t(func() uint32 { 3413 if Int32(0x80) == Int32(0x80) { 3414 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3415 } 3416 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3417 }()<<23)>>6 | uint32_t(func() uint32 { 3418 if Int32(0x80) == Int32(0x80) { 3419 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3420 } 3421 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3422 }()<<23)>>12 | uint32_t(0x3), func() uint32 { 3423 if 0x4 >= 5 { 3424 return uint32(0) 3425 } 3426 return func() uint32 { 3427 if 0x4 == 0 { 3428 return func() uint32 { 3429 if Int32(0x90) == Int32(0x80) { 3430 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3431 } 3432 return Uint32(Uint32(0) - Uint32FromInt32(0x90)) 3433 }() << 23 3434 } 3435 return func() uint32 { 3436 if 0x4 == 4 { 3437 return func() uint32 { 3438 if Int32(0x80) == Int32(0x80) { 3439 return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) 3440 } 3441 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3442 }() << 23 3443 } 3444 return func() uint32 { 3445 if Int32(0x80) == Int32(0x80) { 3446 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3447 } 3448 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3449 }() << 23 3450 }() 3451 }() 3452 }() | uint32_t(func() uint32 { 3453 if Int32(0x80) == Int32(0x80) { 3454 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3455 } 3456 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3457 }()<<23)>>6 | uint32_t(func() uint32 { 3458 if Int32(0x80) == Int32(0x80) { 3459 return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) 3460 } 3461 return Uint32(Uint32(0) - Uint32FromInt32(0x80)) 3462 }()<<23)>>12 | uint32_t(0x4), 3463 } /* internal.c:18:16 */ 3464 3465 type wint_t = uint32 /* alltypes.h:21:18 */ 3466 3467 type wctype_t = uint64 /* alltypes.h:211:23 */ 3468 3469 type __mbstate_t = struct { 3470 __opaque1 uint32 3471 __opaque2 uint32 3472 } /* alltypes.h:345:9 */ 3473 3474 type mbstate_t = __mbstate_t /* alltypes.h:345:63 */ 3475 3476 func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */ 3477 bp := tls.Alloc(4) 3478 defer tls.Free(4) 3479 3480 var c uint32 3481 var s uintptr 3482 var N uint32 3483 // var dummy wchar_t at bp, 4 3484 s = src 3485 N = uint32(n) 3486 3487 if !!(st != 0) { 3488 goto __1 3489 } 3490 st = uintptr(unsafe.Pointer(&_sinternal_state)) 3491 __1: 3492 ; 3493 c = *(*uint32)(unsafe.Pointer(st)) 3494 3495 if !!(s != 0) { 3496 goto __2 3497 } 3498 if !(c != 0) { 3499 goto __4 3500 } 3501 goto ilseq 3502 __4: 3503 ; 3504 return uint64(0) 3505 goto __3 3506 __2: 3507 if !!(wc != 0) { 3508 goto __5 3509 } 3510 wc = bp /* &dummy */ 3511 __5: 3512 ; 3513 __3: 3514 ; 3515 3516 if !!(n != 0) { 3517 goto __6 3518 } 3519 return Uint64FromInt32(-2) 3520 __6: 3521 ; 3522 if !!(c != 0) { 3523 goto __7 3524 } 3525 if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) { 3526 goto __8 3527 } 3528 return BoolUint64(!!(int32(AssignPtrUint32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s))))) != 0)) 3529 __8: 3530 ; 3531 if !(func() int32 { 3532 if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) { 3533 return 4 3534 } 3535 return 1 3536 }() == 1) { 3537 goto __9 3538 } 3539 *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(0xdfff & int32(int8(*(*uint8)(unsafe.Pointer(s))))) 3540 return 1 3541 __9: 3542 ; 3543 if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0xc2 > 0xf4-0xc2) { 3544 goto __10 3545 } 3546 goto ilseq 3547 __10: 3548 ; 3549 c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0xc2] 3550 n-- 3551 __7: 3552 ; 3553 3554 if !(n != 0) { 3555 goto __11 3556 } 3557 if !((int32(*(*uint8)(unsafe.Pointer(s)))>>3-0x10|(int32(*(*uint8)(unsafe.Pointer(s)))>>3+int32_t(c)>>26))&CplInt32(7) != 0) { 3558 goto __12 3559 } 3560 goto ilseq 3561 __12: 3562 ; 3563 loop: 3564 c = c<<6 | uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0x80) 3565 n-- 3566 if !!(c&(uint32(1)<<31) != 0) { 3567 goto __13 3568 } 3569 *(*uint32)(unsafe.Pointer(st)) = uint32(0) 3570 *(*wchar_t)(unsafe.Pointer(wc)) = c 3571 return size_t(N) - n 3572 __13: 3573 ; 3574 if !(n != 0) { 3575 goto __14 3576 } 3577 if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0x80 >= uint32(0x40)) { 3578 goto __15 3579 } 3580 goto ilseq 3581 __15: 3582 ; 3583 goto loop 3584 __14: 3585 ; 3586 __11: 3587 ; 3588 3589 *(*uint32)(unsafe.Pointer(st)) = c 3590 return Uint64FromInt32(-2) 3591 ilseq: 3592 *(*uint32)(unsafe.Pointer(st)) = uint32(0) 3593 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84 3594 return Uint64FromInt32(-1) 3595 } 3596 3597 var _sinternal_state uint32 /* mbrtowc.c:8:18: */ 3598 3599 func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */ 3600 return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0)) 3601 } 3602 3603 type imaxdiv_t = struct { 3604 quot intmax_t 3605 rem intmax_t 3606 } /* inttypes.h:14:40 */ 3607 3608 type socklen_t = uint32 /* alltypes.h:369:18 */ 3609 3610 type sa_family_t = uint16 /* alltypes.h:374:24 */ 3611 3612 type msghdr = struct { 3613 msg_name uintptr 3614 msg_namelen socklen_t 3615 _ [4]byte 3616 msg_iov uintptr 3617 msg_iovlen int32 3618 __pad1 int32 3619 msg_control uintptr 3620 msg_controllen socklen_t 3621 __pad2 int32 3622 msg_flags int32 3623 _ [4]byte 3624 } /* socket.h:22:1 */ 3625 3626 type cmsghdr = struct { 3627 cmsg_len socklen_t 3628 __pad1 int32 3629 cmsg_level int32 3630 cmsg_type int32 3631 } /* socket.h:44:1 */ 3632 3633 type linger = struct { 3634 l_onoff int32 3635 l_linger int32 3636 } /* socket.h:74:1 */ 3637 3638 type sockaddr = struct { 3639 sa_family sa_family_t 3640 sa_data [14]uint8 3641 } /* socket.h:367:1 */ 3642 3643 type sockaddr_storage = struct { 3644 ss_family sa_family_t 3645 __ss_padding [118]uint8 3646 __ss_align uint64 3647 } /* socket.h:372:1 */ 3648 3649 type in_port_t = uint16_t /* in.h:12:18 */ 3650 type in_addr_t = uint32_t /* in.h:13:18 */ 3651 type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */ 3652 3653 type sockaddr_in = struct { 3654 sin_family sa_family_t 3655 sin_port in_port_t 3656 sin_addr struct{ s_addr in_addr_t } 3657 sin_zero [8]uint8_t 3658 } /* in.h:16:1 */ 3659 3660 type in6_addr = struct { 3661 __in6_union struct { 3662 _ [0]uint32 3663 __s6_addr [16]uint8_t 3664 } 3665 } /* in.h:23:1 */ 3666 3667 type sockaddr_in6 = struct { 3668 sin6_family sa_family_t 3669 sin6_port in_port_t 3670 sin6_flowinfo uint32_t 3671 sin6_addr struct { 3672 __in6_union struct { 3673 _ [0]uint32 3674 __s6_addr [16]uint8_t 3675 } 3676 } 3677 sin6_scope_id uint32_t 3678 } /* in.h:34:1 */ 3679 3680 type ipv6_mreq = struct { 3681 ipv6mr_multiaddr struct { 3682 __in6_union struct { 3683 _ [0]uint32 3684 __s6_addr [16]uint8_t 3685 } 3686 } 3687 ipv6mr_interface uint32 3688 } /* in.h:42:1 */ 3689 3690 type ip_opts = struct { 3691 ip_dst struct{ s_addr in_addr_t } 3692 ip_opts [40]uint8 3693 } /* in.h:229:1 */ 3694 3695 type ip_mreq = struct { 3696 imr_multiaddr struct{ s_addr in_addr_t } 3697 imr_interface struct{ s_addr in_addr_t } 3698 } /* in.h:247:1 */ 3699 3700 type ip_mreqn = struct { 3701 imr_multiaddr struct{ s_addr in_addr_t } 3702 imr_address struct{ s_addr in_addr_t } 3703 imr_ifindex int32 3704 } /* in.h:252:1 */ 3705 3706 type ip_mreq_source = struct { 3707 imr_multiaddr struct{ s_addr in_addr_t } 3708 imr_interface struct{ s_addr in_addr_t } 3709 imr_sourceaddr struct{ s_addr in_addr_t } 3710 } /* in.h:258:1 */ 3711 3712 type ip_msfilter = struct { 3713 imsf_multiaddr struct{ s_addr in_addr_t } 3714 imsf_interface struct{ s_addr in_addr_t } 3715 imsf_fmode uint32_t 3716 imsf_numsrc uint32_t 3717 imsf_slist [1]struct{ s_addr in_addr_t } 3718 } /* in.h:264:1 */ 3719 3720 type group_req = struct { 3721 gr_interface uint32_t 3722 _ [4]byte 3723 gr_group struct { 3724 ss_family sa_family_t 3725 __ss_padding [118]uint8 3726 __ss_align uint64 3727 } 3728 } /* in.h:275:1 */ 3729 3730 type group_source_req = struct { 3731 gsr_interface uint32_t 3732 _ [4]byte 3733 gsr_group struct { 3734 ss_family sa_family_t 3735 __ss_padding [118]uint8 3736 __ss_align uint64 3737 } 3738 gsr_source struct { 3739 ss_family sa_family_t 3740 __ss_padding [118]uint8 3741 __ss_align uint64 3742 } 3743 } /* in.h:280:1 */ 3744 3745 type group_filter = struct { 3746 gf_interface uint32_t 3747 _ [4]byte 3748 gf_group struct { 3749 ss_family sa_family_t 3750 __ss_padding [118]uint8 3751 __ss_align uint64 3752 } 3753 gf_fmode uint32_t 3754 gf_numsrc uint32_t 3755 gf_slist [1]struct { 3756 ss_family sa_family_t 3757 __ss_padding [118]uint8 3758 __ss_align uint64 3759 } 3760 } /* in.h:286:1 */ 3761 3762 type in_pktinfo = struct { 3763 ipi_ifindex int32 3764 ipi_spec_dst struct{ s_addr in_addr_t } 3765 ipi_addr struct{ s_addr in_addr_t } 3766 } /* in.h:297:1 */ 3767 3768 type in6_pktinfo = struct { 3769 ipi6_addr struct { 3770 __in6_union struct { 3771 _ [0]uint32 3772 __s6_addr [16]uint8_t 3773 } 3774 } 3775 ipi6_ifindex uint32 3776 } /* in.h:303:1 */ 3777 3778 type ip6_mtuinfo = struct { 3779 ip6m_addr struct { 3780 sin6_family sa_family_t 3781 sin6_port in_port_t 3782 sin6_flowinfo uint32_t 3783 sin6_addr struct { 3784 __in6_union struct { 3785 _ [0]uint32 3786 __s6_addr [16]uint8_t 3787 } 3788 } 3789 sin6_scope_id uint32_t 3790 } 3791 ip6m_mtu uint32_t 3792 } /* in.h:308:1 */ 3793 3794 type addrinfo = struct { 3795 ai_flags int32 3796 ai_family int32 3797 ai_socktype int32 3798 ai_protocol int32 3799 ai_addrlen socklen_t 3800 _ [4]byte 3801 ai_addr uintptr 3802 ai_canonname uintptr 3803 ai_next uintptr 3804 } /* netdb.h:16:1 */ 3805 3806 // Legacy functions follow (marked OBsolete in SUS) 3807 3808 type netent = struct { 3809 n_name uintptr 3810 n_aliases uintptr 3811 n_addrtype int32 3812 n_net uint32_t 3813 } /* netdb.h:62:1 */ 3814 3815 type hostent = struct { 3816 h_name uintptr 3817 h_aliases uintptr 3818 h_addrtype int32 3819 h_length int32 3820 h_addr_list uintptr 3821 } /* netdb.h:69:1 */ 3822 3823 type servent = struct { 3824 s_name uintptr 3825 s_aliases uintptr 3826 s_port int32 3827 _ [4]byte 3828 s_proto uintptr 3829 } /* netdb.h:78:1 */ 3830 3831 type protoent = struct { 3832 p_name uintptr 3833 p_aliases uintptr 3834 p_proto int32 3835 _ [4]byte 3836 } /* netdb.h:85:1 */ 3837 3838 type aibuf = struct { 3839 ai struct { 3840 ai_flags int32 3841 ai_family int32 3842 ai_socktype int32 3843 ai_protocol int32 3844 ai_addrlen socklen_t 3845 _ [4]byte 3846 ai_addr uintptr 3847 ai_canonname uintptr 3848 ai_next uintptr 3849 } 3850 sa struct { 3851 sin struct { 3852 sin_family sa_family_t 3853 sin_port in_port_t 3854 sin_addr struct{ s_addr in_addr_t } 3855 sin_zero [8]uint8_t 3856 } 3857 _ [12]byte 3858 } 3859 lock [1]int32 3860 slot int16 3861 ref int16 3862 _ [4]byte 3863 } /* lookup.h:10:1 */ 3864 3865 type sa = struct { 3866 sin struct { 3867 sin_family sa_family_t 3868 sin_port in_port_t 3869 sin_addr struct{ s_addr in_addr_t } 3870 sin_zero [8]uint8_t 3871 } 3872 _ [12]byte 3873 } /* lookup.h:10:1 */ 3874 3875 type address = struct { 3876 family int32 3877 scopeid uint32 3878 addr [16]uint8_t 3879 sortkey int32 3880 } /* lookup.h:20:1 */ 3881 3882 type service = struct { 3883 port uint16_t 3884 proto uint8 3885 socktype uint8 3886 } /* lookup.h:27:1 */ 3887 3888 type resolvconf = struct { 3889 ns [3]struct { 3890 family int32 3891 scopeid uint32 3892 addr [16]uint8_t 3893 sortkey int32 3894 } 3895 nns uint32 3896 attempts uint32 3897 ndots uint32 3898 timeout uint32 3899 } /* lookup.h:34:1 */ 3900 3901 func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ 3902 var cnt size_t 3903 cnt = uint64(1) 3904 __1: 3905 if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) { 3906 goto __3 3907 } 3908 goto __2 3909 __2: 3910 cnt++ 3911 p = (*addrinfo)(unsafe.Pointer(p)).ai_next 3912 goto __1 3913 goto __3 3914 __3: 3915 ; 3916 var b uintptr = p - uintptr(uint64(uintptr(0))) 3917 b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).slot) 3918 //TODO LOCK(b->lock); 3919 if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) { 3920 Xfree(tls, b) 3921 } 3922 //TODO else UNLOCK(b->lock); 3923 } 3924 3925 func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ 3926 bp := tls.Alloc(1608) 3927 defer tls.Free(1608) 3928 3929 // var ports [2]service at bp, 8 3930 3931 // var addrs [48]address at bp+8, 1344 3932 3933 // var canon [256]uint8 at bp+1352, 256 3934 3935 var outcanon uintptr 3936 var nservs int32 3937 var naddrs int32 3938 var nais int32 3939 var canon_len int32 3940 var i int32 3941 var j int32 3942 var k int32 3943 var family int32 = 0 3944 var flags int32 = 0 3945 var proto int32 = 0 3946 var socktype int32 = 0 3947 var out uintptr 3948 3949 if !(host != 0) && !(serv != 0) { 3950 return -2 3951 } 3952 3953 if hint != 0 { 3954 family = (*addrinfo)(unsafe.Pointer(hint)).ai_family 3955 flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags 3956 proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol 3957 socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype 3958 3959 var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400 3960 if flags&mask != flags { 3961 return -1 3962 } 3963 3964 switch family { 3965 case 2: 3966 fallthrough 3967 case 10: 3968 fallthrough 3969 case 0: 3970 break 3971 fallthrough 3972 default: 3973 return -6 3974 } 3975 } 3976 3977 if flags&0x20 != 0 { 3978 Xabort(tls) //TODO- 3979 // /* Define the "an address is configured" condition for address 3980 // * families via ability to create a socket for the family plus 3981 // * routability of the loopback address for the family. */ 3982 // static const struct sockaddr_in lo4 = { 3983 // .sin_family = AF_INET, .sin_port = 65535, 3984 // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN 3985 // ? 0x7f000001 : 0x0100007f 3986 // }; 3987 // static const struct sockaddr_in6 lo6 = { 3988 // .sin6_family = AF_INET6, .sin6_port = 65535, 3989 // .sin6_addr = IN6ADDR_LOOPBACK_INIT 3990 // }; 3991 // int tf[2] = { AF_INET, AF_INET6 }; 3992 // const void *ta[2] = { &lo4, &lo6 }; 3993 // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; 3994 // for (i=0; i<2; i++) { 3995 // if (family==tf[1-i]) continue; 3996 // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, 3997 // IPPROTO_UDP); 3998 // if (s>=0) { 3999 // int cs; 4000 // pthread_setcancelstate( 4001 // PTHREAD_CANCEL_DISABLE, &cs); 4002 // int r = connect(s, ta[i], tl[i]); 4003 // pthread_setcancelstate(cs, 0); 4004 // close(s); 4005 // if (!r) continue; 4006 // } 4007 // switch (errno) { 4008 // case EADDRNOTAVAIL: 4009 // case EAFNOSUPPORT: 4010 // case EHOSTUNREACH: 4011 // case ENETDOWN: 4012 // case ENETUNREACH: 4013 // break; 4014 // default: 4015 // return EAI_SYSTEM; 4016 // } 4017 // if (family == tf[i]) return EAI_NONAME; 4018 // family = tf[1-i]; 4019 // } 4020 } 4021 4022 nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags) 4023 if nservs < 0 { 4024 return nservs 4025 } 4026 4027 naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags) 4028 if naddrs < 0 { 4029 return naddrs 4030 } 4031 4032 nais = nservs * naddrs 4033 canon_len = int32(Xstrlen(tls, bp+1352)) 4034 out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1)) 4035 if !(out != 0) { 4036 return -10 4037 } 4038 4039 if canon_len != 0 { 4040 outcanon = out + uintptr(nais)*88 4041 Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1)) 4042 } else { 4043 outcanon = uintptr(0) 4044 } 4045 4046 for k = AssignInt32(&i, 0); i < naddrs; i++ { 4047 j = 0 4048 __1: 4049 if !(j < nservs) { 4050 goto __3 4051 } 4052 { 4053 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k) 4054 //TODO out[k].ai = (struct addrinfo){ 4055 //TODO .ai_family = addrs[i].family, 4056 //TODO .ai_socktype = ports[j].socktype, 4057 //TODO .ai_protocol = ports[j].proto, 4058 //TODO .ai_addrlen = addrs[i].family == AF_INET 4059 //TODO ? sizeof(struct sockaddr_in) 4060 //TODO : sizeof(struct sockaddr_in6), 4061 //TODO .ai_addr = (void *)&out[k].sa, 4062 //TODO .ai_canonname = outcanon }; 4063 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family 4064 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).socktype) 4065 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).proto) 4066 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 { 4067 if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).family == 2 { 4068 return uint32(unsafe.Sizeof(sockaddr_in{})) 4069 } 4070 return uint32(unsafe.Sizeof(sockaddr_in6{})) 4071 }() 4072 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = out + uintptr(k)*88 + 48 4073 (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon 4074 if k != 0 { 4075 (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).ai.ai_next = out + uintptr(k)*88 4076 } 4077 switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family { 4078 case 2: 4079 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_family = sa_family_t(2) 4080 (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) 4081 Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4)) 4082 break 4083 case 10: 4084 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_family = sa_family_t(10) 4085 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) 4086 (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).scopeid 4087 Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16)) 4088 break 4089 } 4090 4091 } 4092 goto __2 4093 __2: 4094 j++ 4095 k++ 4096 goto __1 4097 goto __3 4098 __3: 4099 } 4100 (*aibuf)(unsafe.Pointer(out)).ref = int16(nais) 4101 *(*uintptr)(unsafe.Pointer(res)) = out 4102 return 0 4103 } 4104 4105 type ucred = struct { 4106 pid pid_t 4107 uid uid_t 4108 gid gid_t 4109 } /* socket.h:57:1 */ 4110 4111 type mmsghdr = struct { 4112 msg_hdr struct { 4113 msg_name uintptr 4114 msg_namelen socklen_t 4115 _ [4]byte 4116 msg_iov uintptr 4117 msg_iovlen int32 4118 __pad1 int32 4119 msg_control uintptr 4120 msg_controllen socklen_t 4121 __pad2 int32 4122 msg_flags int32 4123 _ [4]byte 4124 } 4125 msg_len uint32 4126 _ [4]byte 4127 } /* socket.h:63:1 */ 4128 4129 func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ 4130 bp := tls.Alloc(8) 4131 defer tls.Free(8) 4132 4133 var size size_t = uint64(63) 4134 // var res uintptr at bp, 8 4135 4136 var err int32 4137 for ok := true; ok; ok = err == 34 { 4138 Xfree(tls, _sh) 4139 _sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) 4140 if !(_sh != 0) { 4141 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 4142 return uintptr(0) 4143 } 4144 err = Xgethostbyaddr_r(tls, a, l, af, _sh, 4145 _sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 4146 } 4147 if err != 0 { 4148 return uintptr(0) 4149 } 4150 return _sh 4151 } 4152 4153 var _sh uintptr /* gethostbyaddr.c:9:24: */ 4154 4155 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: */ 4156 bp := tls.Alloc(28) 4157 defer tls.Free(28) 4158 4159 //TODO union { 4160 //TODO struct sockaddr_in sin; 4161 //TODO struct sockaddr_in6 sin6; 4162 //TODO } sa = { .sin.sin_family = af }; 4163 *(*struct { 4164 sin sockaddr_in 4165 _ [12]byte 4166 })(unsafe.Pointer(bp)) = struct { 4167 sin sockaddr_in 4168 _ [12]byte 4169 }{} //TODO- 4170 (*sockaddr_in)(unsafe.Pointer(bp)).sin_family = sa_family_t(af) //TODO- 4171 var sl socklen_t 4172 if af == 10 { 4173 sl = uint32(unsafe.Sizeof(sockaddr_in6{})) 4174 } else { 4175 sl = uint32(unsafe.Sizeof(sockaddr_in{})) 4176 } 4177 var i int32 4178 4179 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 4180 4181 // Load address argument into sockaddr structure 4182 if af == 10 && l == socklen_t(16) { 4183 Xmemcpy(tls, bp+8, a, uint64(16)) 4184 } else if af == 2 && l == socklen_t(4) { 4185 Xmemcpy(tls, bp+4, a, uint64(4)) 4186 } else { 4187 *(*int32)(unsafe.Pointer(err)) = 3 4188 return 22 4189 } 4190 4191 // Align buffer and check for space for pointers and ip address 4192 i = int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))) 4193 if !(i != 0) { 4194 i = int32(unsafe.Sizeof(uintptr(0))) 4195 } 4196 if buflen <= uint64(5)*uint64(unsafe.Sizeof(uintptr(0)))-uint64(i)+uint64(l) { 4197 return 34 4198 } 4199 buf += uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i)) 4200 buflen = buflen - (uint64(5)*uint64(unsafe.Sizeof(uintptr(0))) - uint64(i) + uint64(l)) 4201 4202 (*hostent)(unsafe.Pointer(h)).h_addr_list = buf 4203 buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) 4204 (*hostent)(unsafe.Pointer(h)).h_aliases = buf 4205 buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) 4206 4207 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf 4208 Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) 4209 buf += uintptr(l) 4210 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) 4211 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf 4212 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) 4213 4214 switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { 4215 case -3: 4216 *(*int32)(unsafe.Pointer(err)) = 2 4217 return 11 4218 case -12: 4219 return 34 4220 default: 4221 fallthrough 4222 case -10: 4223 fallthrough 4224 case -11: 4225 fallthrough 4226 case -4: 4227 *(*int32)(unsafe.Pointer(err)) = 3 4228 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 4229 case 0: 4230 break 4231 } 4232 4233 (*hostent)(unsafe.Pointer(h)).h_addrtype = af 4234 (*hostent)(unsafe.Pointer(h)).h_length = int32(l) 4235 (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) 4236 *(*uintptr)(unsafe.Pointer(res)) = h 4237 return 0 4238 } 4239 4240 func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ 4241 return Xgethostbyname2(tls, name, 2) 4242 } 4243 4244 func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ 4245 bp := tls.Alloc(8) 4246 defer tls.Free(8) 4247 4248 var size size_t = uint64(63) 4249 // var res uintptr at bp, 8 4250 4251 var err int32 4252 for ok := true; ok; ok = err == 34 { 4253 Xfree(tls, _sh1) 4254 _sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) 4255 if !(_sh1 != 0) { 4256 *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 4257 return uintptr(0) 4258 } 4259 err = Xgethostbyname2_r(tls, name, af, _sh1, 4260 _sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) 4261 } 4262 if err != 0 { 4263 return uintptr(0) 4264 } 4265 return _sh1 4266 } 4267 4268 var _sh1 uintptr /* gethostbyname2.c:10:24: */ 4269 4270 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: */ 4271 bp := tls.Alloc(1600) 4272 defer tls.Free(1600) 4273 4274 // var addrs [48]address at bp, 1344 4275 4276 // var canon [256]uint8 at bp+1344, 256 4277 4278 var i int32 4279 var cnt int32 4280 var align size_t 4281 var need size_t 4282 4283 *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) 4284 cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02) 4285 if cnt < 0 { 4286 switch cnt { 4287 case -2: 4288 *(*int32)(unsafe.Pointer(err)) = 1 4289 return 2 4290 fallthrough 4291 case -3: 4292 *(*int32)(unsafe.Pointer(err)) = 2 4293 return 11 4294 fallthrough 4295 default: 4296 fallthrough 4297 case -4: 4298 *(*int32)(unsafe.Pointer(err)) = 3 4299 return 74 4300 fallthrough 4301 case -10: 4302 fallthrough 4303 case -11: 4304 *(*int32)(unsafe.Pointer(err)) = 3 4305 return *(*int32)(unsafe.Pointer(X___errno_location(tls))) 4306 } 4307 } 4308 4309 (*hostent)(unsafe.Pointer(h)).h_addrtype = af 4310 (*hostent)(unsafe.Pointer(h)).h_length = func() int32 { 4311 if af == 10 { 4312 return 16 4313 } 4314 return 4 4315 }() 4316 4317 // Align buffer 4318 align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)) 4319 4320 need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0))) 4321 need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).h_length)) 4322 need = need + (Xstrlen(tls, name) + uint64(1)) 4323 need = need + (Xstrlen(tls, bp+1344) + uint64(1)) 4324 need = need + align 4325 4326 if need > buflen { 4327 return 34 4328 } 4329 4330 buf += uintptr(align) 4331 (*hostent)(unsafe.Pointer(h)).h_aliases = buf 4332 buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0)))) 4333 (*hostent)(unsafe.Pointer(h)).h_addr_list = buf 4334 buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0)))) 4335 4336 for i = 0; i < cnt; i++ { 4337 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf 4338 buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length) 4339 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)) 4340 } 4341 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0) 4342 4343 (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf) 4344 Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344) 4345 buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1)) 4346 4347 if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 { 4348 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf 4349 Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name) 4350 buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1)) 4351 } else { 4352 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) 4353 } 4354 4355 *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0) 4356 4357 *(*uintptr)(unsafe.Pointer(res)) = h 4358 return 0 4359 } 4360 4361 func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ 4362 return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) 4363 } 4364 4365 type if_nameindex = struct { 4366 if_index uint32 4367 _ [4]byte 4368 if_name uintptr 4369 } /* if.h:12:1 */ 4370 4371 type ifaddr = struct { 4372 ifa_addr struct { 4373 sa_family sa_family_t 4374 sa_data [14]uint8 4375 } 4376 ifa_ifu struct { 4377 ifu_broadaddr struct { 4378 sa_family sa_family_t 4379 sa_data [14]uint8 4380 } 4381 } 4382 ifa_ifp uintptr 4383 ifa_next uintptr 4384 } /* if.h:51:1 */ 4385 4386 type ifmap = struct { 4387 mem_start uint64 4388 mem_end uint64 4389 base_addr uint16 4390 irq uint8 4391 dma uint8 4392 port uint8 4393 _ [3]byte 4394 } /* if.h:64:1 */ 4395 4396 type ifreq = struct { 4397 ifr_ifrn struct{ ifrn_name [16]uint8 } 4398 ifr_ifru struct { 4399 _ [0]uint64 4400 ifru_addr struct { 4401 sa_family sa_family_t 4402 sa_data [14]uint8 4403 } 4404 _ [8]byte 4405 } 4406 } /* if.h:76:1 */ 4407 4408 type ifconf = struct { 4409 ifc_len int32 4410 _ [4]byte 4411 ifc_ifcu struct{ ifcu_buf uintptr } 4412 } /* if.h:116:1 */ 4413 4414 type ns_sect = uint32 /* nameser.h:37:3 */ 4415 4416 type __ns_msg = struct { 4417 _msg uintptr 4418 _eom uintptr 4419 _id uint16_t 4420 _flags uint16_t 4421 _counts [4]uint16_t 4422 _ [4]byte 4423 _sections [4]uintptr 4424 _sect ns_sect 4425 _rrnum int32 4426 _msg_ptr uintptr 4427 } /* nameser.h:39:9 */ 4428 4429 type ns_msg = __ns_msg /* nameser.h:46:3 */ 4430 4431 type _ns_flagdata = struct { 4432 mask int32 4433 shift int32 4434 } /* nameser.h:48:1 */ 4435 4436 type __ns_rr = struct { 4437 name [1025]uint8 4438 _ [1]byte 4439 __type uint16_t 4440 rr_class uint16_t 4441 _ [2]byte 4442 ttl uint32_t 4443 rdlength uint16_t 4444 _ [2]byte 4445 rdata uintptr 4446 } /* nameser.h:59:9 */ 4447 4448 type ns_rr = __ns_rr /* nameser.h:66:3 */ 4449 4450 type ns_flag = uint32 /* nameser.h:87:3 */ 4451 4452 type ns_opcode = uint32 /* nameser.h:96:3 */ 4453 4454 type ns_rcode = uint32 /* nameser.h:115:3 */ 4455 4456 type ns_update_operation = uint32 /* nameser.h:121:3 */ 4457 4458 type ns_tsig_key1 = struct { 4459 name [1025]uint8 4460 alg [1025]uint8 4461 _ [6]byte 4462 data uintptr 4463 len int32 4464 _ [4]byte 4465 } /* nameser.h:123:1 */ 4466 4467 type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ 4468 4469 type ns_tcp_tsig_state1 = struct { 4470 counter int32 4471 _ [4]byte 4472 key uintptr 4473 ctx uintptr 4474 sig [512]uint8 4475 siglen int32 4476 _ [4]byte 4477 } /* nameser.h:130:1 */ 4478 4479 type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ 4480 4481 type ns_type = uint32 /* nameser.h:200:3 */ 4482 4483 type ns_class = uint32 /* nameser.h:219:3 */ 4484 4485 type ns_key_types = uint32 /* nameser.h:226:3 */ 4486 4487 type ns_cert_types = uint32 /* nameser.h:234:3 */ 4488 4489 type HEADER = struct { 4490 _ [0]uint32 4491 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 */ 4492 qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ 4493 nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ 4494 } /* nameser.h:353:3 */ 4495 4496 // unused; purely for broken apps 4497 type __res_state = struct { 4498 retrans int32 4499 retry int32 4500 options uint64 4501 nscount int32 4502 nsaddr_list [3]struct { 4503 sin_family sa_family_t 4504 sin_port in_port_t 4505 sin_addr struct{ s_addr in_addr_t } 4506 sin_zero [8]uint8_t 4507 } 4508 id uint16 4509 _ [2]byte 4510 dnsrch [7]uintptr 4511 defdname [256]uint8 4512 pfcode uint64 4513 ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ 4514 _ [4]byte 4515 sort_list [10]struct { 4516 addr struct{ s_addr in_addr_t } 4517 mask uint32_t 4518 } 4519 qhook uintptr 4520 rhook uintptr 4521 res_h_errno int32 4522 _vcsock int32 4523 _flags uint32 4524 _ [4]byte 4525 _u struct { 4526 _ [0]uint64 4527 pad [52]uint8 4528 _ [4]byte 4529 } 4530 } /* resolv.h:26:9 */ 4531 4532 // unused; purely for broken apps 4533 type res_state = uintptr /* resolv.h:62:3 */ 4534 4535 type res_sym = struct { 4536 number int32 4537 _ [4]byte 4538 name uintptr 4539 humanname uintptr 4540 } /* resolv.h:70:1 */ 4541 4542 func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ 4543 p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0)))) 4544 *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(0) 4545 for ok := true; ok; ok = x != 0 { 4546 *(*uint8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = uint8(uint32('0') + x%uint32(10)) 4547 x = x / uint32(10) 4548 } 4549 return p 4550 } 4551 4552 func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ 4553 bp := tls.Alloc(32) 4554 defer tls.Free(32) 4555 4556 Xsprintf(tls, s, ts+25, 4557 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))))) 4558 } 4559 4560 func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ 4561 var i int32 4562 for i = 15; i >= 0; i-- { 4563 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15] 4564 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.') 4565 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4] 4566 *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = uint8('.') 4567 } 4568 Xstrcpy(tls, s, ts+50) 4569 } 4570 4571 var _sxdigits = *(*[17]uint8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */ 4572 4573 func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ 4574 bp := tls.Alloc(556) 4575 defer tls.Free(556) 4576 4577 // var line [512]uint8 at bp+16, 512 4578 4579 var p uintptr 4580 var z uintptr 4581 var _buf [1032]uint8 4582 _ = _buf 4583 // var atmp [16]uint8 at bp, 16 4584 4585 // var iplit address at bp+528, 28 4586 4587 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 4588 var f uintptr = Xfopen(tls, ts+76, ts+87) 4589 if !(f != 0) { 4590 return 4591 } 4592 if family == 2 { 4593 Xmemcpy(tls, bp+uintptr(12), a, uint64(4)) 4594 Xmemcpy(tls, bp, ts+90, uint64(12)) 4595 a = bp /* &atmp[0] */ 4596 } 4597 for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]uint8{})), f) != 0 { 4598 if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 { 4599 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n') 4600 *(*uint8)(unsafe.Pointer(p)) = uint8(0) 4601 } 4602 4603 for p = bp + 16; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { 4604 } 4605 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0) 4606 if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 { 4607 continue 4608 } 4609 4610 if (*address)(unsafe.Pointer(bp+528)).family == 2 { 4611 Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4)) 4612 Xmemcpy(tls, bp+528+8, ts+90, uint64(12)) 4613 (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0) 4614 } 4615 4616 if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).scopeid != scopeid { 4617 continue 4618 } 4619 4620 for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ { 4621 } 4622 for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ { 4623 } 4624 *(*uint8)(unsafe.Pointer(z)) = uint8(0) 4625 if (int64(z)-int64(p))/1 < int64(256) { 4626 Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1))) 4627 break 4628 } 4629 } 4630 //TODO __fclose_ca(f); 4631 Xfclose(tls, f) 4632 } 4633 4634 func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ 4635 Xabort(tls) //TODO- 4636 // unsigned long svport; 4637 // char line[128], *p, *z; 4638 // unsigned char _buf[1032]; 4639 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 4640 // if (!f) return; 4641 // while (fgets(line, sizeof line, f)) { 4642 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 4643 4644 // for (p=line; *p && !isspace(*p); p++); 4645 // if (!*p) continue; 4646 // *p++ = 0; 4647 // svport = strtoul(p, &z, 10); 4648 4649 // if (svport != port || z==p) continue; 4650 // if (dgram && strncmp(z, "/udp", 4)) continue; 4651 // if (!dgram && strncmp(z, "/tcp", 4)) continue; 4652 // if (p-line > 32) continue; 4653 4654 // memcpy(buf, line, p-line); 4655 // break; 4656 // } 4657 // __fclose_ca(f); 4658 } 4659 4660 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: */ 4661 bp := tls.Alloc(347) 4662 defer tls.Free(347) 4663 4664 // var ptr [78]uint8 at bp, 78 4665 4666 // var buf [256]uint8 at bp+78, 256 4667 4668 // var num [13]uint8 at bp+334, 13 4669 4670 var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) 4671 var a uintptr 4672 var scopeid uint32 4673 4674 switch af { 4675 case 2: 4676 a = sa1 + 4 4677 if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{})) { 4678 return -6 4679 } 4680 mkptr4(tls, bp, a) 4681 scopeid = uint32(0) 4682 break 4683 case 10: 4684 a = sa1 + 8 4685 if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{})) { 4686 return -6 4687 } 4688 if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { 4689 mkptr6(tls, bp, a) 4690 } else { 4691 mkptr4(tls, bp, a+uintptr(12)) 4692 } 4693 scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id 4694 break 4695 default: 4696 return -6 4697 } 4698 4699 if node != 0 && nodelen != 0 { 4700 *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0) 4701 if !(flags&0x01 != 0) { 4702 reverse_hosts(tls, bp+78, a, scopeid, af) 4703 } 4704 if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) { 4705 Xabort(tls) //TODO- 4706 // unsigned char query[18+PTR_MAX], reply[512]; 4707 // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, 4708 // 0, 0, 0, query, sizeof query); 4709 // query[3] = 0; /* don't need AD flag */ 4710 // int rlen = __res_send(query, qlen, reply, sizeof reply); 4711 // buf[0] = 0; 4712 // if (rlen > 0) 4713 // __dns_parse(reply, rlen, dns_parse_callback, buf); 4714 } 4715 if !(int32(*(*uint8)(unsafe.Pointer(bp + 78))) != 0) { 4716 if flags&0x08 != 0 { 4717 return -2 4718 } 4719 Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]uint8{}))) 4720 if scopeid != 0 { 4721 Xabort(tls) //TODO- 4722 // char *p = 0, tmp[IF_NAMESIZE+1]; 4723 // if (!(flags & NI_NUMERICSCOPE) && 4724 // (IN6_IS_ADDR_LINKLOCAL(a) || 4725 // IN6_IS_ADDR_MC_LINKLOCAL(a))) 4726 // p = if_indextoname(scopeid, tmp+1); 4727 // if (!p) 4728 // p = itoa(num, scopeid); 4729 // *--p = '%'; 4730 // strcat(buf, p); 4731 } 4732 } 4733 if Xstrlen(tls, bp+78) >= size_t(nodelen) { 4734 return -12 4735 } 4736 Xstrcpy(tls, node, bp+78) 4737 } 4738 4739 if serv != 0 && servlen != 0 { 4740 var p uintptr = bp + 78 /* buf */ 4741 var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) 4742 *(*uint8)(unsafe.Pointer(bp + 78)) = uint8(0) 4743 if !(flags&0x02 != 0) { 4744 reverse_services(tls, bp+78, port, flags&0x10) 4745 } 4746 if !(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { 4747 p = itoa(tls, bp+334, uint32(port)) 4748 } 4749 if Xstrlen(tls, p) >= size_t(servlen) { 4750 return -12 4751 } 4752 Xstrcpy(tls, serv, p) 4753 } 4754 4755 return 0 4756 } 4757 4758 var Xh_errno int32 /* h_errno.c:4:5: */ 4759 4760 func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ 4761 return uintptr(unsafe.Pointer(&Xh_errno)) 4762 } 4763 4764 func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ 4765 bp := tls.Alloc(40) 4766 defer tls.Free(40) 4767 4768 var s uintptr = s0 4769 var d uintptr = dest 4770 *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)} 4771 // var z uintptr at bp+32, 8 4772 4773 var i int32 4774 4775 for i = 0; i < 4; i++ { 4776 *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0) 4777 if *(*uintptr)(unsafe.Pointer(bp + 32)) == s || *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))) != 0 && int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != '.' || !(func() int32 { 4778 if 0 != 0 { 4779 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s)))) 4780 } 4781 return Bool32(uint32(*(*uint8)(unsafe.Pointer(s)))-uint32('0') < uint32(10)) 4782 }() != 0) { 4783 return 0 4784 } 4785 if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) { 4786 break 4787 } 4788 s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1) 4789 } 4790 if i == 4 { 4791 return 0 4792 } 4793 switch i { 4794 case 0: 4795 *(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff) 4796 AssignShrPtrUint64(bp, int(24)) 4797 fallthrough 4798 case 1: 4799 *(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff) 4800 AssignShrPtrUint64(bp+1*8, int(16)) 4801 fallthrough 4802 case 2: 4803 *(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff) 4804 AssignShrPtrUint64(bp+2*8, int(8)) 4805 } 4806 for i = 0; i < 4; i++ { 4807 if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) { 4808 return 0 4809 } 4810 *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8))) 4811 } 4812 return 1 4813 } 4814 4815 func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ 4816 bp := tls.Alloc(276) 4817 defer tls.Free(276) 4818 4819 var a uintptr = a0 4820 var i int32 4821 var j int32 4822 var max int32 4823 var best int32 4824 // var buf [100]uint8 at bp+176, 100 4825 4826 switch af { 4827 case 2: 4828 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 { 4829 return s 4830 } 4831 break 4832 case 10: 4833 if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { 4834 Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]uint8{})), 4835 ts+115, 4836 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))), 4837 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))), 4838 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))), 4839 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))))) 4840 } else { 4841 Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]uint8{})), 4842 ts+139, 4843 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))), 4844 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))), 4845 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))), 4846 int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) 4847 } 4848 // Replace longest /(^0|:)[:0]{2,}/ with "::" 4849 i = AssignInt32(&best, 0) 4850 max = 2 4851 for ; *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ { 4852 if i != 0 && int32(*(*uint8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' { 4853 continue 4854 } 4855 j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169)) 4856 if j > max { 4857 best = i 4858 max = j 4859 } 4860 } 4861 if max > 3 { 4862 *(*uint8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrUint8(bp+176+uintptr(best+1), uint8(':')) 4863 Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1)) 4864 } 4865 if Xstrlen(tls, bp+176) < size_t(l) { 4866 Xstrcpy(tls, s, bp+176) 4867 return s 4868 } 4869 break 4870 default: 4871 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 4872 return uintptr(0) 4873 } 4874 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28 4875 return uintptr(0) 4876 } 4877 4878 func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ 4879 if c-uint32('0') < uint32(10) { 4880 return int32(c - uint32('0')) 4881 } 4882 c = c | uint32(32) 4883 if c-uint32('a') < uint32(6) { 4884 return int32(c - uint32('a') + uint32(10)) 4885 } 4886 return -1 4887 } 4888 4889 func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ 4890 bp := tls.Alloc(16) 4891 defer tls.Free(16) 4892 4893 // var ip [8]uint16_t at bp, 16 4894 4895 var a uintptr = a0 4896 var i int32 4897 var j int32 4898 var v int32 4899 var d int32 4900 var brk int32 = -1 4901 var need_v4 int32 = 0 4902 4903 if af == 2 { 4904 for i = 0; i < 4; i++ { 4905 for v = AssignInt32(&j, 0); j < 3 && func() int32 { 4906 if 0 != 0 { 4907 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))) 4908 } 4909 return Bool32(uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10)) 4910 }() != 0; j++ { 4911 v = 10*v + int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) - '0' 4912 } 4913 if j == 0 || j > 1 && int32(*(*uint8)(unsafe.Pointer(s))) == '0' || v > 255 { 4914 return 0 4915 } 4916 *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) 4917 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 { 4918 return 1 4919 } 4920 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' { 4921 return 0 4922 } 4923 s += uintptr(j + 1) 4924 } 4925 return 0 4926 } else if af != 10 { 4927 *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 4928 return -1 4929 } 4930 4931 if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' { 4932 return 0 4933 } 4934 4935 for i = 0; ; i++ { 4936 if int32(*(*uint8)(unsafe.Pointer(s))) == ':' && brk < 0 { 4937 brk = i 4938 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0) 4939 if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { 4940 break 4941 } 4942 if i == 7 { 4943 return 0 4944 } 4945 continue 4946 } 4947 for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ { 4948 v = 16*v + d 4949 } 4950 if j == 0 { 4951 return 0 4952 } 4953 *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v) 4954 if !(int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) { 4955 break 4956 } 4957 if i == 7 { 4958 return 0 4959 } 4960 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != ':' { 4961 if int32(*(*uint8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 { 4962 return 0 4963 } 4964 need_v4 = 1 4965 i++ 4966 break 4967 } 4968 s += uintptr(j + 1) 4969 } 4970 if brk >= 0 { 4971 Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk))) 4972 for j = 0; j < 7-i; j++ { 4973 *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0) 4974 } 4975 } 4976 for j = 0; j < 8; j++ { 4977 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8) 4978 *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) 4979 } 4980 if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 { 4981 return 0 4982 } 4983 return 1 4984 } 4985 4986 func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ 4987 bp := tls.Alloc(96) 4988 defer tls.Free(96) 4989 4990 // var a4 in_addr at bp, 4 4991 4992 // var a6 in6_addr at bp+68, 16 4993 4994 if X__inet_aton(tls, name, bp) > 0 { 4995 if family == 10 { // wrong family 4996 return -2 4997 } 4998 Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{}))) 4999 (*address)(unsafe.Pointer(buf)).family = 2 5000 (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) 5001 return 1 5002 } 5003 // var tmp [64]uint8 at bp+4, 64 5004 5005 var p uintptr = Xstrchr(tls, name, '%') 5006 // var z uintptr at bp+88, 8 5007 5008 var scopeid uint64 = uint64(0) 5009 if p != 0 && (int64(p)-int64(name))/1 < int64(64) { 5010 Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1)) 5011 *(*uint8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = uint8(0) 5012 name = bp + 4 /* &tmp[0] */ 5013 } 5014 5015 if Xinet_pton(tls, 10, name, bp+68) <= 0 { 5016 return 0 5017 } 5018 if family == 2 { // wrong family 5019 return -2 5020 } 5021 5022 Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{}))) 5023 (*address)(unsafe.Pointer(buf)).family = 10 5024 if p != 0 { 5025 if func() int32 { 5026 if 0 != 0 { 5027 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) 5028 } 5029 return Bool32(uint32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10)) 5030 }() != 0 { 5031 scopeid = Xstrtoull(tls, p, bp+88, 10) 5032 } else { 5033 *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1) 5034 } 5035 if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 { 5036 Xabort(tls) //TODO- 5037 // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && 5038 // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) 5039 // return EAI_NONAME; 5040 // scopeid = if_nametoindex(p); 5041 // if (!scopeid) return EAI_NONAME; 5042 } 5043 if scopeid > uint64(0xffffffff) { 5044 return -2 5045 } 5046 } 5047 (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid) 5048 return 1 5049 } 5050 5051 func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ 5052 var s uintptr 5053 //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; 5054 if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) { 5055 return 0 5056 } 5057 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++ { 5058 } 5059 return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) 5060 } 5061 5062 var Xzero_struct_address address /* lookup_name.c:27:16: */ 5063 5064 func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ 5065 var cnt int32 = 0 5066 if name != 0 { 5067 return 0 5068 } 5069 if flags&0x01 != 0 { 5070 //TODO if (family != AF_INET6) 5071 //TODO buf[cnt++] = (struct address){ .family = AF_INET }; 5072 if family != 10 { 5073 var x = Xzero_struct_address 5074 x.family = 2 5075 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 5076 } 5077 //TODO if (family != AF_INET) 5078 //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; 5079 if family != 2 { 5080 var x = Xzero_struct_address 5081 x.family = 10 5082 *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x 5083 } 5084 } else { 5085 Xabort(tls) //TODO- 5086 // if (family != AF_INET6) 5087 // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; 5088 // if (family != AF_INET) 5089 // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; 5090 } 5091 return cnt 5092 } 5093 5094 func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ 5095 return X__lookup_ipliteral(tls, buf, name, family) 5096 } 5097 5098 func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ 5099 bp := tls.Alloc(512) 5100 defer tls.Free(512) 5101 5102 // var line [512]uint8 at bp, 512 5103 5104 var l size_t = Xstrlen(tls, name) 5105 var cnt int32 = 0 5106 var badfam int32 = 0 5107 var _buf [1032]uint8 5108 _ = _buf 5109 //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); 5110 var _f FILE 5111 _ = _f 5112 var f uintptr = Xfopen(tls, ts+76, ts+87) 5113 if !(f != 0) { 5114 switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { 5115 case 2: 5116 fallthrough 5117 case 20: 5118 fallthrough 5119 case 13: 5120 return 0 5121 fallthrough 5122 default: 5123 return -11 5124 } 5125 } 5126 for Xfgets(tls, bp, int32(unsafe.Sizeof([512]uint8{})), f) != 0 && cnt < 48 { 5127 var p uintptr 5128 var z uintptr 5129 5130 if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 { 5131 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8('\n') 5132 *(*uint8)(unsafe.Pointer(p)) = uint8(0) 5133 } 5134 for p = bp + uintptr(1); AssignUintptr(&p, Xstrstr(tls, p, name)) != 0 && (!(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { 5135 } 5136 if !(p != 0) { 5137 continue 5138 } 5139 5140 // Isolate IP address to parse 5141 for p = bp; /* &line[0] */ *(*uint8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0); p++ { 5142 } 5143 *(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = uint8(0) 5144 switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) { 5145 case 1: 5146 cnt++ 5147 break 5148 case 0: 5149 continue 5150 default: 5151 badfam = -2 5152 continue 5153 } 5154 5155 // Extract first name as canonical name 5156 for ; *(*uint8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0; p++ { 5157 } 5158 for z = p; *(*uint8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(z)))) != 0); z++ { 5159 } 5160 *(*uint8)(unsafe.Pointer(z)) = uint8(0) 5161 if is_valid_hostname(tls, p) != 0 { 5162 Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1))) 5163 } 5164 } 5165 //TODO __fclose_ca(f); 5166 Xfclose(tls, f) 5167 if cnt != 0 { 5168 return cnt 5169 } 5170 return badfam 5171 } 5172 5173 type dpc_ctx = struct { 5174 addrs uintptr 5175 canon uintptr 5176 cnt int32 5177 _ [4]byte 5178 } /* lookup_name.c:112:1 */ 5179 5180 func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ 5181 return -1 //TODO- 5182 Xabort(tls) 5183 return int32(0) //TODO- 5184 // char search[256]; 5185 // struct resolvconf conf; 5186 // size_t l, dots; 5187 // char *p, *z; 5188 5189 // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; 5190 5191 // /* Count dots, suppress search when >=ndots or name ends in 5192 // * a dot, which is an explicit request for global scope. */ 5193 // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; 5194 // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; 5195 5196 // /* Strip final dot for canon, fail if multiple trailing dots. */ 5197 // if (name[l-1]=='.') l--; 5198 // if (!l || name[l-1]=='.') return EAI_NONAME; 5199 5200 // /* This can never happen; the caller already checked length. */ 5201 // if (l >= 256) return EAI_NONAME; 5202 5203 // /* Name with search domain appended is setup in canon[]. This both 5204 // * provides the desired default canonical name (if the requested 5205 // * name is not a CNAME record) and serves as a buffer for passing 5206 // * the full requested name to name_from_dns. */ 5207 // memcpy(canon, name, l); 5208 // canon[l] = '.'; 5209 5210 // for (p=search; *p; p=z) { 5211 // for (; isspace(*p); p++); 5212 // for (z=p; *z && !isspace(*z); z++); 5213 // if (z==p) break; 5214 // if (z-p < 256 - l - 1) { 5215 // memcpy(canon+l+1, p, z-p); 5216 // canon[z-p+1+l] = 0; 5217 // int cnt = name_from_dns(buf, canon, canon, family, &conf); 5218 // if (cnt) return cnt; 5219 // } 5220 // } 5221 5222 // canon[l] = 0; 5223 // return name_from_dns(buf, canon, name, family, &conf); 5224 } 5225 5226 type policy = struct { 5227 addr [16]uint8 5228 len uint8 5229 mask uint8 5230 prec uint8 5231 label uint8 5232 } /* lookup_name.c:237:14 */ 5233 5234 var defpolicy = [6]policy{ 5235 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)}, 5236 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)}, 5237 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)}, 5238 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)}, 5239 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)}, 5240 // Last rule must match all addresses to stop loop. 5241 {addr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), prec: uint8(40), label: uint8(1)}, 5242 } /* lookup_name.c:241:3 */ 5243 5244 func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ 5245 var i int32 5246 for i = 0; ; i++ { 5247 if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].len)) != 0 { 5248 continue 5249 } 5250 if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].len))))&int32(defpolicy[i].mask) != 5251 int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].len)))) { 5252 continue 5253 } 5254 return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 5255 } 5256 return uintptr(0) 5257 } 5258 5259 func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ 5260 return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label) 5261 } 5262 5263 func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ 5264 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff { 5265 return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15 5266 } 5267 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 { 5268 return 2 5269 } 5270 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 { 5271 return 2 5272 } 5273 if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 { 5274 return 5 5275 } 5276 return 14 5277 } 5278 5279 func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ 5280 // FIXME: The common prefix length should be limited to no greater 5281 // than the nominal length of the prefix portion of the source 5282 // address. However the definition of the source prefix length is 5283 // not clear and thus this limiting is not yet implemented. 5284 var i uint32 5285 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++ { 5286 } 5287 return int32(i) 5288 } 5289 5290 func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ 5291 var a uintptr = _a 5292 var b uintptr = _b 5293 return (*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey 5294 } 5295 5296 func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ 5297 bp := tls.Alloc(92) 5298 defer tls.Free(92) 5299 5300 var cnt int32 = 0 5301 var i int32 5302 var j int32 5303 _ = j 5304 5305 *(*uint8)(unsafe.Pointer(canon)) = uint8(0) 5306 if name != 0 { 5307 // reject empty name and check len so it fits into temp bufs 5308 var l size_t = Xstrnlen(tls, name, uint64(255)) 5309 if l-uint64(1) >= uint64(254) { 5310 return -2 5311 } 5312 Xmemcpy(tls, canon, name, l+uint64(1)) 5313 } 5314 5315 // Procedurally, a request for v6 addresses with the v4-mapped 5316 // flag set is like a request for unspecified family, followed 5317 // by filtering of the results. 5318 if flags&0x08 != 0 { 5319 if family == 10 { 5320 family = 0 5321 } else { 5322 flags = flags - 0x08 5323 } 5324 } 5325 5326 // Try each backend until there's at least one result. 5327 cnt = name_from_null(tls, buf, name, family, flags) 5328 if !(cnt != 0) { 5329 cnt = name_from_numeric(tls, buf, name, family) 5330 } 5331 if !(cnt != 0) && !(flags&0x04 != 0) { 5332 cnt = name_from_hosts(tls, buf, canon, name, family) 5333 if !(cnt != 0) { 5334 cnt = name_from_dns_search(tls, buf, canon, name, family) 5335 } 5336 } 5337 if cnt <= 0 { 5338 if cnt != 0 { 5339 return cnt 5340 } 5341 return -2 5342 } 5343 5344 // Filter/transform results for v4-mapped lookup, if requested. 5345 if flags&0x08 != 0 { 5346 Xabort(tls) //TODO- 5347 // if (!(flags & AI_ALL)) { 5348 // /* If any v6 results exist, remove v4 results. */ 5349 // for (i=0; i<cnt && buf[i].family != AF_INET6; i++); 5350 // if (i<cnt) { 5351 // for (j=0; i<cnt; i++) { 5352 // if (buf[i].family == AF_INET6) 5353 // buf[j++] = buf[i]; 5354 // } 5355 // cnt = i = j; 5356 // } 5357 // } 5358 // /* Translate any remaining v4 results to v6 */ 5359 // for (i=0; i<cnt; i++) { 5360 // if (buf[i].family != AF_INET) continue; 5361 // memcpy(buf[i].addr+12, buf[i].addr, 4); 5362 // memcpy(buf[i].addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12); 5363 // buf[i].family = AF_INET6; 5364 // } 5365 } 5366 5367 // No further processing is needed if there are fewer than 2 5368 // results or if there are only IPv4 results. 5369 if cnt < 2 || family == 2 { 5370 return cnt 5371 } 5372 for i = 0; i < cnt; i++ { 5373 if (*address)(unsafe.Pointer(buf+uintptr(i)*28)).family != 2 { 5374 break 5375 } 5376 } 5377 if i == cnt { 5378 return cnt 5379 } 5380 var cs int32 5381 _ = cs 5382 //TODO pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); 5383 5384 // The following implements a subset of RFC 3484/6724 destination 5385 // address selection by generating a single 31-bit sort key for 5386 // each address. Rules 3, 4, and 7 are omitted for having 5387 // excessive runtime and code size cost and dubious benefit. 5388 // So far the label/precedence table cannot be customized. 5389 for i = 0; i < cnt; i++ { 5390 var family int32 = (*address)(unsafe.Pointer(buf + uintptr(i)*28)).family 5391 var key int32 = 0 5392 *(*sockaddr_in6)(unsafe.Pointer(bp + 28 /* sa6 */)) = sockaddr_in6{} 5393 *(*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} 5394 *(*sockaddr_in)(unsafe.Pointer(bp + 72 /* sa4 */)) = sockaddr_in{} 5395 *(*sockaddr_in)(unsafe.Pointer(bp + 56 /* da4 */)) = sockaddr_in{sin_family: sa_family_t(2), sin_port: in_port_t(65535)} 5396 var sa1 uintptr 5397 var da uintptr 5398 // var salen socklen_t at bp+88, 4 5399 5400 var dalen socklen_t 5401 if family == 10 { 5402 Xmemcpy(tls, bp+8, buf+uintptr(i)*28+8, uint64(16)) 5403 da = bp /* &da6 */ 5404 dalen = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 5405 sa1 = bp + 28 /* &sa6 */ 5406 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in6{})) 5407 } else { 5408 Xmemcpy(tls, bp+28+8, 5409 ts+90, uint64(12)) 5410 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) 5411 Xmemcpy(tls, bp+8, 5412 ts+90, uint64(12)) 5413 Xmemcpy(tls, bp+8+uintptr(12), buf+uintptr(i)*28+8, uint64(4)) 5414 Xmemcpy(tls, bp+56+4, buf+uintptr(i)*28+8, uint64(4)) 5415 da = bp + 56 /* &da4 */ 5416 dalen = socklen_t(unsafe.Sizeof(sockaddr_in{})) 5417 sa1 = bp + 72 /* &sa4 */ 5418 *(*socklen_t)(unsafe.Pointer(bp + 88 /* salen */)) = socklen_t(unsafe.Sizeof(sockaddr_in{})) 5419 } 5420 var dpolicy uintptr = policyof(tls, bp+8) 5421 var dscope int32 = scopeof(tls, bp+8) 5422 var dlabel int32 = int32((*policy)(unsafe.Pointer(dpolicy)).label) 5423 var dprec int32 = int32((*policy)(unsafe.Pointer(dpolicy)).prec) 5424 var prefixlen int32 = 0 5425 var fd int32 = Xsocket(tls, family, 2|02000000, 17) 5426 if fd >= 0 { 5427 if !(Xconnect(tls, fd, da, dalen) != 0) { 5428 key = key | 0x40000000 5429 if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) { 5430 if family == 2 { 5431 Xmemcpy(tls, 5432 bp+28+8+uintptr(12), 5433 bp+72+4, uint64(4)) 5434 } 5435 if dscope == scopeof(tls, bp+28+8) { 5436 key = key | 0x20000000 5437 } 5438 if dlabel == labelof(tls, bp+28+8) { 5439 key = key | 0x10000000 5440 } 5441 prefixlen = prefixmatch(tls, bp+28+8, 5442 bp+8) 5443 } 5444 } 5445 Xclose(tls, fd) 5446 } 5447 key = key | dprec<<20 5448 key = key | (15-dscope)<<16 5449 key = key | prefixlen<<8 5450 key = key | (48-i)<<0 5451 (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key 5452 } 5453 Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { 5454 f func(*TLS, uintptr, uintptr) int32 5455 }{addrcmp}))) 5456 5457 //TODO pthread_setcancelstate(cs, 0); 5458 5459 return cnt 5460 } 5461 5462 func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ 5463 bp := tls.Alloc(8) 5464 defer tls.Free(8) 5465 5466 var line [128]uint8 5467 _ = line 5468 var cnt int32 = 0 5469 var p uintptr 5470 _ = p 5471 *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */ 5472 var port uint64 = uint64(0) 5473 5474 switch socktype { 5475 case 1: 5476 switch proto { 5477 case 0: 5478 proto = 6 5479 fallthrough 5480 case 6: 5481 break 5482 default: 5483 return -8 5484 } 5485 break 5486 case 2: 5487 switch proto { 5488 case 0: 5489 proto = 17 5490 fallthrough 5491 case 17: 5492 break 5493 default: 5494 return -8 5495 } 5496 fallthrough 5497 case 0: 5498 break 5499 default: 5500 if name != 0 { 5501 return -8 5502 } 5503 (*service)(unsafe.Pointer(buf)).port = uint16_t(0) 5504 (*service)(unsafe.Pointer(buf)).proto = uint8(proto) 5505 (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype) 5506 return 1 5507 } 5508 5509 if name != 0 { 5510 if !(int32(*(*uint8)(unsafe.Pointer(name))) != 0) { 5511 return -8 5512 } 5513 port = Xstrtoul(tls, name, bp, 10) 5514 } 5515 if !(int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) { 5516 if port > uint64(65535) { 5517 return -8 5518 } 5519 if proto != 17 { 5520 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) 5521 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1) 5522 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6) 5523 } 5524 if proto != 6 { 5525 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) 5526 (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2) 5527 (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17) 5528 } 5529 return cnt 5530 } 5531 5532 if flags&0x400 != 0 { 5533 return -2 5534 } 5535 5536 var l size_t = Xstrlen(tls, name) 5537 _ = l 5538 5539 Xabort(tls) //TODO- 5540 // unsigned char _buf[1032]; 5541 // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); 5542 // if (!f) switch (errno) { 5543 // case ENOENT: 5544 // case ENOTDIR: 5545 // case EACCES: 5546 // return EAI_SERVICE; 5547 // default: 5548 // return EAI_SYSTEM; 5549 // } 5550 5551 Xabort(tls) //TODO- 5552 // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { 5553 // if ((p=strchr(line, '#'))) *p++='\n', *p=0; 5554 5555 // /* Find service name */ 5556 // for(p=line; (p=strstr(p, name)); p++) { 5557 // if (p>line && !isspace(p[-1])) continue; 5558 // if (p[l] && !isspace(p[l])) continue; 5559 // break; 5560 // } 5561 // if (!p) continue; 5562 5563 // /* Skip past canonical name at beginning of line */ 5564 // for (p=line; *p && !isspace(*p); p++); 5565 5566 // port = strtoul(p, &z, 10); 5567 // if (port > 65535 || z==p) continue; 5568 // if (!strncmp(z, "/udp", 4)) { 5569 // if (proto == IPPROTO_TCP) continue; 5570 // buf[cnt].port = port; 5571 // buf[cnt].socktype = SOCK_DGRAM; 5572 // buf[cnt++].proto = IPPROTO_UDP; 5573 // } 5574 // if (!strncmp(z, "/tcp", 4)) { 5575 // if (proto == IPPROTO_UDP) continue; 5576 // buf[cnt].port = port; 5577 // buf[cnt].socktype = SOCK_STREAM; 5578 // buf[cnt++].proto = IPPROTO_TCP; 5579 // } 5580 // } 5581 // __fclose_ca(f); 5582 // return cnt > 0 ? cnt : EAI_SERVICE; 5583 Xabort(tls) 5584 return int32(0) //TODO- 5585 } 5586 5587 func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */ 5588 x = x ^ x>>11 5589 x = x ^ x<<7&0x9D2C5680 5590 x = x ^ x<<15&0xEFC60000 5591 x = x ^ x>>18 5592 return x 5593 } 5594 5595 func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */ 5596 return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2)) 5597 } 5598 5599 func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */ 5600 var owner int32 = (*FILE)(unsafe.Pointer(f)).lock 5601 var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid 5602 if owner&CplInt32(0x40000000) == tid { 5603 return 0 5604 } 5605 owner = a_cas(tls, f+140, 0, tid) 5606 if !(owner != 0) { 5607 return 1 5608 } 5609 for AssignInt32(&owner, a_cas(tls, f+140, 0, tid|0x40000000)) != 0 { 5610 if owner&0x40000000 != 0 || a_cas(tls, f+140, owner, owner|0x40000000) == owner { 5611 __futexwait(tls, f+140, owner|0x40000000, 1) 5612 } 5613 } 5614 return 1 5615 } 5616 5617 func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */ 5618 if a_swap(tls, f+140, 0)&0x40000000 != 0 { 5619 __wake(tls, f+140, 1, 1) 5620 } 5621 } 5622 5623 func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ 5624 *(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1 5625 if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { 5626 (*struct { 5627 f func(*TLS, uintptr, uintptr, size_t) size_t 5628 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).write})).f(tls, f, uintptr(0), uint64(0)) 5629 } 5630 (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0))) 5631 if (*FILE)(unsafe.Pointer(f)).flags&uint32(4) != 0 { 5632 *(*uint32)(unsafe.Pointer(f)) |= uint32(32) 5633 return -1 5634 } 5635 (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).buf+uintptr((*FILE)(unsafe.Pointer(f)).buf_size)) 5636 if (*FILE)(unsafe.Pointer(f)).flags&uint32(16) != 0 { 5637 return -1 5638 } 5639 return 0 5640 } 5641 5642 func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ 5643 X__builtin_abort(tls) //TODO- 5644 // __stdio_exit_needed(); 5645 } 5646 5647 // This function assumes it will never be called if there is already 5648 // data buffered for reading. 5649 5650 func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ 5651 bp := tls.Alloc(1) 5652 defer tls.Free(1) 5653 5654 // var c uint8 at bp, 1 5655 5656 if !(X__toread(tls, f) != 0) && (*struct { 5657 f func(*TLS, uintptr, uintptr, size_t) size_t 5658 })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).read})).f(tls, f, bp, uint64(1)) == uint64(1) { 5659 return int32(*(*uint8)(unsafe.Pointer(bp))) 5660 } 5661 return -1 5662 } 5663 5664 func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */ 5665 var ret int32 5666 var ap va_list 5667 _ = ap 5668 ap = va 5669 ret = Xvsscanf(tls, s, fmt, ap) 5670 _ = ap 5671 return ret 5672 } 5673 5674 type wctrans_t = uintptr /* wctype.h:20:19 */ 5675 5676 func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */ 5677 if !(dest != 0) { 5678 return 5679 } 5680 switch size { 5681 case -2: 5682 *(*uint8)(unsafe.Pointer(dest)) = uint8(i) 5683 break 5684 case -1: 5685 *(*int16)(unsafe.Pointer(dest)) = int16(i) 5686 break 5687 case 0: 5688 *(*int32)(unsafe.Pointer(dest)) = int32(i) 5689 break 5690 case 1: 5691 *(*int64)(unsafe.Pointer(dest)) = int64(i) 5692 break 5693 case 3: 5694 *(*int64)(unsafe.Pointer(dest)) = int64(i) 5695 break 5696 } 5697 } 5698 5699 func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */ 5700 var p uintptr 5701 var i uint32 5702 var ap2 va_list 5703 _ = ap2 5704 ap2 = ap 5705 for i = n; i > uint32(1); i-- { 5706 VaUintptr(&ap2) 5707 } 5708 p = VaUintptr(&ap2) 5709 _ = ap2 5710 return p 5711 } 5712 5713 func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */ 5714 bp := tls.Alloc(276) 5715 defer tls.Free(276) 5716 5717 var width int32 5718 var size int32 5719 var alloc int32 5720 var base int32 5721 var p uintptr 5722 var c int32 5723 var t int32 5724 var s uintptr 5725 var wcs uintptr 5726 // var st mbstate_t at bp+268, 8 5727 5728 var dest uintptr 5729 var invert int32 5730 var matches int32 5731 var x uint64 5732 var y float64 5733 var pos off_t 5734 // var scanset [257]uint8 at bp, 257 5735 5736 var i size_t 5737 var k size_t 5738 // var wc wchar_t at bp+260, 4 5739 5740 var __need_unlock int32 5741 var tmp uintptr 5742 var tmp1 uintptr 5743 alloc = 0 5744 dest = uintptr(0) 5745 matches = 0 5746 pos = int64(0) 5747 __need_unlock = func() int32 { 5748 if (*FILE)(unsafe.Pointer(f)).lock >= 0 { 5749 return X__lockfile(tls, f) 5750 } 5751 return 0 5752 }() 5753 5754 if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { 5755 goto __1 5756 } 5757 X__toread(tls, f) 5758 __1: 5759 ; 5760 if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { 5761 goto __2 5762 } 5763 goto input_fail 5764 __2: 5765 ; 5766 5767 p = fmt 5768 __3: 5769 if !(*(*uint8)(unsafe.Pointer(p)) != 0) { 5770 goto __5 5771 } 5772 5773 alloc = 0 5774 5775 if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) { 5776 goto __6 5777 } 5778 __7: 5779 if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) { 5780 goto __8 5781 } 5782 p++ 5783 goto __7 5784 __8: 5785 ; 5786 X__shlim(tls, f, int64(0)) 5787 __9: 5788 if !(__isspace(tls, func() int32 { 5789 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5790 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5791 } 5792 return X__shgetc(tls, f) 5793 }()) != 0) { 5794 goto __10 5795 } 5796 goto __9 5797 __10: 5798 ; 5799 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 5800 (*FILE)(unsafe.Pointer(f)).rpos-- 5801 } else { 5802 } 5803 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 5804 goto __4 5805 __6: 5806 ; 5807 if !(int32(*(*uint8)(unsafe.Pointer(p))) != '%' || int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%') { 5808 goto __11 5809 } 5810 X__shlim(tls, f, int64(0)) 5811 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') { 5812 goto __12 5813 } 5814 p++ 5815 __14: 5816 if !(__isspace(tls, AssignInt32(&c, func() int32 { 5817 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5818 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5819 } 5820 return X__shgetc(tls, f) 5821 }())) != 0) { 5822 goto __15 5823 } 5824 goto __14 5825 __15: 5826 ; 5827 goto __13 5828 __12: 5829 c = func() int32 { 5830 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 5831 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 5832 } 5833 return X__shgetc(tls, f) 5834 }() 5835 __13: 5836 ; 5837 if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) { 5838 goto __16 5839 } 5840 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 5841 (*FILE)(unsafe.Pointer(f)).rpos-- 5842 } else { 5843 } 5844 if !(c < 0) { 5845 goto __17 5846 } 5847 goto input_fail 5848 __17: 5849 ; 5850 goto match_fail 5851 __16: 5852 ; 5853 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 5854 goto __4 5855 __11: 5856 ; 5857 5858 p++ 5859 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') { 5860 goto __18 5861 } 5862 dest = uintptr(0) 5863 p++ 5864 goto __19 5865 __18: 5866 if !(func() int32 { 5867 if 0 != 0 { 5868 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) 5869 } 5870 return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) 5871 }() != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$') { 5872 goto __20 5873 } 5874 dest = arg_n(tls, ap, uint32(int32(*(*uint8)(unsafe.Pointer(p)))-'0')) 5875 p += uintptr(2) 5876 goto __21 5877 __20: 5878 dest = VaUintptr(&ap) 5879 __21: 5880 ; 5881 __19: 5882 ; 5883 5884 width = 0 5885 __22: 5886 if !(func() int32 { 5887 if 0 != 0 { 5888 return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) 5889 } 5890 return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) 5891 }() != 0) { 5892 goto __24 5893 } 5894 width = 10*width + int32(*(*uint8)(unsafe.Pointer(p))) - '0' 5895 goto __23 5896 __23: 5897 p++ 5898 goto __22 5899 goto __24 5900 __24: 5901 ; 5902 5903 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') { 5904 goto __25 5905 } 5906 wcs = uintptr(0) 5907 s = uintptr(0) 5908 alloc = BoolInt32(!!(dest != 0)) 5909 p++ 5910 goto __26 5911 __25: 5912 alloc = 0 5913 __26: 5914 ; 5915 5916 size = 0 5917 switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) { 5918 case 'h': 5919 goto __28 5920 case 'l': 5921 goto __29 5922 case 'j': 5923 goto __30 5924 case 'z': 5925 goto __31 5926 case 't': 5927 goto __32 5928 case 'L': 5929 goto __33 5930 case 'd': 5931 goto __34 5932 case 'i': 5933 goto __35 5934 case 'o': 5935 goto __36 5936 case 'u': 5937 goto __37 5938 case 'x': 5939 goto __38 5940 case 'a': 5941 goto __39 5942 case 'e': 5943 goto __40 5944 case 'f': 5945 goto __41 5946 case 'g': 5947 goto __42 5948 case 'A': 5949 goto __43 5950 case 'E': 5951 goto __44 5952 case 'F': 5953 goto __45 5954 case 'G': 5955 goto __46 5956 case 'X': 5957 goto __47 5958 case 's': 5959 goto __48 5960 case 'c': 5961 goto __49 5962 case '[': 5963 goto __50 5964 case 'S': 5965 goto __51 5966 case 'C': 5967 goto __52 5968 case 'p': 5969 goto __53 5970 case 'n': 5971 goto __54 5972 default: 5973 goto __55 5974 } 5975 goto __27 5976 __28: 5977 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') { 5978 goto __56 5979 } 5980 p++ 5981 size = -2 5982 goto __57 5983 __56: 5984 size = -1 5985 __57: 5986 ; 5987 goto __27 5988 __29: 5989 if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') { 5990 goto __58 5991 } 5992 p++ 5993 size = 3 5994 goto __59 5995 __58: 5996 size = 1 5997 __59: 5998 ; 5999 goto __27 6000 __30: 6001 size = 3 6002 goto __27 6003 __31: 6004 __32: 6005 size = 1 6006 goto __27 6007 __33: 6008 size = 2 6009 goto __27 6010 __34: 6011 __35: 6012 __36: 6013 __37: 6014 __38: 6015 __39: 6016 __40: 6017 __41: 6018 __42: 6019 __43: 6020 __44: 6021 __45: 6022 __46: 6023 __47: 6024 __48: 6025 __49: 6026 __50: 6027 __51: 6028 __52: 6029 __53: 6030 __54: 6031 p-- 6032 goto __27 6033 __55: 6034 goto fmt_fail 6035 __27: 6036 ; 6037 6038 t = int32(*(*uint8)(unsafe.Pointer(p))) 6039 6040 // C or S 6041 if !(t&0x2f == 3) { 6042 goto __60 6043 } 6044 t = t | 32 6045 size = 1 6046 __60: 6047 ; 6048 6049 switch t { 6050 case 'c': 6051 goto __62 6052 case '[': 6053 goto __63 6054 case 'n': 6055 goto __64 6056 default: 6057 goto __65 6058 } 6059 goto __61 6060 __62: 6061 if !(width < 1) { 6062 goto __66 6063 } 6064 width = 1 6065 __66: 6066 ; 6067 __63: 6068 goto __61 6069 __64: 6070 store_int(tls, dest, size, uint64(pos)) 6071 // do not increment match count, etc! 6072 goto __4 6073 __65: 6074 X__shlim(tls, f, int64(0)) 6075 __67: 6076 if !(__isspace(tls, func() int32 { 6077 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6078 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6079 } 6080 return X__shgetc(tls, f) 6081 }()) != 0) { 6082 goto __68 6083 } 6084 goto __67 6085 __68: 6086 ; 6087 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6088 (*FILE)(unsafe.Pointer(f)).rpos-- 6089 } else { 6090 } 6091 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 6092 __61: 6093 ; 6094 6095 X__shlim(tls, f, int64(width)) 6096 if !(func() int32 { 6097 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6098 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6099 } 6100 return X__shgetc(tls, f) 6101 }() < 0) { 6102 goto __69 6103 } 6104 goto input_fail 6105 __69: 6106 ; 6107 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6108 (*FILE)(unsafe.Pointer(f)).rpos-- 6109 } else { 6110 } 6111 6112 switch t { 6113 case 's': 6114 goto __71 6115 case 'c': 6116 goto __72 6117 case '[': 6118 goto __73 6119 case 'p': 6120 goto __74 6121 case 'X': 6122 goto __75 6123 case 'x': 6124 goto __76 6125 case 'o': 6126 goto __77 6127 case 'd': 6128 goto __78 6129 case 'u': 6130 goto __79 6131 case 'i': 6132 goto __80 6133 case 'a': 6134 goto __81 6135 case 'A': 6136 goto __82 6137 case 'e': 6138 goto __83 6139 case 'E': 6140 goto __84 6141 case 'f': 6142 goto __85 6143 case 'F': 6144 goto __86 6145 case 'g': 6146 goto __87 6147 case 'G': 6148 goto __88 6149 } 6150 goto __70 6151 __71: 6152 __72: 6153 __73: 6154 if !(t == 'c' || t == 's') { 6155 goto __89 6156 } 6157 Xmemset(tls, bp, -1, uint64(unsafe.Sizeof([257]uint8{}))) 6158 *(*uint8)(unsafe.Pointer(bp)) = uint8(0) 6159 if !(t == 's') { 6160 goto __91 6161 } 6162 *(*uint8)(unsafe.Pointer(bp + 10)) = uint8(0) 6163 *(*uint8)(unsafe.Pointer(bp + 11)) = uint8(0) 6164 *(*uint8)(unsafe.Pointer(bp + 12)) = uint8(0) 6165 *(*uint8)(unsafe.Pointer(bp + 13)) = uint8(0) 6166 *(*uint8)(unsafe.Pointer(bp + 14)) = uint8(0) 6167 *(*uint8)(unsafe.Pointer(bp + 33)) = uint8(0) 6168 __91: 6169 ; 6170 goto __90 6171 __89: 6172 if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') { 6173 goto __92 6174 } 6175 p++ 6176 invert = 1 6177 goto __93 6178 __92: 6179 invert = 0 6180 __93: 6181 ; 6182 Xmemset(tls, bp, invert, uint64(unsafe.Sizeof([257]uint8{}))) 6183 *(*uint8)(unsafe.Pointer(bp)) = uint8(0) 6184 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') { 6185 goto __94 6186 } 6187 p++ 6188 *(*uint8)(unsafe.Pointer(bp + 46)) = uint8(1 - invert) 6189 goto __95 6190 __94: 6191 if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') { 6192 goto __96 6193 } 6194 p++ 6195 *(*uint8)(unsafe.Pointer(bp + 94)) = uint8(1 - invert) 6196 __96: 6197 ; 6198 __95: 6199 ; 6200 __97: 6201 if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') { 6202 goto __99 6203 } 6204 if !!(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { 6205 goto __100 6206 } 6207 goto fmt_fail 6208 __100: 6209 ; 6210 if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-' && *(*uint8)(unsafe.Pointer(p + 1)) != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']') { 6211 goto __101 6212 } 6213 c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1)))) 6214 __102: 6215 if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) { 6216 goto __104 6217 } 6218 *(*uint8)(unsafe.Pointer(bp + uintptr(1+c))) = uint8(1 - invert) 6219 goto __103 6220 __103: 6221 c++ 6222 goto __102 6223 goto __104 6224 __104: 6225 ; 6226 __101: 6227 ; 6228 *(*uint8)(unsafe.Pointer(bp + uintptr(1+int32(*(*uint8)(unsafe.Pointer(p)))))) = uint8(1 - invert) 6229 goto __98 6230 __98: 6231 p++ 6232 goto __97 6233 goto __99 6234 __99: 6235 ; 6236 __90: 6237 ; 6238 wcs = uintptr(0) 6239 s = uintptr(0) 6240 i = uint64(0) 6241 if t == 'c' { 6242 k = uint64(uint32(width) + 1) 6243 } else { 6244 k = uint64(31) 6245 } 6246 if !(size == 1) { 6247 goto __105 6248 } 6249 if !(alloc != 0) { 6250 goto __107 6251 } 6252 wcs = Xmalloc(tls, k*size_t(unsafe.Sizeof(wchar_t(0)))) 6253 if !!(wcs != 0) { 6254 goto __109 6255 } 6256 goto alloc_fail 6257 __109: 6258 ; 6259 goto __108 6260 __107: 6261 wcs = dest 6262 __108: 6263 ; 6264 *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{} 6265 __110: 6266 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6267 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6268 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6269 } 6270 return X__shgetc(tls, f) 6271 }())+1))) != 0) { 6272 goto __111 6273 } 6274 switch Xmbrtowc(tls, bp+260, func() uintptr { *(*uint8)(unsafe.Pointer(bp + 264)) = uint8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) { 6275 case Uint64FromInt32(-1): 6276 goto __113 6277 case Uint64FromInt32(-2): 6278 goto __114 6279 } 6280 goto __112 6281 __113: 6282 goto input_fail 6283 __114: 6284 goto __110 6285 __112: 6286 ; 6287 if !(wcs != 0) { 6288 goto __115 6289 } 6290 *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint64(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */)) 6291 __115: 6292 ; 6293 if !(alloc != 0 && i == k) { 6294 goto __116 6295 } 6296 k = k + (k + uint64(1)) 6297 tmp = Xrealloc(tls, wcs, k*size_t(unsafe.Sizeof(wchar_t(0)))) 6298 if !!(tmp != 0) { 6299 goto __117 6300 } 6301 goto alloc_fail 6302 __117: 6303 ; 6304 wcs = tmp 6305 __116: 6306 ; 6307 goto __110 6308 __111: 6309 ; 6310 if !!(Xmbsinit(tls, bp+268) != 0) { 6311 goto __118 6312 } 6313 goto input_fail 6314 __118: 6315 ; 6316 goto __106 6317 __105: 6318 if !(alloc != 0) { 6319 goto __119 6320 } 6321 s = Xmalloc(tls, k) 6322 if !!(s != 0) { 6323 goto __121 6324 } 6325 goto alloc_fail 6326 __121: 6327 ; 6328 __122: 6329 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6330 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6331 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6332 } 6333 return X__shgetc(tls, f) 6334 }())+1))) != 0) { 6335 goto __123 6336 } 6337 *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c) 6338 if !(i == k) { 6339 goto __124 6340 } 6341 k = k + (k + uint64(1)) 6342 tmp1 = Xrealloc(tls, s, k) 6343 if !!(tmp1 != 0) { 6344 goto __125 6345 } 6346 goto alloc_fail 6347 __125: 6348 ; 6349 s = tmp1 6350 __124: 6351 ; 6352 goto __122 6353 __123: 6354 ; 6355 goto __120 6356 __119: 6357 if !(AssignUintptr(&s, dest) != 0) { 6358 goto __126 6359 } 6360 __128: 6361 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6362 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6363 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6364 } 6365 return X__shgetc(tls, f) 6366 }())+1))) != 0) { 6367 goto __129 6368 } 6369 *(*uint8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = uint8(c) 6370 goto __128 6371 __129: 6372 ; 6373 goto __127 6374 __126: 6375 __130: 6376 if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { 6377 if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { 6378 return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) 6379 } 6380 return X__shgetc(tls, f) 6381 }())+1))) != 0) { 6382 goto __131 6383 } 6384 goto __130 6385 __131: 6386 ; 6387 __127: 6388 ; 6389 __120: 6390 ; 6391 __106: 6392 ; 6393 if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { 6394 (*FILE)(unsafe.Pointer(f)).rpos-- 6395 } else { 6396 } 6397 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6398 goto __132 6399 } 6400 goto match_fail 6401 __132: 6402 ; 6403 if !(t == 'c' && (*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != off_t(width)) { 6404 goto __133 6405 } 6406 goto match_fail 6407 __133: 6408 ; 6409 if !(alloc != 0) { 6410 goto __134 6411 } 6412 if !(size == 1) { 6413 goto __135 6414 } 6415 *(*uintptr)(unsafe.Pointer(dest)) = wcs 6416 goto __136 6417 __135: 6418 *(*uintptr)(unsafe.Pointer(dest)) = s 6419 __136: 6420 ; 6421 __134: 6422 ; 6423 if !(t != 'c') { 6424 goto __137 6425 } 6426 if !(wcs != 0) { 6427 goto __138 6428 } 6429 *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = wchar_t(0) 6430 __138: 6431 ; 6432 if !(s != 0) { 6433 goto __139 6434 } 6435 *(*uint8)(unsafe.Pointer(s + uintptr(i))) = uint8(0) 6436 __139: 6437 ; 6438 __137: 6439 ; 6440 goto __70 6441 __74: 6442 __75: 6443 __76: 6444 base = 16 6445 goto int_common 6446 __77: 6447 base = 8 6448 goto int_common 6449 __78: 6450 __79: 6451 base = 10 6452 goto int_common 6453 __80: 6454 base = 0 6455 int_common: 6456 x = X__intscan(tls, f, uint32(base), 0, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6457 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6458 goto __140 6459 } 6460 goto match_fail 6461 __140: 6462 ; 6463 if !(t == 'p' && dest != 0) { 6464 goto __141 6465 } 6466 *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x)) 6467 goto __142 6468 __141: 6469 store_int(tls, dest, size, x) 6470 __142: 6471 ; 6472 goto __70 6473 __81: 6474 __82: 6475 __83: 6476 __84: 6477 __85: 6478 __86: 6479 __87: 6480 __88: 6481 y = X__floatscan(tls, f, size, 0) 6482 if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { 6483 goto __143 6484 } 6485 goto match_fail 6486 __143: 6487 ; 6488 if !(dest != 0) { 6489 goto __144 6490 } 6491 switch size { 6492 case 0: 6493 goto __146 6494 case 1: 6495 goto __147 6496 case 2: 6497 goto __148 6498 } 6499 goto __145 6500 __146: 6501 *(*float32)(unsafe.Pointer(dest)) = float32(y) 6502 goto __145 6503 __147: 6504 *(*float64)(unsafe.Pointer(dest)) = y 6505 goto __145 6506 __148: 6507 *(*float64)(unsafe.Pointer(dest)) = y 6508 goto __145 6509 __145: 6510 ; 6511 __144: 6512 ; 6513 goto __70 6514 __70: 6515 ; 6516 6517 pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) 6518 if !(dest != 0) { 6519 goto __149 6520 } 6521 matches++ 6522 __149: 6523 ; 6524 goto __4 6525 __4: 6526 p++ 6527 goto __3 6528 goto __5 6529 __5: 6530 ; 6531 if !(0 != 0) { 6532 goto __150 6533 } 6534 fmt_fail: 6535 alloc_fail: 6536 input_fail: 6537 if !!(matches != 0) { 6538 goto __151 6539 } 6540 matches-- 6541 __151: 6542 ; 6543 match_fail: 6544 if !(alloc != 0) { 6545 goto __152 6546 } 6547 Xfree(tls, s) 6548 Xfree(tls, wcs) 6549 __152: 6550 ; 6551 __150: 6552 ; 6553 __153: 6554 if !(__need_unlock != 0) { 6555 goto __156 6556 } 6557 X__unlockfile(tls, f) 6558 __156: 6559 ; 6560 goto __154 6561 __154: 6562 if 0 != 0 { 6563 goto __153 6564 } 6565 goto __155 6566 __155: 6567 ; 6568 return matches 6569 } 6570 6571 func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */ 6572 var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie 6573 var k size_t = len + uint64(256) 6574 var end uintptr = Xmemchr(tls, src, 0, k) 6575 if end != 0 { 6576 k = size_t((int64(end) - int64(src)) / 1) 6577 } 6578 if k < len { 6579 len = k 6580 } 6581 Xmemcpy(tls, buf, src, len) 6582 (*FILE)(unsafe.Pointer(f)).rpos = src + uintptr(len) 6583 (*FILE)(unsafe.Pointer(f)).rend = src + uintptr(k) 6584 (*FILE)(unsafe.Pointer(f)).cookie = src + uintptr(k) 6585 return len 6586 } 6587 6588 func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */ 6589 bp := tls.Alloc(232) 6590 defer tls.Free(232) 6591 6592 *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct { 6593 f func(*TLS, uintptr, uintptr, size_t) size_t 6594 }{string_read})), buf: s, lock: -1, cookie: s} 6595 return Xvfscanf(tls, bp, fmt, ap) 6596 } 6597 6598 func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */ 6599 var try uintptr 6600 var sign int32 6601 for nel > uint64(0) { 6602 try = base + uintptr(width*(nel/uint64(2))) 6603 sign = (*struct { 6604 f func(*TLS, uintptr, uintptr) int32 6605 })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try) 6606 if sign < 0 { 6607 nel = nel / uint64(2) 6608 } else if sign > 0 { 6609 base = try + uintptr(width) 6610 nel = nel - (nel/uint64(2) + uint64(1)) 6611 } else { 6612 return try 6613 } 6614 } 6615 return uintptr(0) 6616 } 6617 6618 func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ 6619 bp := tls.Alloc(232) 6620 defer tls.Free(232) 6621 6622 // var f FILE at bp, 232 6623 6624 (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) 6625 (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) 6626 X__shlim(tls, bp, int64(0)) 6627 var y float64 = X__floatscan(tls, bp, prec, 1) 6628 var cnt off_t = (*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1 6629 if p != 0 { 6630 *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { 6631 if cnt != 0 { 6632 return s + uintptr(cnt) 6633 } 6634 return s 6635 }() 6636 } 6637 return y 6638 } 6639 6640 func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ 6641 return float32(strtox(tls, s, p, 0)) 6642 } 6643 6644 func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ 6645 return strtox(tls, s, p, 1) 6646 } 6647 6648 func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ 6649 return strtox(tls, s, p, 2) 6650 } 6651 6652 func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ 6653 bp := tls.Alloc(232) 6654 defer tls.Free(232) 6655 6656 // var f FILE at bp, 232 6657 6658 (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) 6659 (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) 6660 X__shlim(tls, bp, int64(0)) 6661 var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim) 6662 if p != 0 { 6663 var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1) 6664 *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt) 6665 } 6666 return y 6667 } 6668 6669 func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ 6670 return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)) 6671 } 6672 6673 func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ 6674 return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1)))) 6675 } 6676 6677 func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */ 6678 return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))) 6679 } 6680 6681 func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */ 6682 return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1)))) 6683 } 6684 6685 func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ 6686 return intmax_t(Xstrtoll(tls, s, p, base)) 6687 } 6688 6689 func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ 6690 return uintmax_t(Xstrtoull(tls, s, p, base)) 6691 } 6692 6693 func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ 6694 var l size_t = Xstrlen(tls, s) 6695 var d uintptr = Xmalloc(tls, l+uint64(1)) 6696 if !(d != 0) { 6697 return uintptr(0) 6698 } 6699 return Xmemcpy(tls, d, s, l+uint64(1)) 6700 } 6701 6702 func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */ 6703 var l size_t = Xstrnlen(tls, d, n) 6704 if l == n { 6705 return l + Xstrlen(tls, s) 6706 } 6707 return l + Xstrlcpy(tls, d+uintptr(l), s, n-l) 6708 } 6709 6710 // Support signed or unsigned plain-char 6711 6712 // Implementation choices... 6713 6714 // Arbitrary numbers... 6715 6716 // POSIX/SUS requirements follow. These numbers come directly 6717 // from SUS and have nothing to do with the host system. 6718 6719 func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */ 6720 var d0 uintptr 6721 var wd uintptr 6722 var ws uintptr 6723 d0 = d 6724 6725 if !!(int32(PostDecUint64(&n, 1)) != 0) { 6726 goto __1 6727 } 6728 goto finish 6729 __1: 6730 ; 6731 if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) == uintptr_t(d)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1))) { 6732 goto __2 6733 } 6734 __3: 6735 if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) != 0 && n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) { 6736 goto __5 6737 } 6738 goto __4 6739 __4: 6740 n-- 6741 s++ 6742 d++ 6743 goto __3 6744 goto __5 6745 __5: 6746 ; 6747 if !(n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0) { 6748 goto __6 6749 } 6750 wd = d 6751 ws = s 6752 __7: 6753 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)) { 6754 goto __9 6755 } 6756 *(*size_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) 6757 goto __8 6758 __8: 6759 n = n - size_t(unsafe.Sizeof(size_t(0))) 6760 ws += 8 6761 wd += 8 6762 goto __7 6763 goto __9 6764 __9: 6765 ; 6766 d = wd 6767 s = ws 6768 __6: 6769 ; 6770 __2: 6771 ; 6772 __10: 6773 if !(n != 0 && AssignPtrUint8(d, *(*uint8)(unsafe.Pointer(s))) != 0) { 6774 goto __12 6775 } 6776 goto __11 6777 __11: 6778 n-- 6779 s++ 6780 d++ 6781 goto __10 6782 goto __12 6783 __12: 6784 ; 6785 *(*uint8)(unsafe.Pointer(d)) = uint8(0) 6786 finish: 6787 return size_t((int64(d)-int64(d0))/1) + Xstrlen(tls, s) 6788 } 6789 6790 func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */ 6791 var l uintptr = _l 6792 var r uintptr = _r 6793 if !(int32(PostDecUint64(&n, 1)) != 0) { 6794 return 0 6795 } 6796 __1: 6797 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)))))) { 6798 goto __3 6799 } 6800 goto __2 6801 __2: 6802 l++ 6803 r++ 6804 n-- 6805 goto __1 6806 goto __3 6807 __3: 6808 ; 6809 return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))) 6810 } 6811 6812 func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */ 6813 return Xstrncasecmp(tls, l, r, n) 6814 } 6815 6816 func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */ 6817 var a uintptr = d 6818 d += uintptr(Xstrlen(tls, d)) 6819 for n != 0 && *(*uint8)(unsafe.Pointer(s)) != 0 { 6820 n-- 6821 *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))) 6822 } 6823 *(*uint8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = uint8(0) 6824 return a 6825 } 6826 6827 func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ 6828 var p uintptr = Xmemchr(tls, s, 0, n) 6829 if p != 0 { 6830 return uint64((int64(p) - int64(s)) / 1) 6831 } 6832 return n 6833 } 6834 6835 func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ 6836 bp := tls.Alloc(32) 6837 defer tls.Free(32) 6838 6839 var a uintptr = s 6840 *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} 6841 6842 if !(int32(*(*uint8)(unsafe.Pointer(c))) != 0) { 6843 return uint64(0) 6844 } 6845 if !(int32(*(*uint8)(unsafe.Pointer(c + 1))) != 0) { 6846 for ; int32(*(*uint8)(unsafe.Pointer(s))) == int32(*(*uint8)(unsafe.Pointer(c))); s++ { 6847 } 6848 return size_t((int64(s) - int64(a)) / 1) 6849 } 6850 6851 for ; *(*uint8)(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++ { 6852 } 6853 for ; *(*uint8)(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++ { 6854 } 6855 return size_t((int64(s) - int64(a)) / 1) 6856 } 6857 6858 func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ 6859 if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) { 6860 return uintptr(0) 6861 } 6862 s += uintptr(Xstrspn(tls, s, sep)) 6863 if !(int32(*(*uint8)(unsafe.Pointer(s))) != 0) { 6864 return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0)) 6865 } 6866 _sp = s + uintptr(Xstrcspn(tls, s, sep)) 6867 if *(*uint8)(unsafe.Pointer(_sp)) != 0 { 6868 *(*uint8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = uint8(0) 6869 } else { 6870 _sp = uintptr(0) 6871 } 6872 return s 6873 } 6874 6875 var _sp uintptr /* strtok.c:5:14: */ 6876 6877 func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ 6878 return *(*int32)(unsafe.Pointer(a + 6*4)) 6879 } 6880 6881 func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ 6882 *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4)) 6883 return 0 6884 } 6885 6886 // 6887 // int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) 6888 // { 6889 // *size = a->_a_guardsize; 6890 // return 0; 6891 // } 6892 // 6893 // int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) 6894 // { 6895 // *inherit = a->_a_sched; 6896 // return 0; 6897 // } 6898 // 6899 // int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) 6900 // { 6901 // param->sched_priority = a->_a_prio; 6902 // return 0; 6903 // } 6904 // 6905 // int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) 6906 // { 6907 // *policy = a->_a_policy; 6908 // return 0; 6909 // } 6910 // 6911 // int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) 6912 // { 6913 // *scope = PTHREAD_SCOPE_SYSTEM; 6914 // return 0; 6915 // } 6916 // 6917 // int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) 6918 // { 6919 // if (!a->_a_stackaddr) 6920 // return EINVAL; 6921 // *size = a->_a_stacksize; 6922 // *addr = (void *)(a->_a_stackaddr - *size); 6923 // return 0; 6924 // } 6925 // 6926 // int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) 6927 // { 6928 // *size = a->_a_stacksize; 6929 // return 0; 6930 // } 6931 // 6932 // int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) 6933 // { 6934 // *pshared = !!a->__attr; 6935 // return 0; 6936 // } 6937 // 6938 // int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) 6939 // { 6940 // *clk = a->__attr & 0x7fffffff; 6941 // return 0; 6942 // } 6943 // 6944 // int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) 6945 // { 6946 // *pshared = a->__attr>>31; 6947 // return 0; 6948 // } 6949 // 6950 // int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) 6951 // { 6952 // *protocol = PTHREAD_PRIO_NONE; 6953 // return 0; 6954 // } 6955 // int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) 6956 // { 6957 // *pshared = a->__attr / 128U % 2; 6958 // return 0; 6959 // } 6960 // 6961 // int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) 6962 // { 6963 // *robust = a->__attr / 4U % 2; 6964 // return 0; 6965 // } 6966 6967 func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ 6968 return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3)) 6969 } 6970 6971 // int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) 6972 // { 6973 // *type = a->__attr & 3; 6974 // return 0; 6975 // } 6976 // 6977 // int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) 6978 // { 6979 // *pshared = a->__attr[0]; 6980 // return 0; 6981 // } 6982 6983 func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ 6984 if uint32(state) > 1 { 6985 return 22 6986 } 6987 *(*int32)(unsafe.Pointer(a + 6*4)) = state 6988 return 0 6989 } 6990 6991 func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ 6992 return *(*int32)(unsafe.Pointer(m)) & 15 6993 } 6994 6995 // int __pthread_mutex_lock(pthread_mutex_t *m) 6996 // { 6997 // if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL 6998 // && !a_cas(&m->_m_lock, 0, EBUSY)) 6999 // return 0; 7000 // 7001 // return __pthread_mutex_timedlock(m, 0); 7002 // } 7003 // 7004 // weak_alias(__pthread_mutex_lock, pthread_mutex_lock); 7005 7006 func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ 7007 return 0 7008 } 7009 7010 func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ 7011 *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} 7012 return 0 7013 } 7014 7015 func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ 7016 if uint32(type1) > uint32(2) { 7017 return 22 7018 } 7019 (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr&Uint32FromInt32(CplInt32(3)) | uint32(type1) 7020 return 0 7021 } 7022 7023 func init() { 7024 *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = uintptr(unsafe.Pointer(&table)) + uintptr(128)*2 // __ctype_b_loc.c:36:45: 7025 } 7026 7027 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" 7028 var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data