#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int _TimerBaseValid(int);
void TimerEnable(uint32_t ui32Base, uint32_t ui32Timer) {
  ASSERT(_TimerBaseValid(ui32Base));
  ASSERT((ui32Timer == 0x000000ff) || (ui32Timer == 0x0000ff00) ||
         (ui32Timer == 0x0000ffff));
  (*((volatile uint32_t *)(ui32Base + 0x0000000C))) |=
      ui32Timer & (0x00000001 | 0x00000100);
}


x86 assembly (clang, -O0):
<TimerEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_TimerBaseValid@plt>
mov    %eax,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0xff,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     116e <TimerEnable+0x4e>
mov    $0x1,%al
cmpl   $0xff00,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     116e <TimerEnable+0x4e>
cmpl   $0xffff,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%edx
and    $0x101,%edx
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerEnable>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <_TimerBaseValid@plt>
mov    %eax,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%edi
cmp    $0xff,%ebx
je     1154 <TimerEnable+0x34>
cmp    $0xff00,%ebx
je     1154 <TimerEnable+0x34>
xor    %edi,%edi
cmp    $0xffff,%ebx
sete   %dil
call   1030 <ASSERT@plt>
and    $0x101,%ebx
movslq %ebp,%rax
or     %ebx,0xc(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @TimerEnable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @_TimerBaseValid(i32 %5)
%7 = call i32 @ASSERT(i32 %6)
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 255
br i1 %9, label %16, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 65280
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp eq i32 %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 @ASSERT(i32 %18)
%20 = load i32, i32* %4
%21 = and i32 %20, 257
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 12
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = or i32 %26, %21
store volatile i32 %27, i32* %25
ret void
}

LLVM IR (-O2):
define void @TimerEnable(i32 %0, i32 %1) {
%3 = tail call i32 @_TimerBaseValid(i32 %0)
%4 = tail call i32 @ASSERT(i32 %3)
switch i32 %1, label %5 [
i32 65280, label %8
i32 255, label %8
]
5: ; preds = %2
%6 = icmp eq i32 %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 @ASSERT(i32 %9)
%11 = and i32 %1, 257
%12 = add nsw i32 %0, 12
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = or i32 %15, %11
store volatile i32 %16, i32* %14
ret void
}