#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*/ erase_file();
char get_menu_option();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_file();
int /*<<< orphan*/ show_fat_table();
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ write_file();
int main(void) {
  char option = 0;
  do {
    option = get_menu_option();
    switch (option) {
    case '1':
      system("clear");
      write_file();
      break;
    case '2':
      system("clear");
      read_file();
      break;
    case '3':
      system("clear");
      erase_file();
      break;
    case '4':
      system("clear");
      show_fat_table();
      break;
    case '5':
      break;
    }
  } while (option != '5');
  system("clear");
  printf("Hard Disk had turned off...\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
xor    %eax,%eax
call   1090 <get_menu_option@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     121c <main+0xac>
mov    -0x10(%rbp),%rax
lea    0xe52(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe56(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1050 <write_file@plt>
jmp    121c <main+0xac>
lea    0xe3e(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1070 <read_file@plt>
jmp    121c <main+0xac>
lea    0xe26(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1080 <erase_file@plt>
jmp    121c <main+0xac>
lea    0xe0e(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1060 <show_fat_table@plt>
jmp    121c <main+0xac>
jmp    121c <main+0xac>
jmp    1221 <main+0xb1>
movsbl -0x5(%rbp),%eax
cmp    $0x35,%eax
jne    1183 <main+0x13>
lea    0xddf(%rip),%rdi
call   1030 <system@plt>
lea    0xdd9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xe84(%rip),%r15
lea    0xe8d(%rip),%r14
jmp    11a5 <main+0x35>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1060 <show_fat_table@plt>
nop
cmp    $0x35,%bl
je     1211 <main+0xa1>
xor    %eax,%eax
call   1090 <get_menu_option@plt>
mov    %eax,%ebx
movsbl %al,%eax
add    $0xffffffcf,%eax
cmp    $0x3,%eax
ja     11a0 <main+0x30>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
mov    %r14,%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1050 <write_file@plt>
jmp    11a0 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1070 <read_file@plt>
jmp    11a0 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1080 <erase_file@plt>
jmp    11a0 <main+0x30>
lea    0xdf8(%rip),%rdi
call   1040 <system@plt>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [29 x i8] c"Hard Disk had turned off...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %2
br label %3
3: ; preds = %21, %0
%4 = call signext i8 (...) @get_menu_option()
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
switch i32 %6, label %20 [
i32 49, label %7
i32 50, label %10
i32 51, label %13
i32 52, label %16
i32 53, label %19
]
7: ; preds = %3
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @write_file()
br label %20
10: ; preds = %3
%11 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (...) @read_file()
br label %20
13: ; preds = %3
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (...) @erase_file()
br label %20
16: ; preds = %3
%17 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%18 = call i32 (...) @show_fat_table()
br label %20
19: ; preds = %3
br label %20
20: ; preds = %3, %19, %16, %13, %10, %7
br label %21
21: ; preds = %20
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 53
br i1 %24, label %3, label %25
25: ; preds = %21
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%27 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@str = [28 x i8] c"Hard Disk had turned off...\00"
define i32 @main() {
br label %1
1: ; preds = %16, %0
%2 = tail call signext i8 (...) @get_menu_option()
%3 = sext i8 %2 to i32
switch i32 %3, label %16 [
i32 49, label %4
i32 50, label %7
i32 51, label %10
i32 52, label %13
]
4: ; preds = %1
%5 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @write_file()
br label %16
7: ; preds = %1
%8 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (...) @read_file()
br label %16
10: ; preds = %1
%11 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (...) @erase_file()
br label %16
13: ; preds = %1
%14 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 (...) @show_fat_table()
br label %16
16: ; preds = %4, %7, %10, %13, %1
%17 = icmp eq i8 %2, 53
br i1 %17, label %18, label %1
18: ; preds = %16
%19 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}