#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_WCSA(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_WCSA(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();
unsigned long index_len;
index_size(index, &index_len);
error = free_index(index);
{{if (error){fprintf(stderr, "%s\n", error_index(error));
exit(1);
}
}
}
;
free(params);
fprintf(stdout,
        "\n\n\t ## Building time (**parsing into integers + present_layer: "
        "%.3f secs",
        end - start);
fprintf(stdout, "\n\t ## Input: %lu bytes --> Output (pres_layer) %lu bytes.",
        text_len, index_len);
fprintf(stdout,
        "\n\t ## Overall compression --> %.2f%% (%.2f bits per char).\n\n",
        (100.0 * index_len) / text_len, (index_len * 8.0) / text_len);
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   1110 <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   10d0 <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   10f0 <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   1100 <exit@plt>
mov    -0x18(%rbp),%rdx
lea    -0x70(%rbp),%rdi
lea    -0x64(%rbp),%rsi
call   10c0 <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   10f0 <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   1100 <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   10b0 <build_WCSA@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   10f0 <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   1100 <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   10f0 <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   1100 <exit@plt>
mov    $0x0,%al
call   1060 <getTime@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x40(%rbp),%rdi
lea    -0x78(%rbp),%rsi
call   1050 <index_size@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <free_index@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
je     14fc <main+0x30c>
mov    0x2b15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x44(%rbp),%edi
call   10f0 <error_index@plt>
mov    -0x8c(%rbp),%edi
mov    %rax,%rdx
lea    0xb45(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    0x2acc(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    (%rax),%edi
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
subsd  %xmm1,%xmm0
lea    0xb0a(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    -0x98(%rbp),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
mov    -0x78(%rbp),%rcx
lea    0xb34(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    -0x98(%rbp),%rax
mov    (%rax),%edi
movaps 0xaa0(%rip),%xmm4
movq   -0x78(%rbp),%xmm1
punpckldq %xmm4,%xmm1
movapd 0xa9f(%rip),%xmm3
subpd  %xmm3,%xmm1
movaps %xmm1,%xmm0
unpckhpd %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xa98(%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  0xa75(%rip),%xmm3
mulsd  %xmm3,%xmm1
divsd  %xmm2,%xmm1
lea    0xaf5(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   1100 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r12
cmp    $0x2,%edi
jg     1217 <main+0x27>
mov    (%r12),%rdi
call   1110 <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   10d0 <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,0x30(%rsp)
lea    0x40(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
call   10a0 <read_file@plt>
test   %eax,%eax
jne    142d <main+0x23d>
lea    0x38(%rsp),%rdi
lea    0x1c(%rsp),%rsi
mov    %r15,%rdx
call   10c0 <loadDocBeginngins@plt>
test   %eax,%eax
jne    142d <main+0x23d>
mov    0x40(%rsp),%rdi
mov    0x10(%rsp),%rsi
mov    0x38(%rsp),%rdx
mov    0x1c(%rsp),%ecx
lea    0x8(%rsp),%r9
mov    %r14,%r8
call   10b0 <build_WCSA@plt>
test   %eax,%eax
jne    142d <main+0x23d>
mov    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1080 <save_index@plt>
test   %eax,%eax
jne    142d <main+0x23d>
xor    %eax,%eax
call   1060 <getTime@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x8(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1050 <index_size@plt>
mov    0x8(%rsp),%rdi
call   10e0 <free_index@plt>
test   %eax,%eax
jne    142d <main+0x23d>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x2c56(%rip),%rbx
mov    (%rbx),%edi
movsd  0x28(%rsp),%xmm0
subsd  0x30(%rsp),%xmm0
lea    0xc9d(%rip),%rsi
mov    $0x1,%al
call   1090 <fprintf@plt>
mov    (%rbx),%edi
mov    0x10(%rsp),%rdx
mov    0x20(%rsp),%rcx
lea    0xccc(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    (%rbx),%edi
movsd  0x20(%rsp),%xmm0
movapd 0xc38(%rip),%xmm2
unpcklps %xmm2,%xmm0
movapd 0xc3d(%rip),%xmm3
subpd  %xmm3,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0xc35(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0x10(%rsp),%xmm4
unpcklps %xmm2,%xmm4
subpd  %xmm3,%xmm4
movapd %xmm4,%xmm2
unpckhpd %xmm4,%xmm2
addsd  %xmm4,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xc14(%rip),%xmm1
divsd  %xmm2,%xmm1
lea    0xc98(%rip),%rsi
mov    $0x2,%al
call   1090 <fprintf@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    0x2bac(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   10f0 <error_index@plt>
lea    0xbec(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
@.str.1 = [73 x i8] c"\0A\0A\09 ## Building time (**parsing into integers + present_layer: %.3f secs\00"
@.str.2 = [58 x i8] c"\0A\09 ## Input: %lu bytes --> Output (pres_layer) %lu bytes.\00"
@.str.3 = [61 x i8] c"\0A\09 ## 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_WCSA(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 i8*, i8** %11
%162 = call i32 @index_size(i8* %161, i64* %20)
%163 = load i8*, i8** %11
%164 = call i32 @free_index(i8* %163)
store i32 %164, i32* %12
%165 = load i32, i32* %12
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %173
167: ; preds = %159
%168 = load i32, i32* @stderr
%169 = load i32, i32* %12
%170 = call i8* @error_index(i32 %169)
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %168, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %170)
%172 = call i32 @exit(i32 1)
unreachable
173: ; preds = %159
%174 = load i8*, i8** %9
%175 = call i32 @free(i8* %174)
%176 = load i32, i32* @stdout
%177 = load double, double* %15
%178 = load double, double* %14
%179 = fsub double %177, %178
%180 = call i32 (i32, i8*, ...) @fprintf(i32 %176, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), double %179)
%181 = load i32, i32* @stdout
%182 = load i64, i64* %10
%183 = load i64, i64* %20
%184 = call i32 (i32, i8*, ...) @fprintf(i32 %181, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i64 %182, i64 %183)
%185 = load i32, i32* @stdout
%186 = load i64, i64* %20
%187 = uitofp i64 %186 to double
%188 = fmul double 1.000000e+02, %187
%189 = load i64, i64* %10
%190 = uitofp i64 %189 to double
%191 = fdiv double %188, %190
%192 = load i64, i64* %20
%193 = uitofp i64 %192 to double
%194 = fmul double %193, 8.000000e+00
%195 = load i64, i64* %10
%196 = uitofp i64 %195 to double
%197 = fdiv double %194, %196
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %185, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), double %191, double %197)
%199 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@stdout = global i32 0
@.str.1 = [73 x i8] c"\0A\0A\09 ## Building time (**parsing into integers + present_layer: %.3f secs\00"
@.str.2 = [58 x i8] c"\0A\09 ## Input: %lu bytes --> Output (pres_layer) %lu bytes.\00"
@.str.3 = [61 x i8] c"\0A\09 ## 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_WCSA(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 = bitcast i64* %8 to i8*
%108 = load i8*, i8** %5
%109 = call i32 @index_size(i8* %108, i64* %8)
%110 = load i8*, i8** %5
%111 = call i32 @free_index(i8* %110)
%112 = icmp eq i32 %111, 0
br i1 %112, label %118, label %113
113: ; preds = %105
%114 = load i32, i32* @stderr
%115 = call i8* @error_index(i32 %111)
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %114, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %115)
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %105
%119 = call i32 @free(i8* %61)
%120 = load i32, i32* @stdout
%121 = fsub double %106, %66
%122 = call i32 (i32, i8*, ...) @fprintf(i32 %120, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0), double %121)
%123 = load i32, i32* @stdout
%124 = load i64, i64* %4
%125 = load i64, i64* %8
%126 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0), i64 %124, i64 %125)
%127 = load i32, i32* @stdout
%128 = load i64, i64* %8
%129 = uitofp i64 %128 to double
%130 = fmul double %129, 1.000000e+02
%131 = load i64, i64* %4
%132 = uitofp i64 %131 to double
%133 = fdiv double %130, %132
%134 = fmul double %129, 8.000000e+00
%135 = fdiv double %134, %132
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.3, i64 0, i64 0), double %133, double %135)
%137 = call i32 @exit(i32 0)
unreachable
}