#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*/ makeDirectory(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ removeDirectory(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ showDirectoryInfo();
int main(int argc, char **argv) {
  int user_input = 0;
  while (user_input != 4) {
    puts("1. MAke directory");
    puts("2. Remove directory");
    puts("3. Shows Current Directory info");
    puts("4. Exit");
    puts("================");
    printf("Select Num : ");
    scanf("%d", &user_input);
    char input[256];
    int i;
    for (i = 0; i < 256; i++) {
      input[i] = 0;
    }
    switch (user_input) {
    case 1:
      printf("Enter directory Name(Make) : ");
      scanf("%s", input);
      makeDirectory(input);
      showDirectoryInfo();
      break;
    case 2:
      printf("Enter directory Name(remove) : ");
      scanf("%s", input);
      removeDirectory(input);
      showDirectoryInfo();
      break;
    case 3:
      showDirectoryInfo();
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
je     12de <main+0x17e>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe75(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe92(%rip),%rdi
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x124(%rbp)
cmpl   $0x100,-0x124(%rbp)
jge    1221 <main+0xc1>
movslq -0x124(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    11ee <main+0x8e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x128(%rbp)
sub    $0x1,%eax
je     1260 <main+0x100>
jmp    1238 <main+0xd8>
mov    -0x128(%rbp),%eax
sub    $0x2,%eax
je     1299 <main+0x139>
jmp    124c <main+0xec>
mov    -0x128(%rbp),%eax
sub    $0x3,%eax
je     12d2 <main+0x172>
jmp    12d9 <main+0x179>
lea    0xe09(%rip),%rdi
call   1050 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x120(%rbp),%rdi
call   1080 <makeDirectory@plt>
mov    $0x0,%al
call   1060 <showDirectoryInfo@plt>
jmp    12d9 <main+0x179>
lea    0xdf1(%rip),%rdi
call   1050 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x120(%rbp),%rdi
call   1030 <removeDirectory@plt>
mov    $0x0,%al
call   1060 <showDirectoryInfo@plt>
jmp    12d9 <main+0x179>
mov    $0x0,%al
call   1060 <showDirectoryInfo@plt>
jmp    1180 <main+0x20>
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
movl   $0x0,0xc(%rsp)
lea    0xec6(%rip),%r13
lea    0xec7(%rip),%rbx
lea    0xed1(%rip),%rbp
lea    0xed8(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    11e9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xeda(%rip),%rdi
call   1050 <printf@plt>
lea    0xecb(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,%rdi
call   1030 <removeDirectory@plt>
xor    %eax,%eax
call   1060 <showDirectoryInfo@plt>
mov    0xc(%rsp),%eax
cmp    $0x4,%eax
je     12e9 <main+0x189>
lea    0xe10(%rip),%rdi
call   1040 <puts@plt>
lea    0xe16(%rip),%rdi
call   1040 <puts@plt>
lea    0xe1e(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
mov    0xc(%rsp),%eax
cmp    $0x3,%eax
je     11d5 <main+0x75>
cmp    $0x2,%eax
je     11b0 <main+0x50>
cmp    $0x1,%eax
jne    11e0 <main+0x80>
lea    0xdaa(%rip),%rdi
call   1050 <printf@plt>
lea    0xdbc(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,%rdi
call   1080 <makeDirectory@plt>
jmp    11d5 <main+0x75>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"1. MAke directory\00"
@.str.1 = [20 x i8] c"2. Remove directory\00"
@.str.2 = [32 x i8] c"3. Shows Current Directory info\00"
@.str.3 = [8 x i8] c"4. Exit\00"
@.str.4 = [17 x i8] c"================\00"
@.str.5 = [14 x i8] c"Select Num : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [30 x i8] c"Enter directory Name(Make) : \00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [32 x i8] c"Enter directory Name(remove) : \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %48, %2
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 4
br i1 %11, label %12, label %49
12: ; preds = %9
%13 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %6)
store i32 0, i32* %8
br label %20
20: ; preds = %27, %12
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 256
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %25
store i8 0, i8* %26
br label %27
27: ; preds = %23
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %20
30: ; preds = %20
%31 = load i32, i32* %6
switch i32 %31, label %48 [
i32 1, label %32
i32 2, label %39
i32 3, label %46
]
32: ; preds = %30
%33 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%37 = call i32 @makeDirectory(i8* %36)
%38 = call i32 (...) @showDirectoryInfo()
br label %48
39: ; preds = %30
%40 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%42 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %41)
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%44 = call i32 @removeDirectory(i8* %43)
%45 = call i32 (...) @showDirectoryInfo()
br label %48
46: ; preds = %30
%47 = call i32 (...) @showDirectoryInfo()
br label %48
48: ; preds = %30, %46, %39, %32
br label %9
49: ; preds = %9
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [18 x i8] c"1. MAke directory\00"
@.str.1 = [20 x i8] c"2. Remove directory\00"
@.str.2 = [32 x i8] c"3. Shows Current Directory info\00"
@.str.3 = [8 x i8] c"4. Exit\00"
@.str.4 = [17 x i8] c"================\00"
@.str.5 = [14 x i8] c"Select Num : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [30 x i8] c"Enter directory Name(Make) : \00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [32 x i8] c"Enter directory Name(remove) : \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
br label %8
8: ; preds = %2, %28
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
switch i32 %16, label %28 [
i32 1, label %17
i32 2, label %21
i32 3, label %25
]
17: ; preds = %8
%18 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%20 = call i32 @makeDirectory(i8* %7)
br label %25
21: ; preds = %8
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %7)
%24 = call i32 @removeDirectory(i8* %7)
br label %25
25: ; preds = %8, %17, %21
%26 = call i32 (...) @showDirectoryInfo()
%27 = load i32, i32* %3
br label %28
28: ; preds = %25, %8
%29 = phi i32 [ %27, %25 ], [ %16, %8 ]
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %8
31: ; preds = %28
ret i32 0
}