#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 Compress(char const *, char const *, char *);
int Decompress(char const *, char const *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  const char *inputFile = "../test_data/compress_test.log";
  const char *outputFile = "../test_data/compress_test.log.lzma";
  const char *outputFile2 = "../test_data/compress_test.log.decmp";
  char errMsg[800] = {0};
  int rt = Compress(inputFile, outputFile, errMsg);
  printf("Compress result code is %d \n", rt);
  if (0 != rt) {
    printf("Compress errMsg=%s \n", errMsg);
  }
  rt = Decompress(outputFile, outputFile2, errMsg);
  printf("Decompress result code is %d \n", rt);
  if (0 != rt) {
    printf("Decompress errMsg=%s \n", errMsg);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x350(%rbp),%rdi
xor    %esi,%esi
mov    $0x320,%edx
call   1050 <memset@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x350(%rbp),%rdx
call   1060 <Compress@plt>
mov    %eax,-0x354(%rbp)
mov    -0x354(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
cmp    -0x354(%rbp),%eax
je     11de <main+0x9e>
lea    -0x350(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x350(%rbp),%rdx
call   1040 <Decompress@plt>
mov    %eax,-0x354(%rbp)
mov    -0x354(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
cmp    -0x354(%rbp),%eax
je     122f <main+0xef>
lea    -0x350(%rbp),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x320,%rsp
mov    %rsp,%rbx
mov    $0x320,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0xe9f(%rip),%rdi
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdx
call   1060 <Compress@plt>
mov    %eax,%ebx
lea    0xeef(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     1197 <main+0x57>
lea    0xef8(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe81(%rip),%rdi
lea    0xe9e(%rip),%rsi
mov    %rsp,%rdx
call   1040 <Decompress@plt>
mov    %eax,%ebx
lea    0xee4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     11d4 <main+0x94>
lea    0xeef(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x320,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"../test_data/compress_test.log\00"
@.str.1 = [36 x i8] c"../test_data/compress_test.log.lzma\00"
@.str.2 = [37 x i8] c"../test_data/compress_test.log.decmp\00"
@.str.3 = [29 x i8] c"Compress result code is %d \0A\00"
@.str.4 = [21 x i8] c"Compress errMsg=%s \0A\00"
@.str.5 = [31 x i8] c"Decompress result code is %d \0A\00"
@.str.6 = [23 x i8] c"Decompress errMsg=%s \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [800 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8** %8
%11 = bitcast [800 x i8]* %9 to i8*
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = getelementptr inbounds [800 x i8], [800 x i8]* %9, i64 0, i64 0
%15 = call i32 @Compress(i8* %12, i8* %13, i8* %14)
store i32 %15, i32* %10
%16 = load i32, i32* %10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %10
%19 = icmp ne i32 0, %18
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = getelementptr inbounds [800 x i8], [800 x i8]* %9, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %2
%24 = load i8*, i8** %7
%25 = load i8*, i8** %8
%26 = getelementptr inbounds [800 x i8], [800 x i8]* %9, i64 0, i64 0
%27 = call i32 @Decompress(i8* %24, i8* %25, i8* %26)
store i32 %27, i32* %10
%28 = load i32, i32* %10
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %10
%31 = icmp ne i32 0, %30
br i1 %31, label %32, label %35
32: ; preds = %23
%33 = getelementptr inbounds [800 x i8], [800 x i8]* %9, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %23
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"../test_data/compress_test.log\00"
@.str.1 = [36 x i8] c"../test_data/compress_test.log.lzma\00"
@.str.2 = [37 x i8] c"../test_data/compress_test.log.decmp\00"
@.str.3 = [29 x i8] c"Compress result code is %d \0A\00"
@.str.4 = [21 x i8] c"Compress errMsg=%s \0A\00"
@.str.5 = [31 x i8] c"Decompress result code is %d \0A\00"
@.str.6 = [23 x i8] c"Decompress errMsg=%s \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [800 x i8]
%4 = getelementptr inbounds [800 x i8], [800 x i8]* %3, i64 0, i64 0
%5 = call i32 @Compress(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %5, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %4)
br label %10
10: ; preds = %8, %2
%11 = call i32 @Decompress(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = icmp eq i32 %11, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %4)
br label %16
16: ; preds = %14, %10
ret i32 0
}