#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*/ DEBUG_ASSERT(int);
int /*<<< orphan*/ IntEnable(unsigned long);
int /*<<< orphan*/ IntRegister(unsigned long, void (*)());
unsigned long PWMGenIntGet(unsigned long, unsigned long);
int PWMGenValid(unsigned long);
void PWMGenIntRegister(unsigned long ulBase, unsigned long ulGen,
                       void (*pfnIntHandler)(void)) {
  unsigned long ulInt;
  DEBUG_ASSERT((ulBase == 0x40028000) || (ulBase == 0x40029000));
  DEBUG_ASSERT(PWMGenValid(ulGen));
  ulInt = PWMGenIntGet(ulBase, ulGen);
  IntRegister(ulInt, pfnIntHandler);
  IntEnable(ulInt);
}


x86 assembly (clang, -O0):
<PWMGenIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1,%al
cmpq   $0x40028000,-0x8(%rbp)
40
mov    %al,-0x21(%rbp)
je     1185 <PWMGenIntRegister+0x35>
cmpq   $0x40029000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdi
call   1070 <PWMGenValid@plt>
mov    %eax,%edi
call   1060 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <PWMGenIntGet@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <IntRegister@plt>
mov    -0x20(%rbp),%rdi
call   1030 <IntEnable@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenIntRegister>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40028000,%rax
sete   %dil
call   1060 <DEBUG_ASSERT@plt>
mov    %r15,%rdi
call   1070 <PWMGenValid@plt>
mov    %eax,%edi
call   1060 <DEBUG_ASSERT@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <PWMGenIntGet@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <IntRegister@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @PWMGenIntRegister(i64 %0, i64 %1, void ()* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca void ()*
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store void ()* %2, void ()** %6
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 1073905664
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i64, i64* %4
%12 = icmp eq i64 %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 @DEBUG_ASSERT(i32 %15)
%17 = load i64, i64* %5
%18 = call i32 @PWMGenValid(i64 %17)
%19 = call i32 @DEBUG_ASSERT(i32 %18)
%20 = load i64, i64* %4
%21 = load i64, i64* %5
%22 = call i64 @PWMGenIntGet(i64 %20, i64 %21)
store i64 %22, i64* %7
%23 = load i64, i64* %7
%24 = load void ()*, void ()** %6
%25 = bitcast void ()* %24 to void (...)*
%26 = call i32 @IntRegister(i64 %23, void (...)* %25)
%27 = load i64, i64* %7
%28 = call i32 @IntEnable(i64 %27)
ret void
}

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