#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int fastbootMenu(void) {
  int user_key;
  system("@cls||clear");
  printf("=======================================\n");
  printf("  Fastboot menu                      |\n");
  printf("=======================================\n");
  printf("| [1] Fastboot devices               |\n");
  printf("| [2] Fastboot reboot                |\n");
  printf("| [3] Fastboot reboot-bootloader     |\n");
  printf("| [4] Fastboot help                  |\n");
  printf("========================================\n");
  printf("\n[0] Exit\n");
  printf("What you want?: ");
  scanf("%d", &user_key);
  switch (user_key) {
  case 1:
    system("fastboot devices");
    break;
  case 2:
    system("fastboot reboot");
    break;
  case 3:
    system("fastboot reboot-bootloader");
    break;
  case 4:
    system("fastboot help");
    break;
  default:
    printf("Make your choice!\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<fastbootMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
lea    0xf9a(%rip),%rdi
mov    %rdi,-0x18(%rbp)
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
lea    0xef0(%rip),%rdi
call   1040 <printf@plt>
lea    0xf0c(%rip),%rdi
call   1040 <printf@plt>
lea    0xf28(%rip),%rdi
call   1040 <printf@plt>
lea    0xf44(%rip),%rdi
call   1040 <printf@plt>
lea    0xf62(%rip),%rdi
call   1040 <printf@plt>
lea    0xf61(%rip),%rdi
call   1040 <printf@plt>
lea    0xf66(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     123a <fastbootMenu+0x10a>
mov    -0x10(%rbp),%rax
lea    0xe13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf30(%rip),%rdi
call   1030 <system@plt>
jmp    1246 <fastbootMenu+0x116>
lea    0xf30(%rip),%rdi
call   1030 <system@plt>
jmp    1246 <fastbootMenu+0x116>
lea    0xf2f(%rip),%rdi
call   1030 <system@plt>
jmp    1246 <fastbootMenu+0x116>
lea    0xf39(%rip),%rdi
call   1030 <system@plt>
jmp    1246 <fastbootMenu+0x116>
lea    0xf36(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastbootMenu>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <system@plt>
lea    0xfe6(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf13(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
lea    0xf41(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf77(%rip),%rdi
call   1030 <puts@plt>
lea    0xf92(%rip),%rdi
call   1030 <puts@plt>
lea    0xfaf(%rip),%rdi
call   1030 <puts@plt>
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11fe <fastbootMenu+0xbe>
lea    0xe14(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe34(%rip),%rdi
jmp    1225 <fastbootMenu+0xe5>
lea    0xf6b(%rip),%rdi
call   1030 <puts@plt>
jmp    122a <fastbootMenu+0xea>
lea    0xe2e(%rip),%rdi
jmp    1225 <fastbootMenu+0xe5>
lea    0xe35(%rip),%rdi
jmp    1225 <fastbootMenu+0xe5>
lea    0xe47(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"@cls||clear\00"
@.str.1 = [41 x i8] c"=======================================\0A\00"
@.str.2 = [40 x i8] c" Fastboot menu |\0A\00"
@.str.3 = [40 x i8] c"| [1] Fastboot devices |\0A\00"
@.str.4 = [40 x i8] c"| [2] Fastboot reboot |\0A\00"
@.str.5 = [40 x i8] c"| [3] Fastboot reboot-bootloader |\0A\00"
@.str.6 = [40 x i8] c"| [4] Fastboot help |\0A\00"
@.str.7 = [42 x i8] c"========================================\0A\00"
@.str.8 = [11 x i8] c"\0A[0] Exit\0A\00"
@.str.9 = [17 x i8] c"What you want?: \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [17 x i8] c"fastboot devices\00"
@.str.12 = [16 x i8] c"fastboot reboot\00"
@.str.13 = [27 x i8] c"fastboot reboot-bootloader\00"
@.str.14 = [14 x i8] c"fastboot help\00"
@.str.15 = [19 x i8] c"Make your choice!\0A\00"
define i32 @fastbootMenu() {
%1 = alloca i32
%2 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
switch i32 %14, label %23 [
i32 1, label %15
i32 2, label %17
i32 3, label %19
i32 4, label %21
]
15: ; preds = %0
%16 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %25
17: ; preds = %0
%18 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %25
19: ; preds = %0
%20 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
br label %25
21: ; preds = %0
%22 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0))
br label %25
23: ; preds = %0
%24 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0))
br label %25
25: ; preds = %23, %21, %19, %17, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"@cls||clear\00"
@.str.9 = [17 x i8] c"What you want?: \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [17 x i8] c"fastboot devices\00"
@.str.12 = [16 x i8] c"fastboot reboot\00"
@.str.13 = [27 x i8] c"fastboot reboot-bootloader\00"
@.str.14 = [14 x i8] c"fastboot help\00"
@str.16 = [39 x i8] c" Fastboot menu |\00"
@str.17 = [40 x i8] c"=======================================\00"
@str.18 = [39 x i8] c"| [1] Fastboot devices |\00"
@str.19 = [39 x i8] c"| [2] Fastboot reboot |\00"
@str.20 = [39 x i8] c"| [3] Fastboot reboot-bootloader |\00"
@str.21 = [39 x i8] c"| [4] Fastboot help |\00"
@str.22 = [41 x i8] c"========================================\00"
@str.23 = [10 x i8] c"\0A[0] Exit\00"
@str.24 = [18 x i8] c"Make your choice!\00"
define i32 @fastbootMenu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.17, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.21, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.22, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.23, i64 0, i64 0))
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
switch i32 %15, label %24 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %22
]
16: ; preds = %0
%17 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
br label %26
18: ; preds = %0
%19 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %26
20: ; preds = %0
%21 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
br label %26
22: ; preds = %0
%23 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0))
br label %26
24: ; preds = %0
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.24, i64 0, i64 0))
br label %26
26: ; preds = %24, %22, %20, %18, %16
ret i32 0
}