#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*/ anl_load_conf(char *);
int /*<<< orphan*/ anl_reset_columns(char *);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ parse_file(char *);
int /*<<< orphan*/ post_calc();
int /*<<< orphan*/ prep_anl();
int /*<<< orphan*/ print_results();
int /*<<< orphan*/ printf(char *, ...);
char *rf_loadfile(char *);
int /*<<< orphan*/ wait_for_input_then_exit();
int main(int argc, char **argv) {
  printf("**** aldl-analyzer: CSV Log Analyzer %s ****\n", "1.1b");
  printf("(c)2015 Steve Haslin  resfilter@resfilter.net http://fbodytech.com/");
  printf("\n\n");
  anl_load_conf("/etc/aldl/analyzer.conf");
  prep_anl();
  if (argc < 2)
    error("No logs to analyze!\nTry dragging and dropping your log files onto "
          "analyzer.exe...");
  int x;
  char *log;
  for (x = 1; x < argc; x++) {
    printf("Loading file %s\n", argv[x]);
    log = rf_loadfile(argv[x]);
    if (log == NULL) {
      printf("Couldn't load file, skipping.\n");
    } else {
      anl_reset_columns(log);
      parse_file(log);
      free(log);
    }
  }
  post_calc();
  print_results();
  wait_for_input_then_exit();
  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    0xe33(%rip),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
call   1060 <anl_load_conf@plt>
mov    $0x0,%al
call   10b0 <prep_anl@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1220 <main+0x70>
lea    0xe77(%rip),%rdi
call   1070 <error@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ae <main+0xfe>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10d0 <rf_loadfile@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1280 <main+0xd0>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    129b <main+0xeb>
mov    -0x20(%rbp),%rdi
call   1080 <anl_reset_columns@plt>
mov    -0x20(%rbp),%rdi
call   1090 <parse_file@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
jmp    12a0 <main+0xf0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1227 <main+0x77>
mov    $0x0,%al
call   10a0 <post_calc@plt>
mov    $0x0,%al
call   1050 <print_results@plt>
mov    $0x0,%al
call   10c0 <wait_for_input_then_exit@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %edi,%ebp
lea    0xe29(%rip),%rdi
lea    0xe50(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe47(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe32(%rip),%rdi
call   1040 <puts@plt>
lea    0xe71(%rip),%rdi
call   1070 <anl_load_conf@plt>
xor    %eax,%eax
call   10c0 <prep_anl@plt>
cmp    $0x1,%ebp
jg     124c <main+0x8c>
lea    0xe71(%rip),%rdi
call   1080 <error@plt>
xor    %eax,%eax
call   10b0 <post_calc@plt>
xor    %eax,%eax
call   1060 <print_results@plt>
xor    %eax,%eax
call   10d0 <wait_for_input_then_exit@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%r12d
mov    $0x1,%ebx
lea    0xe86(%rip),%r14
lea    0xe90(%rip),%r15
jmp    1294 <main+0xd4>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rbp
mov    %rax,%rdi
call   1090 <anl_reset_columns@plt>
mov    %rbp,%rdi
call   10a0 <parse_file@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     1223 <main+0x63>
mov    0x0(%r13,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13,%rbx,8),%rdi
call   10e0 <rf_loadfile@plt>
test   %rax,%rax
jne    1270 <main+0xb0>
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    128b <main+0xcb>

LLVM IR (-O0):
@.str = [46 x i8] c"**** aldl-analyzer: CSV Log Analyzer %s ****\0A\00"
@.str.1 = [5 x i8] c"1.1b\00"
@.str.2 = [68 x i8] c"(c)2015 Steve Haslin resfilter@resfilter.net http://fbodytech.com/\00"
@.str.3 = [3 x i8] c"\0A\0A\00"
@.str.4 = [24 x i8] c"/etc/aldl/analyzer.conf\00"
@.str.5 = [82 x i8] c"No logs to analyze!\0ATry dragging and dropping your log files onto analyzer.exe...\00"
@.str.6 = [17 x i8] c"Loading file %s\0A\00"
@.str.7 = [31 x i8] c"Couldn't load file, skipping.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @anl_load_conf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (...) @prep_anl()
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @error(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.5, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
store i32 1, i32* %6
br label %18
18: ; preds = %47, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %50
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %27)
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i8* @rf_loadfile(i8* %33)
store i8* %34, i8** %7
%35 = load i8*, i8** %7
%36 = icmp eq i8* %35, null
br i1 %36, label %37, label %39
37: ; preds = %22
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %46
39: ; preds = %22
%40 = load i8*, i8** %7
%41 = call i32 @anl_reset_columns(i8* %40)
%42 = load i8*, i8** %7
%43 = call i32 @parse_file(i8* %42)
%44 = load i8*, i8** %7
%45 = call i32 @free(i8* %44)
br label %46
46: ; preds = %39, %37
br label %47
47: ; preds = %46
%48 = load i32, i32* %6
%49 = add nsw i32 %48, 1
store i32 %49, i32* %6
br label %18
50: ; preds = %18
%51 = call i32 (...) @post_calc()
%52 = call i32 (...) @print_results()
%53 = call i32 (...) @wait_for_input_then_exit()
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"**** aldl-analyzer: CSV Log Analyzer %s ****\0A\00"
@.str.1 = [5 x i8] c"1.1b\00"
@.str.2 = [68 x i8] c"(c)2015 Steve Haslin resfilter@resfilter.net http://fbodytech.com/\00"
@.str.4 = [24 x i8] c"/etc/aldl/analyzer.conf\00"
@.str.5 = [82 x i8] c"No logs to analyze!\0ATry dragging and dropping your log files onto analyzer.exe...\00"
@.str.6 = [17 x i8] c"Loading file %s\0A\00"
@str = [2 x i8] c"\0A\00"
@str.8 = [30 x i8] c"Couldn't load file, skipping.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @anl_load_conf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 (...) @prep_anl()
%8 = icmp slt i32 %0, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @error(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.5, i64 0, i64 0))
br label %30
11: ; preds = %2
%12 = zext i32 %0 to i64
br label %13
13: ; preds = %11, %27
%14 = phi i64 [ 1, %11 ], [ %28, %27 ]
%15 = getelementptr inbounds i8*, i8** %1, i64 %14
%16 = load i8*, i8** %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %15
%19 = tail call i8* @rf_loadfile(i8* %18)
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.8, i64 0, i64 0))
br label %27
23: ; preds = %13
%24 = tail call i32 @anl_reset_columns(i8* %19)
%25 = tail call i32 @parse_file(i8* %19)
%26 = tail call i32 @free(i8* %19)
br label %27
27: ; preds = %21, %23
%28 = add nuw nsw i64 %14, 1
%29 = icmp eq i64 %28, %12
br i1 %29, label %30, label %13
30: ; preds = %27, %9
%31 = tail call i32 (...) @post_calc()
%32 = tail call i32 (...) @print_results()
%33 = tail call i32 (...) @wait_for_input_then_exit()
ret i32 1
}