source: code/trunk/vendor/modernc.org/libc/musl_linux_386.go@ 823

Last change on this file since 823 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

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