#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  FILE *in, *out;
  int current_timestamp = 0;
  int timestamp_bytes[4] = {0, 0, 0, 0};
  int temp = 0;
  if (argc != 3) {
    puts("wrong number of parameters!\n"
         "usage is openlog2tlm <inuptfile> <outputfile>");
    return EXIT_FAILURE;
  }
  if ((in = fopen(argv[1], "rb")) == NULL) {
    puts("openlog2tlm wasn't able to open the inputfile\n");
    return EXIT_FAILURE;
  }
  if ((out = fopen(argv[2], "wb")) == NULL) {
    puts("openlog2tlm wasn't able to open the outputfile\n");
    return EXIT_FAILURE;
  }
  printf("converting %s to %s\n", argv[1], argv[2]);
  temp = fgetc(in);
  while (!feof(in)) {
    if (temp == 0x99) {
      int length = fgetc(in);
      int message[length - 2];
      int i;
      for (i = 0; i < (length - 2); i++) {
        message[i] = fgetc(in);
      }
      temp = fgetc(in);
      if (message[1] == 129) {
        current_timestamp = message[2] + (message[3] << 8) +
                            (message[4] << 16) + (message[5] << 24);
        current_timestamp = current_timestamp * 10;
        timestamp_bytes[0] = current_timestamp & 0xff;
        timestamp_bytes[1] = (current_timestamp >> 8) & 0xff;
        timestamp_bytes[2] = (current_timestamp >> 16) & 0xff;
        timestamp_bytes[3] = (current_timestamp >> 24) & 0xff;
      }
      fputc(0x99, out);
      fputc(length - 4, out);
      fputc(0, out);
      fputc(timestamp_bytes[0], out);
      fputc(timestamp_bytes[1], out);
      fputc(timestamp_bytes[2], out);
      fputc(timestamp_bytes[3], out);
      int checksum = length - 4 + timestamp_bytes[0] + timestamp_bytes[1] +
                     timestamp_bytes[2] + timestamp_bytes[3];
      for (i = 0; i < (length - 4); i++) {
        fputc(message[i], out);
        checksum += message[i];
      }
      fputc(checksum, out);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11cb <main+0x5b>
lea    0xe4b(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1467 <main+0x2f7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe70(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    120a <main+0x9a>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
mov    0x2de0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1467 <main+0x2f7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe63(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1249 <main+0xd9>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1467 <main+0x2f7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe4f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    128f <main+0x11f>
jmp    145b <main+0x2eb>
cmpl   $0x99,-0x44(%rbp)
jne    1456 <main+0x2e6>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
add    $0xfffffffe,%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x68(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x48(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    130e <main+0x19e>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,%edx
mov    -0x68(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12d9 <main+0x169>
mov    -0x18(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
mov    %ecx,-0x44(%rbp)
cmpl   $0x81,0x4(%rax)
jne    138b <main+0x21b>
mov    -0x68(%rbp),%rcx
mov    0x8(%rcx),%eax
mov    0xc(%rcx),%edx
shl    $0x8,%edx
add    %edx,%eax
mov    0x10(%rcx),%edx
shl    $0x10,%edx
add    %edx,%eax
mov    0x14(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
imul   $0xa,-0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x99,%edi
call   1070 <fputc@plt>
mov    -0x48(%rbp),%edi
sub    $0x4,%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1070 <fputc@plt>
mov    -0x40(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x3c(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x38(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x48(%rbp),%eax
sub    $0x4,%eax
add    -0x40(%rbp),%eax
add    -0x3c(%rbp),%eax
add    -0x38(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x60(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x48(%rbp),%ecx
sub    $0x4,%ecx
cmp    %ecx,%eax
jge    1443 <main+0x2d3>
mov    -0x68(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x68(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x60(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13ff <main+0x28f>
mov    -0x60(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1070 <fputc@plt>
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
jmp    1271 <main+0x101>
mov    0x2b76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0x3,%edi
jne    11dc <main+0x7c>
mov    %rsi,%r15
mov    0x8(%rsi),%rdi
lea    0xec6(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11e5 <main+0x85>
mov    %rax,%r12
mov    0x10(%r15),%rdi
lea    0xee0(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11ee <main+0x8e>
mov    %rax,%r13
mov    0x8(%r15),%rsi
mov    0x10(%r15),%rdx
lea    0xef7(%rip),%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     1212 <main+0xb2>
mov    0x2dfe(%rip),%rax
jmp    1201 <main+0xa1>
lea    0xe1d(%rip),%rdi
jmp    11f5 <main+0x95>
lea    0xe61(%rip),%rdi
jmp    11f5 <main+0x95>
lea    0xe8a(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
mov    %r12,-0x58(%rbp)
jmp    126c <main+0x10c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%r14
mov    %r12d,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
mov    -0x68(%rbp),%rsp
mov    -0x58(%rbp),%r12
mov    %r14,%r13
mov    -0x48(%rbp),%ebx
mov    %r12,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    11d3 <main+0x73>
cmp    $0x99,%ebx
jne    125c <main+0xfc>
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %rsp,-0x68(%rbp)
lea    -0x2(%rax),%r14d
mov    %rsp,%r15
lea    0xf(,%r14,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r15
mov    %r15,%rsp
mov    %rax,-0x40(%rbp)
cmp    $0x3,%eax
jl     12c5 <main+0x165>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %eax,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    12b0 <main+0x150>
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x81,0x4(%r15)
jne    131b <main+0x1bb>
mov    0xc(%r15),%eax
mov    0x10(%r15),%ecx
shl    $0x8,%eax
add    0x8(%r15),%eax
shl    $0x10,%ecx
add    %eax,%ecx
mov    0x14(%r15),%eax
shl    $0x18,%eax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%ecx
movzbl %cl,%eax
mov    %rax,-0x38(%rbp)
movzbl %ch,%eax
mov    %rax,-0x50(%rbp)
mov    %ecx,%eax
shr    $0x10,%eax
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
shr    $0x18,%ecx
mov    %ecx,-0x30(%rbp)
mov    %r15,-0x60(%rbp)
mov    $0x99,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    -0x40(%rbp),%rax
lea    -0x4(%rax),%edi
mov    %rax,%r12
mov    %edi,-0x44(%rbp)
mov    %r13,%rsi
call   1060 <fputc@plt>
xor    %edi,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    -0x38(%rbp),%rdi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    -0x50(%rbp),%r15
mov    %r15d,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    -0x2c(%rbp),%r14d
mov    %r14d,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    -0x30(%rbp),%ebx
mov    %ebx,%edi
mov    %r13,%rsi
call   1060 <fputc@plt>
mov    %r12,%rax
add    %r15d,%r12d
add    $0xfffffffc,%r12d
add    %r14d,%r12d
add    %ebx,%r12d
add    -0x38(%rbp),%r12d
cmp    $0x5,%eax
jl     1240 <main+0xe0>
mov    -0x44(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    %r13,%r14
xor    %r13d,%r13d
mov    -0x60(%rbp),%r15
mov    (%r15,%r13,4),%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   1060 <fputc@plt>
add    %ebx,%r12d
add    $0x1,%r13
cmp    %r13,-0x40(%rbp)
jne    13b0 <main+0x250>
jmp    1243 <main+0xe3>

LLVM IR (-O0):
@.str = [74 x i8] c"wrong number of parameters!\0Ausage is openlog2tlm <inuptfile> <outputfile>\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [47 x i8] c"openlog2tlm wasn't able to open the inputfile\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [48 x i8] c"openlog2tlm wasn't able to open the outputfile\0A\00"
@.str.5 = [21 x i8] c"converting %s to %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [4 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%16 = bitcast [4 x i32]* %9 to i8*
store i32 0, i32* %10
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 @puts(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
store i32 %21, i32* %3
br label %186
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %6
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 @puts(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
store i32 %30, i32* %3
br label %186
31: ; preds = %22
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %35, i32** %7
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = call i32 @puts(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%39 = load i32, i32* @EXIT_FAILURE
store i32 %39, i32* %3
br label %186
40: ; preds = %31
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %43, i8* %46)
%48 = load i32*, i32** %6
%49 = call i32 @fgetc(i32* %48)
store i32 %49, i32* %10
br label %50
50: ; preds = %183, %40
%51 = load i32*, i32** %6
%52 = call i32 @feof(i32* %51)
%53 = icmp ne i32 %52, 0
%54 = xor i1 %53, true
br i1 %54, label %55, label %184
55: ; preds = %50
%56 = load i32, i32* %10
%57 = icmp eq i32 %56, 153
br i1 %57, label %58, label %183
58: ; preds = %55
%59 = load i32*, i32** %6
%60 = call i32 @fgetc(i32* %59)
store i32 %60, i32* %11
%61 = load i32, i32* %11
%62 = sub nsw i32 %61, 2
%63 = zext i32 %62 to i64
%64 = call i8* @llvm.stacksave()
store i8* %64, i8** %12
%65 = alloca i32, i64 %63
store i64 %63, i64* %13
store i32 0, i32* %14
br label %66
66: ; preds = %77, %58
%67 = load i32, i32* %14
%68 = load i32, i32* %11
%69 = sub nsw i32 %68, 2
%70 = icmp slt i32 %67, %69
br i1 %70, label %71, label %80
71: ; preds = %66
%72 = load i32*, i32** %6
%73 = call i32 @fgetc(i32* %72)
%74 = load i32, i32* %14
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i32, i32* %65, i64 %75
store i32 %73, i32* %76
br label %77
77: ; preds = %71
%78 = load i32, i32* %14
%79 = add nsw i32 %78, 1
store i32 %79, i32* %14
br label %66
80: ; preds = %66
%81 = load i32*, i32** %6
%82 = call i32 @fgetc(i32* %81)
store i32 %82, i32* %10
%83 = getelementptr inbounds i32, i32* %65, i64 1
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, 129
br i1 %85, label %86, label %118
86: ; preds = %80
%87 = getelementptr inbounds i32, i32* %65, i64 2
%88 = load i32, i32* %87
%89 = getelementptr inbounds i32, i32* %65, i64 3
%90 = load i32, i32* %89
%91 = shl i32 %90, 8
%92 = add nsw i32 %88, %91
%93 = getelementptr inbounds i32, i32* %65, i64 4
%94 = load i32, i32* %93
%95 = shl i32 %94, 16
%96 = add nsw i32 %92, %95
%97 = getelementptr inbounds i32, i32* %65, i64 5
%98 = load i32, i32* %97
%99 = shl i32 %98, 24
%100 = add nsw i32 %96, %99
store i32 %100, i32* %8
%101 = load i32, i32* %8
%102 = mul nsw i32 %101, 10
store i32 %102, i32* %8
%103 = load i32, i32* %8
%104 = and i32 %103, 255
%105 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
store i32 %104, i32* %105
%106 = load i32, i32* %8
%107 = ashr i32 %106, 8
%108 = and i32 %107, 255
%109 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
store i32 %108, i32* %109
%110 = load i32, i32* %8
%111 = ashr i32 %110, 16
%112 = and i32 %111, 255
%113 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
store i32 %112, i32* %113
%114 = load i32, i32* %8
%115 = ashr i32 %114, 24
%116 = and i32 %115, 255
%117 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
store i32 %116, i32* %117
br label %118
118: ; preds = %86, %80
%119 = load i32*, i32** %7
%120 = call i32 @fputc(i32 153, i32* %119)
%121 = load i32, i32* %11
%122 = sub nsw i32 %121, 4
%123 = load i32*, i32** %7
%124 = call i32 @fputc(i32 %122, i32* %123)
%125 = load i32*, i32** %7
%126 = call i32 @fputc(i32 0, i32* %125)
%127 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%128 = load i32, i32* %127
%129 = load i32*, i32** %7
%130 = call i32 @fputc(i32 %128, i32* %129)
%131 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
%132 = load i32, i32* %131
%133 = load i32*, i32** %7
%134 = call i32 @fputc(i32 %132, i32* %133)
%135 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
%136 = load i32, i32* %135
%137 = load i32*, i32** %7
%138 = call i32 @fputc(i32 %136, i32* %137)
%139 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
%140 = load i32, i32* %139
%141 = load i32*, i32** %7
%142 = call i32 @fputc(i32 %140, i32* %141)
%143 = load i32, i32* %11
%144 = sub nsw i32 %143, 4
%145 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 0
%146 = load i32, i32* %145
%147 = add nsw i32 %144, %146
%148 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 1
%149 = load i32, i32* %148
%150 = add nsw i32 %147, %149
%151 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 2
%152 = load i32, i32* %151
%153 = add nsw i32 %150, %152
%154 = getelementptr inbounds [4 x i32], [4 x i32]* %9, i64 0, i64 3
%155 = load i32, i32* %154
%156 = add nsw i32 %153, %155
store i32 %156, i32* %15
store i32 0, i32* %14
br label %157
157: ; preds = %175, %118
%158 = load i32, i32* %14
%159 = load i32, i32* %11
%160 = sub nsw i32 %159, 4
%161 = icmp slt i32 %158, %160
br i1 %161, label %162, label %178
162: ; preds = %157
%163 = load i32, i32* %14
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i32, i32* %65, i64 %164
%166 = load i32, i32* %165
%167 = load i32*, i32** %7
%168 = call i32 @fputc(i32 %166, i32* %167)
%169 = load i32, i32* %14
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i32, i32* %65, i64 %170
%172 = load i32, i32* %171
%173 = load i32, i32* %15
%174 = add nsw i32 %173, %172
store i32 %174, i32* %15
br label %175
175: ; preds = %162
%176 = load i32, i32* %14
%177 = add nsw i32 %176, 1
store i32 %177, i32* %14
br label %157
178: ; preds = %157
%179 = load i32, i32* %15
%180 = load i32*, i32** %7
%181 = call i32 @fputc(i32 %179, i32* %180)
%182 = load i8*, i8** %12
br label %183
183: ; preds = %178, %55
br label %50
184: ; preds = %50
%185 = load i32, i32* @EXIT_SUCCESS
store i32 %185, i32* %3
br label %186
186: ; preds = %184, %37, %28, %19
%187 = load i32, i32* %3
ret i32 %187
}

LLVM IR (-O2):
@.str = [74 x i8] c"wrong number of parameters!\0Ausage is openlog2tlm <inuptfile> <outputfile>\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [47 x i8] c"openlog2tlm wasn't able to open the inputfile\0A\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [48 x i8] c"openlog2tlm wasn't able to open the outputfile\0A\00"
@.str.5 = [21 x i8] c"converting %s to %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %108
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %108, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32* @fopen(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %108, label %14
14: ; preds = %9
%15 = load i8*, i8** %5
%16 = load i8*, i8** %10
%17 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8* %15, i8* %16)
%18 = tail call i32 @fgetc(i32* %7)
%19 = tail call i32 @feof(i32* %7)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %111
21: ; preds = %14, %100
%22 = phi i32 [ %105, %100 ], [ 0, %14 ]
%23 = phi i32 [ %104, %100 ], [ %18, %14 ]
%24 = phi i32 [ %103, %100 ], [ 0, %14 ]
%25 = phi i32 [ %102, %100 ], [ 0, %14 ]
%26 = phi i32 [ %101, %100 ], [ 0, %14 ]
%27 = icmp eq i32 %23, 153
br i1 %27, label %28, label %100
28: ; preds = %21
%29 = tail call i32 @fgetc(i32* %7)
%30 = add i32 %29, -2
%31 = zext i32 %30 to i64
%32 = tail call i8* @llvm.stacksave()
%33 = alloca i32, i64 %31
%34 = icmp sgt i32 %29, 2
br i1 %34, label %35, label %41
35: ; preds = %28, %35
%36 = phi i64 [ %39, %35 ], [ 0, %28 ]
%37 = tail call i32 @fgetc(i32* %7)
%38 = getelementptr inbounds i32, i32* %33, i64 %36
store i32 %37, i32* %38
%39 = add nuw nsw i64 %36, 1
%40 = icmp eq i64 %39, %31
br i1 %40, label %41, label %35
41: ; preds = %35, %28
%42 = tail call i32 @fgetc(i32* %7)
%43 = getelementptr inbounds i32, i32* %33, i64 1
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 129
br i1 %45, label %46, label %68
46: ; preds = %41
%47 = getelementptr inbounds i32, i32* %33, i64 2
%48 = load i32, i32* %47
%49 = getelementptr inbounds i32, i32* %33, i64 3
%50 = load i32, i32* %49
%51 = shl i32 %50, 8
%52 = add nsw i32 %51, %48
%53 = getelementptr inbounds i32, i32* %33, i64 4
%54 = load i32, i32* %53
%55 = shl i32 %54, 16
%56 = add nsw i32 %52, %55
%57 = getelementptr inbounds i32, i32* %33, i64 5
%58 = load i32, i32* %57
%59 = shl i32 %58, 24
%60 = add nsw i32 %56, %59
%61 = mul nsw i32 %60, 10
%62 = and i32 %61, 254
%63 = lshr i32 %61, 8
%64 = and i32 %63, 255
%65 = lshr i32 %61, 16
%66 = and i32 %65, 255
%67 = lshr i32 %61, 24
br label %68
68: ; preds = %46, %41
%69 = phi i32 [ %64, %46 ], [ %26, %41 ]
%70 = phi i32 [ %66, %46 ], [ %25, %41 ]
%71 = phi i32 [ %67, %46 ], [ %24, %41 ]
%72 = phi i32 [ %62, %46 ], [ %22, %41 ]
%73 = tail call i32 @fputc(i32 153, i32* %12)
%74 = add nsw i32 %29, -4
%75 = tail call i32 @fputc(i32 %74, i32* %12)
%76 = tail call i32 @fputc(i32 0, i32* %12)
%77 = tail call i32 @fputc(i32 %72, i32* %12)
%78 = tail call i32 @fputc(i32 %69, i32* %12)
%79 = tail call i32 @fputc(i32 %70, i32* %12)
%80 = tail call i32 @fputc(i32 %71, i32* %12)
%81 = add i32 %69, %74
%82 = add i32 %81, %70
%83 = add i32 %82, %71
%84 = add i32 %83, %72
%85 = icmp sgt i32 %29, 4
br i1 %85, label %86, label %97
86: ; preds = %68
%87 = zext i32 %74 to i64
br label %88
88: ; preds = %86, %88
%89 = phi i64 [ 0, %86 ], [ %95, %88 ]
%90 = phi i32 [ %84, %86 ], [ %94, %88 ]
%91 = getelementptr inbounds i32, i32* %33, i64 %89
%92 = load i32, i32* %91
%93 = tail call i32 @fputc(i32 %92, i32* %12)
%94 = add nsw i32 %92, %90
%95 = add nuw nsw i64 %89, 1
%96 = icmp eq i64 %95, %87
br i1 %96, label %97, label %88
97: ; preds = %88, %68
%98 = phi i32 [ %84, %68 ], [ %94, %88 ]
%99 = tail call i32 @fputc(i32 %98, i32* %12)
tail call void @llvm.stackrestore(i8* %32)
br label %100
100: ; preds = %97, %21
%101 = phi i32 [ %69, %97 ], [ %26, %21 ]
%102 = phi i32 [ %70, %97 ], [ %25, %21 ]
%103 = phi i32 [ %71, %97 ], [ %24, %21 ]
%104 = phi i32 [ %42, %97 ], [ %23, %21 ]
%105 = phi i32 [ %72, %97 ], [ %22, %21 ]
%106 = tail call i32 @feof(i32* %7)
%107 = icmp eq i32 %106, 0
br i1 %107, label %21, label %111
108: ; preds = %9, %4, %2
%109 = phi i8* [ getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), %9 ]
%110 = tail call i32 @puts(i8* dereferenceable(1) %109)
br label %111
111: ; preds = %100, %108, %14
%112 = phi i32* [ @EXIT_SUCCESS, %14 ], [ @EXIT_FAILURE, %108 ], [ @EXIT_SUCCESS, %100 ]
%113 = load i32, i32* %112
ret i32 %113
}