#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_orDie(char const *const, char *const, int);
char *createOutFilename_orDie(char const *const);
int /*<<< orphan*/ free(char *const);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char **argv) {
  const char *const exeName = argv[0];
  if (argc != 2) {
    printf("wrong arguments\n");
    printf("usage:\n");
    printf("%s FILE\n", exeName);
    return 1;
  }
  const char *const inFilename = argv[1];
  char *const outFilename = createOutFilename_orDie(inFilename);
  compressFile_orDie(inFilename, outFilename, 1);
  free(outFilename);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a5 <main+0x65>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e0 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <createOutFilename_orDie@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x1,%edx
call   1060 <compressFile_orDie@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    1184 <main+0x34>
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1060 <createOutFilename_orDie@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x1,%edx
call   1070 <compressFile_orDie@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    11b5 <main+0x65>
mov    (%rsi),%rbx
lea    0xe7b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe7f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"wrong arguments\0A\00"
@.str.1 = [8 x i8] c"usage:\0A\00"
@.str.2 = [9 x i8] c"%s FILE\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*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
store i8* %11, i8** %6
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %17)
store i32 1, i32* %3
br label %30
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
store i8* %22, i8** %7
%23 = load i8*, i8** %7
%24 = call i8* @createOutFilename_orDie(i8* %23)
store i8* %24, i8** %8
%25 = load i8*, i8** %7
%26 = load i8*, i8** %8
%27 = call i32 @compressFile_orDie(i8* %25, i8* %26, i32 1)
%28 = load i8*, i8** %8
%29 = call i32 @free(i8* %28)
store i32 0, i32* %3
br label %30
30: ; preds = %19, %14
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c"%s FILE\0A\00"
@str = [16 x i8] c"wrong arguments\00"
@str.3 = [7 x i8] c"usage:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.3, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %5)
br label %15
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i8* @createOutFilename_orDie(i8* %11)
%13 = tail call i32 @compressFile_orDie(i8* %11, i8* %12, i32 1)
%14 = tail call i32 @free(i8* %12)
br label %15
15: ; preds = %9, %4
%16 = phi i32 [ 1, %4 ], [ 0, %9 ]
ret i32 %16
}