#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*/ Compress(char *, char *);
int /*<<< orphan*/ Decompress(char *, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int comp_descomp;
  do {
    printf("Digite 1 para COMPRIMIR ou 0 para DESCOMPRIMIR.\n");
    scanf("%d", &comp_descomp);
    getchar();
    if (comp_descomp != 1 && comp_descomp != 0) {
      printf("Comando invalido!\n");
    }
  } while (comp_descomp != 1 && comp_descomp != 0);
  if (comp_descomp) {
    char file_to_compress[100];
    char file_created[100];
    printf("Digite o caminho do arquivo que sera comprimido:\n");
    gets(file_to_compress);
    printf("Digite o caminho do novo arquivo comprimido que sera criado:\n");
    gets(file_created);
    Compress(file_to_compress, file_created);
  } else {
    char file_to_decompress[100];
    char decompressed_file[100];
    printf("Digite o caminho do arquivo que sera descomprimido:\n");
    gets(file_to_decompress);
    printf("Digite o caminho do novo arquivo descomprimido que sera criado:\n");
    gets(decompressed_file);
    Decompress(file_to_decompress, decompressed_file);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
cmpl   $0x1,-0x8(%rbp)
je     11b5 <main+0x55>
cmpl   $0x0,-0x8(%rbp)
je     11b5 <main+0x55>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
jmp    11ba <main+0x5a>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x1c1(%rbp)
je     11d9 <main+0x79>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x1c1(%rbp)
mov    -0x1c1(%rbp),%al
test   $0x1,%al
jne    1172 <main+0x12>
cmpl   $0x0,-0x8(%rbp)
je     1233 <main+0xd3>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1080 <Compress@plt>
jmp    1276 <main+0x116>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
lea    -0x150(%rbp),%rdi
call   1060 <gets@plt>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1c0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x150(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1040 <Decompress@plt>
xor    %eax,%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe8,%rsp
lea    0xe8e(%rip),%r14
lea    0xe84(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xf8d(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
jb     11c4 <main+0x64>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
cmp    $0x1,%eax
ja     1190 <main+0x30>
test   %eax,%eax
je     120a <main+0xaa>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <Compress@plt>
jmp    124a <main+0xea>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
lea    0x80(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <Decompress@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Digite 1 para COMPRIMIR ou 0 para DESCOMPRIMIR.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Comando invalido!\0A\00"
@.str.3 = [50 x i8] c"Digite o caminho do arquivo que sera comprimido:\0A\00"
@.str.4 = [62 x i8] c"Digite o caminho do novo arquivo comprimido que sera criado:\0A\00"
@.str.5 = [53 x i8] c"Digite o caminho do arquivo que sera descomprimido:\0A\00"
@.str.6 = [65 x i8] c"Digite o caminho do novo arquivo descomprimido que sera criado:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
store i32 0, i32* %1
br label %7
7: ; preds = %25, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %13, %7
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp ne i32 %23, 0
br label %25
25: ; preds = %22, %19
%26 = phi i1 [ false, %19 ], [ %24, %22 ]
br i1 %26, label %7, label %27
27: ; preds = %25
%28 = load i32, i32* %2
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%33 = call i32 @gets(i8* %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0))
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%36 = call i32 @gets(i8* %35)
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%39 = call i32 @Compress(i8* %37, i8* %38)
br label %50
40: ; preds = %27
%41 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0))
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%43 = call i32 @gets(i8* %42)
%44 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.6, i64 0, i64 0))
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%46 = call i32 @gets(i8* %45)
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%49 = call i32 @Decompress(i8* %47, i8* %48)
br label %50
50: ; preds = %40, %30
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [48 x i8] c"Digite 1 para COMPRIMIR ou 0 para DESCOMPRIMIR.\00"
@str.7 = [52 x i8] c"Digite o caminho do arquivo que sera descomprimido:\00"
@str.8 = [64 x i8] c"Digite o caminho do novo arquivo descomprimido que sera criado:\00"
@str.9 = [49 x i8] c"Digite o caminho do arquivo que sera comprimido:\00"
@str.10 = [61 x i8] c"Digite o caminho do novo arquivo comprimido que sera criado:\00"
@str.11 = [18 x i8] c"Comando invalido!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = bitcast i32* %1 to i8*
br label %7
7: ; preds = %13, %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %1
%12 = icmp ult i32 %11, 2
br i1 %12, label %17, label %13
13: ; preds = %7
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.11, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = icmp ult i32 %15, 2
br i1 %16, label %17, label %7
17: ; preds = %7, %13
%18 = phi i32 [ %15, %13 ], [ %11, %7 ]
%19 = icmp eq i32 %18, 0
br i1 %19, label %28, label %20
20: ; preds = %17
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.9, i64 0, i64 0))
%24 = call i32 @gets(i8* %21)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.10, i64 0, i64 0))
%26 = call i32 @gets(i8* %22)
%27 = call i32 @Compress(i8* %21, i8* %22)
br label %36
28: ; preds = %17
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.7, i64 0, i64 0))
%32 = call i32 @gets(i8* %29)
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.8, i64 0, i64 0))
%34 = call i32 @gets(i8* %30)
%35 = call i32 @Decompress(i8* %29, i8* %30)
br label %36
36: ; preds = %28, %20
ret i32 0
}