#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;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void EMACLPIConfig(uint32_t ui32Base, bool bLPIConfig, uint16_t ui16LPILSTimer,
                   uint16_t ui16LPITWTimer) {
  uint32_t ui32TimerValue;
  ASSERT(ui32Base == 0x400EC000);
  ui32TimerValue = ((ui16LPILSTimer << 16) & 0x03FF0000);
  ui32TimerValue |= ui16LPITWTimer & 0x0000FFFF;
  (*((volatile uint32_t *)(ui32Base + 0x00000034))) = ui32TimerValue;
  if (bLPIConfig) {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) |= 0x00080000;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x00000030))) = 0x0;
  }
}


x86 assembly (clang, -O0):
<EMACLPIConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%eax
shl    $0x10,%eax
and    $0x3ff0000,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
and    $0xffff,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    %ecx,(%rax)
cmpl   $0x0,-0x8(%rbp)
je     1182 <EMACLPIConfig+0x72>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
mov    (%rax),%ecx
or     $0x80000,%ecx
mov    %ecx,(%rax)
jmp    1190 <EMACLPIConfig+0x80>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACLPIConfig>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x400ec000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
shl    $0x10,%ebp
and    $0x3ff0000,%ebp
movzwl %r15w,%ecx
or     %ebp,%ecx
movslq %ebx,%rax
mov    %ecx,0x34(%rax)
test   %r14d,%r14d
je     1156 <EMACLPIConfig+0x46>
mov    $0x80000,%ecx
or     0x30(%rax),%ecx
jmp    1158 <EMACLPIConfig+0x48>
xor    %ecx,%ecx
mov    %ecx,0x30(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @EMACLPIConfig(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1074708480
%12 = zext i1 %11 to i32
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %7
%15 = shl i32 %14, 16
%16 = and i32 %15, 67043328
store i32 %16, i32* %9
%17 = load i32, i32* %8
%18 = and i32 %17, 65535
%19 = load i32, i32* %9
%20 = or i32 %19, %18
store i32 %20, i32* %9
%21 = load i32, i32* %9
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 52
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
store volatile i32 %21, i32* %25
%26 = load i32, i32* %6
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %4
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 48
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load volatile i32, i32* %32
%34 = or i32 %33, 524288
store volatile i32 %34, i32* %32
br label %40
35: ; preds = %4
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 48
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to i32*
store volatile i32 0, i32* %39
br label %40
40: ; preds = %35, %28
ret void
}

LLVM IR (-O2):
define void @EMACLPIConfig(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, 1074708480
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = shl i32 %2, 16
%9 = and i32 %8, 67043328
%10 = and i32 %3, 65535
%11 = or i32 %9, %10
%12 = add nsw i32 %0, 52
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
store volatile i32 %11, i32* %14
%15 = icmp eq i32 %1, 0
%16 = add nsw i32 %0, 48
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
br i1 %15, label %22, label %19
19: ; preds = %4
%20 = load volatile i32, i32* %18
%21 = or i32 %20, 524288
br label %22
22: ; preds = %4, %19
%23 = phi i32 [ %21, %19 ], [ 0, %4 ]
store volatile i32 %23, i32* %18
ret void
}