#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 */
int Pnl_GetPlatform();
unsigned long READ_VID32(int);
int /*<<< orphan*/ WRITE_VID32(int, unsigned long);
unsigned long gfx_detect_video();
void Pnl_PowerUp(void) {
  int Platform;
  unsigned long dcfg, hw_video;
  Platform = Pnl_GetPlatform();
  hw_video = gfx_detect_video();
  if (hw_video == 1) {
    dcfg = READ_VID32(0x0004);
    dcfg |= (0x00000040 | 0x00000080);
    WRITE_VID32(0x0004, dcfg);
  } else if (hw_video == 2) {
    dcfg = READ_VID32(0x004);
    dcfg |= (0x00000040 | 0x00000080);
    WRITE_VID32(0x004, dcfg);
  } else if (hw_video == 3) {
    dcfg = READ_VID32(0x008);
    dcfg |= (0x00000040 | 0x00000080);
    WRITE_VID32(0x008, dcfg);
  }
}


x86 assembly (clang, -O0):
<Pnl_PowerUp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <Pnl_GetPlatform@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <gfx_detect_video@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jne    1197 <Pnl_PowerUp+0x57>
mov    $0x4,%edi
call   1030 <READ_VID32@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0xc0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4,%edi
call   1040 <WRITE_VID32@plt>
jmp    1210 <Pnl_PowerUp+0xd0>
cmpq   $0x2,-0x18(%rbp)
jne    11d1 <Pnl_PowerUp+0x91>
mov    $0x4,%edi
call   1030 <READ_VID32@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0xc0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x4,%edi
call   1040 <WRITE_VID32@plt>
jmp    120b <Pnl_PowerUp+0xcb>
cmpq   $0x3,-0x18(%rbp)
jne    1206 <Pnl_PowerUp+0xc6>
mov    $0x8,%edi
call   1030 <READ_VID32@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
or     $0xc0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x8,%edi
call   1040 <WRITE_VID32@plt>
jmp    120b <Pnl_PowerUp+0xcb>
jmp    1210 <Pnl_PowerUp+0xd0>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pnl_PowerUp>:
push   %rbx
xor    %eax,%eax
call   1050 <Pnl_GetPlatform@plt>
xor    %eax,%eax
call   1060 <gfx_detect_video@plt>
lea    -0x1(%rax),%rcx
cmp    $0x2,%rcx
ja     117c <Pnl_PowerUp+0x3c>
lea    0xea0(%rip),%rcx
mov    -0x4(%rcx,%rax,4),%ebx
mov    %ebx,%edi
call   1030 <READ_VID32@plt>
or     $0xc0,%rax
mov    %ebx,%edi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <WRITE_VID32@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @Pnl_PowerUp() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = call i32 (...) @Pnl_GetPlatform()
store i32 %4, i32* %1
%5 = call i64 (...) @gfx_detect_video()
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp eq i64 %6, 1
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = call i64 @READ_VID32(i32 4)
store i64 %9, i64* %2
%10 = load i64, i64* %2
%11 = or i64 %10, 192
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = call i32 @WRITE_VID32(i32 4, i64 %12)
br label %34
14: ; preds = %0
%15 = load i64, i64* %3
%16 = icmp eq i64 %15, 2
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = call i64 @READ_VID32(i32 4)
store i64 %18, i64* %2
%19 = load i64, i64* %2
%20 = or i64 %19, 192
store i64 %20, i64* %2
%21 = load i64, i64* %2
%22 = call i32 @WRITE_VID32(i32 4, i64 %21)
br label %33
23: ; preds = %14
%24 = load i64, i64* %3
%25 = icmp eq i64 %24, 3
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = call i64 @READ_VID32(i32 8)
store i64 %27, i64* %2
%28 = load i64, i64* %2
%29 = or i64 %28, 192
store i64 %29, i64* %2
%30 = load i64, i64* %2
%31 = call i32 @WRITE_VID32(i32 8, i64 %30)
br label %32
32: ; preds = %26, %23
br label %33
33: ; preds = %32, %17
br label %34
34: ; preds = %33, %8
ret void
}

LLVM IR (-O2):
@switch.table.Pnl_PowerUp = [3 x i32] [i32 4, i32 4, i32 8]
define void @Pnl_PowerUp() {
%1 = tail call i32 (...) @Pnl_GetPlatform()
%2 = tail call i64 (...) @gfx_detect_video()
%3 = add i64 %2, -1
%4 = icmp ult i64 %3, 3
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.Pnl_PowerUp, i64 0, i64 %3
%7 = load i32, i32* %6
%8 = tail call i64 @READ_VID32(i32 %7)
%9 = or i64 %8, 192
%10 = tail call i32 @WRITE_VID32(i32 %7, i64 %9)
br label %11
11: ; preds = %0, %5
ret void
}