#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 */
struct fb_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fill_screen(struct fb_info *);
int /*<<< orphan*/ fill_screen_solid(struct fb_info *, int);
void do_fill_screen(struct fb_info *fb_info, int pattern) {
  switch (pattern) {
  case 1:
    fill_screen_solid(fb_info, 0xff0000);
    break;
  case 2:
    fill_screen_solid(fb_info, 0x00ff00);
    break;
  case 3:
    fill_screen_solid(fb_info, 0x0000ff);
    break;
  case 4:
    fill_screen_solid(fb_info, 0xffffff);
    break;
  case 0:
  default:
    fill_screen(fb_info);
    break;
  }
}


x86 assembly (clang, -O0):
<do_fill_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x4,%rax
ja     11a5 <do_fill_screen+0x85>
mov    -0x18(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    $0xff0000,%esi
call   1040 <fill_screen_solid@plt>
jmp    11ae <do_fill_screen+0x8e>
mov    -0x8(%rbp),%rdi
mov    $0xff00,%esi
call   1040 <fill_screen_solid@plt>
jmp    11ae <do_fill_screen+0x8e>
mov    -0x8(%rbp),%rdi
mov    $0xff,%esi
call   1040 <fill_screen_solid@plt>
jmp    11ae <do_fill_screen+0x8e>
mov    -0x8(%rbp),%rdi
mov    $0xffffff,%esi
call   1040 <fill_screen_solid@plt>
jmp    11ae <do_fill_screen+0x8e>
jmp    11a5 <do_fill_screen+0x85>
mov    -0x8(%rbp),%rdi
call   1030 <fill_screen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_fill_screen>:
add    $0xffffffff,%esi
cmp    $0x3,%esi
ja     1142 <do_fill_screen+0x22>
lea    0xed1(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    $0xff0000,%esi
jmp    1040 <fill_screen_solid@plt>
jmp    1030 <fill_screen@plt>
mov    $0xff00,%esi
jmp    1040 <fill_screen_solid@plt>
mov    $0xff,%esi
jmp    1040 <fill_screen_solid@plt>
mov    $0xffffff,%esi
jmp    1040 <fill_screen_solid@plt>

LLVM IR (-O0):
%struct.fb_info = type { i32 }
define void @do_fill_screen(%struct.fb_info* %0, i32 %1) {
%3 = alloca %struct.fb_info*
%4 = alloca i32
store %struct.fb_info* %0, %struct.fb_info** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %19 [
i32 1, label %6
i32 2, label %9
i32 3, label %12
i32 4, label %15
i32 0, label %18
]
6: ; preds = %2
%7 = load %struct.fb_info*, %struct.fb_info** %3
%8 = call i32 @fill_screen_solid(%struct.fb_info* %7, i32 16711680)
br label %22
9: ; preds = %2
%10 = load %struct.fb_info*, %struct.fb_info** %3
%11 = call i32 @fill_screen_solid(%struct.fb_info* %10, i32 65280)
br label %22
12: ; preds = %2
%13 = load %struct.fb_info*, %struct.fb_info** %3
%14 = call i32 @fill_screen_solid(%struct.fb_info* %13, i32 255)
br label %22
15: ; preds = %2
%16 = load %struct.fb_info*, %struct.fb_info** %3
%17 = call i32 @fill_screen_solid(%struct.fb_info* %16, i32 16777215)
br label %22
18: ; preds = %2
br label %19
19: ; preds = %2, %18
%20 = load %struct.fb_info*, %struct.fb_info** %3
%21 = call i32 @fill_screen(%struct.fb_info* %20)
br label %22
22: ; preds = %19, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
%struct.fb_info = type { i32 }
define void @do_fill_screen(%struct.fb_info* %0, i32 %1) {
switch i32 %1, label %11 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %9
]
3: ; preds = %2
%4 = tail call i32 @fill_screen_solid(%struct.fb_info* %0, i32 16711680)
br label %13
5: ; preds = %2
%6 = tail call i32 @fill_screen_solid(%struct.fb_info* %0, i32 65280)
br label %13
7: ; preds = %2
%8 = tail call i32 @fill_screen_solid(%struct.fb_info* %0, i32 255)
br label %13
9: ; preds = %2
%10 = tail call i32 @fill_screen_solid(%struct.fb_info* %0, i32 16777215)
br label %13
11: ; preds = %2
%12 = tail call i32 @fill_screen(%struct.fb_info* %0)
br label %13
13: ; preds = %11, %9, %7, %5, %3
ret void
}