#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 LCDIDDCommandWrite(uint32_t ui32Base, uint32_t ui32CS, uint16_t ui16Cmd) {
  uint32_t ui32Reg;
  ASSERT(ui32Base == 0x44050000);
  ASSERT((ui32CS == 0) || (ui32CS == 1));
  ui32Reg = ui32CS ? 0x00000020 : 0x00000014;
  (*((volatile uint32_t *)(ui32Base + ui32Reg))) = ui16Cmd;
}


x86 assembly (clang, -O0):
<LCDIDDCommandWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x44050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     114e <LCDIDDCommandWrite+0x3e>
cmpl   $0x1,-0x8(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%edx
mov    $0x14,%eax
mov    $0x20,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%eax
cltq
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDIDDCommandWrite>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x44050000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x2,%ebp
setb   %dil
call   1030 <ASSERT@plt>
test   %ebp,%ebp
mov    $0x14,%eax
mov    $0x20,%ecx
cmove  %eax,%ecx
movslq %ebx,%rax
mov    %r14d,(%rcx,%rax,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @LCDIDDCommandWrite(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, 1141178368
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br label %17
17: ; preds = %14, %3
%18 = phi i1 [ true, %3 ], [ %16, %14 ]
%19 = zext i1 %18 to i32
%20 = call i32 @ASSERT(i32 %19)
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 32, i32 20
store i32 %24, i32* %7
%25 = load i32, i32* %6
%26 = load i32, i32* %4
%27 = load i32, i32* %7
%28 = add nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
store volatile i32 %25, i32* %30
ret void
}

LLVM IR (-O2):
define void @LCDIDDCommandWrite(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1141178368
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp ult i32 %1, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = icmp eq i32 %1, 0
%11 = select i1 %10, i32 20, i32 32
%12 = add nsw i32 %11, %0
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
store volatile i32 %2, i32* %14
ret void
}