#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 build_index(unsigned char *, unsigned long, unsigned int *, unsigned int,
                char *, void **);
char *error_index(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int free_index(void *);
double getTime();
int /*<<< orphan*/ index_size(void *, unsigned long *);
int loadDocBeginngins(unsigned int **, unsigned int *, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ print_usage(char *);
int read_file(char *, unsigned char **, unsigned long *);
int save_index(void *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char *argv[]) {
  char *infile, *outfile;
  unsigned char *text;
  char *params = NULL;
  unsigned long text_len;
  void *index;
  int error, i;
  double start, end;
  if (argc < 3)
    print_usage(argv[0]);
  if (argc > 3) {
    int nchars, len;
    nchars = argc - 3;
    for (i = 2; i < argc; i++)
      nchars += strlen(argv[i]);
    params = (char *)malloc((nchars + 1) * sizeof(char));
    params[nchars] = '\0';
    nchars = 0;
    for (i = 3; i < argc; i++) {
      len = strlen(argv[i]);
      strncpy(params + nchars, argv[i], len);
      params[nchars + len] = ' ';
      nchars += len + 1;
    }
    params[nchars - 1] = '\0';
  }
  infile = argv[1];
  outfile = argv[2];
  start = getTime();
  error = read_file(infile, &text, &text_len);
  {{if (error){fprintf(stderr, "%s\n", error_index(error));
  exit(1);
}
}
}
;
unsigned int ndocs;
unsigned int *docboundaries;
error = loadDocBeginngins(&docboundaries, &ndocs, (char *)infile);
{{if (error){fprintf(stderr, "%s\n", error_index(error));
exit(1);
}
}
}
;
error = build_index(text, text_len, docboundaries, ndocs, params, &index);
{{if (error){fprintf(stderr, "%s\n", error_index(error));
exit(1);
}
}
}
;
error = save_index(index, outfile);
{{if (error){fprintf(stderr, "%s\n", error_index(error));
exit(1);
}
}
}
;
end = getTime();
fprintf(stderr, "Building time: %.3f secs\n", end - start);
unsigned long index_len;
index_size(index, &index_len);
fprintf(stdout, "Input: %lu bytes --> Output %lu bytes.\n", text_len,
        index_len);
fprintf(stdout, "Overall compression --> %.2f%% (%.2f bits per char).\n\n",
        (100.0 * index_len) / text_len, (index_len * 8.0) / text_len);
error = free_index(index);
{{if (error){fprintf(stderr, "%s\n", error_index(error));
exit(1);
}
}
}
;
free(params);
exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1227 <main+0x37>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1100 <print_usage@plt>
cmpl   $0x3,-0x8(%rbp)
jle    131e <main+0x12e>
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x5c(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1272 <main+0x82>
mov    -0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
add    -0x5c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1241 <main+0x51>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x5c(%rbp)
movl   $0x3,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    130d <main+0x11d>
mov    -0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
mov    %eax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
movslq -0x5c(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rax
movslq -0x48(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x60(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x30(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    -0x60(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
add    -0x5c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12a3 <main+0xb3>
mov    -0x30(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <getTime@plt>
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   10a0 <read_file@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1392 <main+0x1a2>
mov    0x2c79(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x44(%rbp),%edi
call   10e0 <error_index@plt>
mov    -0x7c(%rbp),%edi
mov    %rax,%rdx
lea    0xcaf(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x18(%rbp),%rdx
lea    -0x70(%rbp),%rdi
lea    -0x64(%rbp),%rsi
call   10b0 <loadDocBeginngins@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     13e2 <main+0x1f2>
mov    0x2c29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    -0x44(%rbp),%edi
call   10e0 <error_index@plt>
mov    -0x80(%rbp),%edi
mov    %rax,%rdx
lea    0xc5f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x64(%rbp),%ecx
mov    -0x30(%rbp),%r8
lea    -0x40(%rbp),%r9
call   1110 <build_index@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1443 <main+0x253>
mov    0x2bce(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x44(%rbp),%edi
call   10e0 <error_index@plt>
mov    -0x84(%rbp),%edi
mov    %rax,%rdx
lea    0xbfe(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <save_index@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     1495 <main+0x2a5>
mov    0x2b7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
mov    -0x44(%rbp),%edi
call   10e0 <error_index@plt>
mov    -0x88(%rbp),%edi
mov    %rax,%rdx
lea    0xbac(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
xor    %eax,%eax
mov    %al,-0x91(%rbp)
call   1060 <getTime@plt>
movsd  %xmm0,-0x58(%rbp)
mov    0x2b32(%rip),%rax
mov    (%rax),%edi
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
subsd  %xmm1,%xmm0
lea    0xb6f(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   1050 <index_size@plt>
mov    -0x91(%rbp),%al
mov    0x2af2(%rip),%rcx
mov    %rcx,-0x90(%rbp)
mov    (%rcx),%edi
mov    -0x38(%rbp),%rdx
mov    -0x78(%rbp),%rcx
lea    0xb50(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x90(%rbp),%rax
mov    (%rax),%edi
movaps 0xaed(%rip),%xmm4
movq   -0x78(%rbp),%xmm1
punpckldq %xmm4,%xmm1
movapd 0xaec(%rip),%xmm3
subpd  %xmm3,%xmm1
movaps %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xae5(%rip),%xmm2
movaps %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movq   -0x38(%rbp),%xmm2
punpckldq %xmm4,%xmm2
subpd  %xmm3,%xmm2
movaps %xmm2,%xmm3
unpckhpd %xmm2,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm0
movsd  0xac2(%rip),%xmm3
mulsd  %xmm3,%xmm1
divsd  %xmm2,%xmm1
lea    0xb01(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   10d0 <free_index@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     15ca <main+0x3da>
mov    0x2a47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
mov    -0x44(%rbp),%edi
call   10e0 <error_index@plt>
mov    -0x98(%rbp),%edi
mov    %rax,%rdx
lea    0xa77(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
jg     1217 <main+0x27>
mov    (%r12),%rdi
call   1100 <print_usage@plt>
xor    %r14d,%r14d
jmp    12bd <main+0xcd>
mov    %edi,%r15d
cmp    $0x3,%edi
jne    1227 <main+0x37>
xor    %r14d,%r14d
jmp    12bd <main+0xcd>
lea    -0x3(%r15),%ebp
mov    %r15d,%r13d
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r12,%rbx,8),%rdi
call   1070 <strlen@plt>
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1240 <main+0x50>
lea    0x1(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,%r14
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
mov    $0xffffffffffffffff,%rax
cmp    $0x4,%r15d
jl     12b8 <main+0xc8>
xor    %ebp,%ebp
mov    $0x3,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdi
call   1070 <strlen@plt>
mov    %eax,%r15d
movslq %ebp,%rbp
lea    (%r14,%rbp,1),%rdi
mov    (%r12,%rbx,8),%rsi
mov    %eax,%edx
call   1040 <strncpy@plt>
lea    (%r15,%rbp,1),%eax
cltq
movb   $0x20,(%r14,%rax,1)
add    %r15d,%ebp
add    $0x1,%ebp
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1280 <main+0x90>
movb   $0x0,(%r14,%rax,1)
mov    0x8(%r12),%r15
mov    0x10(%r12),%rbx
xor    %eax,%eax
call   1060 <getTime@plt>
movsd  %xmm0,0x20(%rsp)
lea    0x30(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %r15,%rdi
call   10a0 <read_file@plt>
test   %eax,%eax
jne    1421 <main+0x231>
lea    0x28(%rsp),%rdi
lea    0x14(%rsp),%rsi
mov    %r15,%rdx
call   10b0 <loadDocBeginngins@plt>
test   %eax,%eax
jne    1421 <main+0x231>
mov    0x30(%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    0x28(%rsp),%rdx
mov    0x14(%rsp),%ecx
mov    %rsp,%r9
mov    %r14,%r8
call   1110 <build_index@plt>
test   %eax,%eax
jne    1421 <main+0x231>
mov    (%rsp),%rdi
mov    %rbx,%rsi
call   1080 <save_index@plt>
test   %eax,%eax
jne    1421 <main+0x231>
xor    %eax,%eax
call   1060 <getTime@plt>
mov    0x2c90(%rip),%rbx
mov    (%rbx),%edi
subsd  0x20(%rsp),%xmm0
lea    0xcd5(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    (%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1050 <index_size@plt>
mov    0x2c5d(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x8(%rsp),%rdx
mov    0x18(%rsp),%rcx
lea    0xcbf(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%rbp),%edi
movsd  0x18(%rsp),%xmm0
movapd 0xc59(%rip),%xmm2
unpcklps %xmm2,%xmm0
movapd 0xc5e(%rip),%xmm3
subpd  %xmm3,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc56(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm4
unpcklps %xmm2,%xmm4
subpd  %xmm3,%xmm4
movapd %xmm4,%xmm2
unpckhpd %xmm4,%xmm2
addsd  %xmm4,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xc35(%rip),%xmm1
divsd  %xmm2,%xmm1
lea    0xc78(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
mov    (%rsp),%rdi
call   10d0 <free_index@plt>
test   %eax,%eax
jne    144e <main+0x25e>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   10f0 <exit@plt>
mov    0x2bb8(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   10e0 <error_index@plt>
lea    0xbf8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    (%rbx),%ebx
jmp    142a <main+0x23a>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [26 x i8] c"Building time: %.3f secs\0A\00"
@stdout = global i32 0
@.str.2 = [40 x i8] c"Input: %lu bytes --> Output %lu bytes.\0A\00"
@.str.3 = [55 x i8] c"Overall compression --> %.2f%% (%.2f bits per char).\0A\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 i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32*
%20 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %9
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %28
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @print_usage(i8* %26)
br label %28
28: ; preds = %23, %2
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 3
br i1 %30, label %31, label %103
31: ; preds = %28
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 3
store i32 %33, i32* %16
store i32 2, i32* %13
br label %34
34: ; preds = %47, %31
%35 = load i32, i32* %13
%36 = load i32, i32* %4
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %50
38: ; preds = %34
%39 = load i8**, i8*** %5
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @strlen(i8* %43)
%45 = load i32, i32* %16
%46 = add nsw i32 %45, %44
store i32 %46, i32* %16
br label %47
47: ; preds = %38
%48 = load i32, i32* %13
%49 = add nsw i32 %48, 1
store i32 %49, i32* %13
br label %34
50: ; preds = %34
%51 = load i32, i32* %16
%52 = add nsw i32 %51, 1
%53 = sext i32 %52 to i64
%54 = mul i64 %53, 1
%55 = trunc i64 %54 to i32
%56 = call i64 @malloc(i32 %55)
%57 = inttoptr i64 %56 to i8*
store i8* %57, i8** %9
%58 = load i8*, i8** %9
%59 = load i32, i32* %16
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
store i8 0, i8* %61
store i32 0, i32* %16
store i32 3, i32* %13
br label %62
62: ; preds = %94, %50
%63 = load i32, i32* %13
%64 = load i32, i32* %4
%65 = icmp slt i32 %63, %64
br i1 %65, label %66, label %97
66: ; preds = %62
%67 = load i8**, i8*** %5
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %67, i64 %69
%71 = load i8*, i8** %70
%72 = call i32 @strlen(i8* %71)
store i32 %72, i32* %17
%73 = load i8*, i8** %9
%74 = load i32, i32* %16
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = load i8**, i8*** %5
%78 = load i32, i32* %13
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = load i32, i32* %17
%83 = call i32 @strncpy(i8* %76, i8* %81, i32 %82)
%84 = load i8*, i8** %9
%85 = load i32, i32* %16
%86 = load i32, i32* %17
%87 = add nsw i32 %85, %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %84, i64 %88
store i8 32, i8* %89
%90 = load i32, i32* %17
%91 = add nsw i32 %90, 1
%92 = load i32, i32* %16
%93 = add nsw i32 %92, %91
store i32 %93, i32* %16
br label %94
94: ; preds = %66
%95 = load i32, i32* %13
%96 = add nsw i32 %95, 1
store i32 %96, i32* %13
br label %62
97: ; preds = %62
%98 = load i8*, i8** %9
%99 = load i32, i32* %16
%100 = sub nsw i32 %99, 1
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %98, i64 %101
store i8 0, i8* %102
br label %103
103: ; preds = %97, %28
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i64 1
%106 = load i8*, i8** %105
store i8* %106, i8** %6
%107 = load i8**, i8*** %5
%108 = getelementptr inbounds i8*, i8** %107, i64 2
%109 = load i8*, i8** %108
store i8* %109, i8** %7
%110 = call double (...) @getTime()
store double %110, double* %14
%111 = load i8*, i8** %6
%112 = call i32 @read_file(i8* %111, i8** %8, i64* %10)
store i32 %112, i32* %12
%113 = load i32, i32* %12
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %121
115: ; preds = %103
%116 = load i32, i32* @stderr
%117 = load i32, i32* %12
%118 = call i8* @error_index(i32 %117)
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %116, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %118)
%120 = call i32 @exit(i32 1)
unreachable
121: ; preds = %103
%122 = load i8*, i8** %6
%123 = call i32 @loadDocBeginngins(i32** %19, i32* %18, i8* %122)
store i32 %123, i32* %12
%124 = load i32, i32* %12
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %132
126: ; preds = %121
%127 = load i32, i32* @stderr
%128 = load i32, i32* %12
%129 = call i8* @error_index(i32 %128)
%130 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %129)
%131 = call i32 @exit(i32 1)
unreachable
132: ; preds = %121
%133 = load i8*, i8** %8
%134 = load i64, i64* %10
%135 = load i32*, i32** %19
%136 = load i32, i32* %18
%137 = load i8*, i8** %9
%138 = call i32 @build_index(i8* %133, i64 %134, i32* %135, i32 %136, i8* %137, i8** %11)
store i32 %138, i32* %12
%139 = load i32, i32* %12
%140 = icmp ne i32 %139, 0
br i1 %140, label %141, label %147
141: ; preds = %132
%142 = load i32, i32* @stderr
%143 = load i32, i32* %12
%144 = call i8* @error_index(i32 %143)
%145 = call i32 (i32, i8*, ...) @fprintf(i32 %142, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %144)
%146 = call i32 @exit(i32 1)
unreachable
147: ; preds = %132
%148 = load i8*, i8** %11
%149 = load i8*, i8** %7
%150 = call i32 @save_index(i8* %148, i8* %149)
store i32 %150, i32* %12
%151 = load i32, i32* %12
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %159
153: ; preds = %147
%154 = load i32, i32* @stderr
%155 = load i32, i32* %12
%156 = call i8* @error_index(i32 %155)
%157 = call i32 (i32, i8*, ...) @fprintf(i32 %154, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %156)
%158 = call i32 @exit(i32 1)
unreachable
159: ; preds = %147
%160 = call double (...) @getTime()
store double %160, double* %15
%161 = load i32, i32* @stderr
%162 = load double, double* %15
%163 = load double, double* %14
%164 = fsub double %162, %163
%165 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double %164)
%166 = load i8*, i8** %11
%167 = call i32 @index_size(i8* %166, i64* %20)
%168 = load i32, i32* @stdout
%169 = load i64, i64* %10
%170 = load i64, i64* %20
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i64 %169, i64 %170)
%172 = load i32, i32* @stdout
%173 = load i64, i64* %20
%174 = uitofp i64 %173 to double
%175 = fmul double 1.000000e+02, %174
%176 = load i64, i64* %10
%177 = uitofp i64 %176 to double
%178 = fdiv double %175, %177
%179 = load i64, i64* %20
%180 = uitofp i64 %179 to double
%181 = fmul double %180, 8.000000e+00
%182 = load i64, i64* %10
%183 = uitofp i64 %182 to double
%184 = fdiv double %181, %183
%185 = call i32 (i32, i8*, ...) @fprintf(i32 %172, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), double %178, double %184)
%186 = load i8*, i8** %11
%187 = call i32 @free_index(i8* %186)
store i32 %187, i32* %12
%188 = load i32, i32* %12
%189 = icmp ne i32 %188, 0
br i1 %189, label %190, label %196
190: ; preds = %159
%191 = load i32, i32* @stderr
%192 = load i32, i32* %12
%193 = call i8* @error_index(i32 %192)
%194 = call i32 (i32, i8*, ...) @fprintf(i32 %191, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %193)
%195 = call i32 @exit(i32 1)
unreachable
196: ; preds = %159
%197 = load i8*, i8** %9
%198 = call i32 @free(i8* %197)
%199 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [26 x i8] c"Building time: %.3f secs\0A\00"
@stdout = global i32 0
@.str.2 = [40 x i8] c"Input: %lu bytes --> Output %lu bytes.\0A\00"
@.str.3 = [55 x i8] c"Overall compression --> %.2f%% (%.2f bits per char).\0A\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i64
%9 = bitcast i8** %3 to i8*
%10 = bitcast i64* %4 to i8*
%11 = bitcast i8** %5 to i8*
%12 = icmp slt i32 %0, 3
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i8*, i8** %1
%15 = tail call i32 @print_usage(i8* %14)
br label %60
16: ; preds = %2
%17 = icmp eq i32 %0, 3
br i1 %17, label %60, label %18
18: ; preds = %16
%19 = add nsw i32 %0, -3
%20 = zext i32 %0 to i64
br label %21
21: ; preds = %18, %21
%22 = phi i64 [ 2, %18 ], [ %28, %21 ]
%23 = phi i32 [ %19, %18 ], [ %27, %21 ]
%24 = getelementptr inbounds i8*, i8** %1, i64 %22
%25 = load i8*, i8** %24
%26 = tail call i32 @strlen(i8* %25)
%27 = add nsw i32 %26, %23
%28 = add nuw nsw i64 %22, 1
%29 = icmp eq i64 %28, %20
br i1 %29, label %30, label %21
30: ; preds = %21
%31 = add nsw i32 %27, 1
%32 = tail call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to i8*
%34 = sext i32 %27 to i64
%35 = getelementptr inbounds i8, i8* %33, i64 %34
store i8 0, i8* %35
%36 = icmp sgt i32 %0, 3
br i1 %36, label %37, label %57
37: ; preds = %30
%38 = zext i32 %0 to i64
br label %39
39: ; preds = %37, %39
%40 = phi i64 [ 3, %37 ], [ %53, %39 ]
%41 = phi i32 [ 0, %37 ], [ %52, %39 ]
%42 = getelementptr inbounds i8*, i8** %1, i64 %40
%43 = load i8*, i8** %42
%44 = tail call i32 @strlen(i8* %43)
%45 = sext i32 %41 to i64
%46 = getelementptr inbounds i8, i8* %33, i64 %45
%47 = load i8*, i8** %42
%48 = tail call i32 @strncpy(i8* %46, i8* %47, i32 %44)
%49 = add i32 %44, %41
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %33, i64 %50
store i8 32, i8* %51
%52 = add i32 %49, 1
%53 = add nuw nsw i64 %40, 1
%54 = icmp eq i64 %53, %38
br i1 %54, label %55, label %39
55: ; preds = %39
%56 = sext i32 %49 to i64
br label %57
57: ; preds = %55, %30
%58 = phi i64 [ -1, %30 ], [ %56, %55 ]
%59 = getelementptr inbounds i8, i8* %33, i64 %58
store i8 0, i8* %59
br label %60
60: ; preds = %13, %57, %16
%61 = phi i8* [ %33, %57 ], [ null, %16 ], [ null, %13 ]
%62 = getelementptr inbounds i8*, i8** %1, i64 1
%63 = load i8*, i8** %62
%64 = getelementptr inbounds i8*, i8** %1, i64 2
%65 = load i8*, i8** %64
%66 = tail call double (...) @getTime()
%67 = call i32 @read_file(i8* %63, i8** %3, i64* %4)
%68 = icmp eq i32 %67, 0
br i1 %68, label %74, label %69
69: ; preds = %60
%70 = load i32, i32* @stderr
%71 = call i8* @error_index(i32 %67)
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %70, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %71)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %60
%75 = bitcast i32* %6 to i8*
%76 = bitcast i32** %7 to i8*
%77 = call i32 @loadDocBeginngins(i32** %7, i32* %6, i8* %63)
%78 = icmp eq i32 %77, 0
br i1 %78, label %84, label %79
79: ; preds = %74
%80 = load i32, i32* @stderr
%81 = call i8* @error_index(i32 %77)
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %81)
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %74
%85 = load i8*, i8** %3
%86 = load i64, i64* %4
%87 = load i32*, i32** %7
%88 = load i32, i32* %6
%89 = call i32 @build_index(i8* %85, i64 %86, i32* %87, i32 %88, i8* %61, i8** %5)
%90 = icmp eq i32 %89, 0
br i1 %90, label %96, label %91
91: ; preds = %84
%92 = load i32, i32* @stderr
%93 = call i8* @error_index(i32 %89)
%94 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %93)
%95 = call i32 @exit(i32 1)
unreachable
96: ; preds = %84
%97 = load i8*, i8** %5
%98 = call i32 @save_index(i8* %97, i8* %65)
%99 = icmp eq i32 %98, 0
br i1 %99, label %105, label %100
100: ; preds = %96
%101 = load i32, i32* @stderr
%102 = call i8* @error_index(i32 %98)
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %102)
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %96
%106 = call double (...) @getTime()
%107 = load i32, i32* @stderr
%108 = fsub double %106, %66
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), double %108)
%110 = bitcast i64* %8 to i8*
%111 = load i8*, i8** %5
%112 = call i32 @index_size(i8* %111, i64* %8)
%113 = load i32, i32* @stdout
%114 = load i64, i64* %4
%115 = load i64, i64* %8
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i64 %114, i64 %115)
%117 = load i32, i32* @stdout
%118 = load i64, i64* %8
%119 = uitofp i64 %118 to double
%120 = fmul double %119, 1.000000e+02
%121 = load i64, i64* %4
%122 = uitofp i64 %121 to double
%123 = fdiv double %120, %122
%124 = fmul double %119, 8.000000e+00
%125 = fdiv double %124, %122
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), double %123, double %125)
%127 = load i8*, i8** %5
%128 = call i32 @free_index(i8* %127)
%129 = icmp eq i32 %128, 0
br i1 %129, label %135, label %130
130: ; preds = %105
%131 = load i32, i32* @stderr
%132 = call i8* @error_index(i32 %128)
%133 = call i32 (i32, i8*, ...) @fprintf(i32 %131, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %132)
%134 = call i32 @exit(i32 1)
unreachable
135: ; preds = %105
%136 = call i32 @free(i8* %61)
%137 = call i32 @exit(i32 0)
unreachable
}