#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 */

/* Variables and functions */
unsigned int LCDVersionGet();
unsigned int RasterClearGetIntStatus(unsigned int baseAddr, unsigned int flag) {
  unsigned int saveStatus = 0;
  unsigned int version;
  version = LCDVersionGet();
  if (2u == version) {
    saveStatus = (*((volatile unsigned int *)(baseAddr + (0x5C)))) & flag;
    (*((volatile unsigned int *)(baseAddr + (0x5C)))) = saveStatus;
  } else if (1u == version) {
    saveStatus = (*((volatile unsigned int *)(baseAddr + (0x8)))) & flag;
    (*((volatile unsigned int *)(baseAddr + (0x8)))) = saveStatus;
  } else {
    ;
  }
  return (saveStatus);
}


x86 assembly (clang, -O0):
<RasterClearGetIntStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <LCDVersionGet@plt>
mov    %eax,-0x10(%rbp)
mov    $0x2,%eax
cmp    -0x10(%rbp),%eax
jne    115f <RasterClearGetIntStatus+0x4f>
mov    -0x4(%rbp),%eax
add    $0x5c,%eax
mov    %eax,%eax
mov    (%rax),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x5c,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
jmp    1199 <RasterClearGetIntStatus+0x89>
mov    $0x1,%eax
cmp    -0x10(%rbp),%eax
jne    118f <RasterClearGetIntStatus+0x7f>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,%eax
mov    (%rax),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
jmp    1194 <RasterClearGetIntStatus+0x84>
jmp    1194 <RasterClearGetIntStatus+0x84>
jmp    1199 <RasterClearGetIntStatus+0x89>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RasterClearGetIntStatus>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%ebx
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <LCDVersionGet@plt>
cmp    $0x1,%eax
je     1131 <RasterClearGetIntStatus+0x21>
cmp    $0x2,%eax
jne    113b <RasterClearGetIntStatus+0x2b>
add    $0x5c,%ebx
jmp    1134 <RasterClearGetIntStatus+0x24>
add    $0x8,%ebx
and    (%rbx),%ebp
mov    %ebp,(%rbx)
mov    %ebp,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @RasterClearGetIntStatus(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%7 = call i32 (...) @LCDVersionGet()
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 2, %8
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i32, i32* %3
%12 = add i32 %11, 92
%13 = zext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = load i32, i32* %4
%17 = and i32 %15, %16
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = add i32 %19, 92
%21 = zext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
store volatile i32 %18, i32* %22
br label %41
23: ; preds = %2
%24 = load i32, i32* %6
%25 = icmp eq i32 1, %24
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i32, i32* %3
%28 = add i32 %27, 8
%29 = zext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
%31 = load volatile i32, i32* %30
%32 = load i32, i32* %4
%33 = and i32 %31, %32
store i32 %33, i32* %5
%34 = load i32, i32* %5
%35 = load i32, i32* %3
%36 = add i32 %35, 8
%37 = zext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
store volatile i32 %34, i32* %38
br label %40
39: ; preds = %23
br label %40
40: ; preds = %39, %26
br label %41
41: ; preds = %40, %10
%42 = load i32, i32* %5
ret i32 %42
}

LLVM IR (-O2):
define i32 @RasterClearGetIntStatus(i32 %0, i32 %1) {
%3 = tail call i32 (...) @LCDVersionGet()
switch i32 %3, label %16 [
i32 2, label %4
i32 1, label %10
]
4: ; preds = %2
%5 = add i32 %0, 92
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, %1
store volatile i32 %9, i32* %7
br label %16
10: ; preds = %2
%11 = add i32 %0, 8
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, %1
store volatile i32 %15, i32* %13
br label %16
16: ; preds = %2, %10, %4
%17 = phi i32 [ %9, %4 ], [ %15, %10 ], [ 0, %2 ]
ret i32 %17
}