#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);
void EPIConfigHB16Set(unsigned long ulBase, unsigned long ulConfig,
                      unsigned long ulMaxWait) {
  DEBUG_ASSERT(ulBase == 0x400D0000);
  DEBUG_ASSERT(ulMaxWait < 256);
  (*((volatile unsigned long *)(ulBase + 0x00000014))) =
      (((ulConfig & 0x00000100) ? 0x80000000 : 0) |
       ((ulConfig & 0x00000800) ? 0x04000000 : 0) |
       ((ulConfig & 0x00000600) << 15));
  ulConfig &= ~0x0000FF00;
  ulConfig |= ulMaxWait << 8;
  (*((volatile unsigned long *)(ulBase + 0x00000010))) = ulConfig;
}


x86 assembly (clang, -O0):
<EPIConfigHB16Set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x400d0000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x100,-0x18(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdx
and    $0x100,%rdx
xor    %eax,%eax
mov    $0x80000000,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    -0x10(%rbp),%rsi
and    $0x800,%rsi
xor    %ecx,%ecx
mov    $0x4000000,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
or     %ecx,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
and    $0x600,%rax
shl    $0xf,%rax
or     %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x14(%rax)
mov    -0x10(%rbp),%rax
and    $0xffffffffffff00ff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EPIConfigHB16Set>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x400d0000,%r14
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x100,%rbx
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r15d,%eax
and    $0x100,%eax
shl    $0x17,%rax
mov    %r15,%rcx
shl    $0xf,%rcx
mov    %ecx,%edx
and    $0x4000000,%edx
or     %rax,%rdx
and    $0x3000000,%ecx
or     %rdx,%rcx
mov    %rcx,0x14(%r14)
and    $0xffffffffffff00ff,%r15
shl    $0x8,%rbx
or     %r15,%rbx
mov    %rbx,0x10(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @EPIConfigHB16Set(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, 1074593792
%9 = zext i1 %8 to i32
%10 = call i32 @DEBUG_ASSERT(i32 %9)
%11 = load i64, i64* %6
%12 = icmp ult i64 %11, 256
%13 = zext i1 %12 to i32
%14 = call i32 @DEBUG_ASSERT(i32 %13)
%15 = load i64, i64* %5
%16 = and i64 %15, 256
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 -2147483648, i32 0
%20 = load i64, i64* %5
%21 = and i64 %20, 2048
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 67108864, i32 0
%25 = or i32 %19, %24
%26 = zext i32 %25 to i64
%27 = load i64, i64* %5
%28 = and i64 %27, 1536
%29 = shl i64 %28, 15
%30 = or i64 %26, %29
%31 = load i64, i64* %4
%32 = add i64 %31, 20
%33 = inttoptr i64 %32 to i64*
store volatile i64 %30, i64* %33
%34 = load i64, i64* %5
%35 = and i64 %34, -65281
store i64 %35, i64* %5
%36 = load i64, i64* %6
%37 = shl i64 %36, 8
%38 = load i64, i64* %5
%39 = or i64 %38, %37
store i64 %39, i64* %5
%40 = load i64, i64* %5
%41 = load i64, i64* %4
%42 = add i64 %41, 16
%43 = inttoptr i64 %42 to i64*
store volatile i64 %40, i64* %43
ret void
}

LLVM IR (-O2):
define void @EPIConfigHB16Set(i64 %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %0, 1074593792
%5 = zext i1 %4 to i32
%6 = tail call i32 @DEBUG_ASSERT(i32 %5)
%7 = icmp ult i64 %2, 256
%8 = zext i1 %7 to i32
%9 = tail call i32 @DEBUG_ASSERT(i32 %8)
%10 = shl i64 %1, 23
%11 = and i64 %10, 2147483648
%12 = shl i64 %1, 15
%13 = and i64 %12, 67108864
%14 = or i64 %11, %13
%15 = and i64 %12, 50331648
%16 = or i64 %14, %15
%17 = add i64 %0, 20
%18 = inttoptr i64 %17 to i64*
store volatile i64 %16, i64* %18
%19 = and i64 %1, -65281
%20 = shl i64 %2, 8
%21 = or i64 %20, %19
%22 = add i64 %0, 16
%23 = inttoptr i64 %22 to i64*
store volatile i64 %21, i64* %23
ret void
}