#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*/ compressFile(char *);
int /*<<< orphan*/ decompress(char *);
scalar_t__ getc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  if (argc <= 1) {
    printf("Add lz paths as command line params");
  }
  for (int i = 1; i < argc; ++i) {
    int strLen = (int)strlen(argv[i]);
    if (strLen > 0) {
      char fileCheck = argv[i][strLen - 1];
      if (fileCheck == 'z') {
        decompress(argv[i]);
      } else if (fileCheck == 'w') {
        compressFile(argv[i]);
      } else {
        printf("Unable to identify whether to compress or decompress "
               "file\nEnter 'D' to decompress, 'C' to compress, or any other "
               "character to skip\n");
        int answer = (char)getc(stdin);
        if (answer == 'D' || answer == 'd') {
          decompress(argv[i]);
        } else if (answer == 'C' || answer == 'c') {
          compressFile(argv[i]);
        } else {
          continue;
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     117c <main+0x2c>
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ae <main+0x15e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    129b <main+0x14b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x7a,%eax
jne    11eb <main+0x9b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <decompress@plt>
jmp    1296 <main+0x146>
movsbl -0x19(%rbp),%eax
cmp    $0x77,%eax
jne    120e <main+0xbe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <compressFile@plt>
jmp    1291 <main+0x141>
lea    0xe0f(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
call   1070 <getc@plt>
movsbl %al,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x44,-0x20(%rbp)
je     1242 <main+0xf2>
cmpl   $0x64,-0x20(%rbp)
jne    1258 <main+0x108>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <decompress@plt>
jmp    128c <main+0x13c>
cmpl   $0x43,-0x20(%rbp)
je     126c <main+0x11c>
cmpl   $0x63,-0x20(%rbp)
jne    1282 <main+0x132>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <compressFile@plt>
jmp    1287 <main+0x137>
jmp    12a0 <main+0x150>
jmp    128c <main+0x13c>
jmp    1291 <main+0x141>
jmp    1296 <main+0x146>
jmp    129b <main+0x14b>
jmp    12a0 <main+0x150>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1183 <main+0x33>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     118d <main+0x2d>
lea    0xe89(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xe85(%rip),%r14
mov    0x2e42(%rip),%rbp
jmp    11c1 <main+0x61>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <compressFile@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     117c <main+0x1c>
mov    (%r15,%rbx,8),%r13
mov    %r13,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    11b8 <main+0x58>
add    $0xffffffff,%eax
movzbl 0x0(%r13,%rax,1),%eax
cmp    $0x77,%al
je     11b0 <main+0x50>
cmp    $0x7a,%al
jne    11f0 <main+0x90>
mov    %r13,%rdi
jmp    120e <main+0xae>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    0x0(%rbp),%edi
call   1080 <getc@plt>
and    $0xdf,%al
cmp    $0x43,%al
je     1215 <main+0xb5>
cmp    $0x44,%al
jne    11b8 <main+0x58>
mov    (%r15,%rbx,8),%rdi
call   1070 <decompress@plt>
jmp    11b8 <main+0x58>
mov    (%r15,%rbx,8),%rdi
jmp    11b3 <main+0x53>

LLVM IR (-O0):
@.str = [36 x i8] c"Add lz paths as command line params\00"
@.str.1 = [132 x i8] c"Unable to identify whether to compress or decompress file\0AEnter 'D' to decompress, 'C' to compress, or any other character to skip\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sle i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
store i32 1, i32* %6
br label %15
15: ; preds = %98, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %101
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i64 @strlen(i8* %24)
%26 = trunc i64 %25 to i32
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %97
29: ; preds = %19
%30 = load i8**, i8*** %5
%31 = load i32, i32* %6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = load i32, i32* %7
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
%39 = load i8, i8* %38
store i8 %39, i8* %8
%40 = load i8, i8* %8
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 122
br i1 %42, label %43, label %50
43: ; preds = %29
%44 = load i8**, i8*** %5
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @decompress(i8* %48)
br label %96
50: ; preds = %29
%51 = load i8, i8* %8
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 119
br i1 %53, label %54, label %61
54: ; preds = %50
%55 = load i8**, i8*** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8*, i8** %55, i64 %57
%59 = load i8*, i8** %58
%60 = call i32 @compressFile(i8* %59)
br label %95
61: ; preds = %50
%62 = call i32 @printf(i8* getelementptr inbounds ([132 x i8], [132 x i8]* @.str.1, i64 0, i64 0))
%63 = load i32, i32* @stdin
%64 = call i64 @getc(i32 %63)
%65 = trunc i64 %64 to i8
%66 = sext i8 %65 to i32
store i32 %66, i32* %9
%67 = load i32, i32* %9
%68 = icmp eq i32 %67, 68
br i1 %68, label %72, label %69
69: ; preds = %61
%70 = load i32, i32* %9
%71 = icmp eq i32 %70, 100
br i1 %71, label %72, label %79
72: ; preds = %69, %61
%73 = load i8**, i8*** %5
%74 = load i32, i32* %6
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8*, i8** %73, i64 %75
%77 = load i8*, i8** %76
%78 = call i32 @decompress(i8* %77)
br label %94
79: ; preds = %69
%80 = load i32, i32* %9
%81 = icmp eq i32 %80, 67
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = load i32, i32* %9
%84 = icmp eq i32 %83, 99
br i1 %84, label %85, label %92
85: ; preds = %82, %79
%86 = load i8**, i8*** %5
%87 = load i32, i32* %6
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @compressFile(i8* %90)
br label %93
92: ; preds = %82
br label %98
93: ; preds = %85
br label %94
94: ; preds = %93, %72
br label %95
95: ; preds = %94, %54
br label %96
96: ; preds = %95, %43
br label %97
97: ; preds = %96, %19
br label %98
98: ; preds = %97, %92
%99 = load i32, i32* %6
%100 = add nsw i32 %99, 1
store i32 %100, i32* %6
br label %15
101: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Add lz paths as command line params\00"
@stdin = global i32 0
@str = [131 x i8] c"Unable to identify whether to compress or decompress file\0AEnter 'D' to decompress, 'C' to compress, or any other character to skip\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %9
8: ; preds = %37, %4
ret i32 0
9: ; preds = %6, %37
%10 = phi i64 [ 1, %6 ], [ %38, %37 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i64 @strlen(i8* dereferenceable(1) %12)
%14 = trunc i64 %13 to i32
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %37
16: ; preds = %9
%17 = add i64 %13, 4294967295
%18 = and i64 %17, 4294967295
%19 = getelementptr inbounds i8, i8* %12, i64 %18
%20 = load i8, i8* %19
switch i8 %20, label %25 [
i8 122, label %21
i8 119, label %23
]
21: ; preds = %16
%22 = tail call i32 @decompress(i8* %12)
br label %37
23: ; preds = %16
%24 = tail call i32 @compressFile(i8* %12)
br label %37
25: ; preds = %16
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([131 x i8], [131 x i8]* @str, i64 0, i64 0))
%27 = load i32, i32* @stdin
%28 = tail call i64 @getc(i32 %27)
%29 = trunc i64 %28 to i8
%30 = and i8 %29, -33
switch i8 %30, label %37 [
i8 68, label %31
i8 67, label %34
]
31: ; preds = %25
%32 = load i8*, i8** %11
%33 = tail call i32 @decompress(i8* %32)
br label %37
34: ; preds = %25
%35 = load i8*, i8** %11
%36 = tail call i32 @compressFile(i8* %35)
br label %37
37: ; preds = %25, %21, %23, %31, %34, %9
%38 = add nuw nsw i64 %10, 1
%39 = icmp eq i64 %38, %7
br i1 %39, label %8, label %9
}