#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*/ dir_compress(char *, int);
int /*<<< orphan*/ dir_decompress(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  char dir_path[500];
  int compress_type = 0;
  if (argc == 2)
    dir_decompress(argv[1]);
  if (argc == 3) {
    strcpy(dir_path, argv[2]);
    if (strcmp(argv[1], "-rl") == 0) {
      compress_type = 1;
      dir_compress(dir_path, compress_type);
    } else if (strcmp(argv[1], "-ke") == 0) {
      compress_type = 2;
      dir_compress(dir_path, compress_type);
    } else
      printf("Invalid Input\n");
  }
  if (argc == 4) {
    strcpy(dir_path, argv[3]);
    if ((strcmp(argv[1], "-rl") == 0) && (strcmp(argv[2], "-ke") == 0)) {
      compress_type = 3;
      dir_compress(dir_path, compress_type);
    } else if ((strcmp(argv[1], "-ke") == 0) && (strcmp(argv[2], "-rl") == 0)) {
      compress_type = 4;
      dir_compress(dir_path, compress_type);
    } else
      printf("Invalid Input\n");
  }
  if ((argc < 2) || (argc > 4))
    printf("Invalid Input\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x214(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    118a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <dir_decompress@plt>
cmpl   $0x3,-0x8(%rbp)
jne    123c <main+0xec>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe49(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11e7 <main+0x97>
movl   $0x1,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
call   1060 <dir_compress@plt>
jmp    1237 <main+0xe7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1226 <main+0xd6>
movl   $0x2,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
call   1060 <dir_compress@plt>
jmp    1232 <main+0xe2>
lea    0xddb(%rip),%rdi
call   1040 <printf@plt>
jmp    1237 <main+0xe7>
jmp    123c <main+0xec>
cmpl   $0x4,-0x8(%rbp)
jne    132a <main+0x1da>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd97(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12b7 <main+0x167>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd7d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12b7 <main+0x167>
movl   $0x3,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
call   1060 <dir_compress@plt>
jmp    1325 <main+0x1d5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd3e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1314 <main+0x1c4>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd1c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1314 <main+0x1c4>
movl   $0x4,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x214(%rbp),%esi
call   1060 <dir_compress@plt>
jmp    1320 <main+0x1d0>
lea    0xced(%rip),%rdi
call   1040 <printf@plt>
jmp    1325 <main+0x1d5>
jmp    132a <main+0x1da>
cmpl   $0x2,-0x8(%rbp)
jl     133e <main+0x1ee>
cmpl   $0x4,-0x8(%rbp)
jle    134a <main+0x1fa>
lea    0xcc3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
je     1180 <main+0x30>
cmp    $0x3,%edi
je     11f3 <main+0xa3>
cmp    $0x2,%edi
jne    1229 <main+0xd9>
mov    0x8(%rbx),%rdi
call   1070 <dir_decompress@plt>
jmp    1235 <main+0xe5>
mov    0x18(%rbx),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%rdi
lea    0xe69(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11ba <main+0x6a>
mov    0x10(%rbx),%rdi
lea    0xe58(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     125e <main+0x10e>
mov    0x8(%rbx),%rdi
lea    0xe3f(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1229 <main+0xd9>
mov    0x10(%rbx),%rdi
lea    0xe26(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1229 <main+0xd9>
mov    %rsp,%rdi
mov    $0x4,%esi
call   1060 <dir_compress@plt>
jmp    1235 <main+0xe5>
mov    0x10(%rbx),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%rdi
lea    0xdf6(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1240 <main+0xf0>
mov    0x8(%rbx),%rdi
lea    0xde5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     124f <main+0xff>
lea    0xdd8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
ret
mov    %rsp,%rdi
mov    $0x1,%esi
call   1060 <dir_compress@plt>
jmp    1235 <main+0xe5>
mov    %rsp,%rdi
mov    $0x2,%esi
call   1060 <dir_compress@plt>
jmp    1235 <main+0xe5>
mov    %rsp,%rdi
mov    $0x3,%esi
call   1060 <dir_compress@plt>
jmp    1235 <main+0xe5>

LLVM IR (-O0):
@.str = [4 x i8] c"-rl\00"
@.str.1 = [4 x i8] c"-ke\00"
@.str.2 = [15 x i8] c"Invalid Input\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [500 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @dir_decompress(i8* %13)
br label %15
15: ; preds = %10, %2
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %47
18: ; preds = %15
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @strcpy(i8* %19, i8* %22)
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %18
store i32 1, i32* %7
%30 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%31 = load i32, i32* %7
%32 = call i32 @dir_compress(i8* %30, i32 %31)
br label %46
33: ; preds = %18
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %33
store i32 2, i32* %7
%40 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%41 = load i32, i32* %7
%42 = call i32 @dir_compress(i8* %40, i32 %41)
br label %45
43: ; preds = %33
%44 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %39
br label %46
46: ; preds = %45, %29
br label %47
47: ; preds = %46, %15
%48 = load i32, i32* %4
%49 = icmp eq i32 %48, 4
br i1 %49, label %50, label %91
50: ; preds = %47
%51 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = call i32 @strcpy(i8* %51, i8* %54)
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %71
61: ; preds = %50
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 2
%64 = load i8*, i8** %63
%65 = call i64 @strcmp(i8* %64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %71
67: ; preds = %61
store i32 3, i32* %7
%68 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%69 = load i32, i32* %7
%70 = call i32 @dir_compress(i8* %68, i32 %69)
br label %90
71: ; preds = %61, %50
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 1
%74 = load i8*, i8** %73
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %87
77: ; preds = %71
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 2
%80 = load i8*, i8** %79
%81 = call i64 @strcmp(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %87
83: ; preds = %77
store i32 4, i32* %7
%84 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%85 = load i32, i32* %7
%86 = call i32 @dir_compress(i8* %84, i32 %85)
br label %89
87: ; preds = %77, %71
%88 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %89
89: ; preds = %87, %83
br label %90
90: ; preds = %89, %67
br label %91
91: ; preds = %90, %47
%92 = load i32, i32* %4
%93 = icmp slt i32 %92, 2
br i1 %93, label %97, label %94
94: ; preds = %91
%95 = load i32, i32* %4
%96 = icmp sgt i32 %95, 4
br i1 %96, label %97, label %99
97: ; preds = %94, %91
%98 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %99
99: ; preds = %97, %94
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"-rl\00"
@.str.1 = [4 x i8] c"-ke\00"
@str.4 = [14 x i8] c"Invalid Input\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [500 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
switch i32 %0, label %55 [
i32 2, label %5
i32 3, label %9
i32 4, label %27
]
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @dir_decompress(i8* %7)
br label %57
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = call i32 @strcpy(i8* %4, i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %9
%18 = call i32 @dir_compress(i8* %4, i32 1)
br label %57
19: ; preds = %9
%20 = load i8*, i8** %13
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @dir_compress(i8* %4, i32 2)
br label %57
25: ; preds = %19
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
br label %57
27: ; preds = %2
%28 = getelementptr inbounds i8*, i8** %1, i64 3
%29 = load i8*, i8** %28
%30 = call i32 @strcpy(i8* %4, i8* %29)
%31 = getelementptr inbounds i8*, i8** %1, i64 1
%32 = load i8*, i8** %31
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %42
35: ; preds = %27
%36 = getelementptr inbounds i8*, i8** %1, i64 2
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 @dir_compress(i8* %4, i32 3)
br label %57
42: ; preds = %35, %27
%43 = load i8*, i8** %31
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %53
46: ; preds = %42
%47 = getelementptr inbounds i8*, i8** %1, i64 2
%48 = load i8*, i8** %47
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 @dir_compress(i8* %4, i32 4)
br label %57
53: ; preds = %46, %42
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
br label %57
55: ; preds = %2
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
br label %57
57: ; preds = %51, %53, %40, %5, %17, %25, %23, %55
ret i32 0
}