#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ delay();
int inb(int);
int /*<<< orphan*/ outb(int, int);
unsigned char asix88796_eeprom_getbit(int ioaddr) {
  unsigned char value;
  outb(inb(ioaddr + 0x14) & 0x7f, ioaddr + 0x14);
  delay();
  value = (inb(ioaddr + 0x14) & 0x40) >> 6;
  outb(inb(ioaddr + 0x14) | 0x80, ioaddr + 0x14);
  delay();
  return value;
}


x86 assembly (clang, -O0):
<asix88796_eeprom_getbit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x14,%edi
call   1050 <inb@plt>
mov    %eax,%edi
and    $0x7f,%edi
mov    -0x4(%rbp),%esi
add    $0x14,%esi
call   1030 <outb@plt>
mov    $0x0,%al
call   1040 <delay@plt>
mov    -0x4(%rbp),%edi
add    $0x14,%edi
call   1050 <inb@plt>
and    $0x40,%eax
sar    $0x6,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
add    $0x14,%edi
call   1050 <inb@plt>
mov    %eax,%edi
or     $0x80,%edi
mov    -0x4(%rbp),%esi
add    $0x14,%esi
call   1030 <outb@plt>
mov    $0x0,%al
call   1040 <delay@plt>
movzbl -0x5(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asix88796_eeprom_getbit>:
push   %rbp
push   %rbx
push   %rax
lea    0x14(%rdi),%ebx
mov    %ebx,%edi
call   1050 <inb@plt>
and    $0x7f,%eax
mov    %eax,%edi
mov    %ebx,%esi
call   1030 <outb@plt>
xor    %eax,%eax
call   1040 <delay@plt>
mov    %ebx,%edi
call   1050 <inb@plt>
mov    %eax,%ebp
shr    $0x6,%bpl
and    $0x1,%bpl
mov    %ebx,%edi
call   1050 <inb@plt>
or     $0x80,%eax
mov    %eax,%edi
mov    %ebx,%esi
call   1030 <outb@plt>
xor    %eax,%eax
call   1040 <delay@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @asix88796_eeprom_getbit(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 20
%6 = call i32 @inb(i32 %5)
%7 = and i32 %6, 127
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 20
%10 = call i32 @outb(i32 %7, i32 %9)
%11 = call i32 (...) @delay()
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 20
%14 = call i32 @inb(i32 %13)
%15 = and i32 %14, 64
%16 = ashr i32 %15, 6
%17 = trunc i32 %16 to i8
store i8 %17, i8* %3
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 20
%20 = call i32 @inb(i32 %19)
%21 = or i32 %20, 128
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 20
%24 = call i32 @outb(i32 %21, i32 %23)
%25 = call i32 (...) @delay()
%26 = load i8, i8* %3
ret i8 %26
}

LLVM IR (-O2):
define zeroext i8 @asix88796_eeprom_getbit(i32 %0) {
%2 = add nsw i32 %0, 20
%3 = tail call i32 @inb(i32 %2)
%4 = and i32 %3, 127
%5 = tail call i32 @outb(i32 %4, i32 %2)
%6 = tail call i32 (...) @delay()
%7 = tail call i32 @inb(i32 %2)
%8 = trunc i32 %7 to i8
%9 = lshr i8 %8, 6
%10 = and i8 %9, 1
%11 = tail call i32 @inb(i32 %2)
%12 = or i32 %11, 128
%13 = tail call i32 @outb(i32 %12, i32 %2)
%14 = tail call i32 (...) @delay()
ret i8 %10
}