#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;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void LCDRasterFrameBufferSet(uint32_t ui32Base, uint8_t ui8Buffer,
                             uint32_t *pui32Addr, uint32_t ui32NumBytes) {
  ASSERT(ui32Base == 0x44050000);
  ASSERT(!((uint32_t)pui32Addr & 3));
  ASSERT(!(ui32NumBytes & 3));
  ASSERT(ui8Buffer < 2);
  if (!ui8Buffer) {
    (*((volatile uint32_t *)(ui32Base + 0x00000044))) = (uint32_t)pui32Addr;
    (*((volatile uint32_t *)(ui32Base + 0x00000048))) =
        (uint32_t)pui32Addr + ui32NumBytes - 4;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x0000004C))) = (uint32_t)pui32Addr;
    (*((volatile uint32_t *)(ui32Base + 0x00000050))) =
        (uint32_t)pui32Addr + ui32NumBytes - 4;
  }
}


x86 assembly (clang, -O0):
<LCDRasterFrameBufferSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x44050000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x10(%rbp),%rax
and    $0x3,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x14(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x2,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11b0 <LCDRasterFrameBufferSet+0xa0>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x44,%eax
cltq
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
add    -0x14(%rbp),%ecx
sub    $0x4,%ecx
mov    -0x4(%rbp),%eax
add    $0x48,%eax
cltq
mov    %ecx,(%rax)
jmp    11d6 <LCDRasterFrameBufferSet+0xc6>
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
add    $0x4c,%eax
cltq
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
add    -0x14(%rbp),%ecx
sub    $0x4,%ecx
mov    -0x4(%rbp),%eax
add    $0x50,%eax
cltq
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDRasterFrameBufferSet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r15d
xor    %edi,%edi
cmp    $0x44050000,%r15d
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0x3,%bl
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0x3,%r14b
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x2,%ebp
setl   %dil
call   1030 <ASSERT@plt>
xor    %eax,%eax
test   %ebp,%ebp
setne  %al
lea    0x44(,%rax,8),%ecx
lea    0x48(,%rax,8),%eax
movslq %r15d,%rdx
mov    %ebx,(%rcx,%rdx,1)
lea    (%r14,%rbx,1),%ecx
add    $0xfffffffc,%ecx
mov    %ecx,(%rax,%rdx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @LCDRasterFrameBufferSet(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1141178368
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32*, i32** %7
%14 = ptrtoint i32* %13 to i32
%15 = and i32 %14, 3
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = call i32 @ASSERT(i32 %18)
%20 = load i32, i32* %8
%21 = and i32 %20, 3
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
%25 = call i32 @ASSERT(i32 %24)
%26 = load i32, i32* %6
%27 = icmp slt i32 %26, 2
%28 = zext i1 %27 to i32
%29 = call i32 @ASSERT(i32 %28)
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
br i1 %31, label %48, label %32
32: ; preds = %4
%33 = load i32*, i32** %7
%34 = ptrtoint i32* %33 to i32
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 68
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
store volatile i32 %34, i32* %38
%39 = load i32*, i32** %7
%40 = ptrtoint i32* %39 to i32
%41 = load i32, i32* %8
%42 = add nsw i32 %40, %41
%43 = sub nsw i32 %42, 4
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 72
%46 = sext i32 %45 to i64
%47 = inttoptr i64 %46 to i32*
store volatile i32 %43, i32* %47
br label %64
48: ; preds = %4
%49 = load i32*, i32** %7
%50 = ptrtoint i32* %49 to i32
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 76
%53 = sext i32 %52 to i64
%54 = inttoptr i64 %53 to i32*
store volatile i32 %50, i32* %54
%55 = load i32*, i32** %7
%56 = ptrtoint i32* %55 to i32
%57 = load i32, i32* %8
%58 = add nsw i32 %56, %57
%59 = sub nsw i32 %58, 4
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 80
%62 = sext i32 %61 to i64
%63 = inttoptr i64 %62 to i32*
store volatile i32 %59, i32* %63
br label %64
64: ; preds = %48, %32
ret void
}

LLVM IR (-O2):
define void @LCDRasterFrameBufferSet(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = icmp eq i32 %0, 1141178368
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = ptrtoint i32* %2 to i64
%9 = trunc i64 %8 to i32
%10 = and i32 %9, 3
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = tail call i32 @ASSERT(i32 %12)
%14 = and i32 %3, 3
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = tail call i32 @ASSERT(i32 %16)
%18 = icmp slt i32 %1, 2
%19 = zext i1 %18 to i32
%20 = tail call i32 @ASSERT(i32 %19)
%21 = icmp eq i32 %1, 0
%22 = select i1 %21, i32 68, i32 76
%23 = select i1 %21, i32 72, i32 80
%24 = add nsw i32 %22, %0
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
store volatile i32 %9, i32* %26
%27 = add i32 %3, -4
%28 = add i32 %27, %9
%29 = add nsw i32 %23, %0
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
store volatile i32 %28, i32* %31
ret void
}