#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 TimerBaseValid(unsigned long);
void TimerEnable(unsigned long ulBase, unsigned long ulTimer) {
  DEBUG_ASSERT(TimerBaseValid(ulBase));
  DEBUG_ASSERT((ulTimer == 0x000000ff) || (ulTimer == 0x0000ff00) ||
               (ulTimer == 0x0000ffff));
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) |=
      ulTimer & (0x00000001 | 0x00000100);
}


x86 assembly (clang, -O0):
<TimerEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <TimerBaseValid@plt>
mov    %eax,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    $0x1,%al
cmpq   $0xff,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1174 <TimerEnable+0x54>
mov    $0x1,%al
cmpq   $0xff00,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1174 <TimerEnable+0x54>
cmpq   $0xffff,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdx
and    $0x101,%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerEnable>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1030 <TimerBaseValid@plt>
mov    %eax,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    $0x1,%edi
cmp    $0xff,%rbx
je     115a <TimerEnable+0x3a>
cmp    $0xff00,%rbx
je     115a <TimerEnable+0x3a>
xor    %edi,%edi
cmp    $0xffff,%rbx
sete   %dil
call   1040 <DEBUG_ASSERT@plt>
and    $0x101,%ebx
or     %rbx,0xc(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @TimerEnable(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* %4
%21 = and i64 %20, 257
%22 = load i64, i64* %3
%23 = add i64 %22, 12
%24 = inttoptr i64 %23 to i64*
%25 = load volatile i64, i64* %24
%26 = or i64 %25, %21
store volatile i64 %26, i64* %24
ret void
}

LLVM IR (-O2):
define void @TimerEnable(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 = and i64 %1, 257
%12 = add i64 %0, 12
%13 = inttoptr i64 %12 to i64*
%14 = load volatile i64, i64* %13
%15 = or i64 %14, %11
store volatile i64 %15, i64* %13
ret void
}