#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_file(char *, char *);
int decompress_file(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ show_syntax();
int main(int argc, char *argv[]) {
  printf("appack, aPLib compression library example\n"
         "Copyright 1998-2014 Joergen Ibsen (www.ibsensoftware.com)\n\n");
  if (argc != 4) {
    show_syntax();
    return 1;
  }
  if (argv[1][0] && argv[1][1] == '\0') {
    switch (argv[1][0]) {
    case 'c':
    case 'C':
      return compress_file(argv[2], argv[3]);
    case 'd':
    case 'D':
      return decompress_file(argv[2], argv[3]);
    }
  }
  show_syntax();
  return 1;
}


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)
lea    0xf2b(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x4,-0x8(%rbp)
je     117f <main+0x3f>
mov    $0x0,%al
call   1040 <show_syntax@plt>
movl   $0x1,-0x4(%rbp)
jmp    1226 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1218 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    1218 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x21,%eax
ja     1213 <main+0xd3>
mov    -0x18(%rbp),%rax
lea    0xe30(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <compress_file@plt>
mov    %eax,-0x4(%rbp)
jmp    1226 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1060 <decompress_file@plt>
mov    %eax,-0x4(%rbp)
jmp    1226 <main+0xe6>
jmp    1218 <main+0xd8>
mov    $0x0,%al
call   1040 <show_syntax@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xf39(%rip),%rdi
call   1040 <puts@plt>
cmp    $0x4,%ebp
jne    116a <main+0x2a>
mov    0x8(%rbx),%rcx
movsbl (%rcx),%eax
test   %eax,%eax
je     116a <main+0x2a>
cmpb   $0x0,0x1(%rcx)
je     117d <main+0x3d>
xor    %eax,%eax
call   1050 <show_syntax@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
add    $0xffffffbd,%eax
cmp    $0x21,%eax
ja     116a <main+0x2a>
lea    0xe74(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <compress_file@plt>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <decompress_file@plt>

LLVM IR (-O0):
@.str = [102 x i8] c"appack, aPLib compression library example\0ACopyright 1998-2014 Joergen Ibsen (www.ibsensoftware.com)\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 4
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @show_syntax()
store i32 1, i32* %3
br label %53
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %51
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %51
27: ; preds = %19
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
switch i32 %33, label %50 [
i32 99, label %34
i32 67, label %34
i32 100, label %42
i32 68, label %42
]
34: ; preds = %27, %27
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 3
%40 = load i8*, i8** %39
%41 = call i32 @compress_file(i8* %37, i8* %40)
store i32 %41, i32* %3
br label %53
42: ; preds = %27, %27
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 3
%48 = load i8*, i8** %47
%49 = call i32 @decompress_file(i8* %45, i8* %48)
store i32 %49, i32* %3
br label %53
50: ; preds = %27
br label %51
51: ; preds = %50, %19, %11
%52 = call i32 (...) @show_syntax()
store i32 1, i32* %3
br label %53
53: ; preds = %51, %42, %34, %9
%54 = load i32, i32* %3
ret i32 %54
}

LLVM IR (-O2):
@str = [101 x i8] c"appack, aPLib compression library example\0ACopyright 1998-2014 Joergen Ibsen (www.ibsensoftware.com)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([101 x i8], [101 x i8]* @str, i64 0, i64 0))
%4 = icmp eq i32 %0, 4
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @show_syntax()
br label %32
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i8 %10, 0
br i1 %12, label %30, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %30
17: ; preds = %13
switch i32 %11, label %30 [
i32 99, label %18
i32 67, label %18
i32 100, label %24
i32 68, label %24
]
18: ; preds = %17, %17
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8*, i8** %1, i64 3
%22 = load i8*, i8** %21
%23 = tail call i32 @compress_file(i8* %20, i8* %22)
br label %32
24: ; preds = %17, %17
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8*, i8** %1, i64 3
%28 = load i8*, i8** %27
%29 = tail call i32 @decompress_file(i8* %26, i8* %28)
br label %32
30: ; preds = %17, %13, %7
%31 = tail call i32 (...) @show_syntax()
br label %32
32: ; preds = %30, %24, %18, %5
%33 = phi i32 [ 1, %5 ], [ 1, %30 ], [ %29, %24 ], [ %23, %18 ]
ret i32 %33
}