#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 USBHostLPMConfig(uint32_t ui32Base, uint32_t ui32ResumeTime,
                      uint32_t ui32Config) {
  ASSERT(ui32Base == 0x40050000);
  ASSERT(ui32ResumeTime <= 1175);
  ASSERT(ui32ResumeTime >= 50);
  (*((volatile uint16_t *)(ui32Base + 0x00000360))) =
      ui32Config | ((ui32ResumeTime - 50) / 75) << 4;
}


x86 assembly (clang, -O0):
<USBHostLPMConfig>:
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   $0x497,-0x8(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x32,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    $0x32,%eax
mov    $0x4b,%esi
cltd
idiv   %esi
shl    $0x4,%eax
or     %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x360,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostLPMConfig>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x40050000,%ebp
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x498,%ebx
setl   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x32,%ebx
setge  %dil
call   1030 <ASSERT@plt>
add    $0xffffffce,%ebx
movslq %ebx,%rax
imul   $0x1b4e81b5,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x23,%rax
add    %ecx,%eax
shl    $0x4,%eax
or     %r14d,%eax
movslq %ebp,%rcx
mov    %eax,0x360(%rcx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @USBHostLPMConfig(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1074069504
%9 = zext i1 %8 to i32
%10 = call i32 @ASSERT(i32 %9)
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 1175
%13 = zext i1 %12 to i32
%14 = call i32 @ASSERT(i32 %13)
%15 = load i32, i32* %5
%16 = icmp sge i32 %15, 50
%17 = zext i1 %16 to i32
%18 = call i32 @ASSERT(i32 %17)
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 50
%22 = sdiv i32 %21, 75
%23 = shl i32 %22, 4
%24 = or i32 %19, %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 864
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i32*
store volatile i32 %24, i32* %28
ret void
}

LLVM IR (-O2):
define void @USBHostLPMConfig(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, 1176
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = icmp sgt i32 %1, 49
%11 = zext i1 %10 to i32
%12 = tail call i32 @ASSERT(i32 %11)
%13 = add nsw i32 %1, -50
%14 = sdiv i32 %13, 75
%15 = shl nsw i32 %14, 4
%16 = or i32 %15, %2
%17 = add nsw i32 %0, 864
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
store volatile i32 %16, i32* %19
ret void
}