#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 RasterSubPanelConfig(unsigned int baseAddr, unsigned int hols,
                          unsigned int lppt, unsigned int dpd) {
  unsigned int version;
  version = LCDVersionGet();
  if (2u == version) {
    (*((volatile unsigned int *)(baseAddr + (0x38)))) &= 0xffff0000;
    (*((volatile unsigned int *)(baseAddr + (0x38)))) = ((dpd & 0xffff));
    (*((volatile unsigned int *)(baseAddr + (0x3C)))) &= 0xff00ffff;
    (*((volatile unsigned int *)(baseAddr + (0x3C)))) =
        ((dpd & 0xff0000) >> 15);
    (*((volatile unsigned int *)(baseAddr + (0x38)))) &= 0xfc00ffff;
    (*((volatile unsigned int *)(baseAddr + (0x38)))) |=
        ((lppt & 0x3ff) << (0x00000010u));
    (*((volatile unsigned int *)(baseAddr + (0x3C)))) &= 0xfffffeff;
    (*((volatile unsigned int *)(baseAddr + (0x3C)))) |= ((lppt & 0x400) >> 11)
                                                         << (0x00000008u);
  } else if (1u == version) {
    (*((volatile unsigned int *)(baseAddr + (0x38)))) &= 0xfc00ffff;
    (*((volatile unsigned int *)(baseAddr + (0x38)))) |=
        (lppt << (0x00000010u));
    (*((volatile unsigned int *)(baseAddr + (0x38)))) &= 0xffff000f;
    (*((volatile unsigned int *)(baseAddr + (0x38)))) |= (dpd << (0x00000000u));
  } else {
    ;
  }
  (*((volatile unsigned int *)(baseAddr + (0x38)))) &= 0xDfffffff;
  (*((volatile unsigned int *)(baseAddr + (0x38)))) |= (hols << (0x0000001Du));
}


x86 assembly (clang, -O0):
<RasterSubPanelConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    $0x0,%al
call   1030 <LCDVersionGet@plt>
mov    %eax,-0x14(%rbp)
mov    $0x2,%eax
cmp    -0x14(%rbp),%eax
jne    11e9 <RasterSubPanelConfig+0xd9>
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffff0000,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
and    $0xffff,%ecx
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xff00ffff,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%ecx
and    $0xff0000,%ecx
shr    $0xf,%ecx
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfc00ffff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
and    $0x3ff,%edx
shl    $0x10,%edx
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
and    $0x400,%edx
shr    $0xb,%edx
shl    $0x8,%edx
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
jmp    1252 <RasterSubPanelConfig+0x142>
mov    $0x1,%eax
cmp    -0x14(%rbp),%eax
jne    1248 <RasterSubPanelConfig+0x138>
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfc00ffff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
shl    $0x10,%edx
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffff000f,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%edx
shl    $0x0,%edx
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
jmp    124d <RasterSubPanelConfig+0x13d>
jmp    124d <RasterSubPanelConfig+0x13d>
jmp    1252 <RasterSubPanelConfig+0x142>
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xdfffffff,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%edx
shl    $0x1d,%edx
mov    -0x4(%rbp),%eax
add    $0x38,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RasterSubPanelConfig>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <LCDVersionGet@plt>
cmp    $0x1,%eax
je     1178 <RasterSubPanelConfig+0x68>
cmp    $0x2,%eax
jne    1191 <RasterSubPanelConfig+0x81>
lea    0x38(%rbx),%eax
andl   $0xffff0000,(%rax)
movzwl %r15w,%ecx
mov    %ecx,(%rax)
add    $0x3c,%ebx
andl   $0xff00ffff,(%rbx)
shr    $0xf,%r15d
and    $0x1fe,%r15d
mov    %r15d,(%rbx)
andl   $0xfc00ffff,(%rax)
shl    $0x10,%ebp
and    $0x3ff0000,%ebp
or     %ebp,(%rax)
andl   $0xfffffeff,(%rbx)
mov    (%rbx),%ecx
mov    %ecx,(%rbx)
mov    %rax,%rbx
jmp    1194 <RasterSubPanelConfig+0x84>
add    $0x38,%ebx
andl   $0xfc00ffff,(%rbx)
shl    $0x10,%ebp
or     %ebp,(%rbx)
andl   $0xffff000f,(%rbx)
or     %r15d,(%rbx)
jmp    1194 <RasterSubPanelConfig+0x84>
add    $0x38,%ebx
andl   $0xdfffffff,(%rbx)
shl    $0x1d,%r14d
or     %r14d,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @RasterSubPanelConfig(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = call i32 (...) @LCDVersionGet()
store i32 %10, i32* %9
%11 = load i32, i32* %9
%12 = icmp eq i32 2, %11
br i1 %12, label %13, label %70
13: ; preds = %4
%14 = load i32, i32* %5
%15 = add i32 %14, 56
%16 = zext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = and i32 %18, -65536
store volatile i32 %19, i32* %17
%20 = load i32, i32* %8
%21 = and i32 %20, 65535
%22 = load i32, i32* %5
%23 = add i32 %22, 56
%24 = zext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
store volatile i32 %21, i32* %25
%26 = load i32, i32* %5
%27 = add i32 %26, 60
%28 = zext i32 %27 to i64
%29 = inttoptr i64 %28 to i32*
%30 = load volatile i32, i32* %29
%31 = and i32 %30, -16711681
store volatile i32 %31, i32* %29
%32 = load i32, i32* %8
%33 = and i32 %32, 16711680
%34 = lshr i32 %33, 15
%35 = load i32, i32* %5
%36 = add i32 %35, 60
%37 = zext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
store volatile i32 %34, i32* %38
%39 = load i32, i32* %5
%40 = add i32 %39, 56
%41 = zext i32 %40 to i64
%42 = inttoptr i64 %41 to i32*
%43 = load volatile i32, i32* %42
%44 = and i32 %43, -67043329
store volatile i32 %44, i32* %42
%45 = load i32, i32* %7
%46 = and i32 %45, 1023
%47 = shl i32 %46, 16
%48 = load i32, i32* %5
%49 = add i32 %48, 56
%50 = zext i32 %49 to i64
%51 = inttoptr i64 %50 to i32*
%52 = load volatile i32, i32* %51
%53 = or i32 %52, %47
store volatile i32 %53, i32* %51
%54 = load i32, i32* %5
%55 = add i32 %54, 60
%56 = zext i32 %55 to i64
%57 = inttoptr i64 %56 to i32*
%58 = load volatile i32, i32* %57
%59 = and i32 %58, -257
store volatile i32 %59, i32* %57
%60 = load i32, i32* %7
%61 = and i32 %60, 1024
%62 = lshr i32 %61, 11
%63 = shl i32 %62, 8
%64 = load i32, i32* %5
%65 = add i32 %64, 60
%66 = zext i32 %65 to i64
%67 = inttoptr i64 %66 to i32*
%68 = load volatile i32, i32* %67
%69 = or i32 %68, %63
store volatile i32 %69, i32* %67
br label %104
70: ; preds = %4
%71 = load i32, i32* %9
%72 = icmp eq i32 1, %71
br i1 %72, label %73, label %102
73: ; preds = %70
%74 = load i32, i32* %5
%75 = add i32 %74, 56
%76 = zext i32 %75 to i64
%77 = inttoptr i64 %76 to i32*
%78 = load volatile i32, i32* %77
%79 = and i32 %78, -67043329
store volatile i32 %79, i32* %77
%80 = load i32, i32* %7
%81 = shl i32 %80, 16
%82 = load i32, i32* %5
%83 = add i32 %82, 56
%84 = zext i32 %83 to i64
%85 = inttoptr i64 %84 to i32*
%86 = load volatile i32, i32* %85
%87 = or i32 %86, %81
store volatile i32 %87, i32* %85
%88 = load i32, i32* %5
%89 = add i32 %88, 56
%90 = zext i32 %89 to i64
%91 = inttoptr i64 %90 to i32*
%92 = load volatile i32, i32* %91
%93 = and i32 %92, -65521
store volatile i32 %93, i32* %91
%94 = load i32, i32* %8
%95 = shl i32 %94, 0
%96 = load i32, i32* %5
%97 = add i32 %96, 56
%98 = zext i32 %97 to i64
%99 = inttoptr i64 %98 to i32*
%100 = load volatile i32, i32* %99
%101 = or i32 %100, %95
store volatile i32 %101, i32* %99
br label %103
102: ; preds = %70
br label %103
103: ; preds = %102, %73
br label %104
104: ; preds = %103, %13
%105 = load i32, i32* %5
%106 = add i32 %105, 56
%107 = zext i32 %106 to i64
%108 = inttoptr i64 %107 to i32*
%109 = load volatile i32, i32* %108
%110 = and i32 %109, -536870913
store volatile i32 %110, i32* %108
%111 = load i32, i32* %6
%112 = shl i32 %111, 29
%113 = load i32, i32* %5
%114 = add i32 %113, 56
%115 = zext i32 %114 to i64
%116 = inttoptr i64 %115 to i32*
%117 = load volatile i32, i32* %116
%118 = or i32 %117, %112
store volatile i32 %118, i32* %116
ret void
}

