require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_I386_PIO_H_)) {
    eval 'sub _I386_PIO_H_ () {1;}' unless defined(&_I386_PIO_H_);
    if(defined(&__OPTIMIZE__)) {
	eval 'sub __use_immediate_port {
	    local($port) = @_;
    	    eval q(( &__builtin_constant_p(($port))  && ($port) < 0x100));
	}' unless defined(&__use_immediate_port);
    } else {
	eval 'sub __use_immediate_port {
	    local($port) = @_;
    	    eval q(0);
	}' unless defined(&__use_immediate_port);
    }
    eval 'sub inb {
        local($port) = @_;
	    eval q(( &__use_immediate_port($port) ?  &__inbc($port) :  &__inb($port)));
    }' unless defined(&inb);
    eval 'sub __inbc {
        local($port) = @_;
	    eval q({  &u_int8_t  &data;  &__asm  &__volatile(\\"inb %w1,%0\\" : \\"=a\\" ( &data) : \\"id\\" ($port));  &data; });
    }' unless defined(&__inbc);
    eval 'sub __inb {
        local($port) = @_;
	    eval q({  &u_int8_t  &data;  &__asm  &__volatile(\\"inb %w1,%0\\" : \\"=a\\" ( &data) : \\"d\\" ($port));  &data; });
    }' unless defined(&__inb);
    eval 'sub insb {
        local($port,$addr,$cnt) = @_;
	    eval q({  &__asm  &__volatile(\\"cld\\\\n\\\\trepne\\\\n\\\\tinsb\\" : \\"+D\\" ($addr), \\"+c\\" ($cnt) : \\"d\\" ($port) : \\"memory\\", \\"cc\\"); });
    }' unless defined(&insb);
    eval 'sub inw {
        local($port) = @_;
	    eval q(( &__use_immediate_port($port) ?  &__inwc($port) :  &__inw($port)));
    }' unless defined(&inw);
    eval 'sub __inwc {
        local($port) = @_;
	    eval q({  &u_int16_t  &data;  &__asm  &__volatile(\\"inw %w1,%0\\" : \\"=a\\" ( &data) : \\"id\\" ($port));  &data; });
    }' unless defined(&__inwc);
    eval 'sub __inw {
        local($port) = @_;
	    eval q({  &u_int16_t  &data;  &__asm  &__volatile(\\"inw %w1,%0\\" : \\"=a\\" ( &data) : \\"d\\" ($port));  &data; });
    }' unless defined(&__inw);
    eval 'sub insw {
        local($port,$addr,$cnt) = @_;
	    eval q({  &__asm  &__volatile(\\"cld\\\\n\\\\trepne\\\\n\\\\tinsw\\" : \\"+D\\" ($addr), \\"+c\\" ($cnt) : \\"d\\" ($port) : \\"memory\\", \\"cc\\"); });
    }' unless defined(&insw);
    eval 'sub inl {
        local($port) = @_;
	    eval q(( &__use_immediate_port($port) ?  &__inlc($port) :  &__inl($port)));
    }' unless defined(&inl);
    eval 'sub __inlc {
        local($port) = @_;
	    eval q({  &u_int32_t  &data;  &__asm  &__volatile(\\"inl %w1,%0\\" : \\"=a\\" ( &data) : \\"id\\" ($port));  &data; });
    }' unless defined(&__inlc);
    eval 'sub __inl {
        local($port) = @_;
	    eval q({  &u_int32_t  &data;  &__asm  &__volatile(\\"inl %w1,%0\\" : \\"=a\\" ( &data) : \\"d\\" ($port));  &data; });
    }' unless defined(&__inl);
    eval 'sub insl {
        local($port,$addr,$cnt) = @_;
	    eval q({  &__asm  &__volatile(\\"cld\\\\n\\\\trepne\\\\n\\\\tinsl\\" : \\"+D\\" ($addr), \\"+c\\" ($cnt) : \\"d\\" ($port) : \\"memory\\", \\"cc\\"); });
    }' unless defined(&insl);
    eval 'sub outb {
        local($port, $data) = @_;
	    eval q(( &__use_immediate_port($port) ?  &__outbc($port, $data) :  &__outb($port, $data)));
    }' unless defined(&outb);
    eval 'sub __outbc {
        local($port,$data) = @_;
	    eval q({  &__asm  &__volatile(\\"outb %0,%w1\\" : : \\"a\\" ($data), \\"id\\" ($port)); });
    }' unless defined(&__outbc);
    eval 'sub __outb {
        local($port,$data) = @_;
	    eval q({  &__asm  &__volatile(\\"outb %0,%w1\\" : : \\"a\\" ($data), \\"d\\" ($port)); });
    }' unless defined(&__outb);
    eval 'sub outsb {
        local($port,$addr,$cnt) = @_;
	    eval q({  &__asm  &__volatile(\\"cld\\\\n\\\\trepne\\\\n\\\\toutsb\\" : \\"+S\\" ($addr), \\"+c\\" ($cnt) : \\"d\\" ($port) : \\"cc\\"); });
    }' unless defined(&outsb);
    eval 'sub outw {
        local($port, $data) = @_;
	    eval q(( &__use_immediate_port($port) ?  &__outwc($port, $data) :  &__outw($port, $data)));
    }' unless defined(&outw);
    eval 'sub __outwc {
        local($port,$data) = @_;
	    eval q({  &__asm  &__volatile(\\"outw %0,%w1\\" : : \\"a\\" ($data), \\"id\\" ($port)); });
    }' unless defined(&__outwc);
    eval 'sub __outw {
        local($port,$data) = @_;
	    eval q({  &__asm  &__volatile(\\"outw %0,%w1\\" : : \\"a\\" ($data), \\"d\\" ($port)); });
    }' unless defined(&__outw);
    eval 'sub outsw {
        local($port,$addr,$cnt) = @_;
	    eval q({  &__asm  &__volatile(\\"cld\\\\n\\\\trepne\\\\n\\\\toutsw\\" : \\"+S\\" ($addr), \\"+c\\" ($cnt) : \\"d\\" ($port) : \\"cc\\"); });
    }' unless defined(&outsw);
    eval 'sub outl {
        local($port, $data) = @_;
	    eval q(( &__use_immediate_port($port) ?  &__outlc($port, $data) :  &__outl($port, $data)));
    }' unless defined(&outl);
    eval 'sub __outlc {
        local($port,$data) = @_;
	    eval q({  &__asm  &__volatile(\\"outl %0,%w1\\" : : \\"a\\" ($data), \\"id\\" ($port)); });
    }' unless defined(&__outlc);
    eval 'sub __outl {
        local($port,$data) = @_;
	    eval q({  &__asm  &__volatile(\\"outl %0,%w1\\" : : \\"a\\" ($data), \\"d\\" ($port)); });
    }' unless defined(&__outl);
    eval 'sub outsl {
        local($port,$addr,$cnt) = @_;
	    eval q({  &__asm  &__volatile(\\"cld\\\\n\\\\trepne\\\\n\\\\toutsl\\" : \\"+S\\" ($addr), \\"+c\\" ($cnt) : \\"d\\" ($port) : \\"cc\\"); });
    }' unless defined(&outsl);
}
1;
