#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*/ TimerIC1PrescalerSet(unsigned long, unsigned long);
int /*<<< orphan*/ TimerIC2PrescalerSet(unsigned long, unsigned long);
int /*<<< orphan*/ TimerTI1Configure(unsigned long, unsigned long,
                                     unsigned long, unsigned long);
int /*<<< orphan*/ TimerTI2Configure(unsigned long, unsigned long,
                                     unsigned long, unsigned long);
void TimerPWMIConfigure(unsigned long ulBase, unsigned long ulChannel,
                        unsigned long ulICPolarity, unsigned long ulICSelection,
                        unsigned long ulPrescaler, unsigned long ulICFilter) {
  unsigned long ulOppositePol = 0x00000000;
  unsigned long ulOppositeSel = 0x00000001;

  ;
  if (ulICPolarity == 0x00000000) {
    ulOppositePol = 0x00000002;
  } else {
    ulOppositePol = 0x00000000;
  }
  if (ulICSelection == 0x00000001) {
    ulOppositeSel = 0x00000002;
  } else {
    ulOppositeSel = 0x00000001;
  }
  if (ulChannel == 1) {
    TimerTI1Configure(ulBase, ulICPolarity, ulICSelection, ulICFilter);
    TimerIC1PrescalerSet(ulBase, ulPrescaler);
    TimerTI2Configure(ulBase, ulOppositePol, ulOppositeSel, ulICFilter);
    TimerIC2PrescalerSet(ulBase, ulPrescaler);
  } else {
    TimerTI2Configure(ulBase, ulICPolarity, ulICSelection, ulICFilter);
    TimerIC2PrescalerSet(ulBase, ulPrescaler);
    TimerTI1Configure(ulBase, ulOppositePol, ulOppositeSel, ulICFilter);
    TimerIC1PrescalerSet(ulBase, ulPrescaler);
  }
}


x86 assembly (clang, -O0):
<TimerPWMIConfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x1,-0x40(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1188 <TimerPWMIConfigure+0x48>
movq   $0x2,-0x38(%rbp)
jmp    1190 <TimerPWMIConfigure+0x50>
movq   $0x0,-0x38(%rbp)
cmpq   $0x1,-0x20(%rbp)
jne    11a8 <TimerPWMIConfigure+0x68>
movq   $0x2,-0x40(%rbp)
jmp    11b0 <TimerPWMIConfigure+0x70>
movq   $0x1,-0x40(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    1204 <TimerPWMIConfigure+0xc4>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <TimerTI1Configure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <TimerIC1PrescalerSet@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1040 <TimerTI2Configure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <TimerIC2PrescalerSet@plt>
jmp    1248 <TimerPWMIConfigure+0x108>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1040 <TimerTI2Configure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <TimerIC2PrescalerSet@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <TimerTI1Configure@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <TimerIC1PrescalerSet@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerPWMIConfigure>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r9,%r15
mov    %r8,%r14
mov    %rdi,%r12
xor    %r13d,%r13d
test   %rdx,%rdx
sete   %r13b
add    %r13,%r13
xor    %ebx,%ebx
cmp    $0x1,%rcx
sete   %bl
add    $0x1,%rbx
cmp    $0x1,%rsi
jne    11b0 <TimerPWMIConfigure+0x70>
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r15,%rcx
call   1030 <TimerTI1Configure@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <TimerIC1PrescalerSet@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1040 <TimerTI2Configure@plt>
mov    %r12,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1060 <TimerIC2PrescalerSet@plt>
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r15,%rcx
call   1040 <TimerTI2Configure@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <TimerIC2PrescalerSet@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1030 <TimerTI1Configure@plt>
mov    %r12,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <TimerIC1PrescalerSet@plt>

LLVM IR (-O0):
define void @TimerPWMIConfigure(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
store i64 0, i64* %13
store i64 1, i64* %14
%15 = load i64, i64* %9
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %6
store i64 2, i64* %13
br label %19
18: ; preds = %6
store i64 0, i64* %13
br label %19
19: ; preds = %18, %17
%20 = load i64, i64* %10
%21 = icmp eq i64 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %19
store i64 2, i64* %14
br label %24
23: ; preds = %19
store i64 1, i64* %14
br label %24
24: ; preds = %23, %22
%25 = load i64, i64* %8
%26 = icmp eq i64 %25, 1
br i1 %26, label %27, label %44
27: ; preds = %24
%28 = load i64, i64* %7
%29 = load i64, i64* %9
%30 = load i64, i64* %10
%31 = load i64, i64* %12
%32 = call i32 @TimerTI1Configure(i64 %28, i64 %29, i64 %30, i64 %31)
%33 = load i64, i64* %7
%34 = load i64, i64* %11
%35 = call i32 @TimerIC1PrescalerSet(i64 %33, i64 %34)
%36 = load i64, i64* %7
%37 = load i64, i64* %13
%38 = load i64, i64* %14
%39 = load i64, i64* %12
%40 = call i32 @TimerTI2Configure(i64 %36, i64 %37, i64 %38, i64 %39)
%41 = load i64, i64* %7
%42 = load i64, i64* %11
%43 = call i32 @TimerIC2PrescalerSet(i64 %41, i64 %42)
br label %61
44: ; preds = %24
%45 = load i64, i64* %7
%46 = load i64, i64* %9
%47 = load i64, i64* %10
%48 = load i64, i64* %12
%49 = call i32 @TimerTI2Configure(i64 %45, i64 %46, i64 %47, i64 %48)
%50 = load i64, i64* %7
%51 = load i64, i64* %11
%52 = call i32 @TimerIC2PrescalerSet(i64 %50, i64 %51)
%53 = load i64, i64* %7
%54 = load i64, i64* %13
%55 = load i64, i64* %14
%56 = load i64, i64* %12
%57 = call i32 @TimerTI1Configure(i64 %53, i64 %54, i64 %55, i64 %56)
%58 = load i64, i64* %7
%59 = load i64, i64* %11
%60 = call i32 @TimerIC1PrescalerSet(i64 %58, i64 %59)
br label %61
61: ; preds = %44, %27
ret void
}

LLVM IR (-O2):
define void @TimerPWMIConfigure(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = icmp eq i64 %2, 0
%8 = select i1 %7, i64 2, i64 0
%9 = icmp eq i64 %3, 1
%10 = select i1 %9, i64 2, i64 1
%11 = icmp eq i64 %1, 1
br i1 %11, label %12, label %17
12: ; preds = %6
%13 = tail call i32 @TimerTI1Configure(i64 %0, i64 %2, i64 %3, i64 %5)
%14 = tail call i32 @TimerIC1PrescalerSet(i64 %0, i64 %4)
%15 = tail call i32 @TimerTI2Configure(i64 %0, i64 %8, i64 %10, i64 %5)
%16 = tail call i32 @TimerIC2PrescalerSet(i64 %0, i64 %4)
br label %22
17: ; preds = %6
%18 = tail call i32 @TimerTI2Configure(i64 %0, i64 %2, i64 %3, i64 %5)
%19 = tail call i32 @TimerIC2PrescalerSet(i64 %0, i64 %4)
%20 = tail call i32 @TimerTI1Configure(i64 %0, i64 %8, i64 %10, i64 %5)
%21 = tail call i32 @TimerIC1PrescalerSet(i64 %0, i64 %4)
br label %22
22: ; preds = %17, %12
ret void
}