#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);
uint32_t USBIntStatusControl(uint32_t ui32Base) {
  uint32_t ui32Status;
  ASSERT(ui32Base == 0x40050000);
  ui32Status = (*((volatile uint8_t *)(ui32Base + 0x0000000A)));
  if ((*((volatile uint32_t *)(ui32Base + 0x0000040C))) & 0x00000001) {
    ui32Status |= 0x00000100;
    (*((volatile uint8_t *)(ui32Base + 0x0000040C))) |= 0x00000001;
  }
  if ((*((volatile uint32_t *)(0x40050000 + 0x0000044C))) & 0x00000001) {
    ui32Status |= 0x00000200;
    (*((volatile uint32_t *)(0x40050000 + 0x0000044C))) |= 0x00000001;
  }
  return (ui32Status);
}


x86 assembly (clang, -O0):
<USBIntStatusControl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40c,%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1170 <USBIntStatusControl+0x60>
mov    -0x8(%rbp),%eax
or     $0x100,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40c,%eax
cltq
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
mov    $0x4005044c,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     119f <USBIntStatusControl+0x8f>
mov    -0x8(%rbp),%eax
or     $0x200,%eax
mov    %eax,-0x8(%rbp)
mov    $0x4005044c,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x4005044c,%eax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntStatusControl>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x40050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rcx
mov    0xa(%rcx),%eax
testl  $0x1,0x40c(%rcx)
jne    1145 <USBIntStatusControl+0x35>
testl  $0x1,0x4005044c
jne    115e <USBIntStatusControl+0x4e>
pop    %rbx
ret
or     $0x100,%eax
orl    $0x1,0x40c(%rcx)
testl  $0x1,0x4005044c
je     1143 <USBIntStatusControl+0x33>
or     $0x200,%eax
orl    $0x1,0x4005044c
01
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @USBIntStatusControl(i32 %0) {
%2 = icmp eq i32 %0, 1074069504
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 10
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = add nsw i32 %0, 1036
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %1
%16 = or i32 %8, 256
%17 = load volatile i32, i32* %11
%18 = or i32 %17, 1
store volatile i32 %18, i32* %11
br label %19
19: ; preds = %15, %1
%20 = phi i32 [ %16, %15 ], [ %8, %1 ]
%21 = load volatile i32, i32* inttoptr (i64 1074070604 to i32*)
%22 = and i32 %21, 1
%23 = icmp eq i32 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %19
%25 = or i32 %20, 512
%26 = load volatile i32, i32* inttoptr (i64 1074070604 to i32*)
%27 = or i32 %26, 1
store volatile i32 %27, i32* inttoptr (i64 1074070604 to i32*)
br label %28
28: ; preds = %24, %19
%29 = phi i32 [ %25, %24 ], [ %20, %19 ]
ret i32 %29
}