#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
uint32_t ADCIntStatusEx(uint32_t ui32Base, bool bMasked) {
  uint32_t ui32Temp;
  ASSERT((ui32Base == 0x40038000) || (ui32Base == 0x40039000));
  if (bMasked) {
    ui32Temp = (*((volatile uint32_t *)(ui32Base + 0x0000000C)));
  } else {
    ui32Temp = (*((volatile uint32_t *)(ui32Base + 0x00000004)));
    if (ui32Temp & 0x00010000) {
      ui32Temp |= (0x00080000 | 0x00040000 | 0x00020000 | 0x00010000);
    }
  }
  return (ui32Temp);
}


x86 assembly (clang, -O0):
<ADCIntStatusEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x40038000,-0x4(%rbp)
mov    %al,-0xd(%rbp)
je     113d <ADCIntStatusEx+0x2d>
cmpl   $0x40039000,-0x4(%rbp)
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0x8(%rbp)
je     1166 <ADCIntStatusEx+0x56>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <ADCIntStatusEx+0x84>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x10000,%eax
cmp    $0x0,%eax
je     118f <ADCIntStatusEx+0x7f>
mov    -0xc(%rbp),%eax
or     $0xf0000,%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <ADCIntStatusEx+0x84>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCIntStatusEx>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40038000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
test   %ebp,%ebp
je     113a <ADCIntStatusEx+0x2a>
mov    0xc(%rax),%eax
jmp    114d <ADCIntStatusEx+0x3d>
mov    0x4(%rax),%ecx
mov    %ecx,%eax
or     $0xf0000,%eax
test   $0x10000,%ecx
cmove  %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ADCIntStatusEx(i32 %0, i32 %1) {
%3 = and i32 %0, -4097
%4 = icmp eq i32 %3, 1073971200
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp eq i32 %1, 0
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = add nsw i32 %0, 12
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
br label %22
13: ; preds = %2
%14 = add nsw i32 %0, 4
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, 65536
%19 = icmp eq i32 %18, 0
%20 = or i32 %17, 983040
%21 = select i1 %19, i32 %17, i32 %20
br label %22
22: ; preds = %13, %8
%23 = phi i32 [ %12, %8 ], [ %21, %13 ]
ret i32 %23
}