require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_AMD64_ASM_H_)) {
    eval 'sub _AMD64_ASM_H_ () {1;}' unless defined(&_AMD64_ASM_H_);
    if(defined(&PIC)) {
	eval 'sub PIC_PLT {
	    my($x) = @_;
    	    eval q($x@ &PLT);
	}' unless defined(&PIC_PLT);
	eval 'sub PIC_GOT {
	    my($x) = @_;
    	    eval q($x@ &GOTPCREL(% &rip));
	}' unless defined(&PIC_GOT);
    } else {
	eval 'sub PIC_PLT {
	    my($x) = @_;
    	    eval q($x);
	}' unless defined(&PIC_PLT);
	eval 'sub PIC_GOT {
	    my($x) = @_;
    	    eval q($x);
	}' unless defined(&PIC_GOT);
    }
    eval 'sub _C_LABEL {
        my($x) = @_;
	    eval q($x);
    }' unless defined(&_C_LABEL);
    eval 'sub _ASM_LABEL {
        my($x) = @_;
	    eval q($x);
    }' unless defined(&_ASM_LABEL);
    eval 'sub CVAROFF {
        my($x,$y) = @_;
	    eval q(( &_C_LABEL($x)+$y)(% &rip));
    }' unless defined(&CVAROFF);
    if(defined(&__STDC__)) {
	eval 'sub __CONCAT {
	    my($x,$y) = @_;
    	    eval q($x  $y);
	}' unless defined(&__CONCAT);
	eval 'sub __STRING {
	    my($x) = @_;
    	    eval q($x);
	}' unless defined(&__STRING);
    } else {
	eval 'sub __CONCAT {
	    my($x,$y) = @_;
    	    eval q($x $y);
	}' unless defined(&__CONCAT);
	eval 'sub __STRING {
	    my($x) = @_;
    	    eval q(\\"x\\");
	}' unless defined(&__STRING);
    }
    unless(defined(&_ALIGN_TEXT)) {
	eval 'sub _ALIGN_TEXT () {. &align 16, 0x90;}' unless defined(&_ALIGN_TEXT);
    }
    eval 'sub _ENTRY {
        my($x) = @_;
	    eval q(. &text;  &_ALIGN_TEXT; . &globl $x; . &type $x,@ &function; $x:);
    }' unless defined(&_ENTRY);
    if(defined(&_KERNEL)) {
	if(defined(&__STDC__)) {
	    eval 'sub IDTVEC {
	        my($name) = @_;
    		eval q(. &text;  &ALIGN_TEXT; . &globl  &X  $name; . &type  &X  $name,@ &function;  &X  $name:);
	    }' unless defined(&IDTVEC);
	} else {
	    eval 'sub IDTVEC {
	        my($name) = @_;
    		eval q(. &text;  &ALIGN_TEXT; . &globl  &X $name; . &type  &X $name,@ &function;  &X $name:);
	    }' unless defined(&IDTVEC);
	}
    }
    if(defined(&__STDC__)) {
	eval 'sub CPUVAR {
	    my($off) = @_;
    	    eval q(% &gs: &CPU_INFO_  $off);
	}' unless defined(&CPUVAR);
    } else {
	eval 'sub CPUVAR {
	    my($off) = @_;
    	    eval q(% &gs: &CPU_INFO_ $off);
	}' unless defined(&CPUVAR);
    }
    if(defined(&GPROF)) {
	eval 'sub _PROF_PROLOGUE () { &pushq % &rbp;  &leaq (% &rsp),% &rbp;  &call  &PIC_PLT( &__mcount);  &popq % &rbp;}' unless defined(&_PROF_PROLOGUE);
    } else {
	eval 'sub _PROF_PROLOGUE () {1;}' unless defined(&_PROF_PROLOGUE);
    }
    eval 'sub ENTRY {
        my($y) = @_;
	    eval q( &_ENTRY( &_C_LABEL($y));  &_PROF_PROLOGUE);
    }' unless defined(&ENTRY);
    eval 'sub NENTRY {
        my($y) = @_;
	    eval q( &_ENTRY( &_C_LABEL($y)));
    }' unless defined(&NENTRY);
    eval 'sub ASENTRY {
        my($y) = @_;
	    eval q( &_ENTRY( &_ASM_LABEL($y));  &_PROF_PROLOGUE);
    }' unless defined(&ASENTRY);
    eval 'sub ASMSTR () {. &asciz;}' unless defined(&ASMSTR);
    eval 'sub RCSID {
        my($x) = @_;
	    eval q(. &text; . &asciz $x);
    }' unless defined(&RCSID);
    eval 'sub WEAK_ALIAS {
        my($alias,$sym) = @_;
	    eval q(. &weak $alias; $alias = $sym);
    }' unless defined(&WEAK_ALIAS);
    if(defined(&__STDC__)) {
	eval 'sub WARN_REFERENCES {
	    my($sym,$msg) = @_;
    	    eval q(. &stabs $msg  ,30,0,0,0; . &stabs  &__STRING( &_C_LABEL($sym))  ,1,0,0,0);
	}' unless defined(&WARN_REFERENCES);
    } else {
	eval 'sub WARN_REFERENCES {
	    my($sym,$msg) = @_;
    	    eval q(. &stabs $msg,30,0,0,0; . &stabs  &__STRING($sym),1,0,0,0);
	}' unless defined(&WARN_REFERENCES);
    }
}
1;
