#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 */
double fabs(double const);
unsigned int test_eq_array_double(unsigned int n, const double *u,
                                  const double *v, double tol) {
  for (unsigned int i = 0; i < n; i++) {
    if (fabs(u[i] - v[i]) > tol)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_eq_array_double>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1174 <test_eq_array_double+0x74>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xeba(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1161 <test_eq_array_double+0x61>
movl   $0x1,-0x4(%rbp)
jmp    117b <test_eq_array_double+0x7b>
jmp    1166 <test_eq_array_double+0x66>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111b <test_eq_array_double+0x1b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_eq_array_double>:
test   %edi,%edi
je     1159 <test_eq_array_double+0x59>
movsd  (%rsi),%xmm1
subsd  (%rdx),%xmm1
andpd  0xeec(%rip),%xmm1
mov    $0x1,%eax
ucomisd %xmm0,%xmm1
ja     1158 <test_eq_array_double+0x58>
mov    %edi,%ecx
mov    $0x1,%eax
movapd 0xed2(%rip),%xmm1
xchg   %ax,%ax
mov    %rax,%rdi
cmp    %rax,%rcx
je     1150 <test_eq_array_double+0x50>
movsd  (%rsi,%rdi,8),%xmm2
subsd  (%rdx,%rdi,8),%xmm2
andpd  %xmm1,%xmm2
lea    0x1(%rdi),%rax
ucomisd %xmm0,%xmm2
jbe    1130 <test_eq_array_double+0x30>
xor    %eax,%eax
cmp    %rcx,%rdi
setb   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @test_eq_array_double(i32 %0, double* %1, double* %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store double* %2, double** %8
store double %3, double* %9
store i32 0, i32* %10
br label %11
11: ; preds = %32, %4
%12 = load i32, i32* %10
%13 = load i32, i32* %6
%14 = icmp ult i32 %12, %13
br i1 %14, label %15, label %35
15: ; preds = %11
%16 = load double*, double** %7
%17 = load i32, i32* %10
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = load double*, double** %8
%22 = load i32, i32* %10
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fsub double %20, %25
%27 = call double @llvm.fabs.f64(double %26)
%28 = load double, double* %9
%29 = fcmp ogt double %27, %28
br i1 %29, label %30, label %31
30: ; preds = %15
store i32 1, i32* %5
br label %36
31: ; preds = %15
br label %32
32: ; preds = %31
%33 = load i32, i32* %10
%34 = add i32 %33, 1
store i32 %34, i32* %10
br label %11
35: ; preds = %11
store i32 0, i32* %5
br label %36
36: ; preds = %35, %30
%37 = load i32, i32* %5
ret i32 %37
}

LLVM IR (-O2):
define i32 @test_eq_array_double(i32 %0, double* nocapture %1, double* nocapture %2, double %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %28, label %6
6: ; preds = %4
%7 = zext i32 %0 to i64
%8 = load double, double* %1
%9 = load double, double* %2
%10 = fsub double %8, %9
%11 = tail call double @llvm.fabs.f64(double %10)
%12 = fcmp ogt double %11, %3
br i1 %12, label %28, label %13
13: ; preds = %6, %16
%14 = phi i64 [ %24, %16 ], [ 1, %6 ]
%15 = icmp eq i64 %14, %7
br i1 %15, label %25, label %16
16: ; preds = %13
%17 = getelementptr inbounds double, double* %1, i64 %14
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %2, i64 %14
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = fcmp ogt double %22, %3
%24 = add nuw nsw i64 %14, 1
br i1 %23, label %25, label %13
25: ; preds = %13, %16
%26 = icmp ult i64 %14, %7
%27 = zext i1 %26 to i32
br label %28
28: ; preds = %25, %6, %4
%29 = phi i32 [ 0, %4 ], [ 1, %6 ], [ %27, %25 ]
ret i32 %29
}