#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 RasterIntStatus(unsigned int baseAddr, unsigned int flag) {
  unsigned int status = 0;
  unsigned int version;
  version = LCDVersionGet();
  if (2u == version) {
    status = (*((volatile unsigned int *)(baseAddr + (0x5C)))) & flag;
  } else if (1u == version) {
    status = (*((volatile unsigned int *)(baseAddr + (0x8)))) & flag;
  } else {
    ;
  }
  return status;
}


x86 assembly (clang, -O0):
<RasterIntStatus>:
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    1152 <RasterIntStatus+0x42>
mov    -0x4(%rbp),%eax
add    $0x5c,%eax
mov    %eax,%eax
mov    (%rax),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117f <RasterIntStatus+0x6f>
mov    $0x1,%eax
cmp    -0x10(%rbp),%eax
jne    1175 <RasterIntStatus+0x65>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,%eax
mov    (%rax),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117a <RasterIntStatus+0x6a>
jmp    117a <RasterIntStatus+0x6a>
jmp    117f <RasterIntStatus+0x6f>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RasterIntStatus>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %edi,%r14d
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <LCDVersionGet@plt>
cmp    $0x2,%eax
je     1133 <RasterIntStatus+0x23>
cmp    $0x1,%eax
jne    113f <RasterIntStatus+0x2f>
mov    $0x8,%eax
jmp    1138 <RasterIntStatus+0x28>
mov    $0x5c,%eax
add    %r14d,%eax
and    (%rax),%ebp
mov    %ebp,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @RasterIntStatus(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 %18
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
br label %31
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp eq i32 1, %19
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add i32 %22, 8
%24 = zext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = load i32, i32* %4
%28 = and i32 %26, %27
store i32 %28, i32* %5
br label %30
29: ; preds = %18
br label %30
30: ; preds = %29, %21
br label %31
31: ; preds = %30, %10
%32 = load i32, i32* %5
ret i32 %32
}

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