modernc.org/z@v1.7.4/internal/example_freebsd_386.go (about)

     1  // Code generated by 'ccgo -lmodernc.org/z/lib -o internal/example_freebsd_386.go -trace-translation-units /tmp/go-generate-3821858036/cdb.json example64', DO NOT EDIT.
     2  
     3  package main
     4  
     5  import (
     6  	"math"
     7  	"reflect"
     8  	"sync/atomic"
     9  	"unsafe"
    10  
    11  	"modernc.org/libc"
    12  	"modernc.org/libc/sys/types"
    13  	"modernc.org/z/lib"
    14  )
    15  
    16  var _ = math.Pi
    17  var _ reflect.Kind
    18  var _ atomic.Value
    19  var _ unsafe.Pointer
    20  var _ *libc.TLS
    21  var _ types.Size_t
    22  
    23  func main() { libc.Start(main1) }
    24  
    25  type ptrdiff_t = int32 /* <builtin>:3:26 */
    26  
    27  type size_t = uint32 /* <builtin>:9:23 */
    28  
    29  type wchar_t = int32 /* <builtin>:15:24 */
    30  
    31  type rune_t = int32 /* stddef.h:50:18 */
    32  
    33  type max_align_t = struct {
    34  	__max_align1 int64
    35  	__max_align2 float64
    36  } /* stddef.h:69:23 */
    37  
    38  // ISO/IEC 9899:2011 K.3.3.2
    39  type rsize_t = size_t /* stddef.h:81:16 */
    40  
    41  type z_size_t = size_t /* zconf.h:248:21 */
    42  
    43  // Maximum value for memLevel in deflateInit2
    44  
    45  // Maximum value for windowBits in deflateInit2 and inflateInit2.
    46  // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
    47  // created by gzip. (Files created by minigzip can still be extracted by
    48  // gzip.)
    49  
    50  // The memory requirements for deflate are (in bytes):
    51  //             (1 << (windowBits+2)) +  (1 << (memLevel+9))
    52  //  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
    53  //  plus a few kilobytes for small objects. For example, if you want to reduce
    54  //  the default memory requirements from 256K to 128K, compile with
    55  //      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
    56  //  Of course this will generally degrade compression (there's no free lunch).
    57  //
    58  //    The memory requirements for inflate are (in bytes) 1 << windowBits
    59  //  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
    60  //  for small objects.
    61  
    62  // Type declarations
    63  
    64  // The following definitions for FAR are needed only for MSDOS mixed
    65  // model programming (small or medium model with some far allocations).
    66  // This was tested only with MSC; for other MSDOS compilers you may have
    67  // to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
    68  // just define FAR to be empty.
    69  
    70  type Byte = uint8   /* zconf.h:391:24 */ // 8 bits
    71  type uInt = uint32  /* zconf.h:393:24 */ // 16 bits or more
    72  type uLong = uint32 /* zconf.h:394:24 */ // 32 bits or more
    73  
    74  type Bytef = Byte   /* zconf.h:400:22 */
    75  type charf = int8   /* zconf.h:402:19 */
    76  type intf = int32   /* zconf.h:403:19 */
    77  type uIntf = uInt   /* zconf.h:404:19 */
    78  type uLongf = uLong /* zconf.h:405:19 */
    79  
    80  type voidpc = uintptr /* zconf.h:408:23 */
    81  type voidpf = uintptr /* zconf.h:409:23 */
    82  type voidp = uintptr  /* zconf.h:410:23 */
    83  
    84  // -
    85  // SPDX-License-Identifier: BSD-3-Clause
    86  //
    87  // Copyright (c) 1988, 1993
    88  //	The Regents of the University of California.  All rights reserved.
    89  //
    90  // Redistribution and use in source and binary forms, with or without
    91  // modification, are permitted provided that the following conditions
    92  // are met:
    93  // 1. Redistributions of source code must retain the above copyright
    94  //    notice, this list of conditions and the following disclaimer.
    95  // 2. Redistributions in binary form must reproduce the above copyright
    96  //    notice, this list of conditions and the following disclaimer in the
    97  //    documentation and/or other materials provided with the distribution.
    98  // 3. Neither the name of the University nor the names of its contributors
    99  //    may be used to endorse or promote products derived from this software
   100  //    without specific prior written permission.
   101  //
   102  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   103  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   104  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   105  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   106  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   107  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   108  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   109  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   110  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   111  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   112  // SUCH DAMAGE.
   113  //
   114  //	@(#)limits.h	8.2 (Berkeley) 1/4/94
   115  // $FreeBSD$
   116  
   117  // -
   118  // SPDX-License-Identifier: BSD-3-Clause
   119  //
   120  // Copyright (c) 1991, 1993
   121  //	The Regents of the University of California.  All rights reserved.
   122  //
   123  // This code is derived from software contributed to Berkeley by
   124  // Berkeley Software Design, Inc.
   125  //
   126  // Redistribution and use in source and binary forms, with or without
   127  // modification, are permitted provided that the following conditions
   128  // are met:
   129  // 1. Redistributions of source code must retain the above copyright
   130  //    notice, this list of conditions and the following disclaimer.
   131  // 2. Redistributions in binary form must reproduce the above copyright
   132  //    notice, this list of conditions and the following disclaimer in the
   133  //    documentation and/or other materials provided with the distribution.
   134  // 3. Neither the name of the University nor the names of its contributors
   135  //    may be used to endorse or promote products derived from this software
   136  //    without specific prior written permission.
   137  //
   138  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   139  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   140  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   141  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   142  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   143  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   144  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   145  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   146  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   147  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   148  // SUCH DAMAGE.
   149  //
   150  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   151  // $FreeBSD$
   152  
   153  // -
   154  // SPDX-License-Identifier: BSD-3-Clause
   155  //
   156  // Copyright (c) 1988, 1993
   157  //	The Regents of the University of California.  All rights reserved.
   158  //
   159  // Redistribution and use in source and binary forms, with or without
   160  // modification, are permitted provided that the following conditions
   161  // are met:
   162  // 1. Redistributions of source code must retain the above copyright
   163  //    notice, this list of conditions and the following disclaimer.
   164  // 2. Redistributions in binary form must reproduce the above copyright
   165  //    notice, this list of conditions and the following disclaimer in the
   166  //    documentation and/or other materials provided with the distribution.
   167  // 3. Neither the name of the University nor the names of its contributors
   168  //    may be used to endorse or promote products derived from this software
   169  //    without specific prior written permission.
   170  //
   171  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   172  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   173  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   174  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   175  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   176  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   177  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   178  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   179  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   180  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   181  // SUCH DAMAGE.
   182  //
   183  // $FreeBSD$
   184  
   185  // -
   186  // SPDX-License-Identifier: BSD-3-Clause
   187  //
   188  // Copyright (c) 1991, 1993
   189  //	The Regents of the University of California.  All rights reserved.
   190  //
   191  // This code is derived from software contributed to Berkeley by
   192  // Berkeley Software Design, Inc.
   193  //
   194  // Redistribution and use in source and binary forms, with or without
   195  // modification, are permitted provided that the following conditions
   196  // are met:
   197  // 1. Redistributions of source code must retain the above copyright
   198  //    notice, this list of conditions and the following disclaimer.
   199  // 2. Redistributions in binary form must reproduce the above copyright
   200  //    notice, this list of conditions and the following disclaimer in the
   201  //    documentation and/or other materials provided with the distribution.
   202  // 3. Neither the name of the University nor the names of its contributors
   203  //    may be used to endorse or promote products derived from this software
   204  //    without specific prior written permission.
   205  //
   206  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   207  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   208  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   209  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   210  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   211  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   212  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   213  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   214  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   215  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   216  // SUCH DAMAGE.
   217  //
   218  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   219  // $FreeBSD$
   220  
   221  // -
   222  // This file is in the public domain.
   223  // $FreeBSD$
   224  
   225  // -
   226  // SPDX-License-Identifier: BSD-3-Clause
   227  //
   228  // Copyright (c) 1988, 1993
   229  //	The Regents of the University of California.  All rights reserved.
   230  //
   231  // Redistribution and use in source and binary forms, with or without
   232  // modification, are permitted provided that the following conditions
   233  // are met:
   234  // 1. Redistributions of source code must retain the above copyright
   235  //    notice, this list of conditions and the following disclaimer.
   236  // 2. Redistributions in binary form must reproduce the above copyright
   237  //    notice, this list of conditions and the following disclaimer in the
   238  //    documentation and/or other materials provided with the distribution.
   239  // 3. Neither the name of the University nor the names of its contributors
   240  //    may be used to endorse or promote products derived from this software
   241  //    without specific prior written permission.
   242  //
   243  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   244  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   245  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   246  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   247  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   248  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   249  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   250  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   251  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   252  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   253  // SUCH DAMAGE.
   254  //
   255  //	@(#)limits.h	8.3 (Berkeley) 1/4/94
   256  // $FreeBSD$
   257  
   258  // -
   259  // SPDX-License-Identifier: BSD-3-Clause
   260  //
   261  // Copyright (c) 1988, 1993
   262  //	The Regents of the University of California.  All rights reserved.
   263  //
   264  // Redistribution and use in source and binary forms, with or without
   265  // modification, are permitted provided that the following conditions
   266  // are met:
   267  // 1. Redistributions of source code must retain the above copyright
   268  //    notice, this list of conditions and the following disclaimer.
   269  // 2. Redistributions in binary form must reproduce the above copyright
   270  //    notice, this list of conditions and the following disclaimer in the
   271  //    documentation and/or other materials provided with the distribution.
   272  // 3. Neither the name of the University nor the names of its contributors
   273  //    may be used to endorse or promote products derived from this software
   274  //    without specific prior written permission.
   275  //
   276  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   277  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   278  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   279  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   280  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   281  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   282  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   283  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   284  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   285  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   286  // SUCH DAMAGE.
   287  //
   288  //	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
   289  // $FreeBSD$
   290  
   291  // Do not add any new variables here.  (See the comment at the end of
   292  // the file for why.)
   293  
   294  // We leave the following values undefined to force applications to either
   295  // assume conservative values or call sysconf() to get the current value.
   296  //
   297  // HOST_NAME_MAX
   298  //
   299  // (We should do this for most of the values currently defined here,
   300  // but many programs are not prepared to deal with this yet.)
   301  
   302  type z_crc_t = uint32 /* zconf.h:429:17 */
   303  type pthread_once = struct {
   304  	state int32
   305  	mutex pthread_mutex_t
   306  } /* _pthreadtypes.h:52:1 */
   307  
   308  // Primitive system data type definitions required by P1003.1c.
   309  //
   310  // Note that P1003.1c specifies that there are no defined comparison
   311  // or assignment operators for the types pthread_attr_t, pthread_cond_t,
   312  // pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
   313  type pthread_t = uintptr             /* _pthreadtypes.h:67:26 */
   314  type pthread_attr_t = uintptr        /* _pthreadtypes.h:70:30 */
   315  type pthread_mutex_t = uintptr       /* _pthreadtypes.h:71:31 */
   316  type pthread_mutexattr_t = uintptr   /* _pthreadtypes.h:72:35 */
   317  type pthread_cond_t = uintptr        /* _pthreadtypes.h:73:30 */
   318  type pthread_condattr_t = uintptr    /* _pthreadtypes.h:74:34 */
   319  type pthread_key_t = int32           /* _pthreadtypes.h:75:20 */
   320  type pthread_once_t = pthread_once   /* _pthreadtypes.h:76:30 */
   321  type pthread_rwlock_t = uintptr      /* _pthreadtypes.h:77:32 */
   322  type pthread_rwlockattr_t = uintptr  /* _pthreadtypes.h:78:35 */
   323  type pthread_barrier_t = uintptr     /* _pthreadtypes.h:79:33 */
   324  type pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */
   325  type pthread_spinlock_t = uintptr    /* _pthreadtypes.h:81:33 */
   326  
   327  // Additional type definitions:
   328  //
   329  // Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
   330  // use in header symbols.
   331  type pthread_addr_t = uintptr         /* _pthreadtypes.h:89:14 */
   332  type pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */
   333  
   334  type u_char = uint8   /* types.h:52:23 */
   335  type u_short = uint16 /* types.h:53:24 */
   336  type u_int = uint32   /* types.h:54:22 */
   337  type u_long = uint32  /* types.h:55:23 */
   338  type ushort = uint16  /* types.h:57:24 */ // Sys V compatibility
   339  type uint = uint32    /* types.h:58:22 */ // Sys V compatibility
   340  
   341  // XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
   342  // -
   343  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   344  //
   345  // Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
   346  // Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
   347  // All rights reserved.
   348  //
   349  // Redistribution and use in source and binary forms, with or without
   350  // modification, are permitted provided that the following conditions
   351  // are met:
   352  // 1. Redistributions of source code must retain the above copyright
   353  //    notice, this list of conditions and the following disclaimer.
   354  // 2. Redistributions in binary form must reproduce the above copyright
   355  //    notice, this list of conditions and the following disclaimer in the
   356  //    documentation and/or other materials provided with the distribution.
   357  //
   358  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   359  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   360  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   361  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   362  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   363  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   364  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   365  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   366  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   367  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   368  // SUCH DAMAGE.
   369  //
   370  // $FreeBSD$
   371  
   372  type int8_t = int8 /* _stdint.h:36:19 */
   373  
   374  type int16_t = int16 /* _stdint.h:41:20 */
   375  
   376  type int32_t = int32 /* _stdint.h:46:20 */
   377  
   378  type int64_t = int64 /* _stdint.h:51:20 */
   379  
   380  type uint8_t = uint8 /* _stdint.h:56:20 */
   381  
   382  type uint16_t = uint16 /* _stdint.h:61:21 */
   383  
   384  type uint32_t = uint32 /* _stdint.h:66:21 */
   385  
   386  type uint64_t = uint64 /* _stdint.h:71:21 */
   387  
   388  type intptr_t = int32   /* _stdint.h:76:21 */
   389  type uintptr_t = uint32 /* _stdint.h:80:22 */
   390  type intmax_t = int64   /* _stdint.h:84:21 */
   391  type uintmax_t = uint64 /* _stdint.h:88:22 */
   392  
   393  type u_int8_t = uint8   /* types.h:67:19 */ // unsigned integrals (deprecated)
   394  type u_int16_t = uint16 /* types.h:68:20 */
   395  type u_int32_t = uint32 /* types.h:69:20 */
   396  type u_int64_t = uint64 /* types.h:70:20 */
   397  
   398  type u_quad_t = uint64 /* types.h:72:20 */ // quads (deprecated)
   399  type quad_t = int64    /* types.h:73:19 */
   400  type qaddr_t = uintptr /* types.h:74:16 */
   401  
   402  type caddr_t = uintptr   /* types.h:76:14 */ // core address
   403  type c_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const
   404  
   405  type blksize_t = int32 /* types.h:80:21 */
   406  
   407  type cpuwhich_t = int32 /* types.h:84:22 */
   408  type cpulevel_t = int32 /* types.h:85:22 */
   409  type cpusetid_t = int32 /* types.h:86:22 */
   410  
   411  type blkcnt_t = int64 /* types.h:89:20 */
   412  
   413  type clock_t = uint32 /* types.h:94:19 */
   414  
   415  type clockid_t = int32 /* types.h:99:21 */
   416  
   417  type critical_t = int32 /* types.h:103:22 */ // Critical section value
   418  type daddr_t = int64    /* types.h:104:19 */ // disk address
   419  
   420  type dev_t = uint64 /* types.h:107:18 */ // device number or struct cdev
   421  
   422  type fflags_t = uint32 /* types.h:112:20 */ // file flags
   423  
   424  type fixpt_t = uint32 /* types.h:116:19 */ // fixed point number
   425  
   426  type fsblkcnt_t = uint64 /* types.h:119:22 */
   427  type fsfilcnt_t = uint64 /* types.h:120:22 */
   428  
   429  type gid_t = uint32 /* types.h:125:18 */ // group id
   430  
   431  type in_addr_t = uint32 /* types.h:130:20 */ // base type for internet address
   432  
   433  type in_port_t = uint16 /* types.h:135:20 */
   434  
   435  type id_t = int64 /* types.h:140:17 */ // can hold a uid_t or pid_t
   436  
   437  type ino_t = uint64 /* types.h:145:18 */ // inode number
   438  
   439  type key_t = int32 /* types.h:150:18 */ // IPC key (for Sys V IPC)
   440  
   441  type lwpid_t = int32 /* types.h:155:19 */ // Thread ID (a.k.a. LWP)
   442  
   443  type mode_t = uint16 /* types.h:160:18 */ // permissions
   444  
   445  type accmode_t = int32 /* types.h:165:21 */ // access permissions
   446  
   447  type nlink_t = uint64 /* types.h:170:19 */ // link count
   448  
   449  type off_t = int64 /* types.h:175:18 */ // file offset
   450  
   451  type off64_t = int64 /* types.h:180:19 */ // file offset (alias)
   452  
   453  type pid_t = int32 /* types.h:185:18 */ // process id
   454  
   455  type register_t = int32 /* types.h:189:22 */
   456  
   457  type rlim_t = int64 /* types.h:192:18 */ // resource limit
   458  
   459  type sbintime_t = int64 /* types.h:196:19 */
   460  
   461  type segsz_t = int32 /* types.h:198:19 */ // segment size (in pages)
   462  
   463  type ssize_t = int32 /* types.h:206:19 */
   464  
   465  type suseconds_t = int32 /* types.h:211:23 */ // microseconds (signed)
   466  
   467  type time_t = int32 /* types.h:216:18 */
   468  
   469  type timer_t = uintptr /* types.h:221:19 */
   470  
   471  type mqd_t = uintptr /* types.h:226:17 */
   472  
   473  type u_register_t = uint32 /* types.h:230:24 */
   474  
   475  type uid_t = uint32 /* types.h:233:18 */ // user id
   476  
   477  type useconds_t = uint32 /* types.h:238:22 */ // microseconds (unsigned)
   478  
   479  type cap_ioctl_t = uint32 /* types.h:244:23 */
   480  
   481  // Types suitable for exporting physical addresses, virtual addresses
   482  // (pointers), and memory object sizes from the kernel independent of native
   483  // word size.  These should be used in place of vm_paddr_t, (u)intptr_t, and
   484  // size_t in structs which contain such types that are shared with userspace.
   485  type kpaddr_t = uint64 /* types.h:260:20 */
   486  type kvaddr_t = uint64 /* types.h:261:20 */
   487  type ksize_t = uint64  /* types.h:262:20 */
   488  type kssize_t = int64  /* types.h:263:19 */
   489  
   490  type vm_offset_t = uint32  /* types.h:265:23 */
   491  type vm_ooffset_t = uint64 /* types.h:266:20 */
   492  type vm_paddr_t = uint64   /* types.h:267:22 */
   493  type vm_pindex_t = uint64  /* types.h:268:20 */
   494  type vm_size_t = uint32    /* types.h:269:21 */
   495  
   496  type rman_res_t = uint64 /* types.h:271:25 */
   497  
   498  func __bitcount32(tls *libc.TLS, _x uint32) uint32 { /* types.h:335:1: */
   499  
   500  	_x = _x&uint32(0x55555555) + _x&0xaaaaaaaa>>1
   501  	_x = _x&uint32(0x33333333) + _x&0xcccccccc>>2
   502  	_x = (_x + _x>>4) & uint32(0x0f0f0f0f)
   503  	_x = _x + _x>>8
   504  	_x = (_x + _x>>16) & uint32(0x000000ff)
   505  	return _x
   506  }
   507  
   508  // -
   509  // SPDX-License-Identifier: BSD-3-Clause
   510  //
   511  // Copyright (c) 1992, 1993
   512  //	The Regents of the University of California.  All rights reserved.
   513  //
   514  // Redistribution and use in source and binary forms, with or without
   515  // modification, are permitted provided that the following conditions
   516  // are met:
   517  // 1. Redistributions of source code must retain the above copyright
   518  //    notice, this list of conditions and the following disclaimer.
   519  // 2. Redistributions in binary form must reproduce the above copyright
   520  //    notice, this list of conditions and the following disclaimer in the
   521  //    documentation and/or other materials provided with the distribution.
   522  // 3. Neither the name of the University nor the names of its contributors
   523  //    may be used to endorse or promote products derived from this software
   524  //    without specific prior written permission.
   525  //
   526  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   527  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   528  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   529  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   530  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   531  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   532  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   533  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   534  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   535  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   536  // SUCH DAMAGE.
   537  //
   538  // $FreeBSD$
   539  
   540  // -
   541  // SPDX-License-Identifier: BSD-3-Clause
   542  //
   543  // Copyright (c) 1991, 1993
   544  //	The Regents of the University of California.  All rights reserved.
   545  //
   546  // This code is derived from software contributed to Berkeley by
   547  // Berkeley Software Design, Inc.
   548  //
   549  // Redistribution and use in source and binary forms, with or without
   550  // modification, are permitted provided that the following conditions
   551  // are met:
   552  // 1. Redistributions of source code must retain the above copyright
   553  //    notice, this list of conditions and the following disclaimer.
   554  // 2. Redistributions in binary form must reproduce the above copyright
   555  //    notice, this list of conditions and the following disclaimer in the
   556  //    documentation and/or other materials provided with the distribution.
   557  // 3. Neither the name of the University nor the names of its contributors
   558  //    may be used to endorse or promote products derived from this software
   559  //    without specific prior written permission.
   560  //
   561  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   562  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   563  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   564  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   565  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   566  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   567  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   568  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   569  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   570  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   571  // SUCH DAMAGE.
   572  //
   573  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   574  // $FreeBSD$
   575  
   576  // -
   577  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   578  //
   579  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   580  // All rights reserved.
   581  //
   582  // Redistribution and use in source and binary forms, with or without
   583  // modification, are permitted provided that the following conditions
   584  // are met:
   585  // 1. Redistributions of source code must retain the above copyright
   586  //    notice, this list of conditions and the following disclaimer.
   587  // 2. Redistributions in binary form must reproduce the above copyright
   588  //    notice, this list of conditions and the following disclaimer in the
   589  //    documentation and/or other materials provided with the distribution.
   590  //
   591  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   592  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   593  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   594  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   595  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   596  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   597  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   598  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   599  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   600  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   601  // SUCH DAMAGE.
   602  //
   603  // $FreeBSD$
   604  
   605  // -
   606  // SPDX-License-Identifier: BSD-3-Clause
   607  //
   608  // Copyright (c) 1982, 1986, 1989, 1991, 1993
   609  //	The Regents of the University of California.  All rights reserved.
   610  // (c) UNIX System Laboratories, Inc.
   611  // All or some portions of this file are derived from material licensed
   612  // to the University of California by American Telephone and Telegraph
   613  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
   614  // the permission of UNIX System Laboratories, Inc.
   615  //
   616  // Redistribution and use in source and binary forms, with or without
   617  // modification, are permitted provided that the following conditions
   618  // are met:
   619  // 1. Redistributions of source code must retain the above copyright
   620  //    notice, this list of conditions and the following disclaimer.
   621  // 2. Redistributions in binary form must reproduce the above copyright
   622  //    notice, this list of conditions and the following disclaimer in the
   623  //    documentation and/or other materials provided with the distribution.
   624  // 3. Neither the name of the University nor the names of its contributors
   625  //    may be used to endorse or promote products derived from this software
   626  //    without specific prior written permission.
   627  //
   628  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   629  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   630  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   631  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   632  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   633  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   634  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   635  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   636  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   637  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   638  // SUCH DAMAGE.
   639  //
   640  //	@(#)signal.h	8.4 (Berkeley) 5/4/95
   641  // $FreeBSD$
   642  
   643  // sigset_t macros.
   644  
   645  type __sigset = struct{ __bits [4]uint32 } /* _sigset.h:53:9 */
   646  
   647  // -
   648  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   649  //
   650  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   651  // All rights reserved.
   652  //
   653  // Redistribution and use in source and binary forms, with or without
   654  // modification, are permitted provided that the following conditions
   655  // are met:
   656  // 1. Redistributions of source code must retain the above copyright
   657  //    notice, this list of conditions and the following disclaimer.
   658  // 2. Redistributions in binary form must reproduce the above copyright
   659  //    notice, this list of conditions and the following disclaimer in the
   660  //    documentation and/or other materials provided with the distribution.
   661  //
   662  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   663  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   664  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   665  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   666  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   667  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   668  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   669  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   670  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   671  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   672  // SUCH DAMAGE.
   673  //
   674  // $FreeBSD$
   675  
   676  // -
   677  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   678  //
   679  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   680  // All rights reserved.
   681  //
   682  // Redistribution and use in source and binary forms, with or without
   683  // modification, are permitted provided that the following conditions
   684  // are met:
   685  // 1. Redistributions of source code must retain the above copyright
   686  //    notice, this list of conditions and the following disclaimer.
   687  // 2. Redistributions in binary form must reproduce the above copyright
   688  //    notice, this list of conditions and the following disclaimer in the
   689  //    documentation and/or other materials provided with the distribution.
   690  //
   691  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   692  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   693  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   694  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   695  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   696  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   697  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   698  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   699  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   700  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   701  // SUCH DAMAGE.
   702  //
   703  // $FreeBSD$
   704  
   705  // Structure returned by gettimeofday(2) system call, and used in other calls.
   706  type timeval = struct {
   707  	tv_sec  time_t
   708  	tv_usec suseconds_t
   709  } /* _timeval.h:49:1 */
   710  
   711  // -
   712  // SPDX-License-Identifier: BSD-3-Clause
   713  //
   714  // Copyright (c) 1982, 1986, 1993
   715  //	The Regents of the University of California.  All rights reserved.
   716  //
   717  // Redistribution and use in source and binary forms, with or without
   718  // modification, are permitted provided that the following conditions
   719  // are met:
   720  // 1. Redistributions of source code must retain the above copyright
   721  //    notice, this list of conditions and the following disclaimer.
   722  // 2. Redistributions in binary form must reproduce the above copyright
   723  //    notice, this list of conditions and the following disclaimer in the
   724  //    documentation and/or other materials provided with the distribution.
   725  // 3. Neither the name of the University nor the names of its contributors
   726  //    may be used to endorse or promote products derived from this software
   727  //    without specific prior written permission.
   728  //
   729  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   730  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   731  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   732  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   733  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   734  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   735  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   736  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   737  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   738  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   739  // SUCH DAMAGE.
   740  //
   741  //	@(#)time.h	8.5 (Berkeley) 5/4/95
   742  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
   743  //	$FreeBSD$
   744  
   745  // -
   746  // SPDX-License-Identifier: BSD-3-Clause
   747  //
   748  // Copyright (c) 1991, 1993
   749  //	The Regents of the University of California.  All rights reserved.
   750  //
   751  // This code is derived from software contributed to Berkeley by
   752  // Berkeley Software Design, Inc.
   753  //
   754  // Redistribution and use in source and binary forms, with or without
   755  // modification, are permitted provided that the following conditions
   756  // are met:
   757  // 1. Redistributions of source code must retain the above copyright
   758  //    notice, this list of conditions and the following disclaimer.
   759  // 2. Redistributions in binary form must reproduce the above copyright
   760  //    notice, this list of conditions and the following disclaimer in the
   761  //    documentation and/or other materials provided with the distribution.
   762  // 3. Neither the name of the University nor the names of its contributors
   763  //    may be used to endorse or promote products derived from this software
   764  //    without specific prior written permission.
   765  //
   766  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   767  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   768  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   769  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   770  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   771  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   772  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   773  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   774  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   775  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   776  // SUCH DAMAGE.
   777  //
   778  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   779  // $FreeBSD$
   780  
   781  // -
   782  // SPDX-License-Identifier: BSD-3-Clause
   783  //
   784  // Copyright (c) 1982, 1986, 1993
   785  //	The Regents of the University of California.  All rights reserved.
   786  //
   787  // Redistribution and use in source and binary forms, with or without
   788  // modification, are permitted provided that the following conditions
   789  // are met:
   790  // 1. Redistributions of source code must retain the above copyright
   791  //    notice, this list of conditions and the following disclaimer.
   792  // 2. Redistributions in binary form must reproduce the above copyright
   793  //    notice, this list of conditions and the following disclaimer in the
   794  //    documentation and/or other materials provided with the distribution.
   795  // 3. Neither the name of the University nor the names of its contributors
   796  //    may be used to endorse or promote products derived from this software
   797  //    without specific prior written permission.
   798  //
   799  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   800  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   801  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   802  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   803  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   804  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   805  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   806  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   807  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   808  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   809  // SUCH DAMAGE.
   810  //
   811  //	@(#)time.h	8.5 (Berkeley) 5/4/95
   812  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
   813  //	$FreeBSD$
   814  
   815  // -
   816  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   817  //
   818  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   819  // All rights reserved.
   820  //
   821  // Redistribution and use in source and binary forms, with or without
   822  // modification, are permitted provided that the following conditions
   823  // are met:
   824  // 1. Redistributions of source code must retain the above copyright
   825  //    notice, this list of conditions and the following disclaimer.
   826  // 2. Redistributions in binary form must reproduce the above copyright
   827  //    notice, this list of conditions and the following disclaimer in the
   828  //    documentation and/or other materials provided with the distribution.
   829  //
   830  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   831  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   832  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   833  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   834  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   835  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   836  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   837  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   838  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   839  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   840  // SUCH DAMAGE.
   841  //
   842  // $FreeBSD$
   843  
   844  type timespec = struct {
   845  	tv_sec  time_t
   846  	tv_nsec int32
   847  } /* _timespec.h:46:1 */
   848  
   849  // Structure defined by POSIX.1b to be like a itimerval, but with
   850  // timespecs. Used in the timer_*() system calls.
   851  type itimerspec = struct {
   852  	it_interval struct {
   853  		tv_sec  time_t
   854  		tv_nsec int32
   855  	}
   856  	it_value struct {
   857  		tv_sec  time_t
   858  		tv_nsec int32
   859  	}
   860  } /* timespec.h:60:1 */
   861  
   862  type fd_mask = uint32 /* select.h:46:19 */
   863  
   864  type sigset_t = __sigset /* select.h:51:20 */
   865  
   866  // Select uses bit masks of file descriptors in longs.  These macros
   867  // manipulate such bit fields (the filesystem macros use chars).
   868  // FD_SETSIZE may be defined by the user, but the default here should
   869  // be enough for most uses.
   870  
   871  type fd_set1 = struct{ __fds_bits [32]uint32 } /* select.h:73:9 */
   872  
   873  // Select uses bit masks of file descriptors in longs.  These macros
   874  // manipulate such bit fields (the filesystem macros use chars).
   875  // FD_SETSIZE may be defined by the user, but the default here should
   876  // be enough for most uses.
   877  
   878  type fd_set = fd_set1 /* select.h:75:3 */
   879  
   880  // -
   881  // This file is in the public domain.
   882  // $FreeBSD$
   883  
   884  // -
   885  // SPDX-License-Identifier: BSD-2-Clause
   886  //
   887  // Copyright (c) 2017 Poul-Henning Kamp.  All rights reserved.
   888  //
   889  // Redistribution and use in source and binary forms, with or without
   890  // modification, are permitted provided that the following conditions
   891  // are met:
   892  // 1. Redistributions of source code must retain the above copyright
   893  //    notice, this list of conditions and the following disclaimer.
   894  // 2. Redistributions in binary form must reproduce the above copyright
   895  //    notice, this list of conditions and the following disclaimer in the
   896  //    documentation and/or other materials provided with the distribution.
   897  //
   898  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   899  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   900  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   901  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   902  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   903  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   904  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   905  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   906  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   907  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   908  // SUCH DAMAGE.
   909  //
   910  // $FreeBSD$
   911  
   912  // -
   913  // SPDX-License-Identifier: BSD-3-Clause
   914  //
   915  // Copyright (c) 2002 David E. O'Brien.  All rights reserved.
   916  //
   917  // Redistribution and use in source and binary forms, with or without
   918  // modification, are permitted provided that the following conditions
   919  // are met:
   920  // 1. Redistributions of source code must retain the above copyright
   921  //    notice, this list of conditions and the following disclaimer.
   922  // 2. Redistributions in binary form must reproduce the above copyright
   923  //    notice, this list of conditions and the following disclaimer in the
   924  //    documentation and/or other materials provided with the distribution.
   925  // 3. Neither the name of the University nor the names of its contributors
   926  //    may be used to endorse or promote products derived from this software
   927  //    without specific prior written permission.
   928  //
   929  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   930  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   931  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   932  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   933  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   934  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   935  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   936  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   937  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   938  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   939  // SUCH DAMAGE.
   940  //
   941  // $FreeBSD$
   942  
   943  // -
   944  // SPDX-License-Identifier: BSD-3-Clause
   945  //
   946  // Copyright (c) 1991, 1993
   947  //	The Regents of the University of California.  All rights reserved.
   948  //
   949  // This code is derived from software contributed to Berkeley by
   950  // Berkeley Software Design, Inc.
   951  //
   952  // Redistribution and use in source and binary forms, with or without
   953  // modification, are permitted provided that the following conditions
   954  // are met:
   955  // 1. Redistributions of source code must retain the above copyright
   956  //    notice, this list of conditions and the following disclaimer.
   957  // 2. Redistributions in binary form must reproduce the above copyright
   958  //    notice, this list of conditions and the following disclaimer in the
   959  //    documentation and/or other materials provided with the distribution.
   960  // 3. Neither the name of the University nor the names of its contributors
   961  //    may be used to endorse or promote products derived from this software
   962  //    without specific prior written permission.
   963  //
   964  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   965  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   966  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   967  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   968  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   969  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   970  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   971  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   972  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   973  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   974  // SUCH DAMAGE.
   975  //
   976  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
   977  // $FreeBSD$
   978  
   979  // -
   980  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
   981  //
   982  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
   983  // All rights reserved.
   984  //
   985  // Redistribution and use in source and binary forms, with or without
   986  // modification, are permitted provided that the following conditions
   987  // are met:
   988  // 1. Redistributions of source code must retain the above copyright
   989  //    notice, this list of conditions and the following disclaimer.
   990  // 2. Redistributions in binary form must reproduce the above copyright
   991  //    notice, this list of conditions and the following disclaimer in the
   992  //    documentation and/or other materials provided with the distribution.
   993  //
   994  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   995  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   996  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   997  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   998  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   999  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1000  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1001  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1002  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1003  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1004  // SUCH DAMAGE.
  1005  //
  1006  // $FreeBSD$
  1007  
  1008  type va_list = uintptr /* _stdarg.h:41:27 */ // select(2)
  1009  
  1010  type crypt_data = struct {
  1011  	initialized int32
  1012  	__buf       [256]int8
  1013  } /* unistd.h:489:1 */
  1014  
  1015  // getopt(3) external variable
  1016  
  1017  // MVS linker does not support external names larger than 8 bytes
  1018  
  1019  //
  1020  //     The 'zlib' compression library provides in-memory compression and
  1021  //   decompression functions, including integrity checks of the uncompressed data.
  1022  //   This version of the library supports only one compression method (deflation)
  1023  //   but other algorithms will be added later and will have the same stream
  1024  //   interface.
  1025  //
  1026  //     Compression can be done in a single step if the buffers are large enough,
  1027  //   or can be done by repeated calls of the compression function.  In the latter
  1028  //   case, the application must provide more input and/or consume the output
  1029  //   (providing more output space) before each call.
  1030  //
  1031  //     The compressed data format used by default by the in-memory functions is
  1032  //   the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
  1033  //   around a deflate stream, which is itself documented in RFC 1951.
  1034  //
  1035  //     The library also supports reading and writing files in gzip (.gz) format
  1036  //   with an interface similar to that of stdio using the functions that start
  1037  //   with "gz".  The gzip format is different from the zlib format.  gzip is a
  1038  //   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
  1039  //
  1040  //     This library can optionally read and write gzip and raw deflate streams in
  1041  //   memory as well.
  1042  //
  1043  //     The zlib format was designed to be compact and fast for use in memory
  1044  //   and on communications channels.  The gzip format was designed for single-
  1045  //   file compression on file systems, has a larger header than zlib to maintain
  1046  //   directory information, and uses a different, slower check method than zlib.
  1047  //
  1048  //     The library does not install any signal handler.  The decoder checks
  1049  //   the consistency of the compressed data, so the library should never crash
  1050  //   even in the case of corrupted input.
  1051  
  1052  type alloc_func = uintptr /* zlib.h:81:16 */
  1053  type free_func = uintptr  /* zlib.h:82:16 */
  1054  
  1055  type z_stream_s = struct {
  1056  	next_in   uintptr
  1057  	avail_in  uInt
  1058  	total_in  uLong
  1059  	next_out  uintptr
  1060  	avail_out uInt
  1061  	total_out uLong
  1062  	msg       uintptr
  1063  	state     uintptr
  1064  	zalloc    alloc_func
  1065  	zfree     free_func
  1066  	opaque    voidpf
  1067  	data_type int32
  1068  	adler     uLong
  1069  	reserved  uLong
  1070  } /* zlib.h:86:9 */
  1071  
  1072  type z_stream = z_stream_s /* zlib.h:106:3 */
  1073  
  1074  type z_streamp = uintptr /* zlib.h:108:22 */
  1075  
  1076  //
  1077  //      gzip header information passed to and from zlib routines.  See RFC 1952
  1078  //   for more details on the meanings of these fields.
  1079  type gz_header_s = struct {
  1080  	text      int32
  1081  	time      uLong
  1082  	xflags    int32
  1083  	os        int32
  1084  	extra     uintptr
  1085  	extra_len uInt
  1086  	extra_max uInt
  1087  	name      uintptr
  1088  	name_max  uInt
  1089  	comment   uintptr
  1090  	comm_max  uInt
  1091  	hcrc      int32
  1092  	done      int32
  1093  } /* zlib.h:114:9 */
  1094  
  1095  //
  1096  //      gzip header information passed to and from zlib routines.  See RFC 1952
  1097  //   for more details on the meanings of these fields.
  1098  type gz_header = gz_header_s /* zlib.h:129:3 */
  1099  
  1100  type gz_headerp = uintptr /* zlib.h:131:23 */
  1101  //
  1102  //      inflateGetHeader() requests that gzip header information be stored in the
  1103  //    provided gz_header structure.  inflateGetHeader() may be called after
  1104  //    inflateInit2() or inflateReset(), and before the first call of inflate().
  1105  //    As inflate() processes the gzip stream, head->done is zero until the header
  1106  //    is completed, at which time head->done is set to one.  If a zlib stream is
  1107  //    being decoded, then head->done is set to -1 to indicate that there will be
  1108  //    no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
  1109  //    used to force inflate() to return immediately after header processing is
  1110  //    complete and before any actual data is decompressed.
  1111  //
  1112  //      The text, time, xflags, and os fields are filled in with the gzip header
  1113  //    contents.  hcrc is set to true if there is a header CRC.  (The header CRC
  1114  //    was valid if done is set to one.) If extra is not Z_NULL, then extra_max
  1115  //    contains the maximum number of bytes to write to extra.  Once done is true,
  1116  //    extra_len contains the actual extra field length, and extra contains the
  1117  //    extra field, or that field truncated if extra_max is less than extra_len.
  1118  //    If name is not Z_NULL, then up to name_max characters are written there,
  1119  //    terminated with a zero unless the length is greater than name_max.  If
  1120  //    comment is not Z_NULL, then up to comm_max characters are written there,
  1121  //    terminated with a zero unless the length is greater than comm_max.  When any
  1122  //    of extra, name, or comment are not Z_NULL and the respective field is not
  1123  //    present in the header, then that field is set to Z_NULL to signal its
  1124  //    absence.  This allows the use of deflateSetHeader() with the returned
  1125  //    structure to duplicate the header.  However if those fields are set to
  1126  //    allocated memory, then the application will need to save those pointers
  1127  //    elsewhere so that they can be eventually freed.
  1128  //
  1129  //      If inflateGetHeader is not used, then the header information is simply
  1130  //    discarded.  The header is always checked for validity, including the header
  1131  //    CRC if present.  inflateReset() will reset the process to discard the header
  1132  //    information.  The application would need to call inflateGetHeader() again to
  1133  //    retrieve the header from the next gzip stream.
  1134  //
  1135  //      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
  1136  //    stream state was inconsistent.
  1137  
  1138  //
  1139  // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
  1140  //                                         unsigned char FAR *window));
  1141  //
  1142  //      Initialize the internal stream state for decompression using inflateBack()
  1143  //    calls.  The fields zalloc, zfree and opaque in strm must be initialized
  1144  //    before the call.  If zalloc and zfree are Z_NULL, then the default library-
  1145  //    derived memory allocation routines are used.  windowBits is the base two
  1146  //    logarithm of the window size, in the range 8..15.  window is a caller
  1147  //    supplied buffer of that size.  Except for special applications where it is
  1148  //    assured that deflate was used with small window sizes, windowBits must be 15
  1149  //    and a 32K byte window must be supplied to be able to decompress general
  1150  //    deflate streams.
  1151  //
  1152  //      See inflateBack() for the usage of these routines.
  1153  //
  1154  //      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
  1155  //    the parameters are invalid, Z_MEM_ERROR if the internal state could not be
  1156  //    allocated, or Z_VERSION_ERROR if the version of the library does not match
  1157  //    the version of the header file.
  1158  
  1159  type in_func = uintptr  /* zlib.h:1092:18 */
  1160  type out_func = uintptr /* zlib.h:1094:13 */
  1161  //
  1162  //      Same as uncompress, except that sourceLen is a pointer, where the
  1163  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
  1164  //    source bytes consumed.
  1165  
  1166  // gzip file access functions
  1167  
  1168  //
  1169  //      This library supports reading and writing files in gzip (.gz) format with
  1170  //    an interface similar to that of stdio, using the functions that start with
  1171  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
  1172  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
  1173  
  1174  type gzFile_s = struct {
  1175  	have uint32
  1176  	next uintptr
  1177  	pos  off_t
  1178  } /* zlib.h:1300:9 */
  1179  
  1180  //
  1181  //      Same as uncompress, except that sourceLen is a pointer, where the
  1182  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
  1183  //    source bytes consumed.
  1184  
  1185  // gzip file access functions
  1186  
  1187  //
  1188  //      This library supports reading and writing files in gzip (.gz) format with
  1189  //    an interface similar to that of stdio, using the functions that start with
  1190  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
  1191  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
  1192  
  1193  type gzFile = uintptr /* zlib.h:1300:25 */
  1194  
  1195  // -
  1196  // SPDX-License-Identifier: BSD-3-Clause
  1197  //
  1198  // Copyright (c) 1990, 1993
  1199  //	The Regents of the University of California.  All rights reserved.
  1200  //
  1201  // This code is derived from software contributed to Berkeley by
  1202  // Chris Torek.
  1203  //
  1204  // Redistribution and use in source and binary forms, with or without
  1205  // modification, are permitted provided that the following conditions
  1206  // are met:
  1207  // 1. Redistributions of source code must retain the above copyright
  1208  //    notice, this list of conditions and the following disclaimer.
  1209  // 2. Redistributions in binary form must reproduce the above copyright
  1210  //    notice, this list of conditions and the following disclaimer in the
  1211  //    documentation and/or other materials provided with the distribution.
  1212  // 3. Neither the name of the University nor the names of its contributors
  1213  //    may be used to endorse or promote products derived from this software
  1214  //    without specific prior written permission.
  1215  //
  1216  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1217  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1218  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1219  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1220  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1221  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1222  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1223  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1224  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1225  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1226  // SUCH DAMAGE.
  1227  //
  1228  //	@(#)stdio.h	8.5 (Berkeley) 4/29/95
  1229  // $FreeBSD$
  1230  
  1231  // -
  1232  // SPDX-License-Identifier: BSD-3-Clause
  1233  //
  1234  // Copyright (c) 1991, 1993
  1235  //	The Regents of the University of California.  All rights reserved.
  1236  //
  1237  // This code is derived from software contributed to Berkeley by
  1238  // Berkeley Software Design, Inc.
  1239  //
  1240  // Redistribution and use in source and binary forms, with or without
  1241  // modification, are permitted provided that the following conditions
  1242  // are met:
  1243  // 1. Redistributions of source code must retain the above copyright
  1244  //    notice, this list of conditions and the following disclaimer.
  1245  // 2. Redistributions in binary form must reproduce the above copyright
  1246  //    notice, this list of conditions and the following disclaimer in the
  1247  //    documentation and/or other materials provided with the distribution.
  1248  // 3. Neither the name of the University nor the names of its contributors
  1249  //    may be used to endorse or promote products derived from this software
  1250  //    without specific prior written permission.
  1251  //
  1252  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1253  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1254  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1255  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1256  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1257  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1258  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1259  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1260  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1261  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1262  // SUCH DAMAGE.
  1263  //
  1264  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  1265  // $FreeBSD$
  1266  
  1267  // -
  1268  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1269  //
  1270  // Copyright (c) 2003 Marcel Moolenaar
  1271  // All rights reserved.
  1272  //
  1273  // Redistribution and use in source and binary forms, with or without
  1274  // modification, are permitted provided that the following conditions
  1275  // are met:
  1276  //
  1277  // 1. Redistributions of source code must retain the above copyright
  1278  //    notice, this list of conditions and the following disclaimer.
  1279  // 2. Redistributions in binary form must reproduce the above copyright
  1280  //    notice, this list of conditions and the following disclaimer in the
  1281  //    documentation and/or other materials provided with the distribution.
  1282  //
  1283  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  1284  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1285  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1286  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  1287  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  1288  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1289  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1290  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1291  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1292  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1293  //
  1294  // $FreeBSD$
  1295  
  1296  // -
  1297  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1298  //
  1299  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  1300  // All rights reserved.
  1301  //
  1302  // Redistribution and use in source and binary forms, with or without
  1303  // modification, are permitted provided that the following conditions
  1304  // are met:
  1305  // 1. Redistributions of source code must retain the above copyright
  1306  //    notice, this list of conditions and the following disclaimer.
  1307  // 2. Redistributions in binary form must reproduce the above copyright
  1308  //    notice, this list of conditions and the following disclaimer in the
  1309  //    documentation and/or other materials provided with the distribution.
  1310  //
  1311  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1312  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1313  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1314  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1315  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1316  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1317  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1318  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1319  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1320  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1321  // SUCH DAMAGE.
  1322  //
  1323  // $FreeBSD$
  1324  
  1325  type fpos_t = int64 /* stdio.h:47:18 */
  1326  
  1327  // NB: to fit things in six character monocase externals, the stdio
  1328  // code uses the prefix `__s' for stdio objects, typically followed
  1329  // by a three-character attempt at a mnemonic.
  1330  
  1331  // stdio buffers
  1332  type __sbuf = struct {
  1333  	_base uintptr
  1334  	_size int32
  1335  } /* stdio.h:91:1 */
  1336  
  1337  // stdio state variables.
  1338  //
  1339  // The following always hold:
  1340  //
  1341  //	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  1342  //		_lbfsize is -_bf._size, else _lbfsize is 0
  1343  //	if _flags&__SRD, _w is 0
  1344  //	if _flags&__SWR, _r is 0
  1345  //
  1346  // This ensures that the getc and putc macros (or inline functions) never
  1347  // try to write or read from a file that is in `read' or `write' mode.
  1348  // (Moreover, they can, and do, automatically switch from read mode to
  1349  // write mode, and back, on "r+" and "w+" files.)
  1350  //
  1351  // _lbfsize is used only to make the inline line-buffered output stream
  1352  // code as compact as possible.
  1353  //
  1354  // _ub, _up, and _ur are used when ungetc() pushes back more characters
  1355  // than fit in the current _bf, or when ungetc() pushes back a character
  1356  // that does not match the previous one in _bf.  When this happens,
  1357  // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  1358  // _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  1359  //
  1360  // Certain members of __sFILE are accessed directly via macros or
  1361  // inline functions.  To preserve ABI compat, these members must not
  1362  // be disturbed.  These members are marked below with (*).
  1363  type __sFILE = struct {
  1364  	_p     uintptr
  1365  	_r     int32
  1366  	_w     int32
  1367  	_flags int16
  1368  	_file  int16
  1369  	_bf    struct {
  1370  		_base uintptr
  1371  		_size int32
  1372  	}
  1373  	_lbfsize int32
  1374  	_cookie  uintptr
  1375  	_close   uintptr
  1376  	_read    uintptr
  1377  	_seek    uintptr
  1378  	_write   uintptr
  1379  	_ub      struct {
  1380  		_base uintptr
  1381  		_size int32
  1382  	}
  1383  	_up   uintptr
  1384  	_ur   int32
  1385  	_ubuf [3]uint8
  1386  	_nbuf [1]uint8
  1387  	_lb   struct {
  1388  		_base uintptr
  1389  		_size int32
  1390  	}
  1391  	_blksize     int32
  1392  	_offset      fpos_t
  1393  	_fl_mutex    uintptr
  1394  	_fl_owner    uintptr
  1395  	_fl_count    int32
  1396  	_orientation int32
  1397  	_mbstate     struct {
  1398  		_          [0]uint32
  1399  		__mbstate8 [128]int8
  1400  	}
  1401  	_flags2 int32
  1402  } /* stdio.h:124:1 */
  1403  
  1404  type FILE = __sFILE /* stdio.h:165:24 */
  1405  type cookie_io_functions_t = struct {
  1406  	read  uintptr
  1407  	write uintptr
  1408  	seek  uintptr
  1409  	close uintptr
  1410  } /* stdio.h:428:3 */
  1411  
  1412  // -
  1413  // Copyright (c) 2011, 2012 The FreeBSD Foundation
  1414  // All rights reserved.
  1415  //
  1416  // Redistribution and use in source and binary forms, with or without
  1417  // modification, are permitted provided that the following conditions
  1418  // are met:
  1419  // 1. Redistributions of source code must retain the above copyright
  1420  //    notice, this list of conditions and the following disclaimer.
  1421  // 2. Redistributions in binary form must reproduce the above copyright
  1422  //    notice, this list of conditions and the following disclaimer in the
  1423  //    documentation and/or other materials provided with the distribution.
  1424  //
  1425  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1426  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1427  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1428  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1429  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1430  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1431  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1432  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1433  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1434  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1435  // SUCH DAMAGE.
  1436  //
  1437  // $FreeBSD$
  1438  
  1439  type locale_t = uintptr /* _strings.h:31:25 */
  1440  
  1441  // xlocale extensions
  1442  
  1443  type errno_t = int32 /* string.h:159:13 */
  1444  
  1445  // -
  1446  // SPDX-License-Identifier: BSD-3-Clause
  1447  //
  1448  // Copyright (c) 1990, 1993
  1449  //	The Regents of the University of California.  All rights reserved.
  1450  //
  1451  // Redistribution and use in source and binary forms, with or without
  1452  // modification, are permitted provided that the following conditions
  1453  // are met:
  1454  // 1. Redistributions of source code must retain the above copyright
  1455  //    notice, this list of conditions and the following disclaimer.
  1456  // 2. Redistributions in binary form must reproduce the above copyright
  1457  //    notice, this list of conditions and the following disclaimer in the
  1458  //    documentation and/or other materials provided with the distribution.
  1459  // 3. Neither the name of the University nor the names of its contributors
  1460  //    may be used to endorse or promote products derived from this software
  1461  //    without specific prior written permission.
  1462  //
  1463  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1464  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1465  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1466  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1467  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1468  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1469  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1470  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1471  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1472  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1473  // SUCH DAMAGE.
  1474  //
  1475  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
  1476  // $FreeBSD$
  1477  
  1478  // -
  1479  // SPDX-License-Identifier: BSD-3-Clause
  1480  //
  1481  // Copyright (c) 1991, 1993
  1482  //	The Regents of the University of California.  All rights reserved.
  1483  //
  1484  // This code is derived from software contributed to Berkeley by
  1485  // Berkeley Software Design, Inc.
  1486  //
  1487  // Redistribution and use in source and binary forms, with or without
  1488  // modification, are permitted provided that the following conditions
  1489  // are met:
  1490  // 1. Redistributions of source code must retain the above copyright
  1491  //    notice, this list of conditions and the following disclaimer.
  1492  // 2. Redistributions in binary form must reproduce the above copyright
  1493  //    notice, this list of conditions and the following disclaimer in the
  1494  //    documentation and/or other materials provided with the distribution.
  1495  // 3. Neither the name of the University nor the names of its contributors
  1496  //    may be used to endorse or promote products derived from this software
  1497  //    without specific prior written permission.
  1498  //
  1499  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  1500  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1501  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1502  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  1503  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1504  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1505  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1506  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1507  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1508  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1509  // SUCH DAMAGE.
  1510  //
  1511  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  1512  // $FreeBSD$
  1513  
  1514  // -
  1515  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1516  //
  1517  // Copyright (c) 2003 Marcel Moolenaar
  1518  // All rights reserved.
  1519  //
  1520  // Redistribution and use in source and binary forms, with or without
  1521  // modification, are permitted provided that the following conditions
  1522  // are met:
  1523  //
  1524  // 1. Redistributions of source code must retain the above copyright
  1525  //    notice, this list of conditions and the following disclaimer.
  1526  // 2. Redistributions in binary form must reproduce the above copyright
  1527  //    notice, this list of conditions and the following disclaimer in the
  1528  //    documentation and/or other materials provided with the distribution.
  1529  //
  1530  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  1531  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1532  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1533  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  1534  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  1535  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  1536  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  1537  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1538  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  1539  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1540  //
  1541  // $FreeBSD$
  1542  
  1543  // -
  1544  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  1545  //
  1546  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  1547  // All rights reserved.
  1548  //
  1549  // Redistribution and use in source and binary forms, with or without
  1550  // modification, are permitted provided that the following conditions
  1551  // are met:
  1552  // 1. Redistributions of source code must retain the above copyright
  1553  //    notice, this list of conditions and the following disclaimer.
  1554  // 2. Redistributions in binary form must reproduce the above copyright
  1555  //    notice, this list of conditions and the following disclaimer in the
  1556  //    documentation and/or other materials provided with the distribution.
  1557  //
  1558  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  1559  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  1560  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  1561  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  1562  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  1563  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  1564  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  1565  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  1566  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  1567  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1568  // SUCH DAMAGE.
  1569  //
  1570  // $FreeBSD$
  1571  
  1572  type div_t = struct {
  1573  	quot int32
  1574  	rem  int32
  1575  } /* stdlib.h:66:3 */
  1576  
  1577  type ldiv_t = struct {
  1578  	quot int32
  1579  	rem  int32
  1580  } /* stdlib.h:71:3 */
  1581  
  1582  // Functions added in C99 which we make conditionally available in the
  1583  // BSD^C89 namespace if the compiler supports `long long'.
  1584  // The #if test is more complicated than it ought to be because
  1585  // __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
  1586  // is not supported in the compilation environment (which therefore means
  1587  // that it can't really be ISO C99).
  1588  //
  1589  // (The only other extension made by C99 in thie header is _Exit().)
  1590  // LONGLONG
  1591  type lldiv_t = struct {
  1592  	quot int64
  1593  	rem  int64
  1594  } /* stdlib.h:142:3 */ // getsubopt(3) external variable
  1595  
  1596  // K.3.6
  1597  type constraint_handler_t = uintptr /* stdlib.h:349:14 */
  1598  
  1599  var hello = *(*[14]int8)(unsafe.Pointer(ts)) /* example.c:29:21 */
  1600  // "hello world" would be more standard, but the repeated "hello"
  1601  // stresses the compression code better, sorry...
  1602  
  1603  var dictionary = *(*[6]int8)(unsafe.Pointer(ts + 14)) /* example.c:34:19 */
  1604  var dictId uLong                                      /* example.c:35:14: */
  1605  
  1606  var zalloc alloc_func = uintptr(0) /* example.c:77:19 */
  1607  var zfree free_func = uintptr(0)   /* example.c:78:18 */
  1608  
  1609  // ===========================================================================
  1610  // Test compress() and uncompress()
  1611  func test_compress(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:88:6: */
  1612  	bp := tls.Alloc(48)
  1613  	defer tls.Free(48)
  1614  	*(*uLong)(unsafe.Pointer(bp + 40)) = comprLen
  1615  	*(*uLong)(unsafe.Pointer(bp + 44)) = uncomprLen
  1616  
  1617  	var err int32
  1618  	var len uLong = uLong(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + uLong(1)
  1619  
  1620  	err = z.Xcompress(tls, compr, bp+40, uintptr(uintptr(unsafe.Pointer(&hello))), len)
  1621  	{
  1622  		if err != 0 {
  1623  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+34, err))
  1624  			libc.Xexit(tls, 1)
  1625  		}
  1626  	}
  1627  
  1628  	libc.Xstrcpy(tls, uncompr, ts+43)
  1629  
  1630  	err = z.Xuncompress(tls, uncompr, bp+44, compr, *(*uLong)(unsafe.Pointer(bp + 40 /* comprLen */)))
  1631  	{
  1632  		if err != 0 {
  1633  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+51, err))
  1634  			libc.Xexit(tls, 1)
  1635  		}
  1636  	}
  1637  
  1638  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  1639  		libc.Xfprintf(tls, libc.X__stderrp, ts+62, 0)
  1640  		libc.Xexit(tls, 1)
  1641  	} else {
  1642  		libc.Xprintf(tls, ts+78, libc.VaList(bp+32, uncompr))
  1643  	}
  1644  }
  1645  
  1646  // ===========================================================================
  1647  // Test read/write of .gz files
  1648  func test_gzio(tls *libc.TLS, fname uintptr, uncompr uintptr, uncomprLen uLong) { /* example.c:114:6: */
  1649  	bp := tls.Alloc(84)
  1650  	defer tls.Free(84)
  1651  
  1652  	// var err int32 at bp+80, 4
  1653  
  1654  	var len int32 = int32(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + 1
  1655  	var file gzFile
  1656  	var pos off_t
  1657  
  1658  	file = z.Xgzopen(tls, fname, ts+96)
  1659  	if file == uintptr(0) {
  1660  		libc.Xfprintf(tls, libc.X__stderrp, ts+99, 0)
  1661  		libc.Xexit(tls, 1)
  1662  	}
  1663  	z.Xgzputc(tls, file, 'h')
  1664  	if z.Xgzputs(tls, file, ts+113) != 4 {
  1665  		libc.Xfprintf(tls, libc.X__stderrp, ts+118, libc.VaList(bp, z.Xgzerror(tls, file, bp+80)))
  1666  		libc.Xexit(tls, 1)
  1667  	}
  1668  	if z.Xgzprintf(tls, file, ts+134, libc.VaList(bp+8, ts+14)) != 8 {
  1669  		libc.Xfprintf(tls, libc.X__stderrp, ts+140, libc.VaList(bp+16, z.Xgzerror(tls, file, bp+80)))
  1670  		libc.Xexit(tls, 1)
  1671  	}
  1672  	z.Xgzseek(tls, file, int64(1), 1) // add one zero byte
  1673  	z.Xgzclose(tls, file)
  1674  
  1675  	file = z.Xgzopen(tls, fname, ts+158)
  1676  	if file == uintptr(0) {
  1677  		libc.Xfprintf(tls, libc.X__stderrp, ts+99, 0)
  1678  		libc.Xexit(tls, 1)
  1679  	}
  1680  	libc.Xstrcpy(tls, uncompr, ts+43)
  1681  
  1682  	if z.Xgzread(tls, file, uncompr, uint32(uncomprLen)) != len {
  1683  		libc.Xfprintf(tls, libc.X__stderrp, ts+161, libc.VaList(bp+24, z.Xgzerror(tls, file, bp+80)))
  1684  		libc.Xexit(tls, 1)
  1685  	}
  1686  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  1687  		libc.Xfprintf(tls, libc.X__stderrp, ts+177, libc.VaList(bp+32, uncompr))
  1688  		libc.Xexit(tls, 1)
  1689  	} else {
  1690  		libc.Xprintf(tls, ts+193, libc.VaList(bp+40, uncompr))
  1691  	}
  1692  
  1693  	pos = z.Xgzseek(tls, file, int64(-8), 1)
  1694  	if pos != int64(6) || z.Xgztell(tls, file) != pos {
  1695  		libc.Xfprintf(tls, libc.X__stderrp, ts+207,
  1696  			libc.VaList(bp+48, int32(pos), int32(z.Xgztell(tls, file))))
  1697  		libc.Xexit(tls, 1)
  1698  	}
  1699  
  1700  	if func() int32 {
  1701  		if (*gzFile_s)(unsafe.Pointer(file)).have != 0 {
  1702  			return int32(func() uint8 {
  1703  				(*gzFile_s)(unsafe.Pointer(file)).have--
  1704  				(*gzFile_s)(unsafe.Pointer(file)).pos++
  1705  				return *(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&(*gzFile_s)(unsafe.Pointer(file)).next, 1)))
  1706  			}())
  1707  		}
  1708  		return z.Xgzgetc(tls, file)
  1709  	}() != ' ' {
  1710  		libc.Xfprintf(tls, libc.X__stderrp, ts+242, 0)
  1711  		libc.Xexit(tls, 1)
  1712  	}
  1713  
  1714  	if z.Xgzungetc(tls, ' ', file) != ' ' {
  1715  		libc.Xfprintf(tls, libc.X__stderrp, ts+256, 0)
  1716  		libc.Xexit(tls, 1)
  1717  	}
  1718  
  1719  	z.Xgzgets(tls, file, uncompr, int32(uncomprLen))
  1720  	if libc.Xstrlen(tls, uncompr) != size_t(7) { // " hello!"
  1721  		libc.Xfprintf(tls, libc.X__stderrp, ts+272, libc.VaList(bp+64, z.Xgzerror(tls, file, bp+80)))
  1722  		libc.Xexit(tls, 1)
  1723  	}
  1724  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))+uintptr(6)) != 0 {
  1725  		libc.Xfprintf(tls, libc.X__stderrp, ts+301, 0)
  1726  		libc.Xexit(tls, 1)
  1727  	} else {
  1728  		libc.Xprintf(tls, ts+326, libc.VaList(bp+72, uncompr))
  1729  	}
  1730  
  1731  	z.Xgzclose(tls, file)
  1732  }
  1733  
  1734  // ===========================================================================
  1735  // Test deflate() with small buffers
  1736  func test_deflate(tls *libc.TLS, compr uintptr, comprLen uLong) { /* example.c:200:6: */
  1737  	bp := tls.Alloc(120)
  1738  	defer tls.Free(120)
  1739  
  1740  	// var c_stream z_stream at bp+64, 56
  1741  	// compression stream
  1742  	var err int32
  1743  	var len uLong = uLong(libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello)))) + uLong(1)
  1744  
  1745  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zalloc = zalloc
  1746  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zfree = zfree
  1747  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).opaque = uintptr(0)
  1748  
  1749  	err = z.XdeflateInit_(tls, bp+64, -1, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1750  	{
  1751  		if err != 0 {
  1752  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+360, err))
  1753  			libc.Xexit(tls, 1)
  1754  		}
  1755  	}
  1756  
  1757  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello)))
  1758  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_out = compr
  1759  
  1760  	for (*z_stream)(unsafe.Pointer(bp+64)).total_in != len && (*z_stream)(unsafe.Pointer(bp+64)).total_out < comprLen {
  1761  		(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = libc.AssignPtrUint32(bp+64+16, uInt(1)) // force small buffers
  1762  		err = z.Xdeflate(tls, bp+64, 0)
  1763  		{
  1764  			if err != 0 {
  1765  				libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+372, err))
  1766  				libc.Xexit(tls, 1)
  1767  			}
  1768  		}
  1769  
  1770  	}
  1771  	// Finish the stream, still forcing small buffers:
  1772  	for {
  1773  		(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_out = uInt(1)
  1774  		err = z.Xdeflate(tls, bp+64, 4)
  1775  		if err == 1 {
  1776  			break
  1777  		}
  1778  		{
  1779  			if err != 0 {
  1780  				libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+372, err))
  1781  				libc.Xexit(tls, 1)
  1782  			}
  1783  		}
  1784  
  1785  	}
  1786  
  1787  	err = z.XdeflateEnd(tls, bp+64)
  1788  	{
  1789  		if err != 0 {
  1790  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+48, ts+380, err))
  1791  			libc.Xexit(tls, 1)
  1792  		}
  1793  	}
  1794  
  1795  }
  1796  
  1797  // ===========================================================================
  1798  // Test inflate() with small buffers
  1799  func test_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:238:6: */
  1800  	bp := tls.Alloc(112)
  1801  	defer tls.Free(112)
  1802  
  1803  	var err int32
  1804  	// var d_stream z_stream at bp+56, 56
  1805  	// decompression stream
  1806  
  1807  	libc.Xstrcpy(tls, uncompr, ts+43)
  1808  
  1809  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc
  1810  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree
  1811  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0)
  1812  
  1813  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr
  1814  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(0)
  1815  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr
  1816  
  1817  	err = z.XinflateInit_(tls, bp+56, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1818  	{
  1819  		if err != 0 {
  1820  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+391, err))
  1821  			libc.Xexit(tls, 1)
  1822  		}
  1823  	}
  1824  
  1825  	for (*z_stream)(unsafe.Pointer(bp+56)).total_out < uncomprLen && (*z_stream)(unsafe.Pointer(bp+56)).total_in < comprLen {
  1826  		(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = libc.AssignPtrUint32(bp+56+16, uInt(1)) // force small buffers
  1827  		err = z.Xinflate(tls, bp+56, 0)
  1828  		if err == 1 {
  1829  			break
  1830  		}
  1831  		{
  1832  			if err != 0 {
  1833  				libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+403, err))
  1834  				libc.Xexit(tls, 1)
  1835  			}
  1836  		}
  1837  
  1838  	}
  1839  
  1840  	err = z.XinflateEnd(tls, bp+56)
  1841  	{
  1842  		if err != 0 {
  1843  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+411, err))
  1844  			libc.Xexit(tls, 1)
  1845  		}
  1846  	}
  1847  
  1848  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  1849  		libc.Xfprintf(tls, libc.X__stderrp, ts+422, 0)
  1850  		libc.Xexit(tls, 1)
  1851  	} else {
  1852  		libc.Xprintf(tls, ts+435, libc.VaList(bp+48, uncompr))
  1853  	}
  1854  }
  1855  
  1856  // ===========================================================================
  1857  // Test deflate() with large buffers and dynamic change of compression level
  1858  func test_large_deflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:279:6: */
  1859  	bp := tls.Alloc(136)
  1860  	defer tls.Free(136)
  1861  
  1862  	// var c_stream z_stream at bp+80, 56
  1863  	// compression stream
  1864  	var err int32
  1865  
  1866  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).zalloc = zalloc
  1867  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).zfree = zfree
  1868  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).opaque = uintptr(0)
  1869  
  1870  	err = z.XdeflateInit_(tls, bp+80, 1, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1871  	{
  1872  		if err != 0 {
  1873  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+360, err))
  1874  			libc.Xexit(tls, 1)
  1875  		}
  1876  	}
  1877  
  1878  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_out = compr
  1879  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_out = uInt(comprLen)
  1880  
  1881  	// At this point, uncompr is still mostly zeroes, so it should compress
  1882  	// very well:
  1883  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = uncompr
  1884  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(uncomprLen)
  1885  	err = z.Xdeflate(tls, bp+80, 0)
  1886  	{
  1887  		if err != 0 {
  1888  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+372, err))
  1889  			libc.Xexit(tls, 1)
  1890  		}
  1891  	}
  1892  
  1893  	if (*z_stream)(unsafe.Pointer(bp+80)).avail_in != uInt(0) {
  1894  		libc.Xfprintf(tls, libc.X__stderrp, ts+450, 0)
  1895  		libc.Xexit(tls, 1)
  1896  	}
  1897  
  1898  	// Feed in already compressed data and switch to no compression:
  1899  	z.XdeflateParams(tls, bp+80, 0, 0)
  1900  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = compr
  1901  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(comprLen) / uInt(2)
  1902  	err = z.Xdeflate(tls, bp+80, 0)
  1903  	{
  1904  		if err != 0 {
  1905  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+372, err))
  1906  			libc.Xexit(tls, 1)
  1907  		}
  1908  	}
  1909  
  1910  	// Switch back to compressing mode:
  1911  	z.XdeflateParams(tls, bp+80, 9, 1)
  1912  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).next_in = uncompr
  1913  	(*z_stream)(unsafe.Pointer(bp + 80 /* &c_stream */)).avail_in = uInt(uncomprLen)
  1914  	err = z.Xdeflate(tls, bp+80, 0)
  1915  	{
  1916  		if err != 0 {
  1917  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+48, ts+372, err))
  1918  			libc.Xexit(tls, 1)
  1919  		}
  1920  	}
  1921  
  1922  	err = z.Xdeflate(tls, bp+80, 4)
  1923  	if err != 1 {
  1924  		libc.Xfprintf(tls, libc.X__stderrp, ts+470, 0)
  1925  		libc.Xexit(tls, 1)
  1926  	}
  1927  	err = z.XdeflateEnd(tls, bp+80)
  1928  	{
  1929  		if err != 0 {
  1930  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+64, ts+380, err))
  1931  			libc.Xexit(tls, 1)
  1932  		}
  1933  	}
  1934  
  1935  }
  1936  
  1937  // ===========================================================================
  1938  // Test inflate() with large buffers
  1939  func test_large_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:334:6: */
  1940  	bp := tls.Alloc(112)
  1941  	defer tls.Free(112)
  1942  
  1943  	var err int32
  1944  	// var d_stream z_stream at bp+56, 56
  1945  	// decompression stream
  1946  
  1947  	libc.Xstrcpy(tls, uncompr, ts+43)
  1948  
  1949  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc
  1950  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree
  1951  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0)
  1952  
  1953  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr
  1954  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(comprLen)
  1955  
  1956  	err = z.XinflateInit_(tls, bp+56, ts+353, int32(unsafe.Sizeof(z_stream{})))
  1957  	{
  1958  		if err != 0 {
  1959  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+391, err))
  1960  			libc.Xexit(tls, 1)
  1961  		}
  1962  	}
  1963  
  1964  	for {
  1965  		(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr // discard the output
  1966  		(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_out = uInt(uncomprLen)
  1967  		err = z.Xinflate(tls, bp+56, 0)
  1968  		if err == 1 {
  1969  			break
  1970  		}
  1971  		{
  1972  			if err != 0 {
  1973  				libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+506, err))
  1974  				libc.Xexit(tls, 1)
  1975  			}
  1976  		}
  1977  
  1978  	}
  1979  
  1980  	err = z.XinflateEnd(tls, bp+56)
  1981  	{
  1982  		if err != 0 {
  1983  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+411, err))
  1984  			libc.Xexit(tls, 1)
  1985  		}
  1986  	}
  1987  
  1988  	if (*z_stream)(unsafe.Pointer(bp+56)).total_out != uLong(2)*uncomprLen+comprLen/uLong(2) {
  1989  		libc.Xfprintf(tls, libc.X__stderrp, ts+520, libc.VaList(bp+48, (*z_stream)(unsafe.Pointer(bp+56 /* &d_stream */)).total_out))
  1990  		libc.Xexit(tls, 1)
  1991  	} else {
  1992  		libc.Xprintf(tls, ts+544, 0)
  1993  	}
  1994  }
  1995  
  1996  // ===========================================================================
  1997  // Test deflate() with full flush
  1998  func test_flush(tls *libc.TLS, compr uintptr, comprLen uintptr) { /* example.c:375:6: */
  1999  	bp := tls.Alloc(120)
  2000  	defer tls.Free(120)
  2001  
  2002  	// var c_stream z_stream at bp+64, 56
  2003  	// compression stream
  2004  	var err int32
  2005  	var len uInt = libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello))) + uInt(1)
  2006  
  2007  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zalloc = zalloc
  2008  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).zfree = zfree
  2009  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).opaque = uintptr(0)
  2010  
  2011  	err = z.XdeflateInit_(tls, bp+64, -1, ts+353, int32(unsafe.Sizeof(z_stream{})))
  2012  	{
  2013  		if err != 0 {
  2014  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+360, err))
  2015  			libc.Xexit(tls, 1)
  2016  		}
  2017  	}
  2018  
  2019  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello)))
  2020  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).next_out = compr
  2021  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = uInt(3)
  2022  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_out = uInt(*(*uLong)(unsafe.Pointer(comprLen)))
  2023  	err = z.Xdeflate(tls, bp+64, 3)
  2024  	{
  2025  		if err != 0 {
  2026  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+372, err))
  2027  			libc.Xexit(tls, 1)
  2028  		}
  2029  	}
  2030  
  2031  	*(*Byte)(unsafe.Pointer(compr + 3))++ // force an error in first compressed block
  2032  	(*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).avail_in = len - uInt(3)
  2033  
  2034  	err = z.Xdeflate(tls, bp+64, 4)
  2035  	if err != 1 {
  2036  		{
  2037  			if err != 0 {
  2038  				libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+372, err))
  2039  				libc.Xexit(tls, 1)
  2040  			}
  2041  		}
  2042  
  2043  	}
  2044  	err = z.XdeflateEnd(tls, bp+64)
  2045  	{
  2046  		if err != 0 {
  2047  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+48, ts+380, err))
  2048  			libc.Xexit(tls, 1)
  2049  		}
  2050  	}
  2051  
  2052  	*(*uLong)(unsafe.Pointer(comprLen)) = (*z_stream)(unsafe.Pointer(bp + 64 /* &c_stream */)).total_out
  2053  }
  2054  
  2055  // ===========================================================================
  2056  // Test inflateSync()
  2057  func test_sync(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:413:6: */
  2058  	bp := tls.Alloc(128)
  2059  	defer tls.Free(128)
  2060  
  2061  	var err int32
  2062  	// var d_stream z_stream at bp+72, 56
  2063  	// decompression stream
  2064  
  2065  	libc.Xstrcpy(tls, uncompr, ts+43)
  2066  
  2067  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).zalloc = zalloc
  2068  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).zfree = zfree
  2069  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).opaque = uintptr(0)
  2070  
  2071  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).next_in = compr
  2072  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_in = uInt(2) // just read the zlib header
  2073  
  2074  	err = z.XinflateInit_(tls, bp+72, ts+353, int32(unsafe.Sizeof(z_stream{})))
  2075  	{
  2076  		if err != 0 {
  2077  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+391, err))
  2078  			libc.Xexit(tls, 1)
  2079  		}
  2080  	}
  2081  
  2082  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).next_out = uncompr
  2083  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_out = uInt(uncomprLen)
  2084  
  2085  	err = z.Xinflate(tls, bp+72, 0)
  2086  	{
  2087  		if err != 0 {
  2088  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+403, err))
  2089  			libc.Xexit(tls, 1)
  2090  		}
  2091  	}
  2092  
  2093  	(*z_stream)(unsafe.Pointer(bp + 72 /* &d_stream */)).avail_in = uInt(comprLen) - uInt(2) // read all compressed data
  2094  	err = z.XinflateSync(tls, bp+72)                                                         /* but skip the damaged part */
  2095  	{
  2096  		if err != 0 {
  2097  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+565, err))
  2098  			libc.Xexit(tls, 1)
  2099  		}
  2100  	}
  2101  
  2102  	err = z.Xinflate(tls, bp+72, 4)
  2103  	if err != -3 {
  2104  		libc.Xfprintf(tls, libc.X__stderrp, ts+577, 0)
  2105  		// Because of incorrect adler32
  2106  		libc.Xexit(tls, 1)
  2107  	}
  2108  	err = z.XinflateEnd(tls, bp+72)
  2109  	{
  2110  		if err != 0 {
  2111  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+48, ts+411, err))
  2112  			libc.Xexit(tls, 1)
  2113  		}
  2114  	}
  2115  
  2116  	libc.Xprintf(tls, ts+611, libc.VaList(bp+64, uncompr))
  2117  }
  2118  
  2119  // ===========================================================================
  2120  // Test deflate() with preset dictionary
  2121  func test_dict_deflate(tls *libc.TLS, compr uintptr, comprLen uLong) { /* example.c:457:6: */
  2122  	bp := tls.Alloc(104)
  2123  	defer tls.Free(104)
  2124  
  2125  	// var c_stream z_stream at bp+48, 56
  2126  	// compression stream
  2127  	var err int32
  2128  
  2129  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).zalloc = zalloc
  2130  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).zfree = zfree
  2131  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).opaque = uintptr(0)
  2132  
  2133  	err = z.XdeflateInit_(tls, bp+48, 9, ts+353, int32(unsafe.Sizeof(z_stream{})))
  2134  	{
  2135  		if err != 0 {
  2136  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+360, err))
  2137  			libc.Xexit(tls, 1)
  2138  		}
  2139  	}
  2140  
  2141  	err = z.XdeflateSetDictionary(tls, bp+48,
  2142  		uintptr(uintptr(unsafe.Pointer(&dictionary))), uint32(int32(unsafe.Sizeof(dictionary))))
  2143  	{
  2144  		if err != 0 {
  2145  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+639, err))
  2146  			libc.Xexit(tls, 1)
  2147  		}
  2148  	}
  2149  
  2150  	dictId = (*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).adler
  2151  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).next_out = compr
  2152  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).avail_out = uInt(comprLen)
  2153  
  2154  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).next_in = uintptr(uintptr(unsafe.Pointer(&hello)))
  2155  	(*z_stream)(unsafe.Pointer(bp + 48 /* &c_stream */)).avail_in = libc.Xstrlen(tls, uintptr(unsafe.Pointer(&hello))) + uInt(1)
  2156  
  2157  	err = z.Xdeflate(tls, bp+48, 4)
  2158  	if err != 1 {
  2159  		libc.Xfprintf(tls, libc.X__stderrp, ts+470, 0)
  2160  		libc.Xexit(tls, 1)
  2161  	}
  2162  	err = z.XdeflateEnd(tls, bp+48)
  2163  	{
  2164  		if err != 0 {
  2165  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+380, err))
  2166  			libc.Xexit(tls, 1)
  2167  		}
  2168  	}
  2169  
  2170  }
  2171  
  2172  // ===========================================================================
  2173  // Test inflate() with a preset dictionary
  2174  func test_dict_inflate(tls *libc.TLS, compr uintptr, comprLen uLong, uncompr uintptr, uncomprLen uLong) { /* example.c:494:6: */
  2175  	bp := tls.Alloc(112)
  2176  	defer tls.Free(112)
  2177  
  2178  	var err int32
  2179  	// var d_stream z_stream at bp+56, 56
  2180  	// decompression stream
  2181  
  2182  	libc.Xstrcpy(tls, uncompr, ts+43)
  2183  
  2184  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zalloc = zalloc
  2185  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).zfree = zfree
  2186  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).opaque = uintptr(0)
  2187  
  2188  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_in = compr
  2189  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_in = uInt(comprLen)
  2190  
  2191  	err = z.XinflateInit_(tls, bp+56, ts+353, int32(unsafe.Sizeof(z_stream{})))
  2192  	{
  2193  		if err != 0 {
  2194  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp, ts+391, err))
  2195  			libc.Xexit(tls, 1)
  2196  		}
  2197  	}
  2198  
  2199  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).next_out = uncompr
  2200  	(*z_stream)(unsafe.Pointer(bp + 56 /* &d_stream */)).avail_out = uInt(uncomprLen)
  2201  
  2202  	for {
  2203  		err = z.Xinflate(tls, bp+56, 0)
  2204  		if err == 1 {
  2205  			break
  2206  		}
  2207  		if err == 2 {
  2208  			if (*z_stream)(unsafe.Pointer(bp+56)).adler != dictId {
  2209  				libc.Xfprintf(tls, libc.X__stderrp, ts+660, 0)
  2210  				libc.Xexit(tls, 1)
  2211  			}
  2212  			err = z.XinflateSetDictionary(tls, bp+56, uintptr(uintptr(unsafe.Pointer(&dictionary))),
  2213  				uint32(int32(unsafe.Sizeof(dictionary))))
  2214  		}
  2215  		{
  2216  			if err != 0 {
  2217  				libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+16, ts+682, err))
  2218  				libc.Xexit(tls, 1)
  2219  			}
  2220  		}
  2221  
  2222  	}
  2223  
  2224  	err = z.XinflateEnd(tls, bp+56)
  2225  	{
  2226  		if err != 0 {
  2227  			libc.Xfprintf(tls, libc.X__stderrp, ts+20, libc.VaList(bp+32, ts+411, err))
  2228  			libc.Xexit(tls, 1)
  2229  		}
  2230  	}
  2231  
  2232  	if libc.Xstrcmp(tls, uncompr, uintptr(unsafe.Pointer(&hello))) != 0 {
  2233  		libc.Xfprintf(tls, libc.X__stderrp, ts+700, 0)
  2234  		libc.Xexit(tls, 1)
  2235  	} else {
  2236  		libc.Xprintf(tls, ts+723, libc.VaList(bp+48, uncompr))
  2237  	}
  2238  }
  2239  
  2240  // ===========================================================================
  2241  // Usage:  example [output.gz  [input.gz]]
  2242  
  2243  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* example.c:545:5: */
  2244  	bp := tls.Alloc(28)
  2245  	defer tls.Free(28)
  2246  
  2247  	var compr uintptr
  2248  	var uncompr uintptr
  2249  	*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) = uint32(10000) * uint32(unsafe.Sizeof(int32(0))) // don't overflow on MSDOS
  2250  	var uncomprLen uLong = *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */))
  2251  
  2252  	if int32(*(*int8)(unsafe.Pointer(z.XzlibVersion(tls)))) != int32(*(*int8)(unsafe.Pointer(myVersion))) {
  2253  		libc.Xfprintf(tls, libc.X__stderrp, ts+752, 0)
  2254  		libc.Xexit(tls, 1)
  2255  
  2256  	} else if libc.Xstrcmp(tls, z.XzlibVersion(tls), ts+353) != 0 {
  2257  		libc.Xfprintf(tls, libc.X__stderrp, ts+779, 0)
  2258  	}
  2259  
  2260  	libc.Xprintf(tls, ts+812,
  2261  		libc.VaList(bp, ts+353, 0x12b0, z.XzlibCompileFlags(tls)))
  2262  
  2263  	compr = libc.Xcalloc(tls, uInt(*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */))), uint32(1))
  2264  	uncompr = libc.Xcalloc(tls, uInt(uncomprLen), uint32(1))
  2265  	// compr and uncompr are cleared to avoid reading uninitialized
  2266  	// data and to ensure that uncompr compresses well.
  2267  	if compr == uintptr(0) || uncompr == uintptr(0) {
  2268  		libc.Xprintf(tls, ts+861, 0)
  2269  		libc.Xexit(tls, 1)
  2270  	}
  2271  
  2272  	test_compress(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2273  
  2274  	test_gzio(tls, func() uintptr {
  2275  		if argc > 1 {
  2276  			return *(*uintptr)(unsafe.Pointer(argv + 1*4))
  2277  		}
  2278  		return ts + 876
  2279  	}(),
  2280  		uncompr, uncomprLen)
  2281  
  2282  	test_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)))
  2283  	test_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2284  
  2285  	test_large_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2286  	test_large_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2287  
  2288  	test_flush(tls, compr, bp+24)
  2289  	test_sync(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2290  	*(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)) = uncomprLen
  2291  
  2292  	test_dict_deflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)))
  2293  	test_dict_inflate(tls, compr, *(*uLong)(unsafe.Pointer(bp + 24 /* comprLen */)), uncompr, uncomprLen)
  2294  
  2295  	libc.Xfree(tls, compr)
  2296  	libc.Xfree(tls, uncompr)
  2297  
  2298  	return 0
  2299  }
  2300  
  2301  var myVersion uintptr = ts + 353 /* "1.2.11" */ /* example.c:552:22 */
  2302  
  2303  var ts1 = "hello, hello!\x00hello\x00%s error: %d\n\x00compress\x00garbage\x00uncompress\x00bad uncompress\n\x00uncompress(): %s\n\x00wb\x00gzopen error\n\x00ello\x00gzputs err: %s\n\x00, %s!\x00gzprintf err: %s\n\x00rb\x00gzread err: %s\n\x00bad gzread: %s\n\x00gzread(): %s\n\x00gzseek error, pos=%ld, gztell=%ld\n\x00gzgetc error\n\x00gzungetc error\n\x00gzgets err after gzseek: %s\n\x00bad gzgets after gzseek\n\x00gzgets() after gzseek: %s\n\x001.2.11\x00deflateInit\x00deflate\x00deflateEnd\x00inflateInit\x00inflate\x00inflateEnd\x00bad inflate\n\x00inflate(): %s\n\x00deflate not greedy\n\x00deflate should report Z_STREAM_END\n\x00large inflate\x00bad large inflate: %ld\n\x00large_inflate(): OK\n\x00inflateSync\x00inflate should report DATA_ERROR\n\x00after inflateSync(): hel%s\n\x00deflateSetDictionary\x00unexpected dictionary\x00inflate with dict\x00bad inflate with dict\n\x00inflate with dictionary: %s\n\x00incompatible zlib version\n\x00warning: different zlib version\n\x00zlib version %s = 0x%04x, compile flags = 0x%lx\n\x00out of memory\n\x00foo.gz\x00"
  2304  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data