#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 scalar_t__ uint_fast8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ IntEnable(scalar_t__);
int /*<<< orphan*/ IntRegister(scalar_t__, void (*)());
scalar_t__ _ADCIntNumberGet(int, int);
void ADCIntRegister(uint32_t ui32Base, uint32_t ui32SequenceNum,
                    void (*pfnHandler)(void)) {
  uint_fast8_t ui8Int;
  ASSERT((ui32Base == 0x40038000) || (ui32Base == 0x40039000));
  ASSERT(ui32SequenceNum < 4);
  ui8Int = _ADCIntNumberGet(ui32Base, ui32SequenceNum);
  ASSERT(ui8Int != 0);
  IntRegister(ui8Int, pfnHandler);
  IntEnable(ui8Int);
}


x86 assembly (clang, -O0):
<ADCIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x40038000,-0x4(%rbp)
mov    %al,-0x19(%rbp)
je     1171 <ADCIntRegister+0x31>
cmpl   $0x40039000,-0x4(%rbp)
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <ASSERT@plt>
cmpl   $0x4,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <ASSERT@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <_ADCIntNumberGet@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <ASSERT@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <IntRegister@plt>
mov    -0x18(%rbp),%rdi
call   1030 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCIntRegister>:
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    $0x40038000,%eax
sete   %dil
call   1050 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x4,%ebp
setl   %dil
call   1050 <ASSERT@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1060 <_ADCIntNumberGet@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <ASSERT@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <IntRegister@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @ADCIntRegister(i32 %0, i32 %1, void ()* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca void ()*
%7 = alloca i64
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, 1073971200
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1073975296
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 = icmp slt i32 %17, 4
%19 = zext i1 %18 to i32
%20 = call i32 @ASSERT(i32 %19)
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i64 @_ADCIntNumberGet(i32 %21, i32 %22)
store i64 %23, i64* %7
%24 = load i64, i64* %7
%25 = icmp ne i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @ASSERT(i32 %26)
%28 = load i64, i64* %7
%29 = load void ()*, void ()** %6
%30 = bitcast void ()* %29 to void (...)*
%31 = call i32 @IntRegister(i64 %28, void (...)* %30)
%32 = load i64, i64* %7
%33 = call i32 @IntEnable(i64 %32)
ret void
}

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