#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 /*<<< orphan*/ uint8_t;
typedef unsigned long uint32_t;

/* Variables and functions */
void LCDRasterFrameBufferSet(uint32_t ui32Base, uint8_t ui8Buffer,
                             uint32_t *pui32Addr, uint32_t ui32NumBytes) {
  ;
  ;
  ;
  ;
  if (!ui8Buffer) {
    (*((volatile unsigned long *)(ui32Base + 0x00000044))) =
        (uint32_t)pui32Addr;
    (*((volatile unsigned long *)(ui32Base + 0x00000048))) =
        (uint32_t)pui32Addr + ui32NumBytes - 4;
  } else {
    (*((volatile unsigned long *)(ui32Base + 0x0000004C))) =
        (uint32_t)pui32Addr;
    (*((volatile unsigned long *)(ui32Base + 0x00000050))) =
        (uint32_t)pui32Addr + ui32NumBytes - 4;
  }
}


x86 assembly (clang, -O0):
<LCDRasterFrameBufferSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1142 <LCDRasterFrameBufferSet+0x42>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x44(%rax)
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
sub    $0x4,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x48(%rax)
jmp    1162 <LCDRasterFrameBufferSet+0x62>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x4c(%rax)
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
sub    $0x4,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x50(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDRasterFrameBufferSet>:
xor    %eax,%eax
test   %esi,%esi
setne  %al
mov    %rdx,0x44(%rdi,%rax,8)
add    %rdx,%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,0x48(%rdi,%rax,8)
ret

LLVM IR (-O0):
define void @LCDRasterFrameBufferSet(i64 %0, i32 %1, i64* %2, i64 %3) {
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i64
store i64 %0, i64* %5
store i32 %1, i32* %6
store i64* %2, i64** %7
store i64 %3, i64* %8
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %25, label %11
11: ; preds = %4
%12 = load i64*, i64** %7
%13 = ptrtoint i64* %12 to i64
%14 = load i64, i64* %5
%15 = add i64 %14, 68
%16 = inttoptr i64 %15 to i64*
store volatile i64 %13, i64* %16
%17 = load i64*, i64** %7
%18 = ptrtoint i64* %17 to i64
%19 = load i64, i64* %8
%20 = add i64 %18, %19
%21 = sub i64 %20, 4
%22 = load i64, i64* %5
%23 = add i64 %22, 72
%24 = inttoptr i64 %23 to i64*
store volatile i64 %21, i64* %24
br label %39
25: ; preds = %4
%26 = load i64*, i64** %7
%27 = ptrtoint i64* %26 to i64
%28 = load i64, i64* %5
%29 = add i64 %28, 76
%30 = inttoptr i64 %29 to i64*
store volatile i64 %27, i64* %30
%31 = load i64*, i64** %7
%32 = ptrtoint i64* %31 to i64
%33 = load i64, i64* %8
%34 = add i64 %32, %33
%35 = sub i64 %34, 4
%36 = load i64, i64* %5
%37 = add i64 %36, 80
%38 = inttoptr i64 %37 to i64*
store volatile i64 %35, i64* %38
br label %39
39: ; preds = %25, %11
ret void
}

LLVM IR (-O2):
define void @LCDRasterFrameBufferSet(i64 %0, i32 %1, i64* %2, i64 %3) {
%5 = icmp eq i32 %1, 0
%6 = ptrtoint i64* %2 to i64
%7 = select i1 %5, i64 68, i64 76
%8 = select i1 %5, i64 72, i64 80
%9 = add i64 %7, %0
%10 = inttoptr i64 %9 to i64*
store volatile i64 %6, i64* %10
%11 = add i64 %3, -4
%12 = add i64 %11, %6
%13 = add i64 %8, %0
%14 = inttoptr i64 %13 to i64*
store volatile i64 %12, i64* %14
ret void
}