LLVM IR (-O2):
define void @RasterSubPanelConfig(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (...) @LCDVersionGet()
switch i32 %5, label %6 [
i32 2, label %10
i32 1, label %33
]
6: ; preds = %4
%7 = add i32 %0, 56
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
br label %46
10: ; preds = %4
%11 = add i32 %0, 56
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, -65536
store volatile i32 %15, i32* %13
%16 = and i32 %3, 65535
store volatile i32 %16, i32* %13
%17 = add i32 %0, 60
%18 = zext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = and i32 %20, -16711681
store volatile i32 %21, i32* %19
%22 = lshr i32 %3, 15
%23 = and i32 %22, 510
store volatile i32 %23, i32* %19
%24 = load volatile i32, i32* %13
%25 = and i32 %24, -67043329
store volatile i32 %25, i32* %13
%26 = shl i32 %2, 16
%27 = and i32 %26, 67043328
%28 = load volatile i32, i32* %13
%29 = or i32 %28, %27
store volatile i32 %29, i32* %13
%30 = load volatile i32, i32* %19
%31 = and i32 %30, -257
store volatile i32 %31, i32* %19
%32 = load volatile i32, i32* %19
store volatile i32 %32, i32* %19
br label %46
33: ; preds = %4
%34 = add i32 %0, 56
%35 = zext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
%37 = load volatile i32, i32* %36
%38 = and i32 %37, -67043329
store volatile i32 %38, i32* %36
%39 = shl i32 %2, 16
%40 = load volatile i32, i32* %36
%41 = or i32 %40, %39
store volatile i32 %41, i32* %36
%42 = load volatile i32, i32* %36
%43 = and i32 %42, -65521
store volatile i32 %43, i32* %36
%44 = load volatile i32, i32* %36
%45 = or i32 %44, %3
store volatile i32 %45, i32* %36
br label %46
46: ; preds = %6, %33, %10
%47 = phi i32* [ %9, %6 ], [ %36, %33 ], [ %13, %10 ]
%48 = load volatile i32, i32* %47
%49 = and i32 %48, -536870913
store volatile i32 %49, i32* %47
%50 = shl i32 %1, 29
%51 = load volatile i32, i32* %47
%52 = or i32 %51, %50
store volatile i32 %52, i32* %47
ret void
}