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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
double fabs(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
int fscanf(int /*<<< orphan*/ *, char *, int *, int *, double *);
int /*<<< orphan*/ fsetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  FILE *totest, *reference;
  fpos_t start_totest, start_reference;
  char *line;
  size_t len;
  ssize_t read;
  int counter, counter1, counter2, max_ref;
  int row1, column1, row2, column2, max_row, max_column;
  double value1, value2, tmp, max_difference;
  if (argc != 3) {
    fprintf(stdout, "Usage: \"%s totest.txt reference.txt\"\n", argv[0]);
    return EXIT_FAILURE;
  }
  totest = fopen(argv[1], "r");
  if (totest == NULL) {
    fprintf(stdout, "Unable to open file %s\n", argv[1]);
    return EXIT_FAILURE;
  }
  fgetpos(totest, &start_totest);
  reference = fopen(argv[2], "r");
  if (reference == NULL) {
    fprintf(stdout, "Unable to open file %s\n", argv[2]);
    fclose(totest);
    return EXIT_FAILURE;
  }
  fgetpos(reference, &start_reference);
  for (line = NULL, len = 0, counter1 = 0;
       (read = getline(&line, &len, totest)) != -1; counter1++)
    ;
  free(line);
  fsetpos(totest, &start_totest);
  for (line = NULL, len = 0, counter2 = 0;
       (read = getline(&line, &len, reference)) != -1; counter2++)
    ;
  free(line);
  fsetpos(reference, &start_reference);
  if (counter1 != counter2) {
    fprintf(stdout, "Files %s:%d and %s:%d have different # lines\n", argv[1],
            counter1, argv[2], counter2);
    goto error;
  }
  max_difference = 0.0;
  for (counter = 0; counter != counter1; counter++) {
    if (fscanf(totest, "%d %d %lf\n", &row1, &column1, &value1) != 3) {
      fprintf(stdout, "Error reading line %d from %s\n", counter + 1, argv[1]);
      break;
    }
    if (fscanf(reference, "%d %d %lf\n", &row2, &column2, &value2) != 3) {
      fprintf(stdout, "Error reading line %d from %s\n", counter + 1, argv[2]);
      break;
    }
    if (row1 != row2 || column1 != column2) {
      fprintf(stdout, "Coordinate mismatch at line %d\n", counter + 1);
      break;
    }
    if ((value1 < 0.0 && value2 > 0.0) || (value1 > 0.0 && value2 < 0.0)) {
      fprintf(stdout, "Sign mismatch at line %d\n", counter + 1);
      break;
    }
    tmp = fabs(value1 - value2);
    if (tmp > max_difference) {
      max_difference = tmp;
      max_ref = counter;
      max_row = row1;
      max_column = column1;
    }
  }
  if (counter == counter1)
    fprintf(stdout, "%.3e\t@%5d (%d,%d)\n", max_difference, max_ref + 1,
            max_row, max_column);
  fclose(totest);
  fclose(reference);
  return EXIT_SUCCESS;
error:
  fclose(totest);
  fclose(reference);
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11d2 <main+0x52>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15c4 <main+0x444>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe55(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1225 <main+0xa5>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15c4 <main+0x444>
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1050 <fgetpos@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdf5(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    128e <main+0x10e>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15c4 <main+0x444>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <fgetpos@plt>
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   10a0 <getline@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0xffffffff,%eax
je     12e2 <main+0x162>
jmp    12d4 <main+0x154>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12b2 <main+0x132>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1090 <fsetpos@plt>
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   10a0 <getline@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0xffffffff,%eax
je     133f <main+0x1bf>
jmp    1331 <main+0x1b1>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    130f <main+0x18f>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <fsetpos@plt>
mov    -0x44(%rbp),%eax
cmp    -0x48(%rbp),%eax
je     1394 <main+0x214>
mov    0x2c70(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x44(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r8
mov    -0x48(%rbp),%r9d
lea    0xcc8(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    15a6 <main+0x426>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x44(%rbp),%eax
je     154b <main+0x3cb>
mov    -0x18(%rbp),%rdi
lea    0xcc1(%rip),%rsi
lea    -0x50(%rbp),%rdx
lea    -0x54(%rbp),%rcx
lea    -0x70(%rbp),%r8
call   1060 <fscanf@plt>
cmp    $0x3,%eax
je     1401 <main+0x281>
mov    0x2bfa(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xc94(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    154b <main+0x3cb>
mov    -0x20(%rbp),%rdi
lea    0xc72(%rip),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x5c(%rbp),%rcx
lea    -0x78(%rbp),%r8
call   1060 <fscanf@plt>
cmp    $0x3,%eax
je     1450 <main+0x2d0>
mov    0x2bab(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xc45(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    154b <main+0x3cb>
mov    -0x50(%rbp),%eax
cmp    -0x58(%rbp),%eax
jne    1468 <main+0x2e8>
mov    -0x54(%rbp),%eax
cmp    -0x5c(%rbp),%eax
je     148a <main+0x30a>
mov    0x2b69(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
add    $0x1,%edx
lea    0xc2a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    154b <main+0x3cb>
xorps  %xmm0,%xmm0
ucomisd -0x70(%rbp),%xmm0
jbe    14aa <main+0x32a>
movsd  -0x78(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
ja     14ca <main+0x34a>
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    14ec <main+0x36c>
xorps  %xmm0,%xmm0
ucomisd -0x78(%rbp),%xmm0
jbe    14ec <main+0x36c>
mov    0x2b07(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
add    $0x1,%edx
lea    0xbe8(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    154b <main+0x3cb>
movsd  -0x70(%rbp),%xmm0
subsd  -0x78(%rbp),%xmm0
movaps 0xb03(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    1538 <main+0x3b8>
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x40(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x50(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x64(%rbp)
jmp    153d <main+0x3bd>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13a6 <main+0x226>
mov    -0x40(%rbp),%eax
cmp    -0x44(%rbp),%eax
jne    1583 <main+0x403>
mov    0x2a7a(%rip),%rax
mov    (%rax),%edi
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x4c(%rbp),%edx
add    $0x1,%edx
mov    -0x60(%rbp),%ecx
mov    -0x64(%rbp),%r8d
lea    0xb66(%rip),%rsi
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2a34(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    15c4 <main+0x444>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2a21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    12bb <main+0x13b>
mov    0x8(%rbx),%rdi
lea    0xe91(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13ad <main+0x22d>
mov    %rax,%r14
lea    0x44(%rsp),%rsi
mov    %rax,%rdi
call   1050 <fgetpos@plt>
mov    0x10(%rbx),%rdi
lea    0xe68(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     13d4 <main+0x254>
mov    %rax,%r13
mov    %rbx,0x10(%rsp)
lea    0x40(%rsp),%rsi
mov    %rax,%rdi
call   1050 <fgetpos@plt>
movq   $0x0,0x8(%rsp)
movq   $0x0,0x20(%rsp)
mov    $0xffffffff,%ebp
lea    0x8(%rsp),%r12
lea    0x20(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10a0 <getline@plt>
add    $0x1,%ebp
cmp    $0xffffffff,%eax
jne    1220 <main+0xa0>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
lea    0x44(%rsp),%rsi
mov    %r14,%rdi
call   1090 <fsetpos@plt>
movq   $0x0,0x8(%rsp)
movq   $0x0,0x20(%rsp)
mov    $0xffffffff,%ebx
lea    0x8(%rsp),%r12
lea    0x20(%rsp),%r15
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   10a0 <getline@plt>
add    $0x1,%ebx
cmp    $0xffffffff,%eax
jne    1270 <main+0xf0>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
lea    0x40(%rsp),%rsi
mov    %r13,%rdi
call   1090 <fsetpos@plt>
cmp    %ebx,%ebp
jne    13f4 <main+0x274>
xor    %r12d,%r12d
lea    0xdcf(%rip),%rbx
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
jmp    12ed <main+0x16d>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xd42(%rip),%rsi
jmp    13c1 <main+0x241>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12d
cmp    %r12d,%ebp
je     14b0 <main+0x330>
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x3c(%rsp),%rdx
lea    0x38(%rsp),%rcx
lea    0x50(%rsp),%r8
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    146f <main+0x2ef>
mov    %r13,%rdi
mov    %rbx,%rsi
lea    0x34(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x48(%rsp),%r8
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    1487 <main+0x307>
mov    0x3c(%rsp),%eax
cmp    0x34(%rsp),%eax
jne    1439 <main+0x2b9>
mov    0x38(%rsp),%ecx
cmp    0x30(%rsp),%ecx
jne    1439 <main+0x2b9>
movsd  0x50(%rsp),%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
movsd  0x48(%rsp),%xmm1
jbe    136f <main+0x1ef>
ucomisd %xmm2,%xmm1
ja     144f <main+0x2cf>
ucomisd %xmm2,%xmm0
jbe    137f <main+0x1ff>
ucomisd %xmm1,%xmm2
ja     144f <main+0x2cf>
subsd  %xmm1,%xmm0
andpd  0xc75(%rip),%xmm0
ucomisd 0x18(%rsp),%xmm0
jbe    12e0 <main+0x160>
mov    %r12d,%r15d
mov    %eax,0x2c(%rsp)
mov    %ecx,0x28(%rsp)
movsd  %xmm0,0x18(%rsp)
jmp    12e0 <main+0x160>
mov    0x2c24(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xc77(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2c11(%rip),%rax
jmp    14f4 <main+0x374>
mov    0x2bfd(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xc50(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
jmp    1428 <main+0x2a8>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    0x8(%rax),%rdx
mov    0x10(%rax),%r8
lea    0xc3f(%rip),%rsi
mov    %ebp,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    0x2bac(%rip),%rax
jmp    14f4 <main+0x374>
mov    0x2b98(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r12d
lea    0xc5b(%rip),%rsi
jmp    1463 <main+0x2e3>
mov    0x2b82(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r12d
lea    0xc65(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    14dd <main+0x35d>
mov    0x2b62(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r12d
mov    0x10(%rsp),%rax
mov    0x8(%rax),%rcx
jmp    149d <main+0x31d>
mov    0x2b4a(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r12d
mov    0x10(%rsp),%rax
mov    0x10(%rax),%rcx
lea    0xbe5(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    14dd <main+0x35d>
mov    0x2b21(%rip),%rax
mov    (%rax),%edi
add    $0x1,%r15d
lea    0xc1e(%rip),%rsi
movsd  0x18(%rsp),%xmm0
mov    %r15d,%edx
mov    0x2c(%rsp),%ecx
mov    0x28(%rsp),%r8d
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
mov    %r13,%rdi
call   1040 <fclose@plt>
mov    0x2adc(%rip),%rax
mov    (%rax),%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [38 x i8] c"Usage: \22%s totest.txt reference.txt\22\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"Unable to open file %s\0A\00"
@.str.3 = [46 x i8] c"Files %s:%d and %s:%d have different # lines\0A\00"
@.str.4 = [11 x i8] c"%d %d %lf\0A\00"
@.str.5 = [31 x i8] c"Error reading line %d from %s\0A\00"
@.str.6 = [32 x i8] c"Coordinate mismatch at line %d\0A\00"
@.str.7 = [26 x i8] c"Sign mismatch at line %d\0A\00"
@.str.8 = [19 x i8] c"%.3e\09@%5d (%d,%d)\0A\00"
@EXIT_SUCCESS = 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 i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%27 = load i32, i32* %4
%28 = icmp ne i32 %27, 3
br i1 %28, label %29, label %36
29: ; preds = %2
%30 = load i32, i32* @stdout
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %211
36: ; preds = %2
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %40, i32** %6
%41 = load i32*, i32** %6
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %50
43: ; preds = %36
%44 = load i32, i32* @stdout
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = load i32, i32* @EXIT_FAILURE
store i32 %49, i32* %3
br label %211
50: ; preds = %36
%51 = load i32*, i32** %6
%52 = call i32 @fgetpos(i32* %51, i32* %8)
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = call i32* @fopen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %56, i32** %7
%57 = load i32*, i32** %7
%58 = icmp eq i32* %57, null
br i1 %58, label %59, label %68
59: ; preds = %50
%60 = load i32, i32* @stdout
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %63)
%65 = load i32*, i32** %6
%66 = call i32 @fclose(i32* %65)
%67 = load i32, i32* @EXIT_FAILURE
store i32 %67, i32* %3
br label %211
68: ; preds = %50
%69 = load i32*, i32** %7
%70 = call i32 @fgetpos(i32* %69, i32* %9)
store i8* null, i8** %10
store i64 0, i64* %11
store i32 0, i32* %14
br label %71
71: ; preds = %76, %68
%72 = load i32*, i32** %6
%73 = call i32 @getline(i8** %10, i64* %11, i32* %72)
store i32 %73, i32* %12
%74 = icmp ne i32 %73, -1
br i1 %74, label %75, label %79
75: ; preds = %71
br label %76
76: ; preds = %75
%77 = load i32, i32* %14
%78 = add nsw i32 %77, 1
store i32 %78, i32* %14
br label %71
79: ; preds = %71
%80 = load i8*, i8** %10
%81 = call i32 @free(i8* %80)
%82 = load i32*, i32** %6
%83 = call i32 @fsetpos(i32* %82, i32* %8)
store i8* null, i8** %10
store i64 0, i64* %11
store i32 0, i32* %15
br label %84
84: ; preds = %89, %79
%85 = load i32*, i32** %7
%86 = call i32 @getline(i8** %10, i64* %11, i32* %85)
store i32 %86, i32* %12
%87 = icmp ne i32 %86, -1
br i1 %87, label %88, label %92
88: ; preds = %84
br label %89
89: ; preds = %88
%90 = load i32, i32* %15
%91 = add nsw i32 %90, 1
store i32 %91, i32* %15
br label %84
92: ; preds = %84
%93 = load i8*, i8** %10
%94 = call i32 @free(i8* %93)
%95 = load i32*, i32** %7
%96 = call i32 @fsetpos(i32* %95, i32* %9)
%97 = load i32, i32* %14
%98 = load i32, i32* %15
%99 = icmp ne i32 %97, %98
br i1 %99, label %100, label %111
100: ; preds = %92
%101 = load i32, i32* @stdout
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 1
%104 = load i8*, i8** %103
%105 = load i32, i32* %14
%106 = load i8**, i8*** %5
%107 = getelementptr inbounds i8*, i8** %106, i64 2
%108 = load i8*, i8** %107
%109 = load i32, i32* %15
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %104, i32 %105, i8* %108, i32 %109)
br label %205
111: ; preds = %92
store double 0.000000e+00, double* %26
store i32 0, i32* %13
br label %112
112: ; preds = %184, %111
%113 = load i32, i32* %13
%114 = load i32, i32* %14
%115 = icmp ne i32 %113, %114
br i1 %115, label %116, label %187
116: ; preds = %112
%117 = load i32*, i32** %6
%118 = call i32 @fscanf(i32* %117, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32* %17, i32* %18, double* %23)
%119 = icmp ne i32 %118, 3
br i1 %119, label %120, label %128
120: ; preds = %116
%121 = load i32, i32* @stdout
%122 = load i32, i32* %13
%123 = add nsw i32 %122, 1
%124 = load i8**, i8*** %5
%125 = getelementptr inbounds i8*, i8** %124, i64 1
%126 = load i8*, i8** %125
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %123, i8* %126)
br label %187
128: ; preds = %116
%129 = load i32*, i32** %7
%130 = call i32 @fscanf(i32* %129, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32* %19, i32* %20, double* %24)
%131 = icmp ne i32 %130, 3
br i1 %131, label %132, label %140
132: ; preds = %128
%133 = load i32, i32* @stdout
%134 = load i32, i32* %13
%135 = add nsw i32 %134, 1
%136 = load i8**, i8*** %5
%137 = getelementptr inbounds i8*, i8** %136, i64 2
%138 = load i8*, i8** %137
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %135, i8* %138)
br label %187
140: ; preds = %128
%141 = load i32, i32* %17
%142 = load i32, i32* %19
%143 = icmp ne i32 %141, %142
br i1 %143, label %148, label %144
144: ; preds = %140
%145 = load i32, i32* %18
%146 = load i32, i32* %20
%147 = icmp ne i32 %145, %146
br i1 %147, label %148, label %153
148: ; preds = %144, %140
%149 = load i32, i32* @stdout
%150 = load i32, i32* %13
%151 = add nsw i32 %150, 1
%152 = call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %151)
br label %187
153: ; preds = %144
%154 = load double, double* %23
%155 = fcmp olt double %154, 0.000000e+00
br i1 %155, label %156, label %159
156: ; preds = %153
%157 = load double, double* %24
%158 = fcmp ogt double %157, 0.000000e+00
br i1 %158, label %165, label %159
159: ; preds = %156, %153
%160 = load double, double* %23
%161 = fcmp ogt double %160, 0.000000e+00
br i1 %161, label %162, label %170
162: ; preds = %159
%163 = load double, double* %24
%164 = fcmp olt double %163, 0.000000e+00
br i1 %164, label %165, label %170
165: ; preds = %162, %156
%166 = load i32, i32* @stdout
%167 = load i32, i32* %13
%168 = add nsw i32 %167, 1
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %168)
br label %187
170: ; preds = %162, %159
%171 = load double, double* %23
%172 = load double, double* %24
%173 = fsub double %171, %172
%174 = call double @llvm.fabs.f64(double %173)
store double %174, double* %25
%175 = load double, double* %25
%176 = load double, double* %26
%177 = fcmp ogt double %175, %176
br i1 %177, label %178, label %183
178: ; preds = %170
%179 = load double, double* %25
store double %179, double* %26
%180 = load i32, i32* %13
store i32 %180, i32* %16
%181 = load i32, i32* %17
store i32 %181, i32* %21
%182 = load i32, i32* %18
store i32 %182, i32* %22
br label %183
183: ; preds = %178, %170
br label %184
184: ; preds = %183
%185 = load i32, i32* %13
%186 = add nsw i32 %185, 1
store i32 %186, i32* %13
br label %112
187: ; preds = %165, %148, %132, %120, %112
%188 = load i32, i32* %13
%189 = load i32, i32* %14
%190 = icmp eq i32 %188, %189
br i1 %190, label %191, label %199
191: ; preds = %187
%192 = load i32, i32* @stdout
%193 = load double, double* %26
%194 = load i32, i32* %16
%195 = add nsw i32 %194, 1
%196 = load i32, i32* %21
%197 = load i32, i32* %22
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %192, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %193, i32 %195, i32 %196, i32 %197)
br label %199
199: ; preds = %191, %187
%200 = load i32*, i32** %6
%201 = call i32 @fclose(i32* %200)
%202 = load i32*, i32** %7
%203 = call i32 @fclose(i32* %202)
%204 = load i32, i32* @EXIT_SUCCESS
store i32 %204, i32* %3
br label %211
205: ; preds = %100
%206 = load i32*, i32** %6
%207 = call i32 @fclose(i32* %206)
%208 = load i32*, i32** %7
%209 = call i32 @fclose(i32* %208)
%210 = load i32, i32* @EXIT_FAILURE
store i32 %210, i32* %3
br label %211
211: ; preds = %205, %199, %59, %43, %29
%212 = load i32, i32* %3
ret i32 %212
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [38 x i8] c"Usage: \22%s totest.txt reference.txt\22\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [24 x i8] c"Unable to open file %s\0A\00"
@.str.3 = [46 x i8] c"Files %s:%d and %s:%d have different # lines\0A\00"
@.str.4 = [11 x i8] c"%d %d %lf\0A\00"
@.str.5 = [31 x i8] c"Error reading line %d from %s\0A\00"
@.str.6 = [32 x i8] c"Coordinate mismatch at line %d\0A\00"
@.str.7 = [26 x i8] c"Sign mismatch at line %d\0A\00"
@.str.8 = [19 x i8] c"%.3e\09@%5d (%d,%d)\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = bitcast i32* %3 to i8*
%14 = bitcast i32* %4 to i8*
%15 = bitcast i8** %5 to i8*
%16 = bitcast i64* %6 to i8*
%17 = bitcast i32* %7 to i8*
%18 = bitcast i32* %8 to i8*
%19 = bitcast i32* %9 to i8*
%20 = bitcast i32* %10 to i8*
%21 = bitcast double* %11 to i8*
%22 = bitcast double* %12 to i8*
%23 = icmp eq i32 %0, 3
br i1 %23, label %28, label %24
24: ; preds = %2
%25 = load i32, i32* @stdout
%26 = load i8*, i8** %1
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %144
28: ; preds = %2
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = tail call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = load i32, i32* @stdout
%35 = load i8*, i8** %29
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %35)
br label %144
37: ; preds = %28
%38 = call i32 @fgetpos(i32* %31, i32* %3)
%39 = getelementptr inbounds i8*, i8** %1, i64 2
%40 = load i8*, i8** %39
%41 = tail call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %48
43: ; preds = %37
%44 = load i32, i32* @stdout
%45 = load i8*, i8** %39
%46 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = tail call i32 @fclose(i32* %31)
br label %144
48: ; preds = %37
%49 = call i32 @fgetpos(i32* %41, i32* %4)
store i8* null, i8** %5
store i64 0, i64* %6
br label %50
50: ; preds = %50, %48
%51 = phi i32 [ 0, %48 ], [ %54, %50 ]
%52 = call i32 @getline(i8** %5, i64* %6, i32* %31)
%53 = icmp eq i32 %52, -1
%54 = add nuw nsw i32 %51, 1
br i1 %53, label %55, label %50
55: ; preds = %50
%56 = load i8*, i8** %5
%57 = call i32 @free(i8* %56)
%58 = call i32 @fsetpos(i32* %31, i32* %3)
store i8* null, i8** %5
store i64 0, i64* %6
br label %59
59: ; preds = %59, %55
%60 = phi i32 [ 0, %55 ], [ %63, %59 ]
%61 = call i32 @getline(i8** %5, i64* %6, i32* %41)
%62 = icmp eq i32 %61, -1
%63 = add nuw nsw i32 %60, 1
br i1 %62, label %64, label %59
64: ; preds = %59
%65 = load i8*, i8** %5
%66 = call i32 @free(i8* %65)
%67 = call i32 @fsetpos(i32* %41, i32* %4)
%68 = icmp eq i32 %51, %60
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = icmp ne i32 %51, 0
br label %78
71: ; preds = %64
%72 = load i32, i32* @stdout
%73 = load i8*, i8** %29
%74 = load i8*, i8** %39
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* %73, i32 %51, i8* %74, i32 %60)
%76 = call i32 @fclose(i32* %31)
%77 = call i32 @fclose(i32* %41)
br label %144
78: ; preds = %69, %130
%79 = phi double [ %134, %130 ], [ 0.000000e+00, %69 ]
%80 = phi i32 [ %133, %130 ], [ undef, %69 ]
%81 = phi i32 [ %132, %130 ], [ undef, %69 ]
%82 = phi i32 [ %131, %130 ], [ undef, %69 ]
%83 = phi i32 [ %135, %130 ], [ 0, %69 ]
%84 = call i32 @fscanf(i32* %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32* %7, i32* %8, double* %11)
%85 = icmp eq i32 %84, 3
br i1 %85, label %91, label %86
86: ; preds = %78
%87 = load i32, i32* @stdout
%88 = add nuw nsw i32 %83, 1
%89 = load i8*, i8** %29
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %88, i8* %89)
br label %141
91: ; preds = %78
%92 = call i32 @fscanf(i32* %41, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32* %9, i32* %10, double* %12)
%93 = icmp eq i32 %92, 3
br i1 %93, label %99, label %94
94: ; preds = %91
%95 = load i32, i32* @stdout
%96 = add nuw nsw i32 %83, 1
%97 = load i8*, i8** %39
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %96, i8* %97)
br label %141
99: ; preds = %91
%100 = load i32, i32* %7
%101 = load i32, i32* %9
%102 = icmp eq i32 %100, %101
br i1 %102, label %103, label %107
103: ; preds = %99
%104 = load i32, i32* %8
%105 = load i32, i32* %10
%106 = icmp eq i32 %104, %105
br i1 %106, label %111, label %107
107: ; preds = %103, %99
%108 = load i32, i32* @stdout
%109 = add nuw nsw i32 %83, 1
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %109)
br label %141
111: ; preds = %103
%112 = load double, double* %11
%113 = fcmp olt double %112, 0.000000e+00
%114 = load double, double* %12
%115 = fcmp ogt double %114, 0.000000e+00
%116 = select i1 %113, i1 %115, i1 false
br i1 %116, label %121, label %117
117: ; preds = %111
%118 = fcmp ogt double %112, 0.000000e+00
%119 = fcmp olt double %114, 0.000000e+00
%120 = select i1 %118, i1 %119, i1 false
br i1 %120, label %121, label %125
121: ; preds = %117, %111
%122 = load i32, i32* @stdout
%123 = add nuw nsw i32 %83, 1
%124 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %123)
br label %141
125: ; preds = %117
%126 = fsub double %112, %114
%127 = call double @llvm.fabs.f64(double %126)
%128 = fcmp ogt double %127, %79
br i1 %128, label %129, label %130
129: ; preds = %125
br label %130
130: ; preds = %125, %129
%131 = phi i32 [ %83, %129 ], [ %82, %125 ]
%132 = phi i32 [ %100, %129 ], [ %81, %125 ]
%133 = phi i32 [ %104, %129 ], [ %80, %125 ]
%134 = phi double [ %127, %129 ], [ %79, %125 ]
%135 = add nuw nsw i32 %83, 1
%136 = icmp eq i32 %135, %51
br i1 %136, label %137, label %78
137: ; preds = %130
%138 = load i32, i32* @stdout
%139 = add nsw i32 %131, 1
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), double %134, i32 %139, i32 %132, i32 %133)
br label %141
141: ; preds = %86, %94, %107, %121, %137
%142 = call i32 @fclose(i32* %31)
%143 = call i32 @fclose(i32* %41)
br label %144
144: ; preds = %71, %141, %43, %33, %24
%145 = phi i32* [ @EXIT_FAILURE, %24 ], [ @EXIT_FAILURE, %33 ], [ @EXIT_FAILURE, %43 ], [ @EXIT_FAILURE, %71 ], [ @EXIT_SUCCESS, %141 ]
%146 = load i32, i32* %145
ret i32 %146
}