#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();
void RasterIntDisable(unsigned int baseAddr, unsigned int flag) {
  unsigned int version;
  version = LCDVersionGet();
  if (2u == version) {
    (*((volatile unsigned int *)(baseAddr + (0x64)))) = flag;
  } else if (1u == version) {
    (*((volatile unsigned int *)(baseAddr + (0x28)))) &= ~flag;
  } else {
    ;
  }
}


x86 assembly (clang, -O0):
<RasterIntDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <LCDVersionGet@plt>
mov    %eax,-0xc(%rbp)
mov    $0x2,%eax
cmp    -0xc(%rbp),%eax
jne    1148 <RasterIntDisable+0x38>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x64,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
jmp    1179 <RasterIntDisable+0x69>
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    116f <RasterIntDisable+0x5f>
mov    -0x8(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x28,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
jmp    1174 <RasterIntDisable+0x64>
jmp    1174 <RasterIntDisable+0x64>
jmp    1179 <RasterIntDisable+0x69>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RasterIntDisable>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <LCDVersionGet@plt>
cmp    $0x1,%eax
je     112f <RasterIntDisable+0x1f>
cmp    $0x2,%eax
jne    1136 <RasterIntDisable+0x26>
add    $0x64,%ebx
mov    %ebp,(%rbx)
jmp    1136 <RasterIntDisable+0x26>
not    %ebp
add    $0x28,%ebx
and    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @RasterIntDisable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (...) @LCDVersionGet()
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = icmp eq i32 2, %7
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = add i32 %11, 100
%13 = zext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
store volatile i32 %10, i32* %14
br label %29
15: ; preds = %2
%16 = load i32, i32* %5
%17 = icmp eq i32 1, %16
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %4
%20 = xor i32 %19, -1
%21 = load i32, i32* %3
%22 = add i32 %21, 40
%23 = zext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
%26 = and i32 %25, %20
store volatile i32 %26, i32* %24
br label %28
27: ; preds = %15
br label %28
28: ; preds = %27, %18
br label %29
29: ; preds = %28, %9
ret void
}

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