#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 *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int opcao = 0;
  char h[999];
  printf("DIGITE O ENDERE\128O DO ARQUIVO: \n");
  scanf("%s", h);
  printf("1 - COMPRESSAO\n");
  printf("2 - DESCOMPRESSAO\n");
  printf("3 - SAIR\n");
  printf("ESCOLHA UMA OP\128AO: ");
  scanf("%d", &opcao);
  compress(h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1030 <compress@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
movl   $0x0,0xc(%rsp)
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9d(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
lea    0xe6f(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <compress@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"DIGITE O ENDERE\0A8O DO ARQUIVO: \0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [16 x i8] c"1 - COMPRESSAO\0A\00"
@.str.3 = [19 x i8] c"2 - DESCOMPRESSAO\0A\00"
@.str.4 = [10 x i8] c"3 - SAIR\0A\00"
@.str.5 = [21 x i8] c"ESCOLHA UMA OP\0A8AO: \00"
@.str.6 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [999 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [999 x i8], [999 x i8]* %3, i64 0, i64 0
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%12 = getelementptr inbounds [999 x i8], [999 x i8]* %3, i64 0, i64 0
%13 = call i32 @compress(i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.5 = [21 x i8] c"ESCOLHA UMA OP\0A8AO: \00"
@.str.6 = [3 x i8] c"%d\00"
@str = [32 x i8] c"DIGITE O ENDERE\0A8O DO ARQUIVO: \00"
@str.7 = [15 x i8] c"1 - COMPRESSAO\00"
@str.8 = [18 x i8] c"2 - DESCOMPRESSAO\00"
@str.9 = [9 x i8] c"3 - SAIR\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [999 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [999 x i8], [999 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.9, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%12 = call i32 @compress(i8* %4)
ret i32 0
}