#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*/ outl(unsigned int, unsigned int);
int /*<<< orphan*/ udelay(int);
int /*<<< orphan*/ v_EepromClock76(unsigned int, unsigned int);
void v_EepromSendCommand76(unsigned int dw_Address,
                           unsigned int dw_EepromCommand,
                           unsigned char b_DataLengthInBits) {
  char c_BitPos = 0;
  unsigned int dw_RegisterValue = 0;
  dw_RegisterValue = 0x2;
  outl(dw_RegisterValue, dw_Address);
  udelay(100);
  for (c_BitPos = (b_DataLengthInBits - 1); c_BitPos >= 0; c_BitPos--) {
    if (dw_EepromCommand & (1 << c_BitPos)) {
      dw_RegisterValue = dw_RegisterValue | 0x4;
    } else {
      dw_RegisterValue = dw_RegisterValue & 0x3;
    }
    outl(dw_RegisterValue, dw_Address);
    udelay(100);
    v_EepromClock76(dw_Address, dw_RegisterValue);
  }
}


x86 assembly (clang, -O0):
<v_EepromSendCommand76>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movb   $0x0,-0xa(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <outl@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
movzbl -0x9(%rbp),%eax
sub    $0x1,%eax
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
cmp    $0x0,%eax
jl     11e0 <v_EepromSendCommand76+0xb0>
mov    -0x8(%rbp),%eax
movsbl -0xa(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     11aa <v_EepromSendCommand76+0x7a>
mov    -0x10(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x10(%rbp)
jmp    11b3 <v_EepromSendCommand76+0x83>
mov    -0x10(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <outl@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <v_EepromClock76@plt>
mov    -0xa(%rbp),%al
add    $0xff,%al
mov    %al,-0xa(%rbp)
jmp    1174 <v_EepromSendCommand76+0x44>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_EepromSendCommand76>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r12d
mov    %esi,%r14d
mov    %edi,%r15d
mov    $0x2,%ebp
mov    $0x2,%edi
mov    %r15d,%esi
call   1040 <outl@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
mov    %r12d,%eax
add    $0xff,%al
js     11a9 <v_EepromSendCommand76+0x79>
movzbl %al,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
or     $0x4,%eax
and    $0x3,%ebp
bt     %ebx,%r14d
cmovb  %eax,%ebp
mov    %ebp,%edi
mov    %r15d,%esi
call   1040 <outl@plt>
mov    $0x64,%edi
call   1050 <udelay@plt>
mov    %r15d,%edi
mov    %ebp,%esi
call   1030 <v_EepromClock76@plt>
add    $0xff,%r12b
add    $0xffffffff,%ebx
test   %r12b,%r12b
jg     1170 <v_EepromSendCommand76+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @v_EepromSendCommand76(i32 %0, i32 %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
store i8 0, i8* %7
store i32 0, i32* %8
store i32 2, i32* %8
%9 = load i32, i32* %8
%10 = load i32, i32* %4
%11 = call i32 @outl(i32 %9, i32 %10)
%12 = call i32 @udelay(i32 100)
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = sub nsw i32 %14, 1
%16 = trunc i32 %15 to i8
store i8 %16, i8* %7
br label %17
17: ; preds = %42, %3
%18 = load i8, i8* %7
%19 = sext i8 %18 to i32
%20 = icmp sge i32 %19, 0
br i1 %20, label %21, label %45
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i8, i8* %7
%24 = sext i8 %23 to i32
%25 = shl i32 1, %24
%26 = and i32 %22, %25
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %21
%29 = load i32, i32* %8
%30 = or i32 %29, 4
store i32 %30, i32* %8
br label %34
31: ; preds = %21
%32 = load i32, i32* %8
%33 = and i32 %32, 3
store i32 %33, i32* %8
br label %34
34: ; preds = %31, %28
%35 = load i32, i32* %8
%36 = load i32, i32* %4
%37 = call i32 @outl(i32 %35, i32 %36)
%38 = call i32 @udelay(i32 100)
%39 = load i32, i32* %4
%40 = load i32, i32* %8
%41 = call i32 @v_EepromClock76(i32 %39, i32 %40)
br label %42
42: ; preds = %34
%43 = load i8, i8* %7
%44 = add i8 %43, -1
store i8 %44, i8* %7
br label %17
45: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @v_EepromSendCommand76(i32 %0, i32 %1, i8 zeroext %2) {
%4 = tail call i32 @outl(i32 2, i32 %0)
%5 = tail call i32 @udelay(i32 100)
%6 = add i8 %2, -1
%7 = icmp sgt i8 %6, -1
br i1 %7, label %8, label %23
8: ; preds = %3, %8
%9 = phi i8 [ %21, %8 ], [ %6, %3 ]
%10 = phi i32 [ %17, %8 ], [ 2, %3 ]
%11 = zext i8 %9 to i32
%12 = shl nuw i32 1, %11
%13 = and i32 %12, %1
%14 = icmp eq i32 %13, 0
%15 = or i32 %10, 4
%16 = and i32 %10, 3
%17 = select i1 %14, i32 %16, i32 %15
%18 = tail call i32 @outl(i32 %17, i32 %0)
%19 = tail call i32 @udelay(i32 100)
%20 = tail call i32 @v_EepromClock76(i32 %0, i32 %17)
%21 = add nsw i8 %9, -1
%22 = icmp sgt i8 %9, 0
br i1 %22, label %8, label %23
23: ; preds = %8, %3
ret void
}