#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 LPCChannelValid(unsigned long);
unsigned long LPCChannelPoolAddressGet(unsigned long ulBase,
                                       unsigned long ulChannel) {
  unsigned long ulAddress;
  DEBUG_ASSERT(ulBase == 0x40080000);
  DEBUG_ASSERT(LPCChannelValid(ulChannel));
  ulAddress =
      (*((volatile unsigned long *)(ulBase + 0x00000010 + (ulChannel * 0x10))));
  ulAddress = ((ulAddress & 0x00003FE0) >> (5 - 1));
  ulAddress += (ulBase + 0x00000400);
  return (ulAddress);
}


x86 assembly (clang, -O0):
<LPCChannelPoolAddressGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40080000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdi
call   1040 <LPCChannelValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    -0x10(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x3fe0,%rax
shr    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x400,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCChannelPoolAddressGet>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x40080000,%r14
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %rbx,%rdi
call   1040 <LPCChannelValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
shl    $0x4,%rbx
mov    0x10(%r14,%rbx,1),%rax
shr    $0x4,%rax
and    $0x3fe,%eax
add    %r14,%rax
add    $0x400,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @LPCChannelPoolAddressGet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = icmp eq i64 %6, 1074266112
%8 = zext i1 %7 to i32
%9 = call i32 @DEBUG_ASSERT(i32 %8)
%10 = load i64, i64* %4
%11 = call i32 @LPCChannelValid(i64 %10)
%12 = call i32 @DEBUG_ASSERT(i32 %11)
%13 = load i64, i64* %3
%14 = add i64 %13, 16
%15 = load i64, i64* %4
%16 = mul i64 %15, 16
%17 = add i64 %14, %16
%18 = inttoptr i64 %17 to i64*
%19 = load volatile i64, i64* %18
store i64 %19, i64* %5
%20 = load i64, i64* %5
%21 = and i64 %20, 16352
%22 = lshr i64 %21, 4
store i64 %22, i64* %5
%23 = load i64, i64* %3
%24 = add i64 %23, 1024
%25 = load i64, i64* %5
%26 = add i64 %25, %24
store i64 %26, i64* %5
%27 = load i64, i64* %5
ret i64 %27
}

LLVM IR (-O2):
define i64 @LPCChannelPoolAddressGet(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074266112
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = tail call i32 @LPCChannelValid(i64 %1)
%7 = tail call i32 @DEBUG_ASSERT(i32 %6)
%8 = add i64 %0, 16
%9 = shl i64 %1, 4
%10 = add i64 %8, %9
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = lshr i64 %12, 4
%14 = and i64 %13, 1022
%15 = add i64 %0, 1024
%16 = add i64 %15, %14
ret i64 %16
}