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