#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ IntEnable(int);
int /*<<< orphan*/ IntRegister(int, void (*)());
int _PWMGenIntNumberGet(int, int);
int _PWMGenValid(int);
void PWMGenIntRegister(uint32_t ui32Base, uint32_t ui32Gen,
                       void (*pfnIntHandler)(void)) {
  uint32_t ui32Int;
  ASSERT((ui32Base == 0x40028000) || (ui32Base == 0x40029000));
  ASSERT(_PWMGenValid(ui32Gen));
  ui32Int = _PWMGenIntNumberGet(ui32Base, ui32Gen);
  ASSERT(ui32Int != 0);
  IntRegister(ui32Int, pfnIntHandler);
  IntEnable(ui32Int);
}


x86 assembly (clang, -O0):
<PWMGenIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x40028000,-0x4(%rbp)
mov    %al,-0x15(%rbp)
je     1181 <PWMGenIntRegister+0x31>
cmpl   $0x40029000,-0x4(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1070 <ASSERT@plt>
mov    -0x8(%rbp),%edi
call   1040 <_PWMGenValid@plt>
mov    %eax,%edi
call   1070 <ASSERT@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <_PWMGenIntNumberGet@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <ASSERT@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <IntRegister@plt>
mov    -0x14(%rbp),%edi
call   1030 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenIntRegister>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40028000,%eax
sete   %dil
call   1070 <ASSERT@plt>
mov    %ebp,%edi
call   1040 <_PWMGenValid@plt>
mov    %eax,%edi
call   1070 <ASSERT@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1050 <_PWMGenIntNumberGet@plt>
mov    %eax,%ebx
xor    %edi,%edi
test   %eax,%eax
setne  %dil
call   1070 <ASSERT@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1060 <IntRegister@plt>
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @PWMGenIntRegister(i32 %0, i32 %1, void ()* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca void ()*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store void ()* %2, void ()** %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1073905664
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1073909760
br label %13
13: ; preds = %10, %3
%14 = phi i1 [ true, %3 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
%16 = call i32 @ASSERT(i32 %15)
%17 = load i32, i32* %5
%18 = call i32 @_PWMGenValid(i32 %17)
%19 = call i32 @ASSERT(i32 %18)
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = call i32 @_PWMGenIntNumberGet(i32 %20, i32 %21)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @ASSERT(i32 %25)
%27 = load i32, i32* %7
%28 = load void ()*, void ()** %6
%29 = bitcast void ()* %28 to void (...)*
%30 = call i32 @IntRegister(i32 %27, void (...)* %29)
%31 = load i32, i32* %7
%32 = call i32 @IntEnable(i32 %31)
ret void
}

LLVM IR (-O2):
define void @PWMGenIntRegister(i32 %0, i32 %1, void ()* %2) {
%4 = and i32 %0, -4097
%5 = icmp eq i32 %4, 1073905664
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = tail call i32 @_PWMGenValid(i32 %1)
%9 = tail call i32 @ASSERT(i32 %8)
%10 = tail call i32 @_PWMGenIntNumberGet(i32 %0, i32 %1)
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = bitcast void ()* %2 to void (...)*
%15 = tail call i32 @IntRegister(i32 %10, void (...)* %14)
%16 = tail call i32 @IntEnable(i32 %10)
ret void
}