require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&__GNUC_VA_LIST)) {
    eval 'sub __GNUC_VA_LIST () {1;}' unless defined(&__GNUC_VA_LIST);
    require 'sys/cdefs.ph';
}
if(defined ( &_STDARG_H) || defined ( &_VARARGS_H)) {
    eval 'sub __va_start_common {
        my($AP,$FAKE) = @_;
	    eval q( &__extension__ ({ ($AP) =  &__builtin_alloca($sizeof{ &__gnuc_va_list});  &__builtin_memcpy (($AP),  &__builtin_saveregs (), $sizeof{ &__gnuc_va_list}); }));
    }' unless defined(&__va_start_common);
    if(defined(&_STDARG_H)) {
	if(defined(&lint)) {
	    eval 'sub va_start {
	        my($AP,$LASGARG) = @_;
    		eval q((($AP) = ($AP)));
	    }' unless defined(&va_start);
	} else {
	    eval 'sub va_start {
	        my($AP,$LASTARG) = @_;
    		eval q(( &__builtin_next_arg ($LASTARG),  &__va_start_common ($AP, 0)));
	    }' unless defined(&va_start);
	}
    } else {
	if(defined(&lint)) {
	    eval 'sub va_start {
	        my($AP) = @_;
    		eval q((($AP) = ($AP)));
	    }' unless defined(&va_start);
	} else {
	    eval 'sub va_start {
	        my($AP) = @_;
    		eval q( &__va_start_common ($AP, 1));
	    }' unless defined(&va_start);
	}
	eval 'sub va_alist () { &__va_1st_arg;}' unless defined(&va_alist);
	eval 'sub va_dcl () { &register \'int\'  &va_alist; ...;}' unless defined(&va_dcl);
    }
    eval 'sub __va_reg_p {
        my($TYPE) = @_;
	    eval q( &__extension__({  &__builtin_classify_type(*($TYPE *)0) < 12? $sizeof{$TYPE} <= 8: $sizeof{$TYPE} == 4 &&  &__alignof__(*($TYPE *)0) == 4; }));
    }' unless defined(&__va_reg_p);
    eval 'sub __va_size {
        my($TYPE) = @_;
	    eval q((($sizeof{$TYPE} + 3) >> 2));
    }' unless defined(&__va_size);
    eval 'sub va_arg {
        my($AP,$TYPE) = @_;
	    eval q( &__extension__(*({  &register $TYPE * &__ptr;  &if (($AP)-> &__va_arg <= 8 &&  &__va_reg_p($TYPE)) {  &if ((($AP)-> &__va_arg & 1) != 0 &&  &__alignof__(*($TYPE *)0) > 4) ($AP)-> &__va_arg++; ($AP)-> &__va_arg +=  &__va_size($TYPE); }  &if (($AP)-> &__va_arg <= 8 &&  &__va_reg_p($TYPE)) {  &__ptr = ($TYPE *) ( &void *) (-> &__va_reg + -> &__va_arg -  &__va_size); }  &else {  &if (((($AP)-> &__va_stk) & 4) != 0 &&  &__alignof__(*($TYPE *)0) > 4) { ($AP)-> &__va_stk++; }  &__ptr = ($TYPE *) ($AP)-> &__va_stk; ($AP)-> &__va_stk +=  &__va_size($TYPE); }  &__ptr; })));
    }' unless defined(&va_arg);
    eval 'sub va_end {
        my($AP) = @_;
	    eval q((( &void)0));
    }' unless defined(&va_end);
    eval 'sub __va_copy {
        my($dest, $src) = @_;
	    eval q( &__extension__ ({ ($dest) =  &__builtin_alloca($sizeof{ &__gnuc_va_list}); *($dest) = *($src); }));
    }' unless defined(&__va_copy);
    if((defined(&__ISO_C_VISIBLE) ? &__ISO_C_VISIBLE : 0) >= 1999) {
	eval 'sub va_copy {
	    my($dest, $src) = @_;
    	    eval q( &__va_copy($dest, $src));
	}' unless defined(&va_copy);
    }
}
1;
