require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_AMD64_STDARG_H_)) {
    eval 'sub _AMD64_STDARG_H_ () {1;}' unless defined(&_AMD64_STDARG_H_);
    require 'sys/cdefs.ph';
    require 'machine/_types.ph';
    eval 'sub __va_size {
        my($type) = @_;
	    eval q(((($sizeof{$type} + $sizeof{\'long\'} - 1) / $sizeof{\'long\'}) * $sizeof{\'long\'}));
    }' unless defined(&__va_size);
    if(defined(&lint)) {
	eval 'sub va_start {
	    my($ap,$lastarg) = @_;
    	    eval q((($ap) = ($ap)));
	}' unless defined(&va_start);
    } else {
	eval 'sub va_start {
	    my($ap, $last) = @_;
    	    eval q((($ap) = ( &va_list)($last) +  &__va_size($last)));
	}' unless defined(&va_start);
    }
    eval 'sub va_arg {
        my($ap, $type) = @_;
	    eval q((*($type *)(($ap) +=  &__va_size($type), ($ap) -  &__va_size($type))));
    }' unless defined(&va_arg);
    if((defined(&__ISO_C_VISIBLE) ? &__ISO_C_VISIBLE : 0) >= 1999) {
	eval 'sub va_copy {
	    my($dest, $src) = @_;
    	    eval q((($dest) = ($src)));
	}' unless defined(&va_copy);
    }
    eval 'sub va_end {
        my($ap) = @_;
	    eval q();
    }' unless defined(&va_end);
}
1;
