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