#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 */
long double cov_deserialize(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
void cov_check(char *log, char *spec) {
  char line[80], estimate_hex[80], ideal_hex[80], delta_hex[80];
  long double estimate, ideal, delta, diff;
  FILE *log_file, *spec_file;
  int ld_size;
  ld_size = 10;
  log_file = fopen(log, "rt");
  while (fgets(line, 80, log_file) != NULL) {
    if (line[0] != '#')
      strcpy(estimate_hex, line);
  }
  fclose(log_file);
  spec_file = fopen(spec, "rt");
  while (fgets(line, 80, spec_file) != NULL) {
    if (strncmp(line, "#ideal", 6) == 0) {
      fgets(ideal_hex, 80, spec_file);
    } else if (strncmp(line, "#delta", 6) == 0) {
      fgets(delta_hex, 80, spec_file);
    }
  }
  fclose(spec_file);
  estimate = cov_deserialize(estimate_hex, ld_size);
  ideal = cov_deserialize(ideal_hex, ld_size);
  delta = cov_deserialize(delta_hex, ld_size);
  if (estimate > ideal)
    diff = estimate - ideal;
  else
    diff = ideal - estimate;
  if (delta >= diff)
    printf("true\n");
  else
    printf("false\n");
}


x86 assembly (clang, -O0):
<cov_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x1a4(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x198(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x198(%rbp),%rdx
mov    $0x50,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     11e5 <cov_check+0x75>
movsbl -0x60(%rbp),%eax
cmp    $0x23,%eax
je     11e0 <cov_check+0x70>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    11a4 <cov_check+0x34>
mov    -0x198(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x1a0(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x1a0(%rbp),%rdx
mov    $0x50,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     12a4 <cov_check+0x134>
lea    -0x60(%rbp),%rdi
lea    0xdd1(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1263 <cov_check+0xf3>
lea    -0x100(%rbp),%rdi
mov    -0x1a0(%rbp),%rdx
mov    $0x50,%esi
call   1070 <fgets@plt>
jmp    129f <cov_check+0x12f>
lea    -0x60(%rbp),%rdi
lea    0xd9c(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    129a <cov_check+0x12a>
lea    -0x150(%rbp),%rdi
mov    -0x1a0(%rbp),%rdx
mov    $0x50,%esi
call   1070 <fgets@plt>
jmp    129f <cov_check+0x12f>
jmp    1208 <cov_check+0x98>
mov    -0x1a0(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x1a4(%rbp),%esi
lea    -0xb0(%rbp),%rdi
call   1090 <cov_deserialize@plt>
fstpt  -0x160(%rbp)
mov    -0x1a4(%rbp),%esi
lea    -0x100(%rbp),%rdi
call   1090 <cov_deserialize@plt>
fstpt  -0x170(%rbp)
mov    -0x1a4(%rbp),%esi
lea    -0x150(%rbp),%rdi
call   1090 <cov_deserialize@plt>
fstpt  -0x180(%rbp)
fldt   -0x160(%rbp)
fldt   -0x170(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    132e <cov_check+0x1be>
jmp    1315 <cov_check+0x1a5>
fldt   -0x160(%rbp)
fldt   -0x170(%rbp)
fsubrp %st,%st(1)
fstpt  -0x190(%rbp)
jmp    1342 <cov_check+0x1d2>
fldt   -0x170(%rbp)
fldt   -0x160(%rbp)
fsubrp %st,%st(1)
fstpt  -0x190(%rbp)
fldt   -0x180(%rbp)
fldt   -0x190(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jb     1370 <cov_check+0x200>
jmp    135f <cov_check+0x1ef>
lea    0xcab(%rip),%rdi
call   1060 <printf@plt>
jmp    137c <cov_check+0x20c>
lea    0xca0(%rip),%rdi
call   1060 <printf@plt>
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cov_check>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rsi,%r14
lea    0xe75(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0x20(%rsp),%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     11e9 <cov_check+0x79>
lea    0x20(%rsp),%r15
lea    0x110(%rsp),%r12
jmp    11d5 <cov_check+0x65>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     11e9 <cov_check+0x79>
cmpb   $0x23,0x20(%rsp)
je     11c0 <cov_check+0x50>
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
jmp    11c0 <cov_check+0x50>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0xe08(%rip),%rsi
mov    %r14,%rdi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0x20(%rsp),%rdi
mov    $0x50,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1294 <cov_check+0x124>
lea    0xc0(%rsp),%r13
lea    0xdda(%rip),%r14
lea    0x20(%rsp),%r15
lea    0x70(%rsp),%rbp
lea    0xdd0(%rip),%r12
jmp    1262 <cov_check+0xf2>
nopl   0x0(%rax)
mov    $0x50,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
mov    %r15,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1294 <cov_check+0x124>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %r13,%rdi
test   %rax,%rax
je     1240 <cov_check+0xd0>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
mov    %rbp,%rdi
test   %rax,%rax
jne    124d <cov_check+0xdd>
jmp    1240 <cov_check+0xd0>
mov    %rbx,%rdi
call   1060 <fclose@plt>
lea    0x110(%rsp),%rdi
mov    $0xa,%esi
call   1090 <cov_deserialize@plt>
fstpt  0x14(%rsp)
lea    0xc0(%rsp),%rdi
mov    $0xa,%esi
call   1090 <cov_deserialize@plt>
fstpt  0x8(%rsp)
lea    0x70(%rsp),%rdi
mov    $0xa,%esi
call   1090 <cov_deserialize@plt>
fldt   0x14(%rsp)
fldt   0x8(%rsp)
fxch   %st(1)
fucomi %st(1),%st
fld    %st(0)
fsub   %st(2),%st
fxch   %st(2)
fsubp  %st,%st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
lea    0xd15(%rip),%rax
lea    0xd14(%rip),%rdi
cmovb  %rax,%rdi
call   1050 <puts@plt>
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [7 x i8] c"#ideal\00"
@.str.2 = [7 x i8] c"#delta\00"
@.str.3 = [6 x i8] c"true\0A\00"
@.str.4 = [7 x i8] c"false\0A\00"
define void @cov_check(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca [80 x i8]
%9 = alloca x86_fp80
%10 = alloca x86_fp80
%11 = alloca x86_fp80
%12 = alloca x86_fp80
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 10, i32* %15
%16 = load i8*, i8** %3
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %13
br label %18
18: ; preds = %32, %2
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%20 = load i32*, i32** %13
%21 = call i32* @fgets(i8* %19, i32 80, i32* %20)
%22 = icmp ne i32* %21, null
br i1 %22, label %23, label %33
23: ; preds = %18
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 35
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%31 = call i32 @strcpy(i8* %29, i8* %30)
br label %32
32: ; preds = %28, %23
br label %18
33: ; preds = %18
%34 = load i32*, i32** %13
%35 = call i32 @fclose(i32* %34)
%36 = load i8*, i8** %4
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %37, i32** %14
br label %38
38: ; preds = %60, %33
%39 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%40 = load i32*, i32** %14
%41 = call i32* @fgets(i8* %39, i32 80, i32* %40)
%42 = icmp ne i32* %41, null
br i1 %42, label %43, label %61
43: ; preds = %38
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%45 = call i64 @strncmp(i8* %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %51
47: ; preds = %43
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%49 = load i32*, i32** %14
%50 = call i32* @fgets(i8* %48, i32 80, i32* %49)
br label %60
51: ; preds = %43
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%53 = call i64 @strncmp(i8* %52, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %51
%56 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%57 = load i32*, i32** %14
%58 = call i32* @fgets(i8* %56, i32 80, i32* %57)
br label %59
59: ; preds = %55, %51
br label %60
60: ; preds = %59, %47
br label %38
61: ; preds = %38
%62 = load i32*, i32** %14
%63 = call i32 @fclose(i32* %62)
%64 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%65 = load i32, i32* %15
%66 = call x86_fp80 @cov_deserialize(i8* %64, i32 %65)
store x86_fp80 %66, x86_fp80* %9
%67 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%68 = load i32, i32* %15
%69 = call x86_fp80 @cov_deserialize(i8* %67, i32 %68)
store x86_fp80 %69, x86_fp80* %10
%70 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%71 = load i32, i32* %15
%72 = call x86_fp80 @cov_deserialize(i8* %70, i32 %71)
store x86_fp80 %72, x86_fp80* %11
%73 = load x86_fp80, x86_fp80* %9
%74 = load x86_fp80, x86_fp80* %10
%75 = fcmp ogt x86_fp80 %73, %74
br i1 %75, label %76, label %80
76: ; preds = %61
%77 = load x86_fp80, x86_fp80* %9
%78 = load x86_fp80, x86_fp80* %10
%79 = fsub x86_fp80 %77, %78
store x86_fp80 %79, x86_fp80* %12
br label %84
80: ; preds = %61
%81 = load x86_fp80, x86_fp80* %10
%82 = load x86_fp80, x86_fp80* %9
%83 = fsub x86_fp80 %81, %82
store x86_fp80 %83, x86_fp80* %12
br label %84
84: ; preds = %80, %76
%85 = load x86_fp80, x86_fp80* %11
%86 = load x86_fp80, x86_fp80* %12
%87 = fcmp oge x86_fp80 %85, %86
br i1 %87, label %88, label %90
88: ; preds = %84
%89 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %92
90: ; preds = %84
%91 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %92
92: ; preds = %90, %88
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [7 x i8] c"#ideal\00"
@.str.2 = [7 x i8] c"#delta\00"
@str = [6 x i8] c"false\00"
@str.5 = [5 x i8] c"true\00"
define void @cov_check(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%11 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = call i32* @fgets(i8* %7, i32 80, i32* %11)
%13 = icmp eq i32* %12, null
br i1 %13, label %22, label %14
14: ; preds = %2, %19
%15 = load i8, i8* %7
%16 = icmp eq i8 %15, 35
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = call i32 @strcpy(i8* %8, i8* %7)
br label %19
19: ; preds = %17, %14
%20 = call i32* @fgets(i8* %7, i32 80, i32* %11)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %14
22: ; preds = %19, %2
%23 = call i32 @fclose(i32* %11)
%24 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = call i32* @fgets(i8* %7, i32 80, i32* %24)
%26 = icmp eq i32* %25, null
br i1 %26, label %39, label %27
27: ; preds = %22, %36
%28 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30, %27
%34 = phi i8* [ %9, %27 ], [ %10, %30 ]
%35 = call i32* @fgets(i8* %34, i32 80, i32* %24)
br label %36
36: ; preds = %33, %30
%37 = call i32* @fgets(i8* %7, i32 80, i32* %24)
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %27
39: ; preds = %36, %22
%40 = call i32 @fclose(i32* %24)
%41 = call x86_fp80 @cov_deserialize(i8* %8, i32 10)
%42 = call x86_fp80 @cov_deserialize(i8* %9, i32 10)
%43 = call x86_fp80 @cov_deserialize(i8* %10, i32 10)
%44 = fcmp ogt x86_fp80 %41, %42
%45 = fsub x86_fp80 %41, %42
%46 = fsub x86_fp80 %42, %41
%47 = select i1 %44, x86_fp80 %45, x86_fp80 %46
%48 = fcmp ult x86_fp80 %43, %47
%49 = select i1 %48, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.5, i64 0, i64 0)
%50 = call i32 @puts(i8* dereferenceable(1) %49)
ret void
}