#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*/ time_t;
struct stat {
  scalar_t__ st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ atof(char const *);
int /*<<< orphan*/ *copySplitData(int /*<<< orphan*/ *, double, long);
int /*<<< orphan*/ ctime_r(int /*<<< orphan*/ *, char *);
float fabs(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fstat(int /*<<< orphan*/, struct stat *);
scalar_t__ ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, double *);
int /*<<< orphan*/ stat(char const *, struct stat *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ *tmpfile();
int main(int argc, const char **argv) {
  char buf[1024];
  double t1, t2;
  FILE *fd, *tempfd;
  long before, after;
  char btime[26];
  const char *base_filename;
  float min_timedifference;
  struct stat fbuf;
  struct stat ftempbuf;
  if (argc != 3) {
    printf("\n"
           " logsplitter - split a log file into smaller chunks, based on the "
           "consecutive timestamp difference\n\n"
           "USAGE:  logsplitter [min_time_difference_in_seconds] [FILE]\n\n");
    return -1;
  }
  min_timedifference = (float)atof(argv[1]);
  base_filename = argv[2];
  printf("I: Minimum time difference is: %f seconds.\n", min_timedifference);
  fd = fopen(base_filename, "r+");
  if (!fd) {
    printf("E: Opening %s ...[failed]\n", base_filename);
    return -1;
  } else
    printf("I: Opening %s ...[success]\n", base_filename);
  stat(base_filename, &fbuf);
  if ((tempfd = tmpfile()) == NULL) {
    printf("E: Cannot create a temporary file! Aborting...\n");
    return -1;
  }
  while (1) {
    fgets(buf, 1024, fd);
    if (feof(fd))
      break;
    fputs(buf, tempfd);
  }
  fflush(tempfd);
  fclose(fd);
  fstat(fileno(tempfd), &ftempbuf);
  if ((fbuf.st_size - ftempbuf.st_size) != 0) {
    printf("E: The temporary file differs than the original log file by %ld "
           "bytes! Aborting...",
           fbuf.st_size - ftempbuf.st_size);
  }
  rewind(tempfd);
  while (!feof(tempfd)) {
    fgets(buf, 1024, tempfd);
    if (strncmp(buf, "##", 2) == 0)
      printf("> ignoring: %s", buf);
    else {
      sscanf(buf, "%lf", &t1);
      break;
    }
  }
  while (!feof(tempfd)) {
    before = ftell(tempfd);
    fgets(buf, 1024, tempfd);
    if (strncmp(buf, "##", 2) == 0)
      printf("> ignoring: %s", buf);
    else
      sscanf(buf, "%lf", &t2);
    after = ftell(tempfd);
    if ((fabs(t2 - t1) > min_timedifference) && (after - before > 0)) {
      time_t t = (time_t)t1;
      ctime_r(&t, btime);
      printf("I: Break (%f) needed after T = %f -> %s", t2 - t1, t1, btime);
      tempfd = copySplitData(tempfd, t2, after - before);
      if (ftell(tempfd) == 0)
        break;
      rewind(tempfd);
    }
    t1 = t2;
  }
  fclose(tempfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     126d <main+0x3d>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    166a <main+0x43a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atof@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x46c(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x468(%rbp)
movss  -0x46c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xdfa(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
mov    -0x468(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x428(%rbp)
cmpq   $0x0,-0x428(%rbp)
jne    12f9 <main+0xc9>
mov    -0x468(%rbp),%rsi
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    166a <main+0x43a>
mov    -0x468(%rbp),%rsi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x468(%rbp),%rdi
lea    -0x478(%rbp),%rsi
call   10f0 <stat@plt>
mov    $0x0,%al
call   10c0 <tmpfile@plt>
mov    %rax,-0x430(%rbp)
cmp    $0x0,%rax
jne    1353 <main+0x123>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    166a <main+0x43a>
jmp    1358 <main+0x128>
lea    -0x410(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
mov    -0x428(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%rax
je     138b <main+0x15b>
jmp    13a3 <main+0x173>
lea    -0x410(%rbp),%rdi
mov    -0x430(%rbp),%rsi
call   1090 <fputs@plt>
jmp    1358 <main+0x128>
mov    -0x430(%rbp),%rdi
call   1110 <fflush@plt>
mov    -0x428(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x430(%rbp),%rdi
call   1100 <fileno@plt>
mov    %eax,%edi
lea    -0x480(%rbp),%rsi
call   1150 <fstat@plt>
mov    -0x478(%rbp),%rax
sub    -0x480(%rbp),%rax
cmp    $0x0,%rax
je     1409 <main+0x1d9>
mov    -0x478(%rbp),%rsi
sub    -0x480(%rbp),%rsi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x430(%rbp),%rdi
call   1080 <rewind@plt>
mov    -0x430(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1437 <main+0x207>
jmp    14af <main+0x27f>
lea    -0x410(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
lea    -0x410(%rbp),%rdi
lea    0xd2f(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    148b <main+0x25b>
lea    -0x410(%rbp),%rsi
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    14aa <main+0x27a>
lea    -0x410(%rbp),%rdi
lea    0xd05(%rip),%rsi
lea    -0x418(%rbp),%rdx
call   1130 <sscanf@plt>
jmp    14af <main+0x27f>
jmp    1415 <main+0x1e5>
jmp    14b4 <main+0x284>
mov    -0x430(%rbp),%rdi
call   10e0 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    14d6 <main+0x2a6>
jmp    1657 <main+0x427>
mov    -0x430(%rbp),%rdi
call   10d0 <ftell@plt>
mov    %rax,-0x438(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x430(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
lea    -0x410(%rbp),%rdi
lea    0xc7d(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    153d <main+0x30d>
lea    -0x410(%rbp),%rsi
lea    0xc5e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1557 <main+0x327>
lea    -0x410(%rbp),%rdi
lea    0xc53(%rip),%rsi
lea    -0x420(%rbp),%rdx
call   1130 <sscanf@plt>
mov    -0x430(%rbp),%rdi
call   10d0 <ftell@plt>
mov    %rax,-0x440(%rbp)
movsd  -0x420(%rbp),%xmm0
ff
subsd  -0x418(%rbp),%xmm0
ff
call   10b0 <fabs@plt>
ucomiss -0x46c(%rbp),%xmm0
jbe    1642 <main+0x412>
mov    -0x440(%rbp),%rax
sub    -0x438(%rbp),%rax
cmp    $0x0,%rax
jle    1642 <main+0x412>
cvttsd2si -0x418(%rbp),%eax
ff
mov    %eax,-0x484(%rbp)
lea    -0x460(%rbp),%rsi
lea    -0x484(%rbp),%rdi
call   1120 <ctime_r@plt>
movsd  -0x420(%rbp),%xmm0
ff
subsd  -0x418(%rbp),%xmm0
ff
movsd  -0x418(%rbp),%xmm1
ff
lea    -0x460(%rbp),%rsi
lea    0xbb7(%rip),%rdi
mov    $0x2,%al
call   1070 <printf@plt>
mov    -0x430(%rbp),%rdi
movsd  -0x420(%rbp),%xmm0
mov    -0x440(%rbp),%rsi
sub    -0x438(%rbp),%rsi
call   1060 <copySplitData@plt>
mov    %rax,-0x430(%rbp)
mov    -0x430(%rbp),%rdi
call   10d0 <ftell@plt>
cmp    $0x0,%rax
jne    1636 <main+0x406>
jmp    1657 <main+0x427>
mov    -0x430(%rbp),%rdi
call   1080 <rewind@plt>
movsd  -0x420(%rbp),%xmm0
ff
movsd  %xmm0,-0x418(%rbp)
ff
jmp    14b4 <main+0x284>
mov    -0x430(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
cmp    $0x3,%edi
jne    13e1 <main+0x1a1>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atof@plt>
cvtsi2ss %rax,%xmm0
mov    0x10(%rbx),%rbx
movss  %xmm0,0x18(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xd80(%rip),%rdi
mov    $0x1,%al
call   1080 <printf@plt>
lea    0xd9e(%rip),%rsi
mov    %rbx,%rdi
call   1150 <fopen@plt>
test   %rax,%rax
je     13f4 <main+0x1b4>
mov    %rax,%rbp
lea    0xda1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1100 <stat@plt>
xor    %eax,%eax
call   10d0 <tmpfile@plt>
test   %rax,%rax
je     140c <main+0x1cc>
mov    %rax,%rbx
lea    0x50(%rsp),%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   10b0 <fgets@plt>
mov    %rbp,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
jne    1328 <main+0xe8>
lea    0x50(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <fputs@plt>
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbp,%rdx
call   10b0 <fgets@plt>
mov    %rbp,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
je     1300 <main+0xc0>
mov    %rbx,%rdi
call   1120 <fflush@plt>
mov    %rbp,%rdi
call   1060 <fclose@plt>
mov    %rbx,%rdi
call   1110 <fileno@plt>
lea    0x20(%rsp),%rsi
mov    %eax,%edi
call   1160 <fstat@plt>
mov    0x28(%rsp),%rsi
sub    0x20(%rsp),%rsi
je     1366 <main+0x126>
lea    0xd07(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1090 <rewind@plt>
mov    %rbx,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
jne    142b <main+0x1eb>
lea    0x50(%rsp),%rbp
lea    0xd2e(%rip),%r14
lea    0xd2a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1415 <main+0x1d5>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
je     13a0 <main+0x160>
jmp    142b <main+0x1eb>
lea    0xd3e(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
jmp    1442 <main+0x202>
lea    0xc34(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%eax
jmp    1442 <main+0x202>
lea    0xce4(%rip),%rdi
jmp    13e8 <main+0x1a8>
lea    0xcaf(%rip),%rsi
lea    0x50(%rsp),%rdi
lea    0x10(%rsp),%rdx
call   1140 <sscanf@plt>
mov    %rbx,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
je     1454 <main+0x214>
mov    %rbx,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x458,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x50(%rsp),%r14
lea    0xc59(%rip),%r15
lea    0x8(%rsp),%r12
jmp    1491 <main+0x251>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1090 <rewind@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
call   10f0 <feof@plt>
test   %rax,%rax
jne    1438 <main+0x1f8>
mov    %rbx,%rdi
call   10e0 <ftell@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     14e0 <main+0x2a0>
mov    %r14,%rdi
lea    0xc00(%rip),%rsi
mov    %r12,%rdx
call   1140 <sscanf@plt>
jmp    14f1 <main+0x2b1>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xbd5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %rbx,%rdi
call   10e0 <ftell@plt>
mov    %rax,%r13
movsd  0x8(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
call   10c0 <fabs@plt>
ucomiss 0x18(%rsp),%xmm0
jbe    1478 <main+0x238>
sub    %rbp,%r13
jle    1478 <main+0x238>
cvttsd2si 0x10(%rsp),%eax
mov    %eax,0x1c(%rsp)
lea    0x1c(%rsp),%rdi
lea    0x30(%rsp),%rbp
mov    %rbp,%rsi
call   1130 <ctime_r@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm1,%xmm0
lea    0xb7b(%rip),%rdi
mov    %rbp,%rsi
mov    $0x2,%al
call   1080 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <copySplitData@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   10e0 <ftell@plt>
test   %rax,%rax
jne    1470 <main+0x230>
jmp    1438 <main+0x1f8>

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [163 x i8] c"\0A logsplitter - split a log file into smaller chunks, based on the consecutive timestamp difference\0A\0AUSAGE: logsplitter [min_time_difference_in_seconds] [FILE]\0A\0A\00"
@.str.1 = [44 x i8] c"I: Minimum time difference is: %f seconds.\0A\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [27 x i8] c"E: Opening %s ...[failed]\0A\00"
@.str.4 = [28 x i8] c"I: Opening %s ...[success]\0A\00"
@.str.5 = [48 x i8] c"E: Cannot create a temporary file! Aborting...\0A\00"
@.str.6 = [83 x i8] c"E: The temporary file differs than the original log file by %ld bytes! Aborting...\00"
@.str.7 = [3 x i8] c"##\00"
@.str.8 = [15 x i8] c"> ignoring: %s\00"
@.str.9 = [4 x i8] c"%lf\00"
@.str.10 = [40 x i8] c"I: Break (%f) needed after T = %f -> %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca double
%8 = alloca double
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i64
%13 = alloca [26 x i8]
%14 = alloca i8*
%15 = alloca float
%16 = alloca %struct.stat
%17 = alloca %struct.stat
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 3
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %172
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i64 @atof(i8* %26)
%28 = sitofp i64 %27 to float
store float %28, float* %15
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
store i8* %31, i8** %14
%32 = load float, float* %15
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), double %33)
%35 = load i8*, i8** %14
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32* %36, i32** %9
%37 = load i32*, i32** %9
%38 = icmp ne i32* %37, null
br i1 %38, label %42, label %39
39: ; preds = %23
%40 = load i8*, i8** %14
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %40)
store i32 -1, i32* %3
br label %172
42: ; preds = %23
%43 = load i8*, i8** %14
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %42
%46 = load i8*, i8** %14
%47 = call i32 @stat(i8* %46, %struct.stat* %16)
%48 = call i32* (...) @tmpfile()
store i32* %48, i32** %10
%49 = icmp eq i32* %48, null
br i1 %49, label %50, label %52
50: ; preds = %45
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %172
52: ; preds = %45
br label %53
53: ; preds = %52, %61
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%55 = load i32*, i32** %9
%56 = call i32 @fgets(i8* %54, i32 1024, i32* %55)
%57 = load i32*, i32** %9
%58 = call i64 @feof(i32* %57)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %53
br label %65
61: ; preds = %53
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%63 = load i32*, i32** %10
%64 = call i32 @fputs(i8* %62, i32* %63)
br label %53
65: ; preds = %60
%66 = load i32*, i32** %10
%67 = call i32 @fflush(i32* %66)
%68 = load i32*, i32** %9
%69 = call i32 @fclose(i32* %68)
%70 = load i32*, i32** %10
%71 = call i32 @fileno(i32* %70)
%72 = call i32 @fstat(i32 %71, %struct.stat* %17)
%73 = getelementptr inbounds %struct.stat, %struct.stat* %16, i32 0, i32 0
%74 = load i64, i64* %73
%75 = getelementptr inbounds %struct.stat, %struct.stat* %17, i32 0, i32 0
%76 = load i64, i64* %75
%77 = sub nsw i64 %74, %76
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %86
79: ; preds = %65
%80 = getelementptr inbounds %struct.stat, %struct.stat* %16, i32 0, i32 0
%81 = load i64, i64* %80
%82 = getelementptr inbounds %struct.stat, %struct.stat* %17, i32 0, i32 0
%83 = load i64, i64* %82
%84 = sub nsw i64 %81, %83
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.6, i64 0, i64 0), i64 %84)
br label %86
86: ; preds = %79, %65
%87 = load i32*, i32** %10
%88 = call i32 @rewind(i32* %87)
br label %89
89: ; preds = %107, %86
%90 = load i32*, i32** %10
%91 = call i64 @feof(i32* %90)
%92 = icmp ne i64 %91, 0
%93 = xor i1 %92, true
br i1 %93, label %94, label %108
94: ; preds = %89
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%96 = load i32*, i32** %10
%97 = call i32 @fgets(i8* %95, i32 1024, i32* %96)
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%99 = call i64 @strncmp(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %94
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %102)
br label %107
104: ; preds = %94
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%106 = call i32 @sscanf(i8* %105, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double* %7)
br label %108
107: ; preds = %101
br label %89
108: ; preds = %104, %89
br label %109
109: ; preds = %167, %108
%110 = load i32*, i32** %10
%111 = call i64 @feof(i32* %110)
%112 = icmp ne i64 %111, 0
%113 = xor i1 %112, true
br i1 %113, label %114, label %169
114: ; preds = %109
%115 = load i32*, i32** %10
%116 = call i64 @ftell(i32* %115)
store i64 %116, i64* %11
%117 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%118 = load i32*, i32** %10
%119 = call i32 @fgets(i8* %117, i32 1024, i32* %118)
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%121 = call i64 @strncmp(i8* %120, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %114
%124 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %124)
br label %129
126: ; preds = %114
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%128 = call i32 @sscanf(i8* %127, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double* %8)
br label %129
129: ; preds = %126, %123
%130 = load i32*, i32** %10
%131 = call i64 @ftell(i32* %130)
store i64 %131, i64* %12
%132 = load double, double* %8
%133 = load double, double* %7
%134 = fsub double %132, %133
%135 = call float @fabs(double %134)
%136 = load float, float* %15
%137 = fcmp ogt float %135, %136
br i1 %137, label %138, label %167
138: ; preds = %129
%139 = load i64, i64* %12
%140 = load i64, i64* %11
%141 = sub nsw i64 %139, %140
%142 = icmp sgt i64 %141, 0
br i1 %142, label %143, label %167
143: ; preds = %138
%144 = load double, double* %7
%145 = fptosi double %144 to i32
store i32 %145, i32* %18
%146 = getelementptr inbounds [26 x i8], [26 x i8]* %13, i64 0, i64 0
%147 = call i32 @ctime_r(i32* %18, i8* %146)
%148 = load double, double* %8
%149 = load double, double* %7
%150 = fsub double %148, %149
%151 = load double, double* %7
%152 = getelementptr inbounds [26 x i8], [26 x i8]* %13, i64 0, i64 0
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), double %150, double %151, i8* %152)
%154 = load i32*, i32** %10
%155 = load double, double* %8
%156 = load i64, i64* %12
%157 = load i64, i64* %11
%158 = sub nsw i64 %156, %157
%159 = call i32* @copySplitData(i32* %154, double %155, i64 %158)
store i32* %159, i32** %10
%160 = load i32*, i32** %10
%161 = call i64 @ftell(i32* %160)
%162 = icmp eq i64 %161, 0
br i1 %162, label %163, label %164
163: ; preds = %143
br label %169
164: ; preds = %143
%165 = load i32*, i32** %10
%166 = call i32 @rewind(i32* %165)
br label %167
167: ; preds = %164, %138, %129
%168 = load double, double* %8
store double %168, double* %7
br label %109
169: ; preds = %163, %109
%170 = load i32*, i32** %10
%171 = call i32 @fclose(i32* %170)
store i32 0, i32* %3
br label %172
172: ; preds = %169, %50, %39, %21
%173 = load i32, i32* %3
ret i32 %173
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str.1 = [44 x i8] c"I: Minimum time difference is: %f seconds.\0A\00"
@.str.2 = [3 x i8] c"r+\00"
@.str.3 = [27 x i8] c"E: Opening %s ...[failed]\0A\00"
@.str.4 = [28 x i8] c"I: Opening %s ...[success]\0A\00"
@.str.6 = [83 x i8] c"E: The temporary file differs than the original log file by %ld bytes! Aborting...\00"
@.str.7 = [3 x i8] c"##\00"
@.str.8 = [15 x i8] c"> ignoring: %s\00"
@.str.9 = [4 x i8] c"%lf\00"
@.str.10 = [40 x i8] c"I: Break (%f) needed after T = %f -> %s\00"
@str = [47 x i8] c"E: Cannot create a temporary file! Aborting...\00"
@str.11 = [162 x i8] c"\0A logsplitter - split a log file into smaller chunks, based on the consecutive timestamp difference\0A\0AUSAGE: logsplitter [min_time_difference_in_seconds] [FILE]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca double
%5 = alloca double
%6 = alloca [26 x i8]
%7 = alloca %struct.stat
%8 = alloca %struct.stat
%9 = alloca i32
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = bitcast double* %4 to i8*
%12 = bitcast double* %5 to i8*
%13 = getelementptr inbounds [26 x i8], [26 x i8]* %6, i64 0, i64 0
%14 = bitcast %struct.stat* %7 to i8*
%15 = bitcast %struct.stat* %8 to i8*
%16 = icmp eq i32 %0, 3
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([162 x i8], [162 x i8]* @str.11, i64 0, i64 0))
br label %123
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i64 @atof(i8* %21)
%23 = sitofp i64 %22 to float
%24 = getelementptr inbounds i8*, i8** %1, i64 2
%25 = load i8*, i8** %24
%26 = fpext float %23 to double
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), double %26)
%28 = tail call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %19
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %123
32: ; preds = %19
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* %25)
%34 = call i32 @stat(i8* %25, %struct.stat* %7)
%35 = tail call i32* (...) @tmpfile()
%36 = icmp eq i32* %35, null
br i1 %36, label %41, label %37
37: ; preds = %32
%38 = call i32 @fgets(i8* %10, i32 1024, i32* %28)
%39 = call i64 @feof(i32* %28)
%40 = icmp eq i64 %39, 0
br i1 %40, label %43, label %48
41: ; preds = %32
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
br label %123
43: ; preds = %37, %43
%44 = call i32 @fputs(i8* %10, i32* %35)
%45 = call i32 @fgets(i8* %10, i32 1024, i32* %28)
%46 = call i64 @feof(i32* %28)
%47 = icmp eq i64 %46, 0
br i1 %47, label %43, label %48
48: ; preds = %43, %37
%49 = call i32 @fflush(i32* %35)
%50 = call i32 @fclose(i32* %28)
%51 = call i32 @fileno(i32* %35)
%52 = call i32 @fstat(i32 %51, %struct.stat* %8)
%53 = getelementptr inbounds %struct.stat, %struct.stat* %7, i64 0, i32 0
%54 = load i64, i64* %53
%55 = getelementptr inbounds %struct.stat, %struct.stat* %8, i64 0, i32 0
%56 = load i64, i64* %55
%57 = sub nsw i64 %54, %56
%58 = icmp eq i64 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %48
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @.str.6, i64 0, i64 0), i64 %57)
br label %61
61: ; preds = %59, %48
%62 = call i32 @rewind(i32* %35)
%63 = call i64 @feof(i32* %35)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %75
65: ; preds = %61, %69
%66 = call i32 @fgets(i8* %10, i32 1024, i32* %35)
%67 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %73
69: ; preds = %65
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %10)
%71 = call i64 @feof(i32* %35)
%72 = icmp eq i64 %71, 0
br i1 %72, label %65, label %75
73: ; preds = %65
%74 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double* %4)
br label %75
75: ; preds = %69, %61, %73
%76 = call i64 @feof(i32* %35)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %120
78: ; preds = %75
%79 = bitcast i32* %9 to i8*
br label %80
80: ; preds = %78, %115
%81 = phi i32* [ %35, %78 ], [ %116, %115 ]
%82 = call i64 @ftell(i32* %81)
%83 = call i32 @fgets(i8* %10, i32 1024, i32* %81)
%84 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 2)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %80
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* %10)
br label %90
88: ; preds = %80
%89 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), double* %5)
br label %90
90: ; preds = %88, %86
%91 = call i64 @ftell(i32* %81)
%92 = load double, double* %5
%93 = load double, double* %4
%94 = fsub double %92, %93
%95 = call float @fabs(double %94)
%96 = fcmp ogt float %95, %23
br i1 %96, label %97, label %115
97: ; preds = %90
%98 = sub nsw i64 %91, %82
%99 = icmp sgt i64 %98, 0
br i1 %99, label %100, label %115
100: ; preds = %97
%101 = load double, double* %4
%102 = fptosi double %101 to i32
store i32 %102, i32* %9
%103 = call i32 @ctime_r(i32* %9, i8* %13)
%104 = load double, double* %5
%105 = load double, double* %4
%106 = fsub double %104, %105
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0), double %106, double %105, i8* %13)
%108 = load double, double* %5
%109 = call i32* @copySplitData(i32* %81, double %108, i64 %98)
%110 = call i64 @ftell(i32* %109)
%111 = icmp eq i64 %110, 0
br i1 %111, label %114, label %112
112: ; preds = %100
%113 = call i32 @rewind(i32* %109)
br label %115
114: ; preds = %100
br label %120
115: ; preds = %112, %97, %90
%116 = phi i32* [ %81, %97 ], [ %81, %90 ], [ %109, %112 ]
%117 = load double, double* %5
store double %117, double* %4
%118 = call i64 @feof(i32* %116)
%119 = icmp eq i64 %118, 0
br i1 %119, label %80, label %120
120: ; preds = %115, %75, %114
%121 = phi i32* [ %109, %114 ], [ %35, %75 ], [ %116, %115 ]
%122 = call i32 @fclose(i32* %121)
br label %123
123: ; preds = %120, %41, %30, %17
%124 = phi i32 [ -1, %17 ], [ -1, %41 ], [ 0, %120 ], [ -1, %30 ]
ret i32 %124
}