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

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void USBHostLPMSend(uint32_t ui32Base, uint32_t ui32Address,
                    uint32_t ui32Endpoint) {
  uint32_t ui32Reg;
  ASSERT(ui32Base == 0x40050000);
  ASSERT(ui32Address < 127);
  (*((volatile uint8_t *)(ui32Base + 0x00000365))) = ui32Address;
  ui32Reg = (*((volatile uint16_t *)(ui32Base + 0x00000360))) & ~0x0000F000;
  ui32Reg |= (((ui32Endpoint) >> 4) << 12);
  (*((volatile uint16_t *)(ui32Base + 0x00000360))) = ui32Reg;
  (*((volatile uint8_t *)(ui32Base + 0x00000362))) |= 0x00000001;
}


x86 assembly (clang, -O0):
<USBHostLPMSend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x40050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x7f,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x365,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x360,%eax
cltq
mov    (%rax),%eax
and    $0xffff0fff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x4,%eax
shl    $0xc,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x360,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x362,%eax
cltq
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostLPMSend>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x7f,%r14d
setl   %dil
call   1030 <ASSERT@plt>
movslq %ebp,%rax
mov    %r14d,0x365(%rax)
mov    $0xffff0fff,%ecx
and    0x360(%rax),%ecx
and    $0xfffffff0,%ebx
shl    $0x8,%ebx
or     %ecx,%ebx
mov    %ebx,0x360(%rax)
orl    $0x1,0x362(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBHostLPMSend(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1074069504
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 127
%14 = zext i1 %13 to i32
%15 = call i32 @ASSERT(i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 869
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store volatile i32 %16, i32* %20
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 864
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
%26 = and i32 %25, -61441
store i32 %26, i32* %7
%27 = load i32, i32* %6
%28 = ashr i32 %27, 4
%29 = shl i32 %28, 12
%30 = load i32, i32* %7
%31 = or i32 %30, %29
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 864
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
store volatile i32 %32, i32* %36
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 866
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to i32*
%41 = load volatile i32, i32* %40
%42 = or i32 %41, 1
store volatile i32 %42, i32* %40
ret void
}

LLVM IR (-O2):
define void @USBHostLPMSend(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1074069504
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp slt i32 %1, 127
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = add nsw i32 %0, 869
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
store volatile i32 %1, i32* %12
%13 = add nsw i32 %0, 864
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = and i32 %16, -61441
%18 = shl i32 %2, 8
%19 = and i32 %18, -4096
%20 = or i32 %17, %19
store volatile i32 %20, i32* %15
%21 = add nsw i32 %0, 866
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = load volatile i32, i32* %23
%25 = or i32 %24, 1
store volatile i32 %25, i32* %23
ret void
}