#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, double *, double *);
int /*<<< orphan*/ printf(char *, int, ...);
double sqrt(double);
int /*<<< orphan*/ stderr;
main(int argc, char **argv) {
  int n, n1, n2;
  char *infile, *outfile;
  double max_diff, diff;
  FILE *fp1, *fp2;
  double re1, im1, re2, im2;
  int i, j, k;
  int mi;
  double mre1, mre2, mim1, mim2;
  if (argc != 4) {
    fprintf(stderr, "format: compare file1 file2 n\n");
    exit(-1);
  }
  fp1 = fopen(argv[1], "r");
  fp2 = fopen(argv[2], "r");
  n = atoi(argv[3]);
  printf("No. of points %d\n", n);
  max_diff = 0.0;
  for (i = 0; i < n; i += 1) {
    fscanf(fp1, "%lf %lf\n", &re1, &im1);
    fscanf(fp2, "%lf %lf\n", &re2, &im2);
    diff = sqrt((re1 - re2) * (re1 - re2) + (im1 - im2) * (im1 - im2));
    if (diff > max_diff) {
      max_diff = diff;
      mi = i;
      mre1 = re1;
      mre2 = re2;
      mim1 = im1;
      mim2 = im2;
    }
  }
  fclose(fp1);
  fclose(fp2);
  printf("  max componentwise distance: %g\n", max_diff);
  printf("%d %g,%g == %g,%g\n", mi, mre1, mim1, mre2, mim2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     11c2 <main+0x42>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4e(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe36(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1303 <main+0x183>
mov    -0x48(%rbp),%rdi
lea    0xdfa(%rip),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   1050 <fscanf@plt>
mov    -0x50(%rbp),%rdi
lea    0xde2(%rip),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x70(%rbp),%rcx
call   1050 <fscanf@plt>
movsd  -0x58(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
subsd  -0x68(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
subsd  -0x70(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm3
subsd  -0x70(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
jbe    12f0 <main+0x170>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,-0x80(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    12f5 <main+0x175>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1222 <main+0xa2>
mov    -0x48(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
cvttsd2si -0x38(%rbp),%esi
lea    0xd1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x80(%rbp),%esi
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm3
ff
lea    0xd0c(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x4,%edi
jne    1339 <main+0x1b9>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe82(%rip),%rbp
mov    %rbp,%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
mov    %rbp,%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
lea    0xe58(%rip),%rdi
xor    %r13d,%r13d
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
jle    12d1 <main+0x151>
lea    0xe4f(%rip),%rbx
lea    0x18(%rsp),%r15
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
jmp    120d <main+0x8d>
nopl   (%rax)
add    $0x1,%r13d
cmp    %r13d,%ebp
je     12da <main+0x15a>
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x30(%rsp),%rdx
lea    0x28(%rsp),%rcx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
lea    0x20(%rsp),%rdx
mov    %r15,%rcx
call   1050 <fscanf@plt>
movsd  0x30(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
subsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xd9f(%rip),%xmm0
jb     1280 <main+0x100>
sqrtsd %xmm0,%xmm0
ucomisd 0x8(%rsp),%xmm0
jbe    1200 <main+0x80>
jmp    1291 <main+0x111>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1090 <sqrt@plt>
ucomisd 0x8(%rsp),%xmm0
jbe    1200 <main+0x80>
movsd  0x30(%rsp),%xmm1
movsd  %xmm1,0x48(%rsp)
movsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x50(%rsp)
movsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x38(%rsp)
movsd  0x18(%rsp),%xmm1
movsd  %xmm1,0x40(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %r13d,0x14(%rsp)
jmp    1200 <main+0x80>
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r12,%rdi
call   1030 <fclose@plt>
cvttsd2si 0x8(%rsp),%esi
lea    0xd4d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd61(%rip),%rdi
mov    0x14(%rsp),%esi
movsd  0x48(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
movsd  0x50(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
mov    $0x4,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
lea    0xcbf(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"format: compare file1 file2 n\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"No. of points %d\0A\00"
@.str.3 = [9 x i8] c"%lf %lf\0A\00"
@.str.4 = [34 x i8] c" max componentwise distance: %g\0A\00"
@.str.5 = [19 x i8] c"%d %g,%g == %g,%g\0A\00"
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 i8*
%10 = alloca i8*
%11 = alloca double
%12 = alloca double
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%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, 4
br i1 %28, label %29, label %33
29: ; preds = %2
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @exit(i32 -1)
unreachable
33: ; preds = %2
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%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** %13
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %41, i32** %14
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 3
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
store i32 %45, i32* %6
%46 = load i32, i32* %6
%47 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %46)
store double 0.000000e+00, double* %11
store i32 0, i32* %19
br label %48
48: ; preds = %83, %33
%49 = load i32, i32* %19
%50 = load i32, i32* %6
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %86
52: ; preds = %48
%53 = load i32*, i32** %13
%54 = call i32 @fscanf(i32* %53, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double* %15, double* %16)
%55 = load i32*, i32** %14
%56 = call i32 @fscanf(i32* %55, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double* %17, double* %18)
%57 = load double, double* %15
%58 = load double, double* %17
%59 = fsub double %57, %58
%60 = load double, double* %15
%61 = load double, double* %17
%62 = fsub double %60, %61
%63 = load double, double* %16
%64 = load double, double* %18
%65 = fsub double %63, %64
%66 = load double, double* %16
%67 = load double, double* %18
%68 = fsub double %66, %67
%69 = fmul double %65, %68
%70 = call double @llvm.fmuladd.f64(double %59, double %62, double %69)
%71 = call double @sqrt(double %70)
store double %71, double* %12
%72 = load double, double* %12
%73 = load double, double* %11
%74 = fcmp ogt double %72, %73
br i1 %74, label %75, label %82
75: ; preds = %52
%76 = load double, double* %12
store double %76, double* %11
%77 = load i32, i32* %19
store i32 %77, i32* %22
%78 = load double, double* %15
store double %78, double* %23
%79 = load double, double* %17
store double %79, double* %24
%80 = load double, double* %16
store double %80, double* %25
%81 = load double, double* %18
store double %81, double* %26
br label %82
82: ; preds = %75, %52
br label %83
83: ; preds = %82
%84 = load i32, i32* %19
%85 = add nsw i32 %84, 1
store i32 %85, i32* %19
br label %48
86: ; preds = %48
%87 = load i32*, i32** %13
%88 = call i32 @fclose(i32* %87)
%89 = load i32*, i32** %14
%90 = call i32 @fclose(i32* %89)
%91 = load double, double* %11
%92 = fptosi double %91 to i32
%93 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %92)
%94 = load i32, i32* %22
%95 = load double, double* %23
%96 = load double, double* %25
%97 = load double, double* %24
%98 = load double, double* %26
%99 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %94, double %95, double %96, double %97, double %98)
%100 = load i32, i32* %3
ret i32 %100
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"format: compare file1 file2 n\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"No. of points %d\0A\00"
@.str.3 = [9 x i8] c"%lf %lf\0A\00"
@.str.4 = [34 x i8] c" max componentwise distance: %g\0A\00"
@.str.5 = [19 x i8] c"%d %g,%g == %g,%g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = bitcast double* %5 to i8*
%10 = bitcast double* %6 to i8*
%11 = icmp eq i32 %0, 4
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
%26 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%27 = icmp sgt i32 %25, 0
br i1 %27, label %28, label %62
28: ; preds = %16, %53
%29 = phi double [ %59, %53 ], [ undef, %16 ]
%30 = phi double [ %58, %53 ], [ undef, %16 ]
%31 = phi double [ %57, %53 ], [ undef, %16 ]
%32 = phi double [ %56, %53 ], [ undef, %16 ]
%33 = phi i32 [ %55, %53 ], [ undef, %16 ]
%34 = phi double [ %54, %53 ], [ 0.000000e+00, %16 ]
%35 = phi i32 [ %60, %53 ], [ 0, %16 ]
%36 = call i32 @fscanf(i32* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double* %3, double* %4)
%37 = call i32 @fscanf(i32* %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double* %5, double* %6)
%38 = load double, double* %3
%39 = load double, double* %5
%40 = fsub double %38, %39
%41 = load double, double* %4
%42 = load double, double* %6
%43 = fsub double %41, %42
%44 = fmul double %43, %43
%45 = call double @llvm.fmuladd.f64(double %40, double %40, double %44)
%46 = call double @sqrt(double %45)
%47 = fcmp ogt double %46, %34
br i1 %47, label %48, label %53
48: ; preds = %28
%49 = load double, double* %3
%50 = load double, double* %5
%51 = load double, double* %4
%52 = load double, double* %6
br label %53
53: ; preds = %28, %48
%54 = phi double [ %46, %48 ], [ %34, %28 ]
%55 = phi i32 [ %35, %48 ], [ %33, %28 ]
%56 = phi double [ %49, %48 ], [ %32, %28 ]
%57 = phi double [ %50, %48 ], [ %31, %28 ]
%58 = phi double [ %51, %48 ], [ %30, %28 ]
%59 = phi double [ %52, %48 ], [ %29, %28 ]
%60 = add nuw nsw i32 %35, 1
%61 = icmp eq i32 %60, %25
br i1 %61, label %62, label %28
62: ; preds = %53, %16
%63 = phi double [ 0.000000e+00, %16 ], [ %54, %53 ]
%64 = phi i32 [ undef, %16 ], [ %55, %53 ]
%65 = phi double [ undef, %16 ], [ %56, %53 ]
%66 = phi double [ undef, %16 ], [ %57, %53 ]
%67 = phi double [ undef, %16 ], [ %58, %53 ]
%68 = phi double [ undef, %16 ], [ %59, %53 ]
%69 = call i32 @fclose(i32* %19)
%70 = call i32 @fclose(i32* %22)
%71 = fptosi double %63 to i32
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %71)
%73 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %64, double %65, double %67, double %66, double %68)
ret i32 0
}