#ifndef _STDLIB_H_
#define _STDLIB_H_
#include <Availability.h>
#include <sys/cdefs.h>
#include <_types.h>
#if !defined(_ANSI_SOURCE)
#ifndef UNIFDEF_DRIVERKIT
#include <sys/wait.h>
#endif
#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#include <alloca.h>
#endif
#endif
#include <sys/_types/_size_t.h>
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#include <sys/_types/_ct_rune_t.h>
#include <sys/_types/_rune_t.h>
#endif
#include <sys/_types/_wchar_t.h>
typedef struct {
int quot;
int rem;
} div_t;
typedef struct {
long quot;
long rem;
} ldiv_t;
#if !__DARWIN_NO_LONG_LONG
typedef struct {
long long quot;
long long rem;
} lldiv_t;
#endif
#include <sys/_types/_null.h>
#ifndef UNIFDEF_DRIVERKIT
#define EXIT_FAILURE 1
#define EXIT_SUCCESS 0
#endif
#define RAND_MAX 0x7fffffff
#ifdef _USE_EXTENDED_LOCALES_
#include <_xlocale.h>
#endif
#ifndef MB_CUR_MAX
#ifdef _USE_EXTENDED_LOCALES_
#define MB_CUR_MAX (___mb_cur_max())
#ifndef MB_CUR_MAX_L
#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x))
#endif
#else
extern int __mb_cur_max;
#define MB_CUR_MAX __mb_cur_max
#endif
#endif
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) \
&& defined(_USE_EXTENDED_LOCALES_) && !defined(MB_CUR_MAX_L)
#define MB_CUR_MAX_L(x) (___mb_cur_max_l(x))
#endif
#include "libc_private.h"
#define LIBC_ABORT(f,...) abort_report_np("%s:%s:%u: " f, __FILE__, __func__, __LINE__, ## __VA_ARGS__)
#ifndef UNIFDEF_DRIVERKIT
#include <malloc/_malloc.h>
#endif
__BEGIN_DECLS
void abort(void) __cold __dead2;
int abs(int) __pure2;
#ifndef UNIFDEF_DRIVERKIT
int atexit(void (* _Nonnull)(void));
#endif
double atof(const char *);
int atoi(const char *);
long atol(const char *);
#if !__DARWIN_NO_LONG_LONG
long long
atoll(const char *);
#endif
void *bsearch(const void *__key, const void *__base, size_t __nel,
size_t __width, int (* _Nonnull __compar)(const void *, const void *));
#ifndef UNIFDEF_DRIVERKIT
#endif
div_t div(int, int) __pure2;
#ifndef UNIFDEF_DRIVERKIT
void exit(int) __dead2;
char *getenv(const char *);
#endif
long labs(long) __pure2;
ldiv_t ldiv(long, long) __pure2;
#if !__DARWIN_NO_LONG_LONG
long long
llabs(long long);
lldiv_t lldiv(long long, long long);
#endif
#ifndef UNIFDEF_DRIVERKIT
#endif
int mblen(const char *__s, size_t __n);
size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
#ifndef UNIFDEF_DRIVERKIT
#endif
void qsort(void *__base, size_t __nel, size_t __width,
int (* _Nonnull __compar)(const void *, const void *));
#ifndef UNIFDEF_DRIVERKIT
int rand(void) __swift_unavailable("Use arc4random instead.");
void srand(unsigned) __swift_unavailable("Use arc4random instead.");
#endif
double strtod(const char *, char **) __DARWIN_ALIAS(strtod);
float strtof(const char *, char **) __DARWIN_ALIAS(strtof);
long strtol(const char *__str, char **__endptr, int __base);
long double
strtold(const char *, char **);
#if !__DARWIN_NO_LONG_LONG
long long
strtoll(const char *__str, char **__endptr, int __base);
#endif
unsigned long
strtoul(const char *__str, char **__endptr, int __base);
#if !__DARWIN_NO_LONG_LONG
unsigned long long
strtoull(const char *__str, char **__endptr, int __base);
#endif
#ifndef UNIFDEF_DRIVERKIT
#ifndef LIBC_ALIAS_SYSTEM
#if TARGET_OS_EMBEDDED
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(ios_msg)
#else
#define __swift_unavailable_on(osx_msg, ios_msg) __swift_unavailable(osx_msg)
#endif
__swift_unavailable_on("Use posix_spawn APIs or NSTask instead.", "Process spawning is unavailable")
__API_AVAILABLE(macos(10.0)) __IOS_PROHIBITED
__WATCHOS_PROHIBITED __TVOS_PROHIBITED
int system(const char *) __DARWIN_ALIAS_C(system);
#else
int system(const char *) LIBC_ALIAS_C(system);
#endif
#undef __swift_unavailable_on
#endif
size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
int wctomb(char *, wchar_t);
#ifndef UNIFDEF_DRIVERKIT
#ifndef _ANSI_SOURCE
void _Exit(int) __dead2;
long a64l(const char *);
double drand48(void);
char *ecvt(double, int, int *__restrict, int *__restrict);
double erand48(unsigned short[3]);
char *fcvt(double, int, int *__restrict, int *__restrict);
char *gcvt(double, int, char *);
int getsubopt(char **, char * const *, char **);
int grantpt(int);
#if __DARWIN_UNIX03
char *initstate(unsigned, char *, size_t);
#else
char *initstate(unsigned long, char *, long);
#endif
long jrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead.");
char *l64a(long);
void lcong48(unsigned short[7]);
long lrand48(void) __swift_unavailable("Use arc4random instead.");
char *mktemp(char *);
int mkstemp(char *);
long mrand48(void) __swift_unavailable("Use arc4random instead.");
long nrand48(unsigned short[3]) __swift_unavailable("Use arc4random instead.");
int posix_openpt(int);
char *ptsname(int);
#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
int ptsname_r(int fildes, char *buffer, size_t buflen) __API_AVAILABLE(macos(10.13.4), ios(11.3), tvos(11.3), watchos(4.3));
#endif
#ifndef LIBC_ALIAS_PUTENV
int putenv(char *) __DARWIN_ALIAS(putenv);
#else
int putenv(char *) LIBC_ALIAS(putenv);
#endif
long random(void) __swift_unavailable("Use arc4random instead.");
int rand_r(unsigned *) __swift_unavailable("Use arc4random instead.");
#ifdef __LIBC__
#ifndef LIBC_ALIAS_REALPATH
char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath);
#else
#ifdef VARIANT_DARWINEXTSN
char *realpath(const char * __restrict, char * __restrict) LIBC_EXTSN(realpath);
#else
char *realpath(const char * __restrict, char * __restrict) LIBC_ALIAS(realpath);
#endif
#endif
#else
#if (__DARWIN_UNIX03 && !defined(_POSIX_C_SOURCE)) || defined(_DARWIN_C_SOURCE) || defined(_DARWIN_BETTER_REALPATH)
char *realpath(const char * __restrict, char * __restrict) __DARWIN_EXTSN(realpath);
#else
char *realpath(const char * __restrict, char * __restrict) __DARWIN_ALIAS(realpath);
#endif
#endif
unsigned short
*seed48(unsigned short[3]);
#ifndef LIBC_ALIAS_SETENV
int setenv(const char * __name, const char * __value, int __overwrite) __DARWIN_ALIAS(setenv);
#else
int setenv(const char * __name, const char * __value, int __overwrite) LIBC_ALIAS(setenv);
#endif
#if __DARWIN_UNIX03
#ifndef LIBC_ALIAS_SETKEY
void setkey(const char *) __DARWIN_ALIAS(setkey);
#else
void setkey(const char *) LIBC_ALIAS(setkey);
#endif
#else
int setkey(const char *);
#endif
char *setstate(const char *);
void srand48(long);
#if __DARWIN_UNIX03
void srandom(unsigned);
#else
void srandom(unsigned long);
#endif
int unlockpt(int);
#if __DARWIN_UNIX03
#ifndef LIBC_ALIAS_UNSETENV
int unsetenv(const char *) __DARWIN_ALIAS(unsetenv);
#else
int unsetenv(const char *) LIBC_ALIAS(unsetenv);
#endif
#else
void unsetenv(const char *);
#endif
#endif
#endif
#if !defined(_ANSI_SOURCE) && (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#include <machine/types.h>
#ifndef UNIFDEF_DRIVERKIT
#include <sys/_types/_dev_t.h>
#include <sys/_types/_mode_t.h>
#endif
#include <_types/_uint32_t.h>
uint32_t arc4random(void);
#ifndef UNIFDEF_DRIVERKIT
void arc4random_addrandom(unsigned char * , int )
__OSX_DEPRECATED(10.0, 10.12, "use arc4random_stir")
__IOS_DEPRECATED(2.0, 10.0, "use arc4random_stir")
__TVOS_DEPRECATED(2.0, 10.0, "use arc4random_stir")
__WATCHOS_DEPRECATED(1.0, 3.0, "use arc4random_stir");
#endif
void arc4random_buf(void * __buf, size_t __nbytes) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
void arc4random_stir(void);
uint32_t
arc4random_uniform(uint32_t __upper_bound) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
#ifdef __BLOCKS__
#ifndef UNIFDEF_DRIVERKIT
int atexit_b(void (^ _Nonnull)(void)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
void *bsearch_b(const void *__key, const void *__base, size_t __nel,
size_t __width, int (^ _Nonnull __compar)(const void *, const void *)) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
#ifndef UNIFDEF_DRIVERKIT
char *cgetcap(char *, const char *, int);
int cgetclose(void);
int cgetent(char **, char **, const char *);
int cgetfirst(char **, char **);
int cgetmatch(const char *, const char *);
int cgetnext(char **, char **);
int cgetnum(char *, const char *, long *);
int cgetset(const char *);
int cgetstr(char *, const char *, char **);
int cgetustr(char *, const char *, char **);
int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
char *devname(dev_t, mode_t);
char *devname_r(dev_t, mode_t, char *buf, int len);
char *getbsize(int *, long *);
int getloadavg(double [], int);
const char
*getprogname(void);
void setprogname(const char *);
#endif
#ifdef __BLOCKS__
#if __has_attribute(noescape)
#define __sort_noescape __attribute__((__noescape__))
#else
#define __sort_noescape
#endif
#endif
int heapsort(void *__base, size_t __nel, size_t __width,
int (* _Nonnull __compar)(const void *, const void *));
#ifdef __BLOCKS__
int heapsort_b(void *__base, size_t __nel, size_t __width,
int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
int mergesort(void *__base, size_t __nel, size_t __width,
int (* _Nonnull __compar)(const void *, const void *));
#ifdef __BLOCKS__
int mergesort_b(void *__base, size_t __nel, size_t __width,
int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
#ifndef UNIFDEF_DRIVERKIT
void psort(void *__base, size_t __nel, size_t __width,
int (* _Nonnull __compar)(const void *, const void *))
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#ifdef __BLOCKS__
void psort_b(void *__base, size_t __nel, size_t __width,
int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
void psort_r(void *__base, size_t __nel, size_t __width, void *,
int (* _Nonnull __compar)(void *, const void *, const void *))
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
#ifdef __BLOCKS__
void qsort_b(void *__base, size_t __nel, size_t __width,
int (^ _Nonnull __compar)(const void *, const void *) __sort_noescape)
__OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
#endif
void qsort_r(void *__base, size_t __nel, size_t __width, void *,
int (* _Nonnull __compar)(void *, const void *, const void *));
int radixsort(const unsigned char **__base, int __nel, const unsigned char *__table,
unsigned __endbyte);
int rpmatch(const char *)
__API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0), watchos(6.0));
int sradixsort(const unsigned char **__base, int __nel, const unsigned char *__table,
unsigned __endbyte);
#ifndef UNIFDEF_DRIVERKIT
void sranddev(void);
void srandomdev(void);
void *reallocf(void *__ptr, size_t __size) __alloc_size(2);
#endif
#if !__DARWIN_NO_LONG_LONG
long long
strtoq(const char *__str, char **__endptr, int __base);
unsigned long long
strtouq(const char *__str, char **__endptr, int __base);
#endif
#ifndef UNIFDEF_DRIVERKIT
extern char *suboptarg;
#endif
#endif
#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
#pragma GCC poison mbstowcs mbtowc wcstombs wctomb
#endif
__END_DECLS
#ifdef _USE_EXTENDED_LOCALES_
#include <xlocale/_stdlib.h>
#endif
#endif