#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*/ lcd_clear(int);
int /*<<< orphan*/ lcd_msg(char *);
void lcd_disp(int choose) {
  char msg1[] = "GATE 1 IS OK%";
  char msg2[] = "GATE 2 IS OK%";
  char msg3[] = "GATE 3 IS OK%";
  char msg4[] = "GATE 4 IS OK%";
  char msg5[] = "GATE 1 IS BAD%";
  char msg6[] = "GATE 2 IS BAD%";
  char msg7[] = "GATE 3 IS BAD%";
  char msg8[] = "GATE 4 IS BAD%";
  switch (choose) {
  case 1:
    lcd_msg(msg1);
    lcd_clear(0xc0);
    break;
  case 2:
    lcd_msg(msg2);
    lcd_clear(0x90);
    break;
  case 3:
    lcd_msg(msg3);
    lcd_clear(0xd0);
    break;
  case 4:
    lcd_msg(msg4);
    break;
  case 5:
    lcd_msg(msg5);
    lcd_clear(0xc0);
    break;
  case 6:
    lcd_msg(msg6);
    lcd_clear(0x90);
    break;
  case 7:
    lcd_msg(msg7);
    lcd_clear(0xd0);
    break;
  case 8:
    lcd_msg(msg8);
    break;
  }
}


