#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 /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ ehrpwm_reg_config(int /*<<< orphan*/, int, unsigned char,
                                     int);
int ehrpwm_aq_continuous_frc(uint8_t module, unsigned char ch,
                             unsigned char act) {
  if (ch > 1)
    return -1;
  if (ch == 0)
    ehrpwm_reg_config(module, 0x1c, act, ((1 << 1) | (1 << 0)));
  else
    ehrpwm_reg_config(module, 0x1c, act << 0x2, ((1 << 3) | (1 << 2)));
  return 0;
}


x86 assembly (clang, -O0):
<ehrpwm_aq_continuous_frc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %edi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x1,%eax
jle    113f <ehrpwm_aq_continuous_frc+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <ehrpwm_aq_continuous_frc+0x7a>
movzbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    1167 <ehrpwm_aq_continuous_frc+0x57>
mov    -0x8(%rbp),%edi
mov    $0x1c,%esi
mov    $0x3,%ecx
movzbl -0xa(%rbp),%edx
call   1030 <ehrpwm_reg_config@plt>
jmp    1183 <ehrpwm_aq_continuous_frc+0x73>
mov    -0x8(%rbp),%edi
movzbl -0xa(%rbp),%eax
shl    $0x2,%eax
mov    $0x1c,%esi
mov    $0xc,%ecx
movzbl %al,%edx
call   1030 <ehrpwm_reg_config@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ehrpwm_aq_continuous_frc>:
push   %rax
mov    $0xffffffff,%eax
cmp    $0x1,%sil
ja     1147 <ehrpwm_aq_continuous_frc+0x37>
test   %sil,%sil
je     1133 <ehrpwm_aq_continuous_frc+0x23>
shl    $0x2,%dl
movzbl %dl,%edx
mov    $0x1c,%esi
mov    $0xc,%ecx
jmp    1140 <ehrpwm_aq_continuous_frc+0x30>
movzbl %dl,%edx
mov    $0x1c,%esi
mov    $0x3,%ecx
call   1030 <ehrpwm_reg_config@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ehrpwm_aq_continuous_frc(i32 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
store i32 %0, i32* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 -1, i32* %4
br label %28
12: ; preds = %3
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %5
%18 = load i8, i8* %7
%19 = call i32 @ehrpwm_reg_config(i32 %17, i32 28, i8 zeroext %18, i32 3)
br label %27
20: ; preds = %12
%21 = load i32, i32* %5
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 2
%25 = trunc i32 %24 to i8
%26 = call i32 @ehrpwm_reg_config(i32 %21, i32 28, i8 zeroext %25, i32 12)
br label %27
27: ; preds = %20, %16
store i32 0, i32* %4
br label %28
28: ; preds = %27, %11
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @ehrpwm_aq_continuous_frc(i32 %0, i8 zeroext %1, i8 zeroext %2) {
%4 = icmp ugt i8 %1, 1
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp eq i8 %1, 0
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @ehrpwm_reg_config(i32 %0, i32 28, i8 zeroext %2, i32 3)
br label %12
9: ; preds = %5
%10 = shl i8 %2, 2
%11 = tail call i32 @ehrpwm_reg_config(i32 %0, i32 28, i8 zeroext %10, i32 12)
br label %12
12: ; preds = %7, %9, %3
%13 = phi i32 [ -1, %3 ], [ 0, %9 ], [ 0, %7 ]
ret i32 %13
}