#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);
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void ComparatorIntUnregister(uint32_t ui32Base, uint32_t ui32Comp) {
  ASSERT(ui32Base == 0x4003C000);
  ASSERT(ui32Comp < 3);
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) &= ~(1 << ui32Comp);
  IntDisable(41 + ui32Comp);
  IntUnregister(41 + ui32Comp);
}


x86 assembly (clang, -O0):
<ComparatorIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x4003c000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
cmpl   $0x3,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edi
add    $0x29,%edi
call   1030 <IntDisable@plt>
mov    -0x8(%rbp),%edi
add    $0x29,%edi
call   1050 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorIntUnregister>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x4003c000,%ebp
sete   %dil
call   1040 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x3,%ebx
setl   %dil
call   1040 <ASSERT@plt>
mov    $0xfffffffe,%eax
mov    %ebx,%ecx
rol    %cl,%eax
movslq %ebp,%rcx
and    %eax,0x8(%rcx)
add    $0x29,%ebx
mov    %ebx,%edi
call   1030 <IntDisable@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <IntUnregister@plt>

LLVM IR (-O0):
define void @ComparatorIntUnregister(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, 1073987584
%7 = zext i1 %6 to i32
%8 = call i32 @ASSERT(i32 %7)
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %4
%14 = shl i32 1, %13
%15 = xor i32 %14, -1
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 8
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = and i32 %20, %15
store volatile i32 %21, i32* %19
%22 = load i32, i32* %4
%23 = add nsw i32 41, %22
%24 = call i32 @IntDisable(i32 %23)
%25 = load i32, i32* %4
%26 = add nsw i32 41, %25
%27 = call i32 @IntUnregister(i32 %26)
ret void
}

LLVM IR (-O2):
define void @ComparatorIntUnregister(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1073987584
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = icmp slt i32 %1, 3
%7 = zext i1 %6 to i32
%8 = tail call i32 @ASSERT(i32 %7)
%9 = shl nuw i32 1, %1
%10 = xor i32 %9, -1
%11 = add nsw i32 %0, 8
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, %10
store volatile i32 %15, i32* %13
%16 = add nsw i32 %1, 41
%17 = tail call i32 @IntDisable(i32 %16)
%18 = tail call i32 @IntUnregister(i32 %16)
ret void
}