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