#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 */

/* Variables and functions */
int /*<<< orphan*/ abort();
void check(double *a, double *b, int N) {
  int i;
  for (i = 0; i < N; i++)
    if (a[i] - b[i] > 0.000001 || b[i] - a[i] > 0.000001)
      abort();
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a8 <check+0x98>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0xea8(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     118e <check+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0xe7c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1195 <check+0x85>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    119a <check+0x8a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <check+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rax
test   %edx,%edx
jle    115b <check+0x4b>
mov    %edx,%eax
xor    %ecx,%ecx
movsd  0xedf(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rdi,%rcx,8),%xmm2
movsd  (%rsi,%rcx,8),%xmm1
movapd %xmm2,%xmm3
subsd  %xmm1,%xmm3
ucomisd %xmm0,%xmm3
ja     115d <check+0x4d>
subsd  %xmm2,%xmm1
ucomisd %xmm0,%xmm1
ja     115d <check+0x4d>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1130 <check+0x20>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @check(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %41, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %44
12: ; preds = %8
%13 = load double*, double** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = load double*, double** %5
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = fsub double %17, %22
%24 = fcmp ogt double %23, 0x3EB0C6F7A0B5ED8D
br i1 %24, label %38, label %25
25: ; preds = %12
%26 = load double*, double** %5
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds double, double* %26, i64 %28
%30 = load double, double* %29
%31 = load double*, double** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = fsub double %30, %35
%37 = fcmp ogt double %36, 0x3EB0C6F7A0B5ED8D
br i1 %37, label %38, label %40
38: ; preds = %25, %12
%39 = call i32 (...) @abort()
unreachable
40: ; preds = %25
br label %41
41: ; preds = %40
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %8
44: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @check(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %23
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %20, %6
br i1 %8, label %23, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %20, %7 ]
%11 = getelementptr inbounds double, double* %0, i64 %10
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 %10
%14 = load double, double* %13
%15 = fsub double %12, %14
%16 = fcmp ogt double %15, 0x3EB0C6F7A0B5ED8D
%17 = fsub double %14, %12
%18 = fcmp ogt double %17, 0x3EB0C6F7A0B5ED8D
%19 = or i1 %16, %18
%20 = add nuw nsw i64 %10, 1
br i1 %19, label %21, label %7
21: ; preds = %9
%22 = tail call i32 (...) @abort()
unreachable
23: ; preds = %7, %3
ret void
}