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

/* Variables and functions */
float atof(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ replace(char *, char, char);
int /*<<< orphan*/ sprintf(char *, char *, char *, float, float);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main() {
  FILE *f = fopen("times.log", "rt");
  if (!f)
    return 1;
  char lines[0xffff][64] = {0};
  int n = 0;
  float mintime = 0.0f, maxtime = 0.0f;
  char rev[10] = {0};
  char line[128] = {0};
  while (fgets(line, sizeof(line), f) && n < (sizeof(lines) / sizeof(*lines))) {
    replace(line, '\r', '\0');
    replace(line, '\n', '\0');
    if (strncmp(line, "HEAD is now at ", 15) == 0) {
      if (rev[0])
        sprintf(lines[n++], "%s\t%.1f\t%.1f", rev, mintime, maxtime);
      strncpy(rev, line + 15, 7);
      mintime = 0.0f;
      maxtime = 0.0f;
    }
    if (strncmp(line, "Overall time:", 13) == 0) {
      float time = atof(line + 14);
      if (mintime < 0.1f || time < mintime)
        mintime = time;
      if (time > maxtime)
        maxtime = time;
    }
  }
  while (n > 0)
    printf("%s\n", lines[--n]);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400080,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe4b(%rip),%rdi
lea    0xe4e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11e0 <main+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1450 <main+0x2b0>
lea    -0x3fffd0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3fffc0,%edx
call   1080 <memset@plt>
movl   $0x0,-0x3fffd4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3fffd8(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3fffdc(%rbp)
ff
lea    -0x3fffe6(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <memset@plt>
lea    -0x400070(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1080 <memset@plt>
lea    -0x400070(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x80,%esi
call   1090 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x400075(%rbp)
je     1279 <main+0xd9>
movslq -0x3fffd4(%rbp),%rax
cmp    $0xffff,%rax
setb   %al
mov    %al,-0x400075(%rbp)
mov    -0x400075(%rbp),%al
test   $0x1,%al
jne    128c <main+0xec>
jmp    13fe <main+0x25e>
lea    -0x400070(%rbp),%rdi
mov    $0xd,%esi
xor    %edx,%edx
call   10a0 <replace@plt>
lea    -0x400070(%rbp),%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   10a0 <replace@plt>
lea    -0x400070(%rbp),%rdi
lea    0xd51(%rip),%rsi
mov    $0xf,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1357 <main+0x1b7>
cmpb   $0x0,-0x3fffe6(%rbp)
je     1325 <main+0x185>
mov    -0x3fffd4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x3fffd4(%rbp)
cltq
lea    -0x3fffd0(%rbp),%rdi
shl    $0x6,%rax
add    %rax,%rdi
lea    -0x3fffe6(%rbp),%rdx
movss  -0x3fffd8(%rbp),%xmm0
ff
movss  -0x3fffdc(%rbp),%xmm1
ff
lea    0xd01(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x3fffe6(%rbp),%rdi
lea    -0x400070(%rbp),%rsi
add    $0xf,%rsi
mov    $0x7,%edx
call   1030 <strncpy@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3fffd8(%rbp)
ff
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3fffdc(%rbp)
ff
lea    -0x400070(%rbp),%rdi
lea    0xcc9(%rip),%rsi
mov    $0xd,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13f9 <main+0x259>
lea    -0x400070(%rbp),%rdi
add    $0xe,%rdi
call   1050 <atof@plt>
movss  %xmm0,-0x400074(%rbp)
ff
movss  0xc67(%rip),%xmm0
ucomiss -0x3fffd8(%rbp),%xmm0
ja     13bf <main+0x21f>
movss  -0x400074(%rbp),%xmm1
ff
movss  -0x3fffd8(%rbp),%xmm0
ff
ucomiss %xmm1,%xmm0
jbe    13cf <main+0x22f>
movss  -0x400074(%rbp),%xmm0
ff
movss  %xmm0,-0x3fffd8(%rbp)
ff
movss  -0x400074(%rbp),%xmm0
ff
ucomiss -0x3fffdc(%rbp),%xmm0
jbe    13f4 <main+0x254>
movss  -0x400074(%rbp),%xmm0
ff
movss  %xmm0,-0x3fffdc(%rbp)
ff
jmp    13f9 <main+0x259>
jmp    1239 <main+0x99>
jmp    1403 <main+0x263>
cmpl   $0x0,-0x3fffd4(%rbp)
jle    1440 <main+0x2a0>
mov    -0x3fffd4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3fffd4(%rbp)
cltq
lea    -0x3fffd0(%rbp),%rsi
shl    $0x6,%rax
add    %rax,%rsi
lea    0xc06(%rip),%rdi
call   1070 <printf@plt>
jmp    1403 <main+0x263>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x400080,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400078,%rsp
lea    0xe4c(%rip),%rdi
lea    0xe4f(%rip),%rsi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13c0 <main+0x220>
mov    %rax,%r12
lea    0xb0(%rsp),%rdi
xor    %r15d,%r15d
mov    $0x3fffc0,%edx
xor    %esi,%esi
call   1080 <memset@plt>
movw   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
lea    0x30(%rsp),%rdi
mov    $0x80,%esi
mov    %r12,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     13b4 <main+0x214>
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
lea    0x30(%rsp),%rbx
lea    0xdb6(%rip),%r13
lea    0xdcc(%rip),%r14
xor    %ebp,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0xd,%esi
xor    %edx,%edx
call   10a0 <replace@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %edx,%edx
call   10a0 <replace@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0xf,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1306 <main+0x166>
cmpb   $0x0,0x10(%rsp)
je     12e1 <main+0x141>
add    $0x1,%r15d
shl    $0x6,%rbp
lea    (%rsp,%rbp,1),%rdi
add    $0xb0,%rdi
lea    0xd5d(%rip),%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdx
movaps 0x20(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   10c0 <sprintf@plt>
mov    %rbp,%rdi
jmp    12e6 <main+0x146>
lea    0x10(%rsp),%rdi
lea    0x3f(%rsp),%rsi
mov    $0x7,%edx
call   1030 <strncpy@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xd,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1357 <main+0x1b7>
lea    0x3e(%rsp),%rdi
call   1050 <atof@plt>
movaps %xmm0,%xmm1
movaps 0x20(%rsp),%xmm3
minss  %xmm3,%xmm1
cmpltss 0xcc6(%rip),%xmm3
movaps %xmm3,%xmm2
andps  %xmm0,%xmm2
andnps %xmm1,%xmm3
orps   %xmm2,%xmm3
movaps %xmm3,0x20(%rsp)
maxss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r12,%rdx
call   1090 <fgets@plt>
mov    %r15d,%ebp
test   %rax,%rax
je     137c <main+0x1dc>
cmp    $0xffff,%r15d
jb     1270 <main+0xd0>
test   %r15d,%r15d
je     13b4 <main+0x214>
add    $0x1,%rbp
lea    0xcb0(%rip),%rbx
nopl   0x0(%rax)
lea    -0x2(%rbp),%eax
shl    $0x6,%rax
lea    (%rsp,%rax,1),%rsi
add    $0xb0,%rsi
mov    %rbx,%rdi
call   1070 <printf@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
ja     1390 <main+0x1f0>
mov    %r12,%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
jmp    13c5 <main+0x225>
mov    $0x1,%eax
add    $0x400078,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"times.log\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [16 x i8] c"HEAD is now at \00"
@.str.3 = [13 x i8] c"%s\09%.1f\09%.1f\00"
@.str.4 = [14 x i8] c"Overall time:\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [65535 x [64 x i8]]
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca [10 x i8]
%8 = alloca [128 x i8]
%9 = alloca float
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = icmp ne i32* %11, null
br i1 %12, label %14, label %13
13: ; preds = %0
store i32 1, i32* %1
br label %94
14: ; preds = %0
%15 = bitcast [65535 x [64 x i8]]* %3 to i8*
store i32 0, i32* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
%16 = bitcast [10 x i8]* %7 to i8*
%17 = bitcast [128 x i8]* %8 to i8*
br label %18
18: ; preds = %79, %14
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%20 = load i32*, i32** %2
%21 = call i64 @fgets(i8* %19, i32 128, i32* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = icmp ult i64 %25, 65535
br label %27
27: ; preds = %23, %18
%28 = phi i1 [ false, %18 ], [ %26, %23 ]
br i1 %28, label %29, label %80
29: ; preds = %27
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%31 = call i32 @replace(i8* %30, i8 signext 13, i8 signext 0)
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%33 = call i32 @replace(i8* %32, i8 signext 10, i8 signext 0)
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%35 = call i64 @strncmp(i8* %34, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %56
37: ; preds = %29
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%39 = load i8, i8* %38
%40 = icmp ne i8 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %37
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [65535 x [64 x i8]], [65535 x [64 x i8]]* %3, i64 0, i64 %44
%46 = getelementptr inbounds [64 x i8], [64 x i8]* %45, i64 0, i64 0
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%48 = load float, float* %5
%49 = load float, float* %6
%50 = call i32 @sprintf(i8* %46, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %47, float %48, float %49)
br label %51
51: ; preds = %41, %37
%52 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%53 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%54 = getelementptr inbounds i8, i8* %53, i64 15
%55 = call i32 @strncpy(i8* %52, i8* %54, i32 7)
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
br label %56
56: ; preds = %51, %29
%57 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%58 = call i64 @strncmp(i8* %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 13)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %79
60: ; preds = %56
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%62 = getelementptr inbounds i8, i8* %61, i64 14
%63 = call float @atof(i8* %62)
store float %63, float* %9
%64 = load float, float* %5
%65 = fcmp olt float %64, 0x3FB99999A0000000
br i1 %65, label %70, label %66
66: ; preds = %60
%67 = load float, float* %9
%68 = load float, float* %5
%69 = fcmp olt float %67, %68
br i1 %69, label %70, label %72
70: ; preds = %66, %60
%71 = load float, float* %9
store float %71, float* %5
br label %72
72: ; preds = %70, %66
%73 = load float, float* %9
%74 = load float, float* %6
%75 = fcmp ogt float %73, %74
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = load float, float* %9
store float %77, float* %6
br label %78
78: ; preds = %76, %72
br label %79
79: ; preds = %78, %56
br label %18
80: ; preds = %27
br label %81
81: ; preds = %84, %80
%82 = load i32, i32* %4
%83 = icmp sgt i32 %82, 0
br i1 %83, label %84, label %91
84: ; preds = %81
%85 = load i32, i32* %4
%86 = add nsw i32 %85, -1
store i32 %86, i32* %4
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [65535 x [64 x i8]], [65535 x [64 x i8]]* %3, i64 0, i64 %87
%89 = getelementptr inbounds [64 x i8], [64 x i8]* %88, i64 0, i64 0
%90 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %89)
br label %81
91: ; preds = %81
%92 = load i32*, i32** %2
%93 = call i32 @fclose(i32* %92)
store i32 0, i32* %1
br label %94
94: ; preds = %91, %13
%95 = load i32, i32* %1
ret i32 %95
}

LLVM IR (-O2):
@.str = [10 x i8] c"times.log\00"
@.str.1 = [3 x i8] c"rt\00"
@.str.2 = [16 x i8] c"HEAD is now at \00"
@.str.3 = [13 x i8] c"%s\09%.1f\09%.1f\00"
@.str.4 = [14 x i8] c"Overall time:\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [65535 x [64 x i8]]
%2 = alloca [10 x i8]
%3 = alloca [128 x i8]
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %69, label %6
6: ; preds = %0
%7 = getelementptr inbounds [65535 x [64 x i8]], [65535 x [64 x i8]]* %1, i64 0, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = call i64 @fgets(i8* %9, i32 128, i32* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %67, label %12
12: ; preds = %6
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 15
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 14
br label %19
15: ; preds = %52
%16 = icmp eq i32 %39, 0
br i1 %16, label %67, label %17
17: ; preds = %15
%18 = zext i32 %39 to i64
br label %60
19: ; preds = %12, %52
%20 = phi i64 [ 0, %12 ], [ %57, %52 ]
%21 = phi float [ 0.000000e+00, %12 ], [ %54, %52 ]
%22 = phi float [ 0.000000e+00, %12 ], [ %53, %52 ]
%23 = phi i32 [ 0, %12 ], [ %39, %52 ]
%24 = call i32 @replace(i8* %9, i8 signext 13, i8 signext 0)
%25 = call i32 @replace(i8* %9, i8 signext 10, i8 signext 0)
%26 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %38
28: ; preds = %19
%29 = load i8, i8* %8
%30 = icmp eq i8 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %28
%32 = add nuw nsw i32 %23, 1
%33 = getelementptr inbounds [65535 x [64 x i8]], [65535 x [64 x i8]]* %1, i64 0, i64 %20, i64 0
%34 = call i32 @sprintf(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %8, float %22, float %21)
br label %35
35: ; preds = %31, %28
%36 = phi i32 [ %32, %31 ], [ %23, %28 ]
%37 = call i32 @strncpy(i8* %8, i8* %13, i32 7)
br label %38
38: ; preds = %35, %19
%39 = phi i32 [ %36, %35 ], [ %23, %19 ]
%40 = phi float [ 0.000000e+00, %35 ], [ %22, %19 ]
%41 = phi float [ 0.000000e+00, %35 ], [ %21, %19 ]
%42 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 13)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %52
44: ; preds = %38
%45 = call float @atof(i8* %14)
%46 = fcmp olt float %40, 0x3FB99999A0000000
%47 = fcmp olt float %45, %40
%48 = select i1 %46, i1 true, i1 %47
%49 = select i1 %48, float %45, float %40
%50 = fcmp ogt float %45, %41
%51 = select i1 %50, float %45, float %41
br label %52
52: ; preds = %44, %38
%53 = phi float [ %49, %44 ], [ %40, %38 ]
%54 = phi float [ %51, %44 ], [ %41, %38 ]
%55 = call i64 @fgets(i8* %9, i32 128, i32* %4)
%56 = icmp ne i64 %55, 0
%57 = zext i32 %39 to i64
%58 = icmp ult i32 %39, 65535
%59 = select i1 %56, i1 %58, i1 false
br i1 %59, label %19, label %15
60: ; preds = %17, %60
%61 = phi i64 [ %18, %17 ], [ %62, %60 ]
%62 = add nsw i64 %61, -1
%63 = and i64 %62, 4294967295
%64 = getelementptr inbounds [65535 x [64 x i8]], [65535 x [64 x i8]]* %1, i64 0, i64 %63, i64 0
%65 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %64)
%66 = icmp ugt i64 %61, 1
br i1 %66, label %60, label %67
67: ; preds = %60, %6, %15
%68 = call i32 @fclose(i32* %4)
br label %69
69: ; preds = %0, %67
%70 = phi i32 [ 0, %67 ], [ 1, %0 ]
ret i32 %70
}