#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 */

/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void ComparatorIntUnregister(unsigned long ulBase, unsigned long ulComp) {
  DEBUG_ASSERT(ulBase == 0x4003C000);
  DEBUG_ASSERT(ulComp < 3);
  (*((volatile unsigned long *)(ulBase + 0x00000008))) &= ~(1 << ulComp);
  IntDisable(41 + ulComp);
  IntUnregister(41 + ulComp);
}


x86 assembly (clang, -O0):
<ComparatorIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x4003c000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
cmpq   $0x3,-0x10(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
add    $0x29,%rax
mov    %eax,%edi
call   1030 <IntDisable@plt>
mov    -0x10(%rbp),%rax
add    $0x29,%rax
mov    %eax,%edi
call   1050 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorIntUnregister>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x4003c000,%r14
sete   %dil
call   1040 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x3,%rbx
setb   %dil
call   1040 <DEBUG_ASSERT@plt>
mov    $0xfffffffe,%eax
mov    %ebx,%ecx
rol    %cl,%eax
cltq
and    %rax,0x8(%r14)
add    $0x29,%ebx
mov    %ebx,%edi
call   1030 <IntDisable@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <IntUnregister@plt>

LLVM IR (-O0):
define void @ComparatorIntUnregister(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1073987584
%7 = zext i1 %6 to i32
%8 = call i32 @DEBUG_ASSERT(i32 %7)
%9 = load i64, i64* %4
%10 = icmp ult i64 %9, 3
%11 = zext i1 %10 to i32
%12 = call i32 @DEBUG_ASSERT(i32 %11)
%13 = load i64, i64* %4
%14 = trunc i64 %13 to i32
%15 = shl i32 1, %14
%16 = xor i32 %15, -1
%17 = sext i32 %16 to i64
%18 = load i64, i64* %3
%19 = add i64 %18, 8
%20 = inttoptr i64 %19 to i64*
%21 = load volatile i64, i64* %20
%22 = and i64 %21, %17
store volatile i64 %22, i64* %20
%23 = load i64, i64* %4
%24 = add i64 41, %23
%25 = trunc i64 %24 to i32
%26 = call i32 @IntDisable(i32 %25)
%27 = load i64, i64* %4
%28 = add i64 41, %27
%29 = trunc i64 %28 to i32
%30 = call i32 @IntUnregister(i32 %29)
ret void
}

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