#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*/ TimerICConfigure(unsigned long, unsigned long, int, int, int,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ TimerInternalClkConfigure(unsigned long);
int /*<<< orphan*/ TimerSlaveModeConfigure(unsigned long, int);
void xTimerCaptureModeSet(unsigned long ulBase, unsigned long ulChannel,
                          unsigned long ulCapMode) {
  if ((ulCapMode & 0x0F) == 0x00000002) {
    TimerICConfigure(ulBase, ulChannel, 0x00000000, 0x00000001, 0x00000000, 0);
    TimerSlaveModeConfigure(ulBase, 0x00000004);
  } else {
    TimerICConfigure(ulBase, ulChannel, 0x00000000, 0x00000001, 0x00000000, 0);
    TimerInternalClkConfigure(ulBase);
  }
}


x86 assembly (clang, -O0):
<xTimerCaptureModeSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0xf,%rax
cmp    $0x2,%rax
jne    1184 <xTimerCaptureModeSet+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r9d,%r9d
mov    $0x1,%ecx
mov    %r9d,%edx
mov    %r9d,%r8d
call   1040 <TimerICConfigure@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1050 <TimerSlaveModeConfigure@plt>
jmp    11a8 <xTimerCaptureModeSet+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r9d,%r9d
mov    $0x1,%ecx
mov    %r9d,%edx
mov    %r9d,%r8d
call   1040 <TimerICConfigure@plt>
mov    -0x8(%rbp),%rdi
call   1030 <TimerInternalClkConfigure@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xTimerCaptureModeSet>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
and    $0xf,%ebx
xor    %edx,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <TimerICConfigure@plt>
mov    %r14,%rdi
cmp    $0x2,%ebx
jne    1168 <xTimerCaptureModeSet+0x38>
mov    $0x4,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <TimerSlaveModeConfigure@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <TimerInternalClkConfigure@plt>

LLVM IR (-O0):
define void @xTimerCaptureModeSet(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = and i64 %7, 15
%9 = icmp eq i64 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %3
%11 = load i64, i64* %4
%12 = load i64, i64* %5
%13 = call i32 @TimerICConfigure(i64 %11, i64 %12, i32 0, i32 1, i32 0, i32 0)
%14 = load i64, i64* %4
%15 = call i32 @TimerSlaveModeConfigure(i64 %14, i32 4)
br label %22
16: ; preds = %3
%17 = load i64, i64* %4
%18 = load i64, i64* %5
%19 = call i32 @TimerICConfigure(i64 %17, i64 %18, i32 0, i32 1, i32 0, i32 0)
%20 = load i64, i64* %4
%21 = call i32 @TimerInternalClkConfigure(i64 %20)
br label %22
22: ; preds = %16, %10
ret void
}

LLVM IR (-O2):
define void @xTimerCaptureModeSet(i64 %0, i64 %1, i64 %2) {
%4 = and i64 %2, 15
%5 = icmp eq i64 %4, 2
%6 = tail call i32 @TimerICConfigure(i64 %0, i64 %1, i32 0, i32 1, i32 0, i32 0)
br i1 %5, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @TimerSlaveModeConfigure(i64 %0, i32 4)
br label %11
9: ; preds = %3
%10 = tail call i32 @TimerInternalClkConfigure(i64 %0)
br label %11
11: ; preds = %9, %7
ret void
}