require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_MIPS_STDARG_H_)) {
    eval 'sub _MIPS_STDARG_H_ () {1;}' unless defined(&_MIPS_STDARG_H_);
    require 'sys/cdefs.ph';
    require 'machine/_types.ph';
    unless(defined(&__GNUC_VA_LIST)) {
	eval 'sub __GNUC_VA_LIST () {1;}' unless defined(&__GNUC_VA_LIST);
	if(defined ( &__mips_eabi)  && ! defined ( &__mips_soft_float)  && ! defined ( &__mips_single_float)) {
	} else {
	}
    }
    unless(defined(&_VA_MIPS_H_ENUM)) {
	eval 'sub _VA_MIPS_H_ENUM () {1;}' unless defined(&_VA_MIPS_H_ENUM);
	eval("sub __no_type_class () { -1; }") unless defined(&__no_type_class);
	eval("sub __void_type_class () { 0; }") unless defined(&__void_type_class);
	eval("sub __integer_type_class () { 1; }") unless defined(&__integer_type_class);
	eval("sub __char_type_class () { 2; }") unless defined(&__char_type_class);
	eval("sub __enumeral_type_class () { 3; }") unless defined(&__enumeral_type_class);
	eval("sub __boolean_type_class () { 4; }") unless defined(&__boolean_type_class);
	eval("sub __pointer_type_class () { 5; }") unless defined(&__pointer_type_class);
	eval("sub __reference_type_class () { 6; }") unless defined(&__reference_type_class);
	eval("sub __offset_type_class () { 7; }") unless defined(&__offset_type_class);
	eval("sub __real_type_class () { 8; }") unless defined(&__real_type_class);
	eval("sub __complex_type_class () { 9; }") unless defined(&__complex_type_class);
	eval("sub __function_type_class () { 10; }") unless defined(&__function_type_class);
	eval("sub __method_type_class () { 11; }") unless defined(&__method_type_class);
	eval("sub __record_type_class () { 12; }") unless defined(&__record_type_class);
	eval("sub __union_type_class () { 13; }") unless defined(&__union_type_class);
	eval("sub __array_type_class () { 14; }") unless defined(&__array_type_class);
	eval("sub __string_type_class () { 15; }") unless defined(&__string_type_class);
	eval("sub __set_type_class () { 16; }") unless defined(&__set_type_class);
	eval("sub __file_type_class () { 17; }") unless defined(&__file_type_class);
	eval("sub __lang_type_class () { 18; }") unless defined(&__lang_type_class);
    }
    eval 'sub __va_ellipsis () {...;}' unless defined(&__va_ellipsis);
    if(defined(&__mips64__)) {
	eval 'sub __va_rounded_size {
	    my($__TYPE) = @_;
    	    eval q(((($sizeof{$__TYPE} + 8- 1) / 8) * 8));
	}' unless defined(&__va_rounded_size);
    } else {
	eval 'sub __va_rounded_size {
	    my($__TYPE) = @_;
    	    eval q(((($sizeof{$__TYPE} + $sizeof{\'int\'} - 1) / $sizeof{\'int\'}) * $sizeof{\'int\'}));
	}' unless defined(&__va_rounded_size);
    }
    if(defined(&__mips64__)) {
	eval 'sub __va_reg_size () {8;}' unless defined(&__va_reg_size);
    } else {
	eval 'sub __va_reg_size () {4;}' unless defined(&__va_reg_size);
    }
    if(defined ( &__mips_eabi)) {
	if(! defined ( &__mips_soft_float)  && ! defined ( &__mips_single_float)) {
	    if(defined(&__mips64__)) {
		eval 'sub va_start {
		    my($__AP, $__LASTARG) = @_;
    		    eval q(( ($__AP->{__gp_regs}) = (  &__builtin_next_arg ($__LASTARG) - ( &__builtin_args_info (2) < 8? (8-  &__builtin_args_info (2)) *  &__va_reg_size : 0)),  ($__AP->{__fp_left}) = 8-  &__builtin_args_info (3),  ($__AP->{__fp_regs}) =  ($__AP->{__gp_regs}) -  ($__AP->{__fp_left}) *  &__va_reg_size));
		}' unless defined(&va_start);
	    } else {
		eval 'sub va_start {
		    my($__AP, $__LASTARG) = @_;
    		    eval q(( ($__AP->{__gp_regs}) = (  &__builtin_next_arg - ( &__builtin_args_info < 8? (8-  &__builtin_args_info ) *  &__va_reg_size : 0)),  ($__AP->{__fp_left}) = (8-  &__builtin_args_info ) / 2,  ($__AP->{__fp_regs}) =  ($__AP->{__gp_regs}) -  ($__AP->{__fp_left}) * 8,  ($__AP->{__fp_regs}) = (  ($__AP->{__fp_regs}) & -8)));
		}' unless defined(&va_start);
	    }
	} else {
	    eval 'sub va_start {
	        my($__AP, $__LASTARG) = @_;
    		eval q(($__AP = (( &__gnuc_va_list)  &__builtin_next_arg ($__LASTARG) - ( &__builtin_args_info (2) >= 8? 0: (8-  &__builtin_args_info (2)) *  &__va_reg_size))));
	    }' unless defined(&va_start);
	}
    } else {
	eval 'sub va_start {
	    my($__AP, $__LASTARG) = @_;
    	    eval q(($__AP = ( &__gnuc_va_list)  &__builtin_next_arg ($__LASTARG)));
	}' unless defined(&va_start);
    }
    unless(defined(&va_end)) {
    }
    eval 'sub va_end {
        my($__AP) = @_;
	    eval q();
    }' unless defined(&va_end);
    if(defined ( &__mips_eabi)) {
	if(! defined ( &__mips_soft_float)  && ! defined ( &__mips_single_float)) {
	    if(defined(&__mips64__)) {
		eval 'sub __va_next_addr {
		    my($__AP, $__type) = @_;
    		    eval q((( &__builtin_classify_type (*($__type *) 0) ==  &__real_type_class  &&  ($__AP->{__fp_left}) > 0) ? (-- ($__AP->{__fp_left}), ( ($__AP->{__fp_regs}) += 8) - 8) : ( ($__AP->{__gp_regs}) +=  &__va_reg_size) -  &__va_reg_size));
		}' unless defined(&__va_next_addr);
	    } else {
		eval 'sub __va_next_addr {
		    my($__AP, $__type) = @_;
    		    eval q((( &__builtin_classify_type (*($__type *) 0) ==  &__real_type_class  &&  ($__AP->{__fp_left}) > 0) ? (-- ($__AP->{__fp_left}), ( ($__AP->{__fp_regs}) += 8) - 8) : ((( &__builtin_classify_type (* ($__type *) 0) <  &__record_type_class  &&  &__alignof__ > 4) ?  ($__AP->{__gp_regs}) = ((  ($__AP->{__gp_regs}) + 8- 1) & -8) : 0), ( &__builtin_classify_type (* ($__type *) 0) >=  &__record_type_class ? ( ($__AP->{__gp_regs}) +=  &__va_reg_size) -  &__va_reg_size : (( ($__AP->{__gp_regs}) +=  &__va_rounded_size ($__type)) -  &__va_rounded_size ($__type))))));
		}' unless defined(&__va_next_addr);
	    }
	} else {
	    if(defined(&__mips64__)) {
		eval 'sub __va_next_addr {
		    my($__AP, $__type) = @_;
    		    eval q((($__AP +=  &__va_reg_size) -  &__va_reg_size));
		}' unless defined(&__va_next_addr);
	    } else {
		eval 'sub __va_next_addr {
		    my($__AP, $__type) = @_;
    		    eval q(((( &__builtin_classify_type (* ($__type *) 0) <  &__record_type_class  &&  &__alignof__ > 4) ? $__AP = ((( &__PTRDIFF_TYPE__) $__AP + 8- 1) & -8) : 0), ( &__builtin_classify_type (* ($__type *) 0) >=  &__record_type_class ? ($__AP +=  &__va_reg_size) -  &__va_reg_size : (($__AP +=  &__va_rounded_size ($__type)) -  &__va_rounded_size ($__type)))));
		}' unless defined(&__va_next_addr);
	    }
	}
	if(defined(&__MIPSEB__)) {
	    eval 'sub va_arg {
	        my($__AP, $__type) = @_;
    		eval q((( &__va_rounded_size ($__type) <=  &__va_reg_size) ? *($__type *) ( &void *) ( &__va_next_addr ($__AP, $__type) +  &__va_reg_size - $sizeof{$__type}) : ( &__builtin_classify_type (*($__type *) 0) >=  &__record_type_class ? **($__type **) ( &void *) ( &__va_next_addr ($__AP, $__type) +  &__va_reg_size - $sizeof{\'char\' }) : *($__type *) ( &void *)  &__va_next_addr ($__AP, $__type))));
	    }' unless defined(&va_arg);
	} else {
	    eval 'sub va_arg {
	        my($__AP, $__type) = @_;
    		eval q((( &__va_rounded_size ($__type) <=  &__va_reg_size) ? *($__type *) ( &void *)  &__va_next_addr ($__AP, $__type) : ( &__builtin_classify_type (* ($__type *) 0) >=  &__record_type_class ? **($__type **) ( &void *)  &__va_next_addr ($__AP, $__type) : *($__type *) ( &void *)  &__va_next_addr ($__AP, $__type))));
	    }' unless defined(&va_arg);
	}
    } else {
	if(defined(&__mips64__)) {
	    if(defined(&__MIPSEB__)) {
		eval 'sub va_arg {
		    my($__AP, $__type) = @_;
    		    eval q((($__type *) ( &void *) ($__AP = (((( &__PTRDIFF_TYPE__)$__AP + 8- 1) & -8) +  &__va_rounded_size ($__type))))[-1]);
		}' unless defined(&va_arg);
	    } else {
		eval 'sub va_arg {
		    my($__AP, $__type) = @_;
    		    eval q((($__AP = (((( &__PTRDIFF_TYPE__)$__AP + 8- 1) & -8) +  &__va_rounded_size ($__type))), *($__type *) ( &void *) ($__AP -  &__va_rounded_size ($__type))));
		}' unless defined(&va_arg);
	    }
	} else {
	    if(defined(&__MIPSEB__)) {
		eval 'sub va_arg {
		    my($__AP, $__type) = @_;
    		    eval q((($__AP = (( &__alignof__ ($__type) > 4? (( &__PTRDIFF_TYPE__)$__AP + 8- 1) & -8: (( &__PTRDIFF_TYPE__)$__AP + 4- 1) & -4) +  &__va_rounded_size ($__type))), *($__type *) ( &void *) ($__AP -  &__va_rounded_size ($__type))));
		}' unless defined(&va_arg);
	    } else {
		eval 'sub va_arg {
		    my($__AP, $__type) = @_;
    		    eval q((($__type *) ( &void *) ($__AP = (( &__alignof__($__type) > 4? (( &__PTRDIFF_TYPE__)$__AP + 8- 1) & -8: (( &__PTRDIFF_TYPE__)$__AP + 4- 1) & -4) +  &__va_rounded_size($__type))))[-1]);
		}' unless defined(&va_arg);
	    }
	}
    }
    eval 'sub __va_copy {
        my($dest, $src) = @_;
	    eval q(($dest) = ($src));
    }' unless defined(&__va_copy);
    if((defined(&__ISO_C_VISIBLE) ? &__ISO_C_VISIBLE : 0) >= 1999) {
	eval 'sub va_copy () { &__va_copy;}' unless defined(&va_copy);
    }
}
1;
