require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_POSIX_SOURCE)) {
    eval 'sub _POSIX_SOURCE () {1;}' unless defined(&_POSIX_SOURCE);
}
require 'errno.ph';
unless(defined(&__set_errno)) {
    eval 'sub __set_errno {
        my($Val) = @_;
	    eval q( &errno = ($Val));
    }' unless defined(&__set_errno);
}
if(defined(&_IO_MTSAFE_IO)) {
    if(defined (defined(&__GLIBC__) ? &__GLIBC__ : 0)  && (defined(&__GLIBC__) ? &__GLIBC__ : 0) >= 2) {
	if((defined(&__GLIBC_MINOR__) ? &__GLIBC_MINOR__ : 0) > 0) {
	    require 'bits/libc-lock.ph';
	} else {
	    require 'libc-lock.ph';
	}
    } else {
    }
}
require 'iolibio.ph';
if(defined(&__cplusplus)) {
}
unless(defined(&_IO_seek_set)) {
    sub _IO_seek_set () {	0;}
}
unless(defined(&_IO_seek_cur)) {
    sub _IO_seek_cur () {	1;}
}
unless(defined(&_IO_seek_end)) {
    sub _IO_seek_end () {	2;}
}
unless(defined(&_IO_JUMPS)) {
    sub _IO_JUMPS {
	my($THIS) = @_;
	eval q(( ($THIS))-> &vtable);
    }
}
if(defined(&_G_USING_THUNKS)) {
    eval 'sub JUMP_FIELD {
        my($TYPE, $NAME) = @_;
	    eval q($TYPE $NAME);
    }' unless defined(&JUMP_FIELD);
    eval 'sub JUMP0 {
        my($FUNC, $THIS) = @_;
	    eval q( &_IO_JUMPS($THIS)->$FUNC ($THIS));
    }' unless defined(&JUMP0);
    eval 'sub JUMP1 {
        my($FUNC, $THIS, $X1) = @_;
	    eval q( &_IO_JUMPS($THIS)->$FUNC ($THIS, $X1));
    }' unless defined(&JUMP1);
    eval 'sub JUMP2 {
        my($FUNC, $THIS, $X1, $X2) = @_;
	    eval q( &_IO_JUMPS($THIS)->$FUNC ($THIS, $X1, $X2));
    }' unless defined(&JUMP2);
    eval 'sub JUMP3 {
        my($FUNC, $THIS, $X1,$X2,$X3) = @_;
	    eval q( &_IO_JUMPS($THIS)->$FUNC ($THIS, $X1,$X2, $X3));
    }' unless defined(&JUMP3);
    eval 'sub JUMP_INIT {
        my($NAME, $VALUE) = @_;
	    eval q($VALUE);
    }' unless defined(&JUMP_INIT);
    eval 'sub JUMP_INIT_DUMMY () { &JUMP_INIT( &dummy, 0),  &JUMP_INIT ( &dummy2, 0);}' unless defined(&JUMP_INIT_DUMMY);
} else {
    eval 'sub JUMP_FIELD {
        my($TYPE, $NAME) = @_;
	    eval q(\'struct struct\' { \'short delta1\',  &delta2; $TYPE  &pfn; } $NAME);
    }' unless defined(&JUMP_FIELD);
    eval 'sub JUMP0 {
        my($FUNC, $THIS) = @_;
	    eval q( &_IO_JUMPS($THIS)-> ($FUNC->{pfn}) ($THIS));
    }' unless defined(&JUMP0);
    eval 'sub JUMP1 {
        my($FUNC, $THIS, $X1) = @_;
	    eval q( &_IO_JUMPS($THIS)-> ($FUNC->{pfn}) ($THIS, $X1));
    }' unless defined(&JUMP1);
    eval 'sub JUMP2 {
        my($FUNC, $THIS, $X1, $X2) = @_;
	    eval q( &_IO_JUMPS($THIS)-> ($FUNC->{pfn}) ($THIS, $X1, $X2));
    }' unless defined(&JUMP2);
    eval 'sub JUMP3 {
        my($FUNC, $THIS, $X1,$X2,$X3) = @_;
	    eval q( &_IO_JUMPS($THIS)-> ($FUNC->{pfn}) ($THIS, $X1,$X2,$X3));
    }' unless defined(&JUMP3);
    eval 'sub JUMP_INIT {
        my($NAME, $VALUE) = @_;
	    eval q({0, 0, $VALUE});
    }' unless defined(&JUMP_INIT);
    eval 'sub JUMP_INIT_DUMMY () { &JUMP_INIT( &dummy, 0);}' unless defined(&JUMP_INIT_DUMMY);
}
unless(defined(&_IO_FINISH)) {
    sub _IO_FINISH {
	my($FP) = @_;
	eval q( &JUMP1 ( &__finish, $FP, 0));
    }
}
unless(defined(&_IO_OVERFLOW)) {
    sub _IO_OVERFLOW {
	my($FP, $CH) = @_;
	eval q( &JUMP1 ( &__overflow, $FP, $CH));
    }
}
unless(defined(&_IO_UNDERFLOW)) {
    sub _IO_UNDERFLOW {
	my($FP) = @_;
	eval q( &JUMP0 ( &__underflow, $FP));
    }
}
unless(defined(&_IO_UFLOW)) {
    sub _IO_UFLOW {
	my($FP) = @_;
	eval q( &JUMP0 ( &__uflow, $FP));
    }
}
unless(defined(&_IO_PBACKFAIL)) {
    sub _IO_PBACKFAIL {
	my($FP, $CH) = @_;
	eval q( &JUMP1 ( &__pbackfail, $FP, $CH));
    }
}
unless(defined(&_IO_XSPUTN)) {
    sub _IO_XSPUTN {
	my($FP, $DATA, $N) = @_;
	eval q( &JUMP2 ( &__xsputn, $FP, $DATA, $N));
    }
}
unless(defined(&_IO_XSGETN)) {
    sub _IO_XSGETN {
	my($FP, $DATA, $N) = @_;
	eval q( &JUMP2 ( &__xsgetn, $FP, $DATA, $N));
    }
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&_IO_SEEKOFF)) {
    sub _IO_SEEKOFF {
	my($FP, $OFF, $DIR, $MODE) = @_;
	eval q( &JUMP3 ( &__seekoff, $FP, $OFF, $DIR, $MODE));
    }
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&_IO_SEEKPOS)) {
    sub _IO_SEEKPOS {
	my($FP, $POS, $FLAGS) = @_;
	eval q( &JUMP2 ( &__seekpos, $FP, $POS, $FLAGS));
    }
}
unless(defined(&_IO_SETBUF)) {
    sub _IO_SETBUF {
	my($FP, $BUFFER, $LENGTH) = @_;
	eval q( &JUMP2 ( &__setbuf, $FP, $BUFFER, $LENGTH));
    }
}
unless(defined(&_IO_SYNC)) {
    sub _IO_SYNC {
	my($FP) = @_;
	eval q( &JUMP0 ( &__sync, $FP));
    }
}
unless(defined(&_IO_DOALLOCATE)) {
    sub _IO_DOALLOCATE {
	my($FP) = @_;
	eval q( &JUMP0 ( &__doallocate, $FP));
    }
}
unless(defined(&_IO_SYSREAD)) {
    sub _IO_SYSREAD {
	my($FP, $DATA, $LEN) = @_;
	eval q( &JUMP2 ( &__read, $FP, $DATA, $LEN));
    }
}
unless(defined(&_IO_SYSWRITE)) {
    sub _IO_SYSWRITE {
	my($FP, $DATA, $LEN) = @_;
	eval q( &JUMP2 ( &__write, $FP, $DATA, $LEN));
    }
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&_IO_SYSSEEK)) {
    sub _IO_SYSSEEK {
	my($FP, $OFFSET, $MODE) = @_;
	eval q( &JUMP2 ( &__seek, $FP, $OFFSET, $MODE));
    }
}
unless(defined(&_IO_SYSCLOSE)) {
    sub _IO_SYSCLOSE {
	my($FP) = @_;
	eval q( &JUMP0 ( &__close, $FP));
    }
}
unless(defined(&_IO_SYSSTAT)) {
    sub _IO_SYSSTAT {
	my($FP, $BUF) = @_;
	eval q( &JUMP1 ( &__stat, $FP, $BUF));
    }
}
if((defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
    eval 'sub _IO_SHOWMANYC {
        my($FP) = @_;
	    eval q( &JUMP0 ( &__showmanyc, $FP));
    }' unless defined(&_IO_SHOWMANYC);
    eval 'sub _IO_IMBUE {
        my($FP, $LOCALE) = @_;
	    eval q( &JUMP1 ( &__imbue, $FP, $LOCALE));
    }' unless defined(&_IO_IMBUE);
}
unless(defined(&_IO_CHAR_TYPE)) {
    sub _IO_CHAR_TYPE () {	'char';}
}
unless(defined(&_IO_INT_TYPE)) {
    sub _IO_INT_TYPE () {	'int';}
}
if(defined(&_G_USING_THUNKS)) {
}
if((defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
}
if(0) {
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&_IO_sputn)) {
    sub _IO_sputn {
	my($__fp, $__s, $__n) = @_;
	eval q( &_IO_XSPUTN ($__fp, $__s, $__n));
    }
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&_IO_default_close)) {
    sub _IO_default_close () {	(( &_IO_close_t)  &_IO_default_sync);}
}
unless(defined(&_IO_do_flush)) {
    sub _IO_do_flush {
	my($_f) = @_;
	eval q( &_IO_do_write($_f, ($_f)-> &_IO_write_base, ($_f)-> &_IO_write_ptr-($_f)-> &_IO_write_base));
    }
}
unless(defined(&_IO_in_put_mode)) {
    sub _IO_in_put_mode {
	my($_fp) = @_;
	eval q((($_fp)-> &_flags &  &_IO_CURRENTLY_PUTTING));
    }
}
unless(defined(&_IO_mask_flags)) {
    sub _IO_mask_flags {
	my($fp, $f, $mask) = @_;
	eval q((($fp)-> &_flags = (($fp)-> &_flags & ~($mask)) | (($f) & ($mask))));
    }
}
unless(defined(&_IO_setg)) {
    sub _IO_setg {
	my($fp, $eb, $g, $eg) = @_;
	eval q((($fp)-> &_IO_read_base = ($eb), ($fp)-> &_IO_read_ptr = ($g), ($fp)-> &_IO_read_end = ($eg)));
    }
}
unless(defined(&_IO_setp)) {
    sub _IO_setp {
	my($__fp, $__p, $__ep) = @_;
	eval q((($__fp)-> &_IO_write_base = ($__fp)-> &_IO_write_ptr = $__p, ($__fp)-> &_IO_write_end = ($__ep)));
    }
}
unless(defined(&_IO_have_backup)) {
    sub _IO_have_backup {
	my($fp) = @_;
	eval q((($fp)-> &_IO_save_base !=  &NULL));
    }
}
unless(defined(&_IO_in_backup)) {
    sub _IO_in_backup {
	my($fp) = @_;
	eval q((($fp)-> &_flags &  &_IO_IN_BACKUP));
    }
}
unless(defined(&_IO_have_markers)) {
    sub _IO_have_markers {
	my($fp) = @_;
	eval q((($fp)-> &_markers !=  &NULL));
    }
}
unless(defined(&_IO_blen)) {
    sub _IO_blen {
	my($fp) = @_;
	eval q((($fp)-> &_IO_buf_end - ($fp)-> &_IO_buf_base));
    }
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&_IO_file_is_open)) {
    sub _IO_file_is_open {
	my($__fp) = @_;
	eval q((($__fp)-> &_fileno >= 0));
    }
}
if((defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
} else {
}
unless(defined(&EOF)) {
    eval 'sub EOF () {(-1);}' unless defined(&EOF);
}
unless(defined(&NULL)) {
    if(defined (defined(&__GNUG__) ? &__GNUG__ : 0)  && ((defined(&__GNUC__) ? &__GNUC__ : 0) > 2|| ((defined(&__GNUC__) ? &__GNUC__ : 0) == 2 && (defined(&__GNUC_MINOR__) ? &__GNUC_MINOR__ : 0) >= 8))) {
	eval 'sub NULL () {( &__null);}' unless defined(&NULL);
    } else {
	if(!defined( &__cplusplus)) {
	    eval 'sub NULL () {(( &void*)0);}' unless defined(&NULL);
	} else {
	    eval 'sub NULL () {(0);}' unless defined(&NULL);
	}
    }
}
if((defined(&_G_HAVE_MMAP) ? &_G_HAVE_MMAP : 0)) {
    require 'unistd.ph';
    require 'fcntl.ph';
    require 'sys/mman.ph';
    require 'sys/param.ph';
    if(!defined( &MAP_ANONYMOUS)  && defined( &MAP_ANON)) {
	eval 'sub MAP_ANONYMOUS () { &MAP_ANON;}' unless defined(&MAP_ANONYMOUS);
    }
    if(!defined( &MAP_ANONYMOUS) || !defined( &EXEC_PAGESIZE)) {
	undef(&_G_HAVE_MMAP) if defined(&_G_HAVE_MMAP);
	eval 'sub _G_HAVE_MMAP () {0;}' unless defined(&_G_HAVE_MMAP);
    }
}
if((defined(&_G_HAVE_MMAP) ? &_G_HAVE_MMAP : 0)) {
    if(defined(&_LIBC)) {
	eval 'sub mmap () { &__mmap;}' unless defined(&mmap);
	eval 'sub munmap () { &__munmap;}' unless defined(&munmap);
    }
    eval 'sub ROUND_TO_PAGE {
        my($_S) = @_;
	    eval q(((($_S) +  &EXEC_PAGESIZE - 1) & ~( &EXEC_PAGESIZE - 1)));
    }' unless defined(&ROUND_TO_PAGE);
    eval 'sub FREE_BUF {
        my($_B, $_S) = @_;
	    eval q( &munmap (($_B),  &ROUND_TO_PAGE ($_S)));
    }' unless defined(&FREE_BUF);
    eval 'sub ALLOC_BUF {
        my($_B, $_S, $_R) = @_;
	    eval q( &do { =  &mmap (0,  &ROUND_TO_PAGE ($_S),  &PROT_READ |  &PROT_WRITE,  &MAP_PRIVATE |  &MAP_ANONYMOUS, -1, 0);  &if (($_B) ==  -1)  &return ($_R); }  &while (0));
    }' unless defined(&ALLOC_BUF);
} else {
    eval 'sub FREE_BUF {
        my($_B, $_S) = @_;
	    eval q( &free($_B));
    }' unless defined(&FREE_BUF);
    eval 'sub ALLOC_BUF {
        my($_B, $_S, $_R) = @_;
	    eval q( &do { =  &malloc($_S);  &if (($_B) ==  &NULL)  &return ($_R); }  &while (0));
    }' unless defined(&ALLOC_BUF);
}
unless(defined(&OS_FSTAT)) {
    eval 'sub OS_FSTAT () { &fstat;}' unless defined(&OS_FSTAT);
}
unless(defined(&_IO_pos_BAD)) {
    if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
	eval 'sub _IO_pos_BAD () {(( &_IO_off64_t) -1);}' unless defined(&_IO_pos_BAD);
    } else {
	eval 'sub _IO_pos_BAD () {(( &_IO_off_t) -1);}' unless defined(&_IO_pos_BAD);
    }
}
unless(defined(&_IO_pos_as_off)) {
    if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
	eval 'sub _IO_pos_as_off {
	    my($__pos) = @_;
    	    eval q((( &_IO_off64_t) ($__pos)));
	}' unless defined(&_IO_pos_as_off);
    } else {
	eval 'sub _IO_pos_as_off {
	    my($__pos) = @_;
    	    eval q((( &_IO_off_t) ($__pos)));
	}' unless defined(&_IO_pos_as_off);
    }
}
unless(defined(&_IO_pos_adjust)) {
    eval 'sub _IO_pos_adjust {
        my($__pos, $__delta) = @_;
	    eval q((($__pos) += ($__delta)));
    }' unless defined(&_IO_pos_adjust);
}
unless(defined(&_IO_pos_0)) {
    if(defined( &_G_IO_IO_FILE_VERSION)  && (defined(&_G_IO_IO_FILE_VERSION) ? &_G_IO_IO_FILE_VERSION : 0) == 0x20001) {
	eval 'sub _IO_pos_0 () {(( &_IO_fpos64_t) 0);}' unless defined(&_IO_pos_0);
    } else {
	eval 'sub _IO_pos_0 () {(( &_IO_fpos_t) 0);}' unless defined(&_IO_pos_0);
    }
}
if(defined(&__cplusplus)) {
}
if(defined(&_IO_MTSAFE_IO)) {
    eval 'sub FILEBUF_LITERAL {
        my($CHAIN, $FLAGS, $FD) = @_;
	    eval q({  &_IO_MAGIC+ &_IO_LINKED+ &_IO_IS_FILEBUF+$FLAGS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $CHAIN, $FD, 0, 0, 0, 0, { 0}, & &_IO_stdfile_$FD &_lock });
    }' unless defined(&FILEBUF_LITERAL);
} else {
    eval 'sub FILEBUF_LITERAL {
        my($CHAIN, $FLAGS, $FD) = @_;
	    eval q({  &_IO_MAGIC+ &_IO_LINKED+ &_IO_IS_FILEBUF+$FLAGS, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, $CHAIN, $FD });
    }' unless defined(&FILEBUF_LITERAL);
}
if(defined(&__GNUC__)) {
    if((defined(&_G_VTABLE_LABEL_HAS_LENGTH) ? &_G_VTABLE_LABEL_HAS_LENGTH : 0)) {
	eval 'sub VTABLE_LABEL {
	    my($NAME, $CLASS, $CNLENGTH) = @_;
    	    eval q( &extern \'char\' $NAME->[]  &asm ( &_G_VTABLE_LABEL_PREFIX $CNLENGTH $CLASS););
	}' unless defined(&VTABLE_LABEL);
    } else {
	eval 'sub VTABLE_LABEL {
	    my($NAME, $CLASS, $CNLENGTH) = @_;
    	    eval q( &extern \'char\' $NAME->[]  &asm ( &_G_VTABLE_LABEL_PREFIX $CLASS););
	}' unless defined(&VTABLE_LABEL);
    }
}
if(!defined( &builtinbuf_vtable)  && defined( &__cplusplus)) {
    if(defined(&__GNUC__)) {
    } else {
	if((defined(&_G_VTABLE_LABEL_HAS_LENGTH) ? &_G_VTABLE_LABEL_HAS_LENGTH : 0)) {
	    eval 'sub builtinbuf_vtable () { &_G_VTABLE_LABEL_PREFIX_ID10 &builtinbuf;}' unless defined(&builtinbuf_vtable);
	} else {
	    eval 'sub builtinbuf_vtable () { &_G_VTABLE_LABEL_PREFIX_ID &builtinbuf;}' unless defined(&builtinbuf_vtable);
	}
    }
}
if(defined( &__STDC__) || defined( &__cplusplus)) {
    eval 'sub _IO_va_start {
        my($args, $last) = @_;
	    eval q( &va_start($args, $last));
    }' unless defined(&_IO_va_start);
} else {
    eval 'sub _IO_va_start {
        my($args, $last) = @_;
	    eval q( &va_start($args));
    }' unless defined(&_IO_va_start);
}
if(1) {
    eval 'sub COERCE_FILE {
        my($FILE) = @_;
	    eval q();
    }' unless defined(&COERCE_FILE);
} else {
    eval 'sub COERCE_FILE {
        my($FILE) = @_;
	    eval q(((-> &_IO_file_flags &  &_IO_MAGIC_MASK) ==  &_OLD_MAGIC_MASK  && = *( &fp)[1]));
    }' unless defined(&COERCE_FILE);
}
if(defined(&EINVAL)) {
    eval 'sub MAYBE_SET_EINVAL () { &__set_errno ( &EINVAL);}' unless defined(&MAYBE_SET_EINVAL);
} else {
    eval 'sub MAYBE_SET_EINVAL () {1;}' unless defined(&MAYBE_SET_EINVAL);
}
if(defined(&IO_DEBUG)) {
    eval 'sub CHECK_FILE {
        my($FILE, $RET) = @_;
	    eval q( &if (($FILE) ==  &NULL) {  &MAYBE_SET_EINVAL;  &return $RET; }  &else {  &COERCE_FILE($FILE);  &if ((($FILE)-> &_IO_file_flags &  &_IO_MAGIC_MASK) !=  &_IO_MAGIC) {  &MAYBE_SET_EINVAL;  &return $RET; }});
    }' unless defined(&CHECK_FILE);
} else {
    eval 'sub CHECK_FILE {
        my($FILE, $RET) = @_;
	    eval q( &COERCE_FILE ($FILE));
    }' unless defined(&CHECK_FILE);
}
1;
