#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 */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBULPIRegWrite(uint32_t ui32Base, uint8_t ui8Reg, uint8_t ui8Data) {
  ASSERT(ui32Base == 0x40050000);
  (*((volatile uint8_t *)(ui32Base + 0x00000075))) = ui8Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000074))) = ui8Data;
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0x00000001;
  while (((*((volatile uint8_t *)(ui32Base + 0x00000076))) & 0x00000002) == 0) {
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0;
}


x86 assembly (clang, -O0):
<USBULPIRegWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x75,%eax
cltq
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x74,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x76,%eax
cltq
movl   $0x1,(%rax)
mov    -0x4(%rbp),%eax
add    $0x76,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1178 <USBULPIRegWrite+0x68>
jmp    115d <USBULPIRegWrite+0x4d>
mov    -0x4(%rbp),%eax
add    $0x76,%eax
cltq
movl   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBULPIRegWrite>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x40050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
mov    %ebp,0x75(%rax)
mov    %r14d,0x74(%rax)
movl   $0x1,0x76(%rax)
nopl   (%rax)
testl  $0x2,0x76(%rax)
je     1140 <USBULPIRegWrite+0x30>
movl   $0x0,0x76(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBULPIRegWrite(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1074069504
%9 = zext i1 %8 to i32
%10 = call i32 @ASSERT(i32 %9)
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 117
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store volatile i32 %11, i32* %15
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 116
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %16, i32* %20
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 118
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
store volatile i32 1, i32* %24
br label %25
25: ; preds = %33, %3
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 118
%28 = sext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
%31 = and i32 %30, 2
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %25
br label %25
34: ; preds = %25
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 118
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
store volatile i32 0, i32* %38
ret void
}

LLVM IR (-O2):
define void @USBULPIRegWrite(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1074069504
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = add nsw i32 %0, 117
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 %1, i32* %9
%10 = add nsw i32 %0, 116
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %2, i32* %12
%13 = add nsw i32 %0, 118
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
store volatile i32 1, i32* %15
br label %16
16: ; preds = %16, %3
%17 = load volatile i32, i32* %15
%18 = and i32 %17, 2
%19 = icmp eq i32 %18, 0
br i1 %19, label %16, label %20
20: ; preds = %16
store volatile i32 0, i32* %15
ret void
}