#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(unsigned long);
int /*<<< orphan*/ IntUnregister(unsigned long);
int TimerBaseValid(unsigned long);
unsigned long TimerIntNumberGet(unsigned long);
void TimerIntUnregister(unsigned long ulBase, unsigned long ulTimer) {
  DEBUG_ASSERT(TimerBaseValid(ulBase));
  DEBUG_ASSERT((ulTimer == 0x000000ff) || (ulTimer == 0x0000ff00) ||
               (ulTimer == 0x0000ffff));
  ulBase = TimerIntNumberGet(ulBase);
  if (ulTimer & 0x000000ff) {
    IntDisable(ulBase);
    IntUnregister(ulBase);
  }
  if (ulTimer & 0x0000ff00) {
    IntDisable(ulBase + 1);
    IntUnregister(ulBase + 1);
  }
}


x86 assembly (clang, -O0):
<TimerIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <TimerBaseValid@plt>
mov    %eax,%edi
call   1060 <DEBUG_ASSERT@plt>
mov    $0x1,%al
cmpq   $0xff,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     11a4 <TimerIntUnregister+0x54>
mov    $0x1,%al
cmpq   $0xff00,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     11a4 <TimerIntUnregister+0x54>
cmpq   $0xffff,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1030 <TimerIntNumberGet@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
cmp    $0x0,%rax
je     11e4 <TimerIntUnregister+0x94>
mov    -0x8(%rbp),%rdi
call   1050 <IntDisable@plt>
mov    -0x8(%rbp),%rdi
call   1070 <IntUnregister@plt>
mov    -0x10(%rbp),%rax
and    $0xff00,%rax
cmp    $0x0,%rax
je     1212 <TimerIntUnregister+0xc2>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1050 <IntDisable@plt>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1070 <IntUnregister@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerIntUnregister>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
call   1040 <TimerBaseValid@plt>
mov    %eax,%edi
call   1060 <DEBUG_ASSERT@plt>
mov    $0x1,%edi
cmp    $0xff,%r15
je     118b <TimerIntUnregister+0x3b>
cmp    $0xff00,%r15
je     118b <TimerIntUnregister+0x3b>
xor    %edi,%edi
cmp    $0xffff,%r15
sete   %dil
call   1060 <DEBUG_ASSERT@plt>
mov    %r14,%rdi
call   1030 <TimerIntNumberGet@plt>
mov    %rax,%rbx
test   %r15b,%r15b
je     11b0 <TimerIntUnregister+0x60>
mov    %rbx,%rdi
call   1050 <IntDisable@plt>
mov    %rbx,%rdi
call   1070 <IntUnregister@plt>
test   $0xff00,%r15d
je     11d2 <TimerIntUnregister+0x82>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <IntDisable@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <IntUnregister@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @TimerIntUnregister(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 = call i32 @TimerBaseValid(i64 %5)
%7 = call i32 @DEBUG_ASSERT(i32 %6)
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 255
br i1 %9, label %16, label %10
10: ; preds = %2
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 65280
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 65535
br label %16
16: ; preds = %13, %10, %2
%17 = phi i1 [ true, %10 ], [ true, %2 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @DEBUG_ASSERT(i32 %18)
%20 = load i64, i64* %3
%21 = call i64 @TimerIntNumberGet(i64 %20)
store i64 %21, i64* %3
%22 = load i64, i64* %4
%23 = and i64 %22, 255
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %16
%26 = load i64, i64* %3
%27 = call i32 @IntDisable(i64 %26)
%28 = load i64, i64* %3
%29 = call i32 @IntUnregister(i64 %28)
br label %30
30: ; preds = %25, %16
%31 = load i64, i64* %4
%32 = and i64 %31, 65280
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %30
%35 = load i64, i64* %3
%36 = add i64 %35, 1
%37 = call i32 @IntDisable(i64 %36)
%38 = load i64, i64* %3
%39 = add i64 %38, 1
%40 = call i32 @IntUnregister(i64 %39)
br label %41
41: ; preds = %34, %30
ret void
}

LLVM IR (-O2):
define void @TimerIntUnregister(i64 %0, i64 %1) {
%3 = tail call i32 @TimerBaseValid(i64 %0)
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
switch i64 %1, label %5 [
i64 65280, label %8
i64 255, label %8
]
5: ; preds = %2
%6 = icmp eq i64 %1, 65535
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %2, %2, %5
%9 = phi i32 [ 1, %2 ], [ %7, %5 ], [ 1, %2 ]
%10 = tail call i32 @DEBUG_ASSERT(i32 %9)
%11 = tail call i64 @TimerIntNumberGet(i64 %0)
%12 = and i64 %1, 255
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = tail call i32 @IntDisable(i64 %11)
%16 = tail call i32 @IntUnregister(i64 %11)
br label %17
17: ; preds = %14, %8
%18 = and i64 %1, 65280
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = add i64 %11, 1
%22 = tail call i32 @IntDisable(i64 %21)
%23 = tail call i32 @IntUnregister(i64 %21)
br label %24
24: ; preds = %20, %17
ret void
}