#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*/ Set1024x768_60();
int /*<<< orphan*/ Set640x480_60();
int /*<<< orphan*/ Set800x600_60();
int /*<<< orphan*/ orgfx_set_colordepth(unsigned char);
void orgfx_vga_set_videomode(unsigned int width, unsigned int height,
                             unsigned char bpp) {
  if (width == 640 && height == 480)
    Set640x480_60();
  else if (width == 800 && height == 600)
    Set800x600_60();
  else if (width == 1024 && height == 768)
    Set1024x768_60();
  else
    Set640x480_60();
  orgfx_set_colordepth(bpp);
}


x86 assembly (clang, -O0):
<orgfx_vga_set_videomode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpl   $0x280,-0x4(%rbp)
jne    1179 <orgfx_vga_set_videomode+0x39>
cmpl   $0x1e0,-0x8(%rbp)
jne    1179 <orgfx_vga_set_videomode+0x39>
mov    $0x0,%al
call   1060 <Set640x480_60@plt>
jmp    11d6 <orgfx_vga_set_videomode+0x96>
cmpl   $0x320,-0x4(%rbp)
jne    119f <orgfx_vga_set_videomode+0x5f>
cmpl   $0x258,-0x8(%rbp)
jne    119f <orgfx_vga_set_videomode+0x5f>
mov    $0x0,%al
call   1050 <Set800x600_60@plt>
jmp    11d1 <orgfx_vga_set_videomode+0x91>
cmpl   $0x400,-0x4(%rbp)
jne    11c5 <orgfx_vga_set_videomode+0x85>
cmpl   $0x300,-0x8(%rbp)
jne    11c5 <orgfx_vga_set_videomode+0x85>
mov    $0x0,%al
call   1040 <Set1024x768_60@plt>
jmp    11cc <orgfx_vga_set_videomode+0x8c>
mov    $0x0,%al
call   1060 <Set640x480_60@plt>
jmp    11d1 <orgfx_vga_set_videomode+0x91>
jmp    11d6 <orgfx_vga_set_videomode+0x96>
movzbl -0x9(%rbp),%edi
call   1030 <orgfx_set_colordepth@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<orgfx_vga_set_videomode>:
push   %rbx
mov    %edx,%ebx
cmp    $0x280,%edi
jne    115c <orgfx_vga_set_videomode+0x1c>
cmp    $0x1e0,%esi
jne    115c <orgfx_vga_set_videomode+0x1c>
xor    %eax,%eax
call   1060 <Set640x480_60@plt>
jmp    118c <orgfx_vga_set_videomode+0x4c>
cmp    $0x320,%edi
jne    1175 <orgfx_vga_set_videomode+0x35>
cmp    $0x258,%esi
jne    1175 <orgfx_vga_set_videomode+0x35>
xor    %eax,%eax
call   1050 <Set800x600_60@plt>
jmp    118c <orgfx_vga_set_videomode+0x4c>
cmp    $0x400,%edi
jne    1153 <orgfx_vga_set_videomode+0x13>
cmp    $0x300,%esi
jne    1153 <orgfx_vga_set_videomode+0x13>
xor    %eax,%eax
call   1040 <Set1024x768_60@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <orgfx_set_colordepth@plt>

LLVM IR (-O0):
define void @orgfx_vga_set_videomode(i32 %0, i32 %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 640
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 480
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @Set640x480_60()
br label %34
14: ; preds = %9, %3
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 800
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 600
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (...) @Set800x600_60()
br label %33
22: ; preds = %17, %14
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1024
br i1 %24, label %25, label %30
25: ; preds = %22
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 768
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (...) @Set1024x768_60()
br label %32
30: ; preds = %25, %22
%31 = call i32 (...) @Set640x480_60()
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32, %20
br label %34
34: ; preds = %33, %12
%35 = load i8, i8* %6
%36 = call i32 @orgfx_set_colordepth(i8 zeroext %35)
ret void
}

LLVM IR (-O2):
define void @orgfx_vga_set_videomode(i32 %0, i32 %1, i8 zeroext %2) {
%4 = icmp eq i32 %0, 640
%5 = icmp eq i32 %1, 480
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (...) @Set640x480_60()
br label %23
9: ; preds = %3
%10 = icmp eq i32 %0, 800
%11 = icmp eq i32 %1, 600
%12 = and i1 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 (...) @Set800x600_60()
br label %23
15: ; preds = %9
%16 = icmp eq i32 %0, 1024
%17 = icmp eq i32 %1, 768
%18 = and i1 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 (...) @Set1024x768_60()
br label %23
21: ; preds = %15
%22 = tail call i32 (...) @Set640x480_60()
br label %23
23: ; preds = %13, %21, %19, %7
%24 = tail call i32 @orgfx_set_colordepth(i8 zeroext %2)
ret void
}