#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 */
unsigned long TimerCapture1Get(unsigned long);
unsigned long TimerCapture2Get(unsigned long);
unsigned long TimerCapture3Get(unsigned long);
unsigned long TimerCapture4Get(unsigned long);
unsigned long xTimerMatchGet(unsigned long ulBase, unsigned long ulChannel) {
  unsigned long ulTemp = 0;
  if (ulChannel == 1) {
    ulTemp = TimerCapture1Get(ulBase);
  } else if (ulChannel == 2) {
    ulTemp = TimerCapture2Get(ulBase);
  } else if (ulChannel == 3) {
    ulTemp = TimerCapture3Get(ulBase);
  } else {
    ulTemp = TimerCapture4Get(ulBase);
  }
  return ulTemp;
}


x86 assembly (clang, -O0):
<xTimerMatchGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    1175 <xTimerMatchGet+0x35>
mov    -0x8(%rbp),%rdi
call   1060 <TimerCapture1Get@plt>
mov    %rax,-0x18(%rbp)
jmp    11c6 <xTimerMatchGet+0x86>
cmpq   $0x2,-0x10(%rbp)
jne    1192 <xTimerMatchGet+0x52>
mov    -0x8(%rbp),%rdi
call   1050 <TimerCapture2Get@plt>
mov    %rax,-0x18(%rbp)
jmp    11c1 <xTimerMatchGet+0x81>
cmpq   $0x3,-0x10(%rbp)
jne    11af <xTimerMatchGet+0x6f>
mov    -0x8(%rbp),%rdi
call   1030 <TimerCapture3Get@plt>
mov    %rax,-0x18(%rbp)
jmp    11bc <xTimerMatchGet+0x7c>
mov    -0x8(%rbp),%rdi
call   1040 <TimerCapture4Get@plt>
mov    %rax,-0x18(%rbp)
jmp    11c1 <xTimerMatchGet+0x81>
jmp    11c6 <xTimerMatchGet+0x86>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xTimerMatchGet>:
cmp    $0x3,%rsi
je     1157 <xTimerMatchGet+0x17>
cmp    $0x2,%rsi
je     115c <xTimerMatchGet+0x1c>
cmp    $0x1,%rsi
jne    1161 <xTimerMatchGet+0x21>
jmp    1060 <TimerCapture1Get@plt>
jmp    1030 <TimerCapture3Get@plt>
jmp    1050 <TimerCapture2Get@plt>
jmp    1040 <TimerCapture4Get@plt>

LLVM IR (-O0):
define i64 @xTimerMatchGet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
store i64 0, i64* %5
%6 = load i64, i64* %4
%7 = icmp eq i64 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %3
%10 = call i64 @TimerCapture1Get(i64 %9)
store i64 %10, i64* %5
br label %28
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp eq i64 %12, 2
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i64, i64* %3
%16 = call i64 @TimerCapture2Get(i64 %15)
store i64 %16, i64* %5
br label %27
17: ; preds = %11
%18 = load i64, i64* %4
%19 = icmp eq i64 %18, 3
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i64, i64* %3
%22 = call i64 @TimerCapture3Get(i64 %21)
store i64 %22, i64* %5
br label %26
23: ; preds = %17
%24 = load i64, i64* %3
%25 = call i64 @TimerCapture4Get(i64 %24)
store i64 %25, i64* %5
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %14
br label %28
28: ; preds = %27, %8
%29 = load i64, i64* %5
ret i64 %29
}

LLVM IR (-O2):
define i64 @xTimerMatchGet(i64 %0, i64 %1) {
switch i64 %1, label %9 [
i64 1, label %3
i64 2, label %5
i64 3, label %7
]
3: ; preds = %2
%4 = tail call i64 @TimerCapture1Get(i64 %0)
br label %11
5: ; preds = %2
%6 = tail call i64 @TimerCapture2Get(i64 %0)
br label %11
7: ; preds = %2
%8 = tail call i64 @TimerCapture3Get(i64 %0)
br label %11
9: ; preds = %2
%10 = tail call i64 @TimerCapture4Get(i64 %0)
br label %11
11: ; preds = %5, %9, %7, %3
%12 = phi i64 [ %4, %3 ], [ %6, %5 ], [ %8, %7 ], [ %10, %9 ]
ret i64 %12
}