#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 /*<<< orphan*/ load_microcode(int, int, int, int /*<<< orphan*/, int, int,
                                  int, int, int, int);
int init_vga(int mode) {
  switch (mode) {
  case 1:
    load_microcode(16, 96, 48, 0, 640, 10, 2, 33, 0, 480);
    break;
  case 2:
    load_microcode(16, 96, 48, 0, 640, 12, 2, 35, 1, 400);
    break;
  default:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<init_vga>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1140 <init_vga+0x30>
jmp    112f <init_vga+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1186 <init_vga+0x76>
jmp    11cc <init_vga+0xbc>
mov    $0x10,%edi
mov    $0x60,%esi
mov    $0x30,%edx
xor    %ecx,%ecx
mov    $0x280,%r8d
mov    $0xa,%r9d
movl   $0x2,(%rsp)
movl   $0x21,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x1e0,0x18(%rsp)
call   1030 <load_microcode@plt>
jmp    11d8 <init_vga+0xc8>
mov    $0x10,%edi
mov    $0x60,%esi
mov    $0x30,%edx
xor    %ecx,%ecx
mov    $0x280,%r8d
mov    $0xc,%r9d
movl   $0x2,(%rsp)
movl   $0x23,0x8(%rsp)
movl   $0x1,0x10(%rsp)
movl   $0x190,0x18(%rsp)
call   1030 <load_microcode@plt>
jmp    11d8 <init_vga+0xc8>
movl   $0xffffffff,-0x4(%rbp)
jmp    11df <init_vga+0xcf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_vga>:
push   %rbx
cmp    $0x2,%edi
je     114a <init_vga+0x3a>
mov    $0xffffffff,%ebx
cmp    $0x1,%edi
jne    117d <init_vga+0x6d>
xor    %ebx,%ebx
mov    $0x10,%edi
mov    $0x60,%esi
mov    $0x30,%edx
xor    %ecx,%ecx
mov    $0x280,%r8d
mov    $0xa,%r9d
push   $0x1e0
push   $0x0
push   $0x21
jmp    1172 <init_vga+0x62>
xor    %ebx,%ebx
mov    $0x10,%edi
mov    $0x60,%esi
mov    $0x30,%edx
xor    %ecx,%ecx
mov    $0x280,%r8d
mov    $0xc,%r9d
push   $0x190
push   $0x1
push   $0x23
push   $0x2
call   1030 <load_microcode@plt>
add    $0x20,%rsp
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @init_vga(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 1, label %5
i32 2, label %7
]
5: ; preds = %1
%6 = call i32 @load_microcode(i32 16, i32 96, i32 48, i32 0, i32 640, i32 10, i32 2, i32 33, i32 0, i32 480)
br label %10
7: ; preds = %1
%8 = call i32 @load_microcode(i32 16, i32 96, i32 48, i32 0, i32 640, i32 12, i32 2, i32 35, i32 1, i32 400)
br label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %11
10: ; preds = %7, %5
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @init_vga(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %2
i32 2, label %4
]
2: ; preds = %1
%3 = tail call i32 @load_microcode(i32 16, i32 96, i32 48, i32 0, i32 640, i32 10, i32 2, i32 33, i32 0, i32 480)
br label %6
4: ; preds = %1
%5 = tail call i32 @load_microcode(i32 16, i32 96, i32 48, i32 0, i32 640, i32 12, i32 2, i32 35, i32 1, i32 400)
br label %6
6: ; preds = %2, %4, %1
%7 = phi i32 [ -1, %1 ], [ 0, %4 ], [ 0, %2 ]
ret i32 %7
}