#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);
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg) {
  ASSERT(ui32Base == 0x40050000);
  (*((volatile uint8_t *)(ui32Base + 0x00000075))) = ui8Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0x00000004 | 0x00000001;
  while (((*((volatile uint8_t *)(ui32Base + 0x00000076))) & 0x00000002) == 0) {
  }
  (*((volatile uint8_t *)(ui32Base + 0x00000076))) = 0;
  return ((*((volatile uint8_t *)(ui32Base + 0x00000074))));
}


x86 assembly (clang, -O0):
<USBULPIRegRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%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    -0x4(%rbp),%eax
add    $0x76,%eax
cltq
movl   $0x5,(%rax)
mov    -0x4(%rbp),%eax
add    $0x76,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1168 <USBULPIRegRead+0x58>
jmp    114d <USBULPIRegRead+0x3d>
mov    -0x4(%rbp),%eax
add    $0x76,%eax
cltq
movl   $0x0,(%rax)
mov    -0x4(%rbp),%eax
add    $0x74,%eax
cltq
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBULPIRegRead>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    %ebx,0x75(%rax)
movl   $0x5,0x76(%rax)
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x2,0x76(%rax)
je     1140 <USBULPIRegRead+0x30>
movl   $0x0,0x76(%rax)
mov    0x74(%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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