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

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int sscanf(char *, char *, int *, int *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
void test_statistics_analysis(int *tstp, int *cont) {
  FILE *fp = fopen("test.out", "r");
  char line[1024];
  *tstp = 0;
  *cont = 0;
  if (!fp)
    do {
      char buf[1024];
      snprintf(buf, sizeof(buf), "open statistics file %s", "test.out");
      fprintf(stderr, "%s: %s\n", buf, strerror(errno));
      exit(EXIT_FAILURE);
    } while (0);
  if (fgets(line, sizeof(line), fp)) {
    errno = 0;
    int ret = sscanf(line, "%d %d", tstp, cont);
    if (ret != 2 && errno)
      do {
        char buf[1024];
        snprintf(buf, sizeof(buf), "extract test statistics");
        fprintf(stderr, "%s: %s\n", buf, strerror(errno));
        exit(EXIT_FAILURE);
      } while (0);
  }
  if (!feof(fp))
    do {
      char buf[1024];
      snprintf(buf, sizeof(buf), "read from the %s", "test.out");
      fprintf(stderr, "%s: %s\n", buf, strerror(errno));
    } while (0);
  if (fclose(fp) == EOF)
    do {
      char buf[1024];
      snprintf(buf, sizeof(buf), "close file %s", "test.out");
      fprintf(stderr, "%s: %s\n", buf, strerror(errno));
    } while (0);
}


x86 assembly (clang, -O0):
<test_statistics_analysis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1470,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe56(%rip),%rdi
lea    0xe58(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
jne    1255 <test_statistics_analysis+0xc5>
jmp    11de <test_statistics_analysis+0x4e>
lea    -0x820(%rbp),%rdi
mov    $0x400,%esi
lea    0xe1a(%rip),%rdx
lea    0xe08(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x143c(%rbp)
lea    -0x820(%rbp),%rax
mov    %rax,-0x1438(%rbp)
mov    0x2dad(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x143c(%rbp),%edi
mov    -0x1438(%rbp),%rdx
mov    %rax,%rcx
lea    0xde1(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     133b <test_statistics_analysis+0x1ab>
mov    0x2d55(%rip),%rax
movq   $0x0,(%rax)
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xd93(%rip),%rsi
call   1080 <sscanf@plt>
mov    %eax,-0x824(%rbp)
cmpl   $0x2,-0x824(%rbp)
je     1336 <test_statistics_analysis+0x1a6>
mov    0x2d19(%rip),%rax
cmpq   $0x0,(%rax)
je     1336 <test_statistics_analysis+0x1a6>
jmp    12c6 <test_statistics_analysis+0x136>
lea    -0xc30(%rbp),%rdi
mov    $0x400,%esi
lea    0xd58(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
mov    0x2cf1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x144c(%rbp)
lea    -0xc30(%rbp),%rax
mov    %rax,-0x1448(%rbp)
mov    0x2ccc(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x144c(%rbp),%edi
mov    -0x1448(%rbp),%rdx
mov    %rax,%rcx
lea    0xd00(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    133b <test_statistics_analysis+0x1ab>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
jne    13c0 <test_statistics_analysis+0x230>
jmp    1352 <test_statistics_analysis+0x1c2>
lea    -0x1030(%rbp),%rdi
mov    $0x400,%esi
lea    0xce4(%rip),%rdx
lea    0xc94(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
mov    0x2c5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x145c(%rbp)
lea    -0x1030(%rbp),%rax
mov    %rax,-0x1458(%rbp)
mov    0x2c39(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x145c(%rbp),%edi
mov    -0x1458(%rbp),%rdx
mov    %rax,%rcx
lea    0xc6d(%rip),%rsi
call   1060 <fprintf@plt>
jmp    13c0 <test_statistics_analysis+0x230>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    0x2c18(%rip),%rcx
cmp    (%rcx),%rax
jne    144c <test_statistics_analysis+0x2bc>
jmp    13de <test_statistics_analysis+0x24e>
lea    -0x1430(%rbp),%rdi
mov    $0x400,%esi
lea    0xc69(%rip),%rdx
lea    0xc08(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x146c(%rbp)
lea    -0x1430(%rbp),%rax
mov    %rax,-0x1468(%rbp)
mov    0x2bad(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
mov    -0x146c(%rbp),%edi
mov    -0x1468(%rbp),%rdx
mov    %rax,%rcx
lea    0xbe1(%rip),%rsi
call   1060 <fprintf@plt>
jmp    144c <test_statistics_analysis+0x2bc>
add    $0x1470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_statistics_analysis>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x808,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe56(%rip),%rdi
lea    0xe58(%rip),%rsi
call   1090 <fopen@plt>
movl   $0x0,(%r15)
movl   $0x0,(%r14)
test   %rax,%rax
je     12e9 <test_statistics_analysis+0x159>
mov    %rax,%rbx
lea    0x400(%rsp),%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1223 <test_statistics_analysis+0x93>
mov    0x2ddf(%rip),%rbp
movq   $0x0,0x0(%rbp)
lea    0xe2b(%rip),%rsi
lea    0x400(%rsp),%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1080 <sscanf@plt>
cmp    $0x2,%eax
je     1223 <test_statistics_analysis+0x93>
cmpq   $0x0,0x0(%rbp)
jne    1334 <test_statistics_analysis+0x1a4>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    127b <test_statistics_analysis+0xeb>
lea    0xe13(%rip),%rdx
lea    0xdc3(%rip),%rcx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    0x2d82(%rip),%rax
mov    (%rax),%ebp
mov    0x2d71(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
lea    0xdb5(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    0x2d5e(%rip),%rcx
cmp    (%rcx),%rax
jne    12db <test_statistics_analysis+0x14b>
lea    0xdc4(%rip),%rdx
lea    0xd63(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    0x2d22(%rip),%rax
mov    (%rax),%ebp
mov    0x2d11(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
lea    0xd55(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1060 <fprintf@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd1b(%rip),%rdx
lea    0xd09(%rip),%rcx
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%ebp
mov    0x2cb2(%rip),%rax
mov    (%rax),%rdi
call   10b0 <strerror@plt>
lea    0xcf6(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
jmp    136b <test_statistics_analysis+0x1db>
lea    0xcf6(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    0x2c84(%rip),%rax
mov    (%rax),%ebx
mov    0x0(%rbp),%rdi
call   10b0 <strerror@plt>
lea    0xcbd(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
call   1060 <fprintf@plt>
mov    0x2c4e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"test.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"open statistics file %s\00"
@stderr = global i32 0
@.str.3 = [8 x i8] c"%s: %s\0A\00"
@errno = global i64 0
@EXIT_FAILURE = global i32 0
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [24 x i8] c"extract test statistics\00"
@.str.6 = [17 x i8] c"read from the %s\00"
@EOF = global i64 0
@.str.7 = [14 x i8] c"close file %s\00"
define void @test_statistics_analysis(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
%12 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %5
%13 = load i32*, i32** %3
store i32 0, i32* %13
%14 = load i32*, i32** %4
store i32 0, i32* %14
%15 = load i32*, i32** %5
%16 = icmp ne i32* %15, null
br i1 %16, label %29, label %17
17: ; preds = %2
br label %18
18: ; preds = %17
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%20 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %19, i32 1024, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* @stderr
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%23 = load i64, i64* @errno
%24 = call i8* @strerror(i64 %23)
%25 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %22, i8* %24)
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; No predecessors!
br label %29
29: ; preds = %28, %2
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%31 = load i32*, i32** %5
%32 = call i64 @fgets(i8* %30, i32 1024, i32* %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %57
34: ; preds = %29
store i64 0, i64* @errno
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%36 = load i32*, i32** %3
%37 = load i32*, i32** %4
%38 = call i32 @sscanf(i8* %35, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %36, i32* %37)
store i32 %38, i32* %8
%39 = load i32, i32* %8
%40 = icmp ne i32 %39, 2
br i1 %40, label %41, label %56
41: ; preds = %34
%42 = load i64, i64* @errno
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %56
44: ; preds = %41
br label %45
45: ; preds = %44
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%47 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %46, i32 1024, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%48 = load i32, i32* @stderr
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%50 = load i64, i64* @errno
%51 = call i8* @strerror(i64 %50)
%52 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %49, i8* %51)
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
55: ; No predecessors!
br label %56
56: ; preds = %55, %41, %34
br label %57
57: ; preds = %56, %29
%58 = load i32*, i32** %5
%59 = call i32 @feof(i32* %58)
%60 = icmp ne i32 %59, 0
br i1 %60, label %71, label %61
61: ; preds = %57
br label %62
62: ; preds = %61
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%64 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %63, i32 1024, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%65 = load i32, i32* @stderr
%66 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%67 = load i64, i64* @errno
%68 = call i8* @strerror(i64 %67)
%69 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %66, i8* %68)
br label %70
70: ; preds = %62
br label %71
71: ; preds = %70, %57
%72 = load i32*, i32** %5
%73 = call i64 @fclose(i32* %72)
%74 = load i64, i64* @EOF
%75 = icmp eq i64 %73, %74
br i1 %75, label %76, label %86
76: ; preds = %71
br label %77
77: ; preds = %76
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%79 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %78, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%80 = load i32, i32* @stderr
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%82 = load i64, i64* @errno
%83 = call i8* @strerror(i64 %82)
%84 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %81, i8* %83)
br label %85
85: ; preds = %77
br label %86
86: ; preds = %85, %71
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.out\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"open statistics file %s\00"
@stderr = global i32 0
@.str.3 = [8 x i8] c"%s: %s\0A\00"
@errno = global i64 0
@EXIT_FAILURE = global i32 0
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [24 x i8] c"extract test statistics\00"
@.str.6 = [17 x i8] c"read from the %s\00"
@EOF = global i64 0
@.str.7 = [14 x i8] c"close file %s\00"
define void @test_statistics_analysis(i32* %0, i32* %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
store i32 0, i32* %0
store i32 0, i32* %1
%10 = icmp eq i32* %8, null
br i1 %10, label %11, label %20
11: ; preds = %2
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %12, i32 1024, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = load i64, i64* @errno
%16 = call i8* @strerror(i64 %15)
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %12, i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = call i64 @fgets(i8* %9, i32 1024, i32* %8)
%22 = icmp eq i64 %21, 0
br i1 %22, label %38, label %23
23: ; preds = %20
store i64 0, i64* @errno
%24 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %0, i32* %1)
%25 = icmp ne i32 %24, 2
%26 = load i64, i64* @errno
%27 = icmp ne i64 %26, 0
%28 = select i1 %25, i1 %27, i1 false
br i1 %28, label %29, label %38
29: ; preds = %23
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%31 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %30, i32 1024, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32, i32* @stderr
%33 = load i64, i64* @errno
%34 = call i8* @strerror(i64 %33)
%35 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %30, i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %23, %20
%39 = call i32 @feof(i32* %8)
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %48
41: ; preds = %38
%42 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%43 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %42, i32 1024, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = load i64, i64* @errno
%46 = call i8* @strerror(i64 %45)
%47 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %42, i8* %46)
br label %48
48: ; preds = %41, %38
%49 = call i64 @fclose(i32* %8)
%50 = load i64, i64* @EOF
%51 = icmp eq i64 %49, %50
br i1 %51, label %52, label %59
52: ; preds = %48
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%54 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %53, i32 1024, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%55 = load i32, i32* @stderr
%56 = load i64, i64* @errno
%57 = call i8* @strerror(i64 %56)
%58 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %53, i8* %57)
br label %59
59: ; preds = %52, %48
ret void
}