unsigned long USBIntStatusControl(unsigned long ulBase) {
  unsigned long ulStatus;
  ;
  ulStatus = (*((volatile unsigned char *)(ulBase + 0x0000000A)));
  if ((*((volatile unsigned long *)(ulBase + 0x0000040C))) & 0x00000001) {
    ulStatus |= 0x00000100;
    (*((volatile unsigned char *)(ulBase + 0x0000040C))) |= 0x00000001;
  }
  if ((*((volatile unsigned long *)(0x40050000 + 0x0000044C))) & 0x00000001) {
    ulStatus |= 0x00000200;
    (*((volatile unsigned long *)(0x40050000 + 0x0000044C))) |= 0x00000001;
  }
  return (ulStatus);
}


x86 assembly (clang, -O0):
<USBIntStatusControl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xa(%rax),%al
movzbl %al,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x40c(%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1153 <USBIntStatusControl+0x53>
mov    -0x10(%rbp),%rax
or     $0x100,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x40c(%rax),%cl
movzbl %cl,%ecx
or     $0x1,%ecx
mov    %cl,0x40c(%rax)
mov    $0x4005044c,%eax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     118b <USBIntStatusControl+0x8b>
mov    -0x10(%rbp),%rax
or     $0x200,%rax
mov    %rax,-0x10(%rbp)
mov    $0x4005044c,%eax
mov    (%rax),%rcx
or     $0x1,%rcx
mov    $0x4005044c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBIntStatusControl>:
movzbl 0xa(%rdi),%eax
testq  $0x1,0x40c(%rdi)
jne    1120 <USBIntStatusControl+0x20>
testq  $0x1,0x4005044c
jne    113b <USBIntStatusControl+0x3b>
ret
or     $0x100,%rax
orb    $0x1,0x40c(%rdi)
testq  $0x1,0x4005044c
je     111f <USBIntStatusControl+0x1f>
or     $0x200,%rax
orq    $0x1,0x4005044c
40 01
ret

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

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