#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*/ exit(int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ hashmap_init();
int /*<<< orphan*/ initializeMetadata();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ ssdDelete(char *);
int /*<<< orphan*/ ssdRead(char *);
int /*<<< orphan*/ ssdWrite(char *);
int main(int argc, char *argv[]) {
  initializeMetadata();
  char file[25];
  hashmap_init();
  char in_c;
  while (1) {
    printf("\nEnter r / w / d / x: ");
    scanf("%c", &in_c);
    while (getchar() != '\n')
      ;
    if (in_c != 'x') {
      printf("\nEnter file name: ");
      scanf("%s", file);
      while (getchar() != '\n')
        ;
    }
    switch (in_c) {
    case 'r':
      ssdRead(file);
      break;
    case 'w':
      ssdWrite(file);
      break;
    case 'd':
      ssdDelete(file);
      break;
    case 'x':
      printf("Goodbye World!!\n");
      exit(0);
      break;
    default:
      printf("\nInvalid selection\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <initializeMetadata@plt>
mov    $0x0,%al
call   1070 <hashmap_init@plt>
lea    0xe99(%rip),%rdi
call   1060 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x31(%rbp),%rsi
call   10a0 <scanf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11e8 <main+0x58>
jmp    11d0 <main+0x40>
movsbl -0x31(%rbp),%eax
cmp    $0x78,%eax
je     122e <main+0x9e>
lea    0xe72(%rip),%rdi
call   1060 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe75(%rip),%rdi
call   10a0 <scanf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1229 <main+0x99>
jmp    1211 <main+0x81>
jmp    122e <main+0x9e>
movsbl -0x31(%rbp),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x14,%eax
ja     1295 <main+0x105>
mov    -0x40(%rbp),%rax
lea    0xdb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x30(%rbp),%rdi
call   1090 <ssdRead@plt>
jmp    12a1 <main+0x111>
lea    -0x30(%rbp),%rdi
call   1050 <ssdWrite@plt>
jmp    12a1 <main+0x111>
lea    -0x30(%rbp),%rdi
call   1030 <ssdDelete@plt>
jmp    12a1 <main+0x111>
lea    0xdfb(%rip),%rdi
call   1060 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    0xdf9(%rip),%rdi
call   1060 <printf@plt>
jmp    11b4 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xor    %eax,%eax
call   1040 <initializeMetadata@plt>
xor    %eax,%eax
call   1080 <hashmap_init@plt>
lea    0xea8(%rip),%r15
lea    0xf(%rsp),%r12
lea    0xe9f(%rip),%r13
lea    0xeab(%rip),%rbx
lea    0x10(%rsp),%rbp
lea    0xe1e(%rip),%r14
jmp    11f8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
call   1030 <ssdDelete@plt>
lea    0xe55(%rip),%rdi
call   1070 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10b0 <scanf@plt>
nop
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0xa,%al
jne    1210 <main+0x70>
cmpb   $0x78,0xf(%rsp)
je     129d <main+0xfd>
mov    %r13,%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10b0 <scanf@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0xa,%al
jne    1240 <main+0xa0>
movsbl 0xf(%rsp),%eax
add    $0xffffff9c,%eax
cmp    $0x14,%eax
ja     1270 <main+0xd0>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    %rbp,%rdi
call   10a0 <ssdRead@plt>
jmp    11f8 <main+0x58>
nopl   0x0(%rax,%rax,1)
lea    0xe1d(%rip),%rdi
call   1050 <puts@plt>
jmp    11f8 <main+0x58>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1060 <ssdWrite@plt>
jmp    11f8 <main+0x58>
lea    0xde0(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0AEnter r / w / d / x: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [19 x i8] c"\0AEnter file name: \00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [17 x i8] c"Goodbye World!!\0A\00"
@.str.5 = [20 x i8] c"\0AInvalid selection\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [25 x i8]
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @initializeMetadata()
%9 = call i32 (...) @hashmap_init()
br label %10
10: ; preds = %2, %49
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %13
13: ; preds = %17, %10
%14 = call signext i8 (...) @getchar()
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 10
br i1 %16, label %17, label %18
17: ; preds = %13
br label %13
18: ; preds = %13
%19 = load i8, i8* %7
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 120
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%24 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %30, %22
%27 = call signext i8 (...) @getchar()
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 10
br i1 %29, label %30, label %31
30: ; preds = %26
br label %26
31: ; preds = %26
br label %32
32: ; preds = %31, %18
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
switch i32 %34, label %47 [
i32 114, label %35
i32 119, label %38
i32 100, label %41
i32 120, label %44
]
35: ; preds = %32
%36 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%37 = call i32 @ssdRead(i8* %36)
br label %49
38: ; preds = %32
%39 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%40 = call i32 @ssdWrite(i8* %39)
br label %49
41: ; preds = %32
%42 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%43 = call i32 @ssdDelete(i8* %42)
br label %49
44: ; preds = %32
%45 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @exit(i32 0)
unreachable
47: ; preds = %32
%48 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %49
49: ; preds = %47, %41, %38, %35
br label %10
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0AEnter r / w / d / x: \00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [19 x i8] c"\0AEnter file name: \00"
@.str.3 = [3 x i8] c"%s\00"
@str = [16 x i8] c"Goodbye World!!\00"
@str.6 = [19 x i8] c"\0AInvalid selection\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [25 x i8]
%4 = alloca i8
%5 = tail call i32 (...) @initializeMetadata()
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (...) @hashmap_init()
br label %8
8: ; preds = %37, %2
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %11
11: ; preds = %11, %8
%12 = call signext i8 (...) @getchar()
%13 = icmp eq i8 %12, 10
br i1 %13, label %14, label %11
14: ; preds = %11
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 120
br i1 %16, label %32, label %17
17: ; preds = %14
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %6)
br label %20
20: ; preds = %20, %17
%21 = call signext i8 (...) @getchar()
%22 = icmp eq i8 %21, 10
br i1 %22, label %23, label %20
23: ; preds = %20
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
switch i32 %25, label %35 [
i32 114, label %26
i32 119, label %28
i32 100, label %30
i32 120, label %32
]
26: ; preds = %23
%27 = call i32 @ssdRead(i8* %6)
br label %37
28: ; preds = %23
%29 = call i32 @ssdWrite(i8* %6)
br label %37
30: ; preds = %23
%31 = call i32 @ssdDelete(i8* %6)
br label %37
32: ; preds = %14, %23
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %23
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
br label %37
37: ; preds = %35, %30, %28, %26
br label %8
}