#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 TimerDisable(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):
<TimerDisable>:
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 <TimerDisable+0x54>
mov    $0x1,%al
cmpq   $0xff00,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1174 <TimerDisable+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
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerDisable>:
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 <TimerDisable+0x3a>
cmp    $0xff00,%rbx
je     115a <TimerDisable+0x3a>
xor    %edi,%edi
cmp    $0xffff,%rbx
sete   %dil
call   1040 <DEBUG_ASSERT@plt>
not    %ebx
or     $0xfffffffffffffefe,%rbx
and    %rbx,0xc(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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