#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 EOF;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
double fabs(double);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, double *);
scalar_t__ isinf(double);
scalar_t__ isnan(double);
int /*<<< orphan*/ stderr;
double strtod(char *, int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  FILE *f, *g;
  double delta;
  double a, b;
  int ra, rb;
  if (argc != 4) {
    fprintf(stderr, "usage %s input1 input2 error\n", argv[0]);
    return 1;
  }
  if ((f = fopen(argv[1], "r")) == NULL)
    fprintf(stderr, "fail opening %s\n", argv[1]);
  if ((g = fopen(argv[2], "r")) == NULL)
    fprintf(stderr, "fail opening %s\n", argv[2]);
  if (f == NULL || g == NULL)
    exit(1);
  delta = strtod(argv[3], NULL);
  while (1) {
    ra = fscanf(f, "%lf", &a);
    rb = fscanf(g, "%lf", &b);
    if (ra == EOF || rb == EOF) {
      exit((ra == EOF && rb == EOF) ? 0 : 1);
    }
    if (isnan(a) || isinf(a) || isnan(b) || isinf(b))
      exit(1);
    if (fabs(a - b) > delta) {
      exit(1);
    }
  }
  assert(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11b7 <main+0x47>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe68(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11f6 <main+0x86>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe3f(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe29(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1235 <main+0xc5>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe00(%rip),%rsi
call   1050 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     124b <main+0xdb>
cmpq   $0x0,-0x20(%rbp)
jne    1255 <main+0xe5>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <strtod@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xdcb(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdb4(%rip),%rsi
lea    -0x38(%rbp),%rdx
call   1040 <fscanf@plt>
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
mov    0x2d45(%rip),%rcx
cmp    (%rcx),%eax
je     12bd <main+0x14d>
mov    -0x40(%rbp),%eax
mov    0x2d33(%rip),%rcx
cmp    (%rcx),%eax
jne    12fb <main+0x18b>
mov    -0x3c(%rbp),%ecx
xor    %eax,%eax
mov    0x2d1f(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x41(%rbp)
jne    12e6 <main+0x176>
mov    -0x40(%rbp),%eax
mov    0x2d0a(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%cl
mov    $0x1,%edi
xor    %eax,%eax
test   $0x1,%cl
cmovne %eax,%edi
call   1080 <exit@plt>
movsd  -0x30(%rbp),%xmm0
call   1060 <isnan@plt>
cmp    $0x0,%rax
jne    134b <main+0x1db>
movsd  -0x30(%rbp),%xmm0
call   1090 <isinf@plt>
cmp    $0x0,%rax
jne    134b <main+0x1db>
movsd  -0x38(%rbp),%xmm0
call   1060 <isnan@plt>
cmp    $0x0,%rax
jne    134b <main+0x1db>
movsd  -0x38(%rbp),%xmm0
call   1090 <isinf@plt>
cmp    $0x0,%rax
je     1355 <main+0x1e5>
mov    $0x1,%edi
call   1080 <exit@plt>
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movaps 0xc9a(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    137f <main+0x20f>
mov    $0x1,%edi
call   1080 <exit@plt>
jmp    126b <main+0xfb>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
je     11b2 <main+0x42>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe77(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rbx),%rdi
lea    0xe71(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    11f7 <main+0x87>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xe55(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x10(%rbx),%rdi
lea    0xe43(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     120f <main+0x9f>
jmp    122b <main+0xbb>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xe29(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
jne    1235 <main+0xc5>
add    $0x10,%rbx
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe0a(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %rax,%r15
mov    0x18(%rbx),%rdi
xor    %esi,%esi
call   1030 <strtod@plt>
movsd  %xmm0,0x10(%rsp)
lea    0xdf1(%rip),%rbx
mov    %rsp,%r13
mov    0x2d8e(%rip),%r12
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x8(%rsp),%rdx
call   1040 <fscanf@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1040 <fscanf@plt>
mov    (%r12),%ecx
cmp    %ecx,%ebp
je     12f0 <main+0x180>
cmp    %ecx,%eax
je     12f0 <main+0x180>
movsd  0x8(%rsp),%xmm0
call   1060 <isnan@plt>
test   %rax,%rax
jne    122b <main+0xbb>
movsd  0x8(%rsp),%xmm0
call   1090 <isinf@plt>
test   %rax,%rax
jne    122b <main+0xbb>
movsd  (%rsp),%xmm0
call   1060 <isnan@plt>
test   %rax,%rax
jne    122b <main+0xbb>
movsd  (%rsp),%xmm0
call   1090 <isinf@plt>
test   %rax,%rax
jne    122b <main+0xbb>
movsd  0x8(%rsp),%xmm0
subsd  (%rsp),%xmm0
andpd  0xd21(%rip),%xmm0
ucomisd 0x10(%rsp),%xmm0
jbe    125a <main+0xea>
jmp    122b <main+0xbb>
xor    %ecx,%ebp
xor    %ecx,%eax
xor    %edi,%edi
or     %ebp,%eax
setne  %dil
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"usage %s input1 input2 error\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"fail opening %s\0A\00"
@.str.3 = [4 x i8] c"%lf\00"
@EOF = 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 double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 4
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %19)
ret i32 1
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %6
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %27, %21
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %37, i32** %7
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %39, %33
%46 = load i32*, i32** %6
%47 = icmp eq i32* %46, null
br i1 %47, label %51, label %48
48: ; preds = %45
%49 = load i32*, i32** %7
%50 = icmp eq i32* %49, null
br i1 %50, label %51, label %53
51: ; preds = %48, %45
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %48
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call double @strtod(i8* %56, i32* null)
store double %57, double* %8
br label %58
58: ; preds = %53, %110
%59 = load i32*, i32** %6
%60 = call i32 @fscanf(i32* %59, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %9)
store i32 %60, i32* %11
%61 = load i32*, i32** %7
%62 = call i32 @fscanf(i32* %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %10)
store i32 %62, i32* %12
%63 = load i32, i32* %11
%64 = load i32, i32* @EOF
%65 = icmp eq i32 %63, %64
br i1 %65, label %70, label %66
66: ; preds = %58
%67 = load i32, i32* %12
%68 = load i32, i32* @EOF
%69 = icmp eq i32 %67, %68
br i1 %69, label %70, label %83
70: ; preds = %66, %58
%71 = load i32, i32* %11
%72 = load i32, i32* @EOF
%73 = icmp eq i32 %71, %72
br i1 %73, label %74, label %78
74: ; preds = %70
%75 = load i32, i32* %12
%76 = load i32, i32* @EOF
%77 = icmp eq i32 %75, %76
br label %78
78: ; preds = %74, %70
%79 = phi i1 [ false, %70 ], [ %77, %74 ]
%80 = zext i1 %79 to i64
%81 = select i1 %79, i32 0, i32 1
%82 = call i32 @exit(i32 %81)
unreachable
83: ; preds = %66
%84 = load double, double* %9
%85 = call i64 @isnan(double %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %99, label %87
87: ; preds = %83
%88 = load double, double* %9
%89 = call i64 @isinf(double %88)
%90 = icmp ne i64 %89, 0
br i1 %90, label %99, label %91
91: ; preds = %87
%92 = load double, double* %10
%93 = call i64 @isnan(double %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %99, label %95
95: ; preds = %91
%96 = load double, double* %10
%97 = call i64 @isinf(double %96)
%98 = icmp ne i64 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %95, %91, %87, %83
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %95
%102 = load double, double* %9
%103 = load double, double* %10
%104 = fsub double %102, %103
%105 = call double @llvm.fabs.f64(double %104)
%106 = load double, double* %8
%107 = fcmp ogt double %105, %106
br i1 %107, label %108, label %110
108: ; preds = %101
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %101
br label %58
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"usage %s input1 input2 error\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [17 x i8] c"fail opening %s\0A\00"
@.str.3 = [4 x i8] c"%lf\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %3 to i8*
%6 = bitcast double* %4 to i8*
%7 = icmp eq i32 %0, 4
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %1
%11 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 1
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %25
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %13
%20 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %30, label %35
25: ; preds = %12
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = tail call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %37
30: ; preds = %25, %17
%31 = phi i8** [ %26, %25 ], [ %21, %17 ]
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %31
%34 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %17, %30
%36 = tail call i32 @exit(i32 1)
unreachable
37: ; preds = %25
%38 = getelementptr inbounds i8*, i8** %1, i64 3
%39 = load i8*, i8** %38
%40 = tail call double @strtod(i8* nocapture %39, i32* null)
br label %41
41: ; preds = %72, %37
%42 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %3)
%43 = call i32 @fscanf(i32* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %4)
%44 = load i32, i32* @EOF
%45 = icmp eq i32 %42, %44
%46 = icmp eq i32 %43, %44
%47 = or i1 %45, %46
br i1 %47, label %48, label %54
48: ; preds = %41
%49 = icmp ne i32 %42, %44
%50 = icmp ne i32 %43, %44
%51 = or i1 %49, %50
%52 = zext i1 %51 to i32
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %41
%55 = load double, double* %3
%56 = call i64 @isnan(double %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %70
58: ; preds = %54
%59 = load double, double* %3
%60 = call i64 @isinf(double %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %70
62: ; preds = %58
%63 = load double, double* %4
%64 = call i64 @isnan(double %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = load double, double* %4
%68 = call i64 @isinf(double %67)
%69 = icmp eq i64 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66, %62, %58, %54
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %66
%73 = load double, double* %3
%74 = load double, double* %4
%75 = fsub double %73, %74
%76 = call double @llvm.fabs.f64(double %75)
%77 = fcmp ogt double %76, %40
br i1 %77, label %78, label %41
78: ; preds = %72
%79 = call i32 @exit(i32 1)
unreachable
}