#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_set_one_shot_act(uint8_t module, unsigned char ch,
                               unsigned char act) {
  if (ch > 1 || act > 3)
    return -1;
  if (ch == 0)
    ehrpwm_reg_config(module, 0x1A, act, ((1 << 1) | (1 << 0)));
  else
    ehrpwm_reg_config(module, 0x1A, act << 0x3, ((1 << 4) | (1 << 3)));
  return 0;
}


x86 assembly (clang, -O0):
<ehrpwm_aq_set_one_shot_act>:
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
jg     1140 <ehrpwm_aq_set_one_shot_act+0x30>
movzbl -0xa(%rbp),%eax
cmp    $0x3,%eax
jle    114c <ehrpwm_aq_set_one_shot_act+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <ehrpwm_aq_set_one_shot_act+0x87>
movzbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    1174 <ehrpwm_aq_set_one_shot_act+0x64>
mov    -0x8(%rbp),%edi
mov    $0x1a,%esi
mov    $0x3,%ecx
movzbl -0xa(%rbp),%edx
call   1030 <ehrpwm_reg_config@plt>
jmp    1190 <ehrpwm_aq_set_one_shot_act+0x80>
mov    -0x8(%rbp),%edi
movzbl -0xa(%rbp),%eax
shl    $0x3,%eax
mov    $0x1a,%esi
mov    $0x18,%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_set_one_shot_act>:
push   %rax
mov    $0xffffffff,%eax
cmp    $0x1,%sil
ja     114c <ehrpwm_aq_set_one_shot_act+0x3c>
cmp    $0x3,%dl
ja     114c <ehrpwm_aq_set_one_shot_act+0x3c>
test   %sil,%sil
je     1138 <ehrpwm_aq_set_one_shot_act+0x28>
shl    $0x3,%dl
movzbl %dl,%edx
mov    $0x1a,%esi
mov    $0x18,%ecx
jmp    1145 <ehrpwm_aq_set_one_shot_act+0x35>
movzbl %dl,%edx
mov    $0x1a,%esi
mov    $0x3,%ecx
call   1030 <ehrpwm_reg_config@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ehrpwm_aq_set_one_shot_act(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 %15, label %11
11: ; preds = %3
%12 = load i8, i8* %7
%13 = zext i8 %12 to i32
%14 = icmp sgt i32 %13, 3
br i1 %14, label %15, label %16
15: ; preds = %11, %3
store i32 -1, i32* %4
br label %32
16: ; preds = %11
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %5
%22 = load i8, i8* %7
%23 = call i32 @ehrpwm_reg_config(i32 %21, i32 26, i8 zeroext %22, i32 3)
br label %31
24: ; preds = %16
%25 = load i32, i32* %5
%26 = load i8, i8* %7
%27 = zext i8 %26 to i32
%28 = shl i32 %27, 3
%29 = trunc i32 %28 to i8
%30 = call i32 @ehrpwm_reg_config(i32 %25, i32 26, i8 zeroext %29, i32 24)
br label %31
31: ; preds = %24, %20
store i32 0, i32* %4
br label %32
32: ; preds = %31, %15
%33 = load i32, i32* %4
ret i32 %33
}

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