#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*/ IntEnable(unsigned long);
int /*<<< orphan*/ IntRegister(unsigned long, void (*)());
unsigned long TimerIntNumberGet(unsigned long);
void TimerIntRegister(unsigned long ulBase, unsigned long ulTimer,
                      void (*pfnHandler)(void)) {
  ;

  ;
  ulBase = TimerIntNumberGet(ulBase);
  if (ulTimer & 0x000000ff) {
    IntRegister(ulBase, pfnHandler);
    IntEnable(ulBase);
  }
  if (ulTimer & 0x0000ff00) {
    IntRegister(ulBase + 1, pfnHandler);
    IntEnable(ulBase + 1);
  }
}


x86 assembly (clang, -O0):
<TimerIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <TimerIntNumberGet@plt>
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
and    $0xff,%rax
cmp    $0x0,%rax
je     117b <TimerIntRegister+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <IntRegister@plt>
mov    -0x8(%rbp),%rdi
call   1040 <IntEnable@plt>
mov    -0x10(%rbp),%rax
and    $0xff00,%rax
cmp    $0x0,%rax
je     11ad <TimerIntRegister+0x7d>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
call   1050 <IntRegister@plt>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1040 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerIntRegister>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1030 <TimerIntNumberGet@plt>
mov    %rax,%rbx
test   %r15b,%r15b
je     115b <TimerIntRegister+0x2b>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <IntRegister@plt>
mov    %rbx,%rdi
call   1040 <IntEnable@plt>
test   $0xff00,%r15d
je     1180 <TimerIntRegister+0x50>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <IntRegister@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <IntEnable@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @TimerIntRegister(i64 %0, i64 %1, void ()* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca void ()*
store i64 %0, i64* %4
store i64 %1, i64* %5
store void ()* %2, void ()** %6
%7 = load i64, i64* %4
%8 = call i64 @TimerIntNumberGet(i64 %7)
store i64 %8, i64* %4
%9 = load i64, i64* %5
%10 = and i64 %9, 255
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %3
%13 = load i64, i64* %4
%14 = load void ()*, void ()** %6
%15 = bitcast void ()* %14 to void (...)*
%16 = call i32 @IntRegister(i64 %13, void (...)* %15)
%17 = load i64, i64* %4
%18 = call i32 @IntEnable(i64 %17)
br label %19
19: ; preds = %12, %3
%20 = load i64, i64* %5
%21 = and i64 %20, 65280
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = load i64, i64* %4
%25 = add i64 %24, 1
%26 = load void ()*, void ()** %6
%27 = bitcast void ()* %26 to void (...)*
%28 = call i32 @IntRegister(i64 %25, void (...)* %27)
%29 = load i64, i64* %4
%30 = add i64 %29, 1
%31 = call i32 @IntEnable(i64 %30)
br label %32
32: ; preds = %23, %19
ret void
}

LLVM IR (-O2):
define void @TimerIntRegister(i64 %0, i64 %1, void ()* %2) {
%4 = tail call i64 @TimerIntNumberGet(i64 %0)
%5 = and i64 %1, 255
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = bitcast void ()* %2 to void (...)*
%9 = tail call i32 @IntRegister(i64 %4, void (...)* %8)
%10 = tail call i32 @IntEnable(i64 %4)
br label %11
11: ; preds = %7, %3
%12 = and i64 %1, 65280
%13 = icmp eq i64 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = add i64 %4, 1
%16 = bitcast void ()* %2 to void (...)*
%17 = tail call i32 @IntRegister(i64 %15, void (...)* %16)
%18 = tail call i32 @IntEnable(i64 %15)
br label %19
19: ; preds = %14, %11
ret void
}