x86 assembly (clang, -O0):
<lcd_disp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
movabs $0x254b4f20534920,%rax
mov    %rax,-0x12(%rbp)
movabs $0x4920312045544147,%rdi
31 20 49
mov    %rdi,-0x18(%rbp)
mov    %rax,-0x22(%rbp)
movabs $0x4920322045544147,%rsi
32 20 49
mov    %rsi,-0x28(%rbp)
mov    %rax,-0x32(%rbp)
movabs $0x4920332045544147,%rdx
33 20 49
mov    %rdx,-0x38(%rbp)
mov    %rax,-0x42(%rbp)
movabs $0x4920342045544147,%rax
34 20 49
mov    %rax,-0x48(%rbp)
movabs $0x25444142205349,%rcx
mov    %rcx,-0x51(%rbp)
mov    %rdi,-0x58(%rbp)
mov    %rcx,-0x61(%rbp)
mov    %rsi,-0x68(%rbp)
mov    %rcx,-0x71(%rbp)
mov    %rdx,-0x78(%rbp)
mov    %rcx,-0x81(%rbp)
mov    %rax,-0x88(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x90(%rbp)
sub    $0x7,%eax
ja     1289 <lcd_disp+0x169>
mov    -0x90(%rbp),%rax
lea    0xe2a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x18(%rbp),%rdi
call   1030 <lcd_msg@plt>
mov    $0xc0,%edi
call   1040 <lcd_clear@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x28(%rbp),%rdi
call   1030 <lcd_msg@plt>
mov    $0x90,%edi
call   1040 <lcd_clear@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x38(%rbp),%rdi
call   1030 <lcd_msg@plt>
mov    $0xd0,%edi
call   1040 <lcd_clear@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x48(%rbp),%rdi
call   1030 <lcd_msg@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x58(%rbp),%rdi
call   1030 <lcd_msg@plt>
mov    $0xc0,%edi
call   1040 <lcd_clear@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x68(%rbp),%rdi
call   1030 <lcd_msg@plt>
mov    $0x90,%edi
call   1040 <lcd_clear@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x78(%rbp),%rdi
call   1030 <lcd_msg@plt>
mov    $0xd0,%edi
call   1040 <lcd_clear@plt>
jmp    1289 <lcd_disp+0x169>
lea    -0x88(%rbp),%rdi
call   1030 <lcd_msg@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_disp>:
sub    $0x88,%rsp
movabs $0x254b4f20534920,%rax
mov    %rax,0x3e(%rsp)
movabs $0x4920312045544147,%r8
31 20 49
mov    %r8,0x38(%rsp)
mov    %rax,0x2e(%rsp)
movabs $0x4920322045544147,%rdx
32 20 49
mov    %rdx,0x28(%rsp)
mov    %rax,0x1e(%rsp)
movabs $0x4920332045544147,%rsi
33 20 49
mov    %rsi,0x18(%rsp)
mov    %rax,0xe(%rsp)
movabs $0x4920342045544147,%rax
34 20 49
mov    %rax,0x8(%rsp)
movabs $0x25444142205349,%rcx
mov    %rcx,0x7f(%rsp)
mov    %r8,0x78(%rsp)
mov    %rcx,0x6f(%rsp)
mov    %rdx,0x68(%rsp)
mov    %rcx,0x5f(%rsp)
mov    %rsi,0x58(%rsp)
mov    %rcx,0x4f(%rsp)
mov    %rax,0x48(%rsp)
add    $0xffffffff,%edi
cmp    $0x7,%edi
ja     122f <lcd_disp+0x10f>
lea    0xe3e(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x38(%rsp),%rdi
jmp    11ec <lcd_disp+0xcc>
lea    0x28(%rsp),%rdi
jmp    11fd <lcd_disp+0xdd>
lea    0x18(%rsp),%rdi
jmp    120e <lcd_disp+0xee>
lea    0x8(%rsp),%rdi
jmp    122a <lcd_disp+0x10a>
lea    0x78(%rsp),%rdi
call   1030 <lcd_msg@plt>
mov    $0xc0,%edi
jmp    1218 <lcd_disp+0xf8>
lea    0x68(%rsp),%rdi
call   1030 <lcd_msg@plt>
mov    $0x90,%edi
jmp    1218 <lcd_disp+0xf8>
lea    0x58(%rsp),%rdi
call   1030 <lcd_msg@plt>
mov    $0xd0,%edi
call   1040 <lcd_clear@plt>
add    $0x88,%rsp
ret
lea    0x48(%rsp),%rdi
call   1030 <lcd_msg@plt>
add    $0x88,%rsp
ret

LLVM IR (-O0):
@__const.lcd_disp.msg1 = [14 x i8] c"GATE 1 IS OK%\00"
@__const.lcd_disp.msg2 = [14 x i8] c"GATE 2 IS OK%\00"
@__const.lcd_disp.msg3 = [14 x i8] c"GATE 3 IS OK%\00"
@__const.lcd_disp.msg4 = [14 x i8] c"GATE 4 IS OK%\00"
@__const.lcd_disp.msg5 = [15 x i8] c"GATE 1 IS BAD%\00"
@__const.lcd_disp.msg6 = [15 x i8] c"GATE 2 IS BAD%\00"
@__const.lcd_disp.msg7 = [15 x i8] c"GATE 3 IS BAD%\00"
@__const.lcd_disp.msg8 = [15 x i8] c"GATE 4 IS BAD%\00"
define void @lcd_disp(i32 %0) {
%2 = alloca i32
%3 = alloca [14 x i8]
%4 = alloca [14 x i8]
%5 = alloca [14 x i8]
%6 = alloca [14 x i8]
%7 = alloca [15 x i8]
%8 = alloca [15 x i8]
%9 = alloca [15 x i8]
%10 = alloca [15 x i8]
store i32 %0, i32* %2
%11 = bitcast [14 x i8]* %3 to i8*
%12 = bitcast [14 x i8]* %4 to i8*
%13 = bitcast [14 x i8]* %5 to i8*
%14 = bitcast [14 x i8]* %6 to i8*
%15 = bitcast [15 x i8]* %7 to i8*
%16 = bitcast [15 x i8]* %8 to i8*
%17 = bitcast [15 x i8]* %9 to i8*
%18 = bitcast [15 x i8]* %10 to i8*
%19 = load i32, i32* %2
switch i32 %19, label %50 [
i32 1, label %20
i32 2, label %24
i32 3, label %28
i32 4, label %32
i32 5, label %35
i32 6, label %39
i32 7, label %43
i32 8, label %47
]
20: ; preds = %1
%21 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%22 = call i32 @lcd_msg(i8* %21)
%23 = call i32 @lcd_clear(i32 192)
br label %50
24: ; preds = %1
%25 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%26 = call i32 @lcd_msg(i8* %25)
%27 = call i32 @lcd_clear(i32 144)
br label %50
28: ; preds = %1
%29 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%30 = call i32 @lcd_msg(i8* %29)
%31 = call i32 @lcd_clear(i32 208)
br label %50
32: ; preds = %1
%33 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%34 = call i32 @lcd_msg(i8* %33)
br label %50
35: ; preds = %1
%36 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%37 = call i32 @lcd_msg(i8* %36)
%38 = call i32 @lcd_clear(i32 192)
br label %50
39: ; preds = %1
%40 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
%41 = call i32 @lcd_msg(i8* %40)
%42 = call i32 @lcd_clear(i32 144)
br label %50
43: ; preds = %1
%44 = getelementptr inbounds [15 x i8], [15 x i8]* %9, i64 0, i64 0
%45 = call i32 @lcd_msg(i8* %44)
%46 = call i32 @lcd_clear(i32 208)
br label %50
47: ; preds = %1
%48 = getelementptr inbounds [15 x i8], [15 x i8]* %10, i64 0, i64 0
%49 = call i32 @lcd_msg(i8* %48)
br label %50
50: ; preds = %1, %47, %43, %39, %35, %32, %28, %24, %20
ret void
}

LLVM IR (-O2):
@__const.lcd_disp.msg1 = [14 x i8] c"GATE 1 IS OK%\00"
@__const.lcd_disp.msg2 = [14 x i8] c"GATE 2 IS OK%\00"
@__const.lcd_disp.msg3 = [14 x i8] c"GATE 3 IS OK%\00"
@__const.lcd_disp.msg4 = [14 x i8] c"GATE 4 IS OK%\00"
@__const.lcd_disp.msg5 = [15 x i8] c"GATE 1 IS BAD%\00"
@__const.lcd_disp.msg6 = [15 x i8] c"GATE 2 IS BAD%\00"
@__const.lcd_disp.msg7 = [15 x i8] c"GATE 3 IS BAD%\00"
@__const.lcd_disp.msg8 = [15 x i8] c"GATE 4 IS BAD%\00"
define void @lcd_disp(i32 %0) {
%2 = alloca [14 x i8]
%3 = alloca [14 x i8]
%4 = alloca [14 x i8]
%5 = alloca [14 x i8]
%6 = alloca [15 x i8]
%7 = alloca [15 x i8]
%8 = alloca [15 x i8]
%9 = alloca [15 x i8]
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [14 x i8], [14 x i8]* %4, i64 0, i64 0
%13 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [15 x i8], [15 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [15 x i8], [15 x i8]* %9, i64 0, i64 0
switch i32 %0, label %40 [
i32 1, label %18
i32 2, label %21
i32 3, label %24
i32 4, label %27
i32 5, label %29
i32 6, label %32
i32 7, label %35
i32 8, label %38
]
18: ; preds = %1
%19 = call i32 @lcd_msg(i8* %10)
%20 = call i32 @lcd_clear(i32 192)
br label %40
21: ; preds = %1
%22 = call i32 @lcd_msg(i8* %11)
%23 = call i32 @lcd_clear(i32 144)
br label %40
24: ; preds = %1
%25 = call i32 @lcd_msg(i8* %12)
%26 = call i32 @lcd_clear(i32 208)
br label %40
27: ; preds = %1
%28 = call i32 @lcd_msg(i8* %13)
br label %40
29: ; preds = %1
%30 = call i32 @lcd_msg(i8* %14)
%31 = call i32 @lcd_clear(i32 192)
br label %40
32: ; preds = %1
%33 = call i32 @lcd_msg(i8* %15)
%34 = call i32 @lcd_clear(i32 144)
br label %40
35: ; preds = %1
%36 = call i32 @lcd_msg(i8* %16)
%37 = call i32 @lcd_clear(i32 208)
br label %40
38: ; preds = %1
%39 = call i32 @lcd_msg(i8* %17)
br label %40
40: ; preds = %1, %38, %35, %32, %29, %27, %24, %21, %18
ret void
}