#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);
bool ComparatorIntStatus(uint32_t ui32Base, uint32_t ui32Comp, bool bMasked) {
  ASSERT(ui32Base == 0x4003C000);
  ASSERT(ui32Comp < 3);
  if (bMasked) {
    return (
        (((*((volatile uint32_t *)(ui32Base + 0x00000000))) >> ui32Comp) & 1)
            ? true
            : false);
  } else {
    return (
        (((*((volatile uint32_t *)(ui32Base + 0x00000004))) >> ui32Comp) & 1)
            ? true
            : false);
  }
}


x86 assembly (clang, -O0):
<ComparatorIntStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x4003c000,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x3,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0x10(%rbp)
je     1177 <ComparatorIntStatus+0x67>
mov    -0x8(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%edx
mov    -0xc(%rbp),%ecx
sar    %cl,%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1199 <ComparatorIntStatus+0x89>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%edx
mov    -0xc(%rbp),%ecx
sar    %cl,%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorIntStatus>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x4003c000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x3,%ebp
setl   %dil
call   1030 <ASSERT@plt>
lea    0x4(%rbx),%eax
test   %r14d,%r14d
cmovne %ebx,%eax
cltq
mov    (%rax),%eax
mov    %ebp,%ecx
shr    %cl,%eax
and    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ComparatorIntStatus(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1073987584
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp slt i32 %1, 3
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = icmp eq i32 %2, 0
%11 = add nsw i32 %0, 4
%12 = select i1 %10, i32 %11, i32 %0
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = lshr i32 %15, %1
%17 = and i32 %16, 1
ret i32 %17
}