#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 SysCtlAPB1ClockGet();
unsigned long SysCtlAPB2ClockGet();
int /*<<< orphan*/ TimerARRPreloadConfigure(unsigned long, int);
int /*<<< orphan*/ TimerAutoReloadSet(unsigned long, unsigned long);
int /*<<< orphan*/ TimerCNTModeConfigure(unsigned long, int);
int /*<<< orphan*/ TimerICConfigure(unsigned long, unsigned long, int, int, int,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ TimerOC1Configure(unsigned long, int, unsigned long, int,
                                     int, int);
int /*<<< orphan*/ TimerOC2Configure(unsigned long, int, unsigned long, int,
                                     int, int);
int /*<<< orphan*/ TimerOC3Configure(unsigned long, int, unsigned long, int,
                                     int, int);
int /*<<< orphan*/ TimerOC4Configure(unsigned long, int, unsigned long, int,
                                     int, int);
int /*<<< orphan*/ TimerOCxModeSelect(unsigned long, unsigned long, int);
int /*<<< orphan*/ TimerOnePulseModeConfigure(unsigned long, int);
int /*<<< orphan*/ TimerPrescalerConfigure(unsigned long, unsigned long, int);
void xTimerInitConfig(unsigned long ulBase, unsigned long ulChannel,
                      unsigned long ulConfig, unsigned long ulTickFreq) {
  unsigned long ulInternalClk;
  unsigned long ulPreScale;
  unsigned long ulTCMPRValue;
  unsigned long ulTemp;

  ;
  if ((ulBase == 0x40012C00) || (ulBase == 0x40013400) ||
      (ulBase == 0x40014C00) || (ulBase == 0x40015000) ||
      (ulBase == 0x40015400)) {
    ulInternalClk = SysCtlAPB2ClockGet();
    ulTemp = ((*((volatile unsigned long *)(0x40021004))) & 0x00003800) >> 11;
    if (ulTemp == 1) {
      ulInternalClk = ulInternalClk * 2;
    }
  } else {
    ulInternalClk = SysCtlAPB1ClockGet();
    ulTemp = ((*((volatile unsigned long *)(0x40021004))) & 0x00000700) >> 8;
    if (ulTemp == 1) {
      ulInternalClk = ulInternalClk * 2;
    }
  }
  for (ulPreScale = 1; ulPreScale < 0x0000FFFF; ulPreScale++) {
    ulTCMPRValue = ulInternalClk / (ulTickFreq * ulPreScale);
    if ((ulTCMPRValue > 1) && (ulTCMPRValue < 0x0000FFFF))
      break;
  }
  switch (ulConfig & 0x000000F0) {
  case 0x00000010: {
    TimerOnePulseModeConfigure(ulBase, 0x00000008);
    TimerOCxModeSelect(ulBase, ulChannel, 0x00000000);
    break;
  }
  case 0x00000020: {
    TimerOnePulseModeConfigure(ulBase, 0x00000000);
    TimerOCxModeSelect(ulBase, ulChannel, 0x00000000);
    break;
  }
  case 0x00000030: {
    TimerOnePulseModeConfigure(ulBase, 0x00000000);
    if (ulChannel == 1) {
      TimerOC1Configure(ulBase, 0x00000030, ulTCMPRValue / 2,
                        0x00000100 | 0x00000000, 0x00000400 | 0x00000000,
                        0x00000000 | 0x00000000);
    } else if (ulChannel == 2) {
      TimerOC2Configure(ulBase, 0x00000030, ulTCMPRValue / 2,
                        0x00000100 | 0x00000000, 0x00000400 | 0x00000000,
                        0x00000000 | 0x00000000);
    } else if (ulChannel == 3) {
      TimerOC3Configure(ulBase, 0x00000030, ulTCMPRValue / 2,
                        0x00000100 | 0x00000000, 0x00000400 | 0x00000000,
                        0x00000000 | 0x00000000);
    } else {
      TimerOC4Configure(ulBase, 0x00000030, ulTCMPRValue / 2,
                        0x00000100 | 0x00000000, 0x00000400 | 0x00000000,
                        0x00000000 | 0x00000000);
    }
    break;
  }
  case 0x00000000: {
    break;
  }
  case 0x00000040: {
    TimerOnePulseModeConfigure(ulBase, 0x00000000);
    TimerICConfigure(ulBase, ulChannel, 0x00000000, 0x00000001, 0x00000000, 0);
    break;
  }
  default:
    break;
  }
  if ((ulConfig & 0x0000000F) == 0x00000001) {
    TimerCNTModeConfigure(ulBase, 0x00000000);
  } else {
    TimerCNTModeConfigure(ulBase, 0x00000010);
  }
  TimerARRPreloadConfigure(ulBase, 0x00000001);
  TimerAutoReloadSet(ulBase, ulTCMPRValue);
  TimerPrescalerConfigure(ulBase, ulPreScale, 0x00000000);
}


x86 assembly (clang, -O0):
<xTimerInitConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x40012c00,-0x8(%rbp)
40
je     122e <xTimerInitConfig+0x5e>
cmpq   $0x40013400,-0x8(%rbp)
40
je     122e <xTimerInitConfig+0x5e>
cmpq   $0x40014c00,-0x8(%rbp)
40
je     122e <xTimerInitConfig+0x5e>
cmpq   $0x40015000,-0x8(%rbp)
40
je     122e <xTimerInitConfig+0x5e>
cmpq   $0x40015400,-0x8(%rbp)
40
jne    126b <xTimerInitConfig+0x9b>
mov    $0x0,%al
call   10a0 <SysCtlAPB2ClockGet@plt>
mov    %rax,-0x28(%rbp)
mov    $0x40021004,%eax
mov    (%rax),%rax
and    $0x3800,%rax
shr    $0xb,%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x1,-0x40(%rbp)
jne    1266 <xTimerInitConfig+0x96>
mov    -0x28(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12a8 <xTimerInitConfig+0xd8>
mov    $0x0,%al
call   1090 <SysCtlAPB1ClockGet@plt>
mov    %rax,-0x28(%rbp)
mov    $0x40021004,%eax
mov    (%rax),%rax
and    $0x700,%rax
shr    $0x8,%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x1,-0x40(%rbp)
jne    12a3 <xTimerInitConfig+0xd3>
mov    -0x28(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12a8 <xTimerInitConfig+0xd8>
movq   $0x1,-0x30(%rbp)
cmpq   $0xffff,-0x30(%rbp)
jae    1308 <xTimerInitConfig+0x138>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
imul   -0x30(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x38(%rbp)
cmpq   $0x1,-0x38(%rbp)
jbe    12f2 <xTimerInitConfig+0x122>
cmpq   $0xffff,-0x38(%rbp)
jae    12f2 <xTimerInitConfig+0x122>
jmp    1308 <xTimerInitConfig+0x138>
jmp    12f7 <xTimerInitConfig+0x127>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12b0 <xTimerInitConfig+0xe0>
mov    -0x18(%rbp),%rax
and    $0xf0,%rax
mov    %rax,-0x48(%rbp)
je     1488 <xTimerInitConfig+0x2b8>
jmp    1321 <xTimerInitConfig+0x151>
mov    -0x48(%rbp),%rax
sub    $0x10,%rax
je     136d <xTimerInitConfig+0x19d>
jmp    1334 <xTimerInitConfig+0x164>
mov    -0x48(%rbp),%rax
sub    $0x20,%rax
je     138f <xTimerInitConfig+0x1bf>
jmp    1347 <xTimerInitConfig+0x177>
mov    -0x48(%rbp),%rax
sub    $0x30,%rax
je     13ae <xTimerInitConfig+0x1de>
jmp    135a <xTimerInitConfig+0x18a>
mov    -0x48(%rbp),%rax
sub    $0x40,%rax
je     148d <xTimerInitConfig+0x2bd>
jmp    14b8 <xTimerInitConfig+0x2e8>
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <TimerOCxModeSelect@plt>
jmp    14bd <xTimerInitConfig+0x2ed>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <TimerOCxModeSelect@plt>
jmp    14bd <xTimerInitConfig+0x2ed>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
cmpq   $0x1,-0x10(%rbp)
jne    13ed <xTimerInitConfig+0x21d>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rdx
shr    $0x1,%rdx
mov    $0x30,%esi
mov    $0x100,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
call   10f0 <TimerOC1Configure@plt>
jmp    1483 <xTimerInitConfig+0x2b3>
cmpq   $0x2,-0x10(%rbp)
jne    1421 <xTimerInitConfig+0x251>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rdx
shr    $0x1,%rdx
mov    $0x30,%esi
mov    $0x100,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
call   1040 <TimerOC2Configure@plt>
jmp    147e <xTimerInitConfig+0x2ae>
cmpq   $0x3,-0x10(%rbp)
jne    1455 <xTimerInitConfig+0x285>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rdx
shr    $0x1,%rdx
mov    $0x30,%esi
mov    $0x100,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
call   10c0 <TimerOC3Configure@plt>
jmp    1479 <xTimerInitConfig+0x2a9>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rdx
shr    $0x1,%rdx
mov    $0x30,%esi
mov    $0x100,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
call   10e0 <TimerOC4Configure@plt>
jmp    147e <xTimerInitConfig+0x2ae>
jmp    1483 <xTimerInitConfig+0x2b3>
jmp    14bd <xTimerInitConfig+0x2ed>
jmp    14bd <xTimerInitConfig+0x2ed>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r9d,%r9d
mov    $0x1,%ecx
mov    %r9d,%edx
mov    %r9d,%r8d
call   10d0 <TimerICConfigure@plt>
jmp    14bd <xTimerInitConfig+0x2ed>
jmp    14bd <xTimerInitConfig+0x2ed>
mov    -0x18(%rbp),%rax
and    $0xf,%rax
cmp    $0x1,%rax
jne    14df <xTimerInitConfig+0x30f>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1060 <TimerCNTModeConfigure@plt>
jmp    14ed <xTimerInitConfig+0x31d>
mov    -0x8(%rbp),%rdi
mov    $0x10,%esi
call   1060 <TimerCNTModeConfigure@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1080 <TimerARRPreloadConfigure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   10b0 <TimerAutoReloadSet@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1070 <TimerPrescalerConfigure@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xTimerInitConfig>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbp
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%r15
lea    -0x40012c00(%rdi),%rax
rol    $0x36,%rax
cmp    $0xa,%rax
ja     1371 <xTimerInitConfig+0x1a1>
mov    $0x705,%ecx
bt     %rax,%rcx
jae    1371 <xTimerInitConfig+0x1a1>
xor    %eax,%eax
call   10a0 <SysCtlAPB2ClockGet@plt>
mov    %rax,%rsi
mov    $0x800,%eax
mov    $0x3800,%ecx
mov    0x40021004,%rdx
40
and    %ecx,%edx
cmp    %rax,%rdx
sete   %cl
shl    %cl,%rsi
mov    %rbp,%rcx
add    %rbp,%rcx
mov    $0x2,%ebx
mov    %rcx,%rdi
mov    %rsi,%rax
or     %rbp,%rax
shr    $0x20,%rax
je     1260 <xTimerInitConfig+0x90>
mov    %rsi,%rax
xor    %edx,%edx
div    %rbp
mov    %rax,%r12
jmp    1269 <xTimerInitConfig+0x99>
nopl   0x0(%rax)
mov    %esi,%eax
xor    %edx,%edx
div    %ebp
mov    %eax,%r12d
lea    -0x2(%r12),%rax
cmp    $0xfffd,%rax
jb     12c0 <xTimerInitConfig+0xf0>
mov    %rsi,%rax
or     %rdi,%rax
shr    $0x20,%rax
je     1290 <xTimerInitConfig+0xc0>
mov    %rsi,%rax
xor    %edx,%edx
div    %rdi
mov    %rax,%r12
jmp    1299 <xTimerInitConfig+0xc9>
nop
mov    %esi,%eax
xor    %edx,%edx
div    %edi
mov    %eax,%r12d
lea    -0x2(%r12),%rax
cmp    $0xfffd,%rax
jb     12c4 <xTimerInitConfig+0xf4>
add    $0x2,%rbx
add    %rcx,%rdi
add    %rcx,%rbp
cmp    $0x10000,%rbx
jne    1240 <xTimerInitConfig+0x70>
mov    $0xffff,%ebx
jmp    12c4 <xTimerInitConfig+0xf4>
add    $0xffffffffffffffff,%rbx
mov    %r14d,%eax
shr    $0x4,%eax
and    $0xf,%eax
add    $0xffffffffffffffff,%rax
cmp    $0x3,%rax
ja     139d <xTimerInitConfig+0x1cd>
lea    0xd1e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r15,%rdi
mov    $0x8,%esi
jmp    1339 <xTimerInitConfig+0x169>
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
mov    %r12,%rdx
shr    %rdx
mov    %r15,%rdi
mov    $0x30,%esi
mov    $0x100,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
cmp    $0x3,%r13
je     138a <xTimerInitConfig+0x1ba>
cmp    $0x2,%r13
je     1391 <xTimerInitConfig+0x1c1>
cmp    $0x1,%r13
jne    1398 <xTimerInitConfig+0x1c8>
call   10f0 <TimerOC1Configure@plt>
jmp    139d <xTimerInitConfig+0x1cd>
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %edx,%edx
call   1030 <TimerOCxModeSelect@plt>
jmp    139d <xTimerInitConfig+0x1cd>
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <TimerOnePulseModeConfigure@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %edx,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   10d0 <TimerICConfigure@plt>
jmp    139d <xTimerInitConfig+0x1cd>
xor    %eax,%eax
call   1090 <SysCtlAPB1ClockGet@plt>
mov    %rax,%rsi
mov    $0x100,%eax
mov    $0x700,%ecx
jmp    121f <xTimerInitConfig+0x4f>
call   10c0 <TimerOC3Configure@plt>
jmp    139d <xTimerInitConfig+0x1cd>
call   1040 <TimerOC2Configure@plt>
jmp    139d <xTimerInitConfig+0x1cd>
call   10e0 <TimerOC4Configure@plt>
and    $0xf,%r14d
xor    %esi,%esi
cmp    $0x1,%r14d
setne  %sil
shl    $0x4,%esi
mov    %r15,%rdi
call   1060 <TimerCNTModeConfigure@plt>
mov    %r15,%rdi
mov    $0x1,%esi
call   1080 <TimerARRPreloadConfigure@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10b0 <TimerAutoReloadSet@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <TimerPrescalerConfigure@plt>

LLVM IR (-O0):
define void @xTimerInitConfig(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%13 = load i64, i64* %5
%14 = icmp eq i64 %13, 1073818624
br i1 %14, label %27, label %15
15: ; preds = %4
%16 = load i64, i64* %5
%17 = icmp eq i64 %16, 1073820672
br i1 %17, label %27, label %18
18: ; preds = %15
%19 = load i64, i64* %5
%20 = icmp eq i64 %19, 1073826816
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = load i64, i64* %5
%23 = icmp eq i64 %22, 1073827840
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i64, i64* %5
%26 = icmp eq i64 %25, 1073828864
br i1 %26, label %27, label %38
27: ; preds = %24, %21, %18, %15, %4
%28 = call i64 (...) @SysCtlAPB2ClockGet()
store i64 %28, i64* %9
%29 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%30 = and i64 %29, 14336
%31 = lshr i64 %30, 11
store i64 %31, i64* %12
%32 = load i64, i64* %12
%33 = icmp eq i64 %32, 1
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = load i64, i64* %9
%36 = mul i64 %35, 2
store i64 %36, i64* %9
br label %37
37: ; preds = %34, %27
br label %49
38: ; preds = %24
%39 = call i64 (...) @SysCtlAPB1ClockGet()
store i64 %39, i64* %9
%40 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%41 = and i64 %40, 1792
%42 = lshr i64 %41, 8
store i64 %42, i64* %12
%43 = load i64, i64* %12
%44 = icmp eq i64 %43, 1
br i1 %44, label %45, label %48
45: ; preds = %38
%46 = load i64, i64* %9
%47 = mul i64 %46, 2
store i64 %47, i64* %9
br label %48
48: ; preds = %45, %38
br label %49
49: ; preds = %48, %37
store i64 1, i64* %10
br label %50
50: ; preds = %66, %49
%51 = load i64, i64* %10
%52 = icmp ult i64 %51, 65535
br i1 %52, label %53, label %69
53: ; preds = %50
%54 = load i64, i64* %9
%55 = load i64, i64* %8
%56 = load i64, i64* %10
%57 = mul i64 %55, %56
%58 = udiv i64 %54, %57
store i64 %58, i64* %11
%59 = load i64, i64* %11
%60 = icmp ugt i64 %59, 1
br i1 %60, label %61, label %65
61: ; preds = %53
%62 = load i64, i64* %11
%63 = icmp ult i64 %62, 65535
br i1 %63, label %64, label %65
64: ; preds = %61
br label %69
65: ; preds = %61, %53
br label %66
66: ; preds = %65
%67 = load i64, i64* %10
%68 = add i64 %67, 1
store i64 %68, i64* %10
br label %50
69: ; preds = %64, %50
%70 = load i64, i64* %7
%71 = and i64 %70, 240
switch i64 %71, label %125 [
i64 16, label %72
i64 32, label %78
i64 48, label %84
i64 0, label %118
i64 64, label %119
]
72: ; preds = %69
%73 = load i64, i64* %5
%74 = call i32 @TimerOnePulseModeConfigure(i64 %73, i32 8)
%75 = load i64, i64* %5
%76 = load i64, i64* %6
%77 = call i32 @TimerOCxModeSelect(i64 %75, i64 %76, i32 0)
br label %126
78: ; preds = %69
%79 = load i64, i64* %5
%80 = call i32 @TimerOnePulseModeConfigure(i64 %79, i32 0)
%81 = load i64, i64* %5
%82 = load i64, i64* %6
%83 = call i32 @TimerOCxModeSelect(i64 %81, i64 %82, i32 0)
br label %126
84: ; preds = %69
%85 = load i64, i64* %5
%86 = call i32 @TimerOnePulseModeConfigure(i64 %85, i32 0)
%87 = load i64, i64* %6
%88 = icmp eq i64 %87, 1
br i1 %88, label %89, label %94
89: ; preds = %84
%90 = load i64, i64* %5
%91 = load i64, i64* %11
%92 = udiv i64 %91, 2
%93 = call i32 @TimerOC1Configure(i64 %90, i32 48, i64 %92, i32 256, i32 1024, i32 0)
br label %117
94: ; preds = %84
%95 = load i64, i64* %6
%96 = icmp eq i64 %95, 2
br i1 %96, label %97, label %102
97: ; preds = %94
%98 = load i64, i64* %5
%99 = load i64, i64* %11
%100 = udiv i64 %99, 2
%101 = call i32 @TimerOC2Configure(i64 %98, i32 48, i64 %100, i32 256, i32 1024, i32 0)
br label %116
102: ; preds = %94
%103 = load i64, i64* %6
%104 = icmp eq i64 %103, 3
br i1 %104, label %105, label %110
105: ; preds = %102
%106 = load i64, i64* %5
%107 = load i64, i64* %11
%108 = udiv i64 %107, 2
%109 = call i32 @TimerOC3Configure(i64 %106, i32 48, i64 %108, i32 256, i32 1024, i32 0)
br label %115
110: ; preds = %102
%111 = load i64, i64* %5
%112 = load i64, i64* %11
%113 = udiv i64 %112, 2
%114 = call i32 @TimerOC4Configure(i64 %111, i32 48, i64 %113, i32 256, i32 1024, i32 0)
br label %115
115: ; preds = %110, %105
br label %116
116: ; preds = %115, %97
br label %117
117: ; preds = %116, %89
br label %126
118: ; preds = %69
br label %126
119: ; preds = %69
%120 = load i64, i64* %5
%121 = call i32 @TimerOnePulseModeConfigure(i64 %120, i32 0)
%122 = load i64, i64* %5
%123 = load i64, i64* %6
%124 = call i32 @TimerICConfigure(i64 %122, i64 %123, i32 0, i32 1, i32 0, i32 0)
br label %126
125: ; preds = %69
br label %126
126: ; preds = %125, %119, %118, %117, %78, %72
%127 = load i64, i64* %7
%128 = and i64 %127, 15
%129 = icmp eq i64 %128, 1
br i1 %129, label %130, label %133
130: ; preds = %126
%131 = load i64, i64* %5
%132 = call i32 @TimerCNTModeConfigure(i64 %131, i32 0)
br label %136
133: ; preds = %126
%134 = load i64, i64* %5
%135 = call i32 @TimerCNTModeConfigure(i64 %134, i32 16)
br label %136
136: ; preds = %133, %130
%137 = load i64, i64* %5
%138 = call i32 @TimerARRPreloadConfigure(i64 %137, i32 1)
%139 = load i64, i64* %5
%140 = load i64, i64* %11
%141 = call i32 @TimerAutoReloadSet(i64 %139, i64 %140)
%142 = load i64, i64* %5
%143 = load i64, i64* %10
%144 = call i32 @TimerPrescalerConfigure(i64 %142, i64 %143, i32 0)
ret void
}

LLVM IR (-O2):
define void @xTimerInitConfig(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = add i64 %0, -1073818624
%6 = tail call i64 @llvm.fshl.i64(i64 %5, i64 %5, i64 54)
switch i64 %6, label %9 [
i64 10, label %7
i64 9, label %7
i64 8, label %7
i64 2, label %7
i64 0, label %7
]
7: ; preds = %4, %4, %4, %4, %4
%8 = tail call i64 (...) @SysCtlAPB2ClockGet()
br label %11
9: ; preds = %4
%10 = tail call i64 (...) @SysCtlAPB1ClockGet()
br label %11
11: ; preds = %9, %7
%12 = phi i64 [ 1792, %9 ], [ 14336, %7 ]
%13 = phi i64 [ 256, %9 ], [ 2048, %7 ]
%14 = phi i64 [ %10, %9 ], [ %8, %7 ]
%15 = load volatile i64, i64* inttoptr (i64 1073876996 to i64*)
%16 = and i64 %15, %12
%17 = icmp eq i64 %16, %13
%18 = zext i1 %17 to i64
%19 = shl i64 %14, %18
br label %20
20: ; preds = %32, %11
%21 = phi i64 [ 1, %11 ], [ %33, %32 ]
%22 = mul i64 %21, %3
%23 = udiv i64 %19, %22
%24 = add i64 %23, -2
%25 = icmp ult i64 %24, 65533
br i1 %25, label %35, label %26
26: ; preds = %20
%27 = add nuw nsw i64 %21, 1
%28 = mul i64 %27, %3
%29 = udiv i64 %19, %28
%30 = add i64 %29, -2
%31 = icmp ult i64 %30, 65533
br i1 %31, label %35, label %32
32: ; preds = %26
%33 = add nuw nsw i64 %21, 2
%34 = icmp eq i64 %33, 65535
br i1 %34, label %35, label %20
35: ; preds = %32, %26, %20
%36 = phi i64 [ %23, %20 ], [ %29, %26 ], [ %29, %32 ]
%37 = phi i64 [ %21, %20 ], [ %27, %26 ], [ 65535, %32 ]
%38 = lshr i64 %2, 4
%39 = and i64 %38, 15
switch i64 %39, label %63 [
i64 1, label %40
i64 2, label %43
i64 3, label %46
i64 4, label %60
]
40: ; preds = %35
%41 = tail call i32 @TimerOnePulseModeConfigure(i64 %0, i32 8)
%42 = tail call i32 @TimerOCxModeSelect(i64 %0, i64 %1, i32 0)
br label %63
43: ; preds = %35
%44 = tail call i32 @TimerOnePulseModeConfigure(i64 %0, i32 0)
%45 = tail call i32 @TimerOCxModeSelect(i64 %0, i64 %1, i32 0)
br label %63
46: ; preds = %35
%47 = tail call i32 @TimerOnePulseModeConfigure(i64 %0, i32 0)
switch i64 %1, label %57 [
i64 1, label %48
i64 2, label %51
i64 3, label %54
]
48: ; preds = %46
%49 = lshr i64 %36, 1
%50 = tail call i32 @TimerOC1Configure(i64 %0, i32 48, i64 %49, i32 256, i32 1024, i32 0)
br label %63
51: ; preds = %46
%52 = lshr i64 %36, 1
%53 = tail call i32 @TimerOC2Configure(i64 %0, i32 48, i64 %52, i32 256, i32 1024, i32 0)
br label %63
54: ; preds = %46
%55 = lshr i64 %36, 1
%56 = tail call i32 @TimerOC3Configure(i64 %0, i32 48, i64 %55, i32 256, i32 1024, i32 0)
br label %63
57: ; preds = %46
%58 = lshr i64 %36, 1
%59 = tail call i32 @TimerOC4Configure(i64 %0, i32 48, i64 %58, i32 256, i32 1024, i32 0)
br label %63
60: ; preds = %35
%61 = tail call i32 @TimerOnePulseModeConfigure(i64 %0, i32 0)
%62 = tail call i32 @TimerICConfigure(i64 %0, i64 %1, i32 0, i32 1, i32 0, i32 0)
br label %63
63: ; preds = %35, %48, %54, %57, %51, %60, %43, %40
%64 = and i64 %2, 15
%65 = icmp eq i64 %64, 1
%66 = select i1 %65, i32 0, i32 16
%67 = tail call i32 @TimerCNTModeConfigure(i64 %0, i32 %66)
%68 = tail call i32 @TimerARRPreloadConfigure(i64 %0, i32 1)
%69 = tail call i32 @TimerAutoReloadSet(i64 %0, i64 %36)
%70 = tail call i32 @TimerPrescalerConfigure(i64 %0, i64 %37, i32 0)
ret void
}