#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ f64_nearly_equal(double, double, double);
uint8_t f64_array_nearly_equal(double *a, size_t a_len, double *b, size_t b_len,
                               double error_margin) {
  size_t index = 0;
  if (!(a_len == b_len)) {
    return (0);
  };
  while ((index < a_len)) {
    if (!f64_nearly_equal((a[index]), (b[index]), error_margin)) {
      return (0);
    };
    index = (1 + index);
  };
  return (1);
}


x86 assembly (clang, -O0):
<f64_array_nearly_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     114f <f64_array_nearly_equal+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <f64_array_nearly_equal+0xa3>
jmp    1154 <f64_array_nearly_equal+0x44>
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11ac <f64_array_nearly_equal+0x9c>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1030 <f64_nearly_equal@plt>
cmp    $0x0,%eax
jne    119b <f64_array_nearly_equal+0x8b>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <f64_array_nearly_equal+0xa3>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1154 <f64_array_nearly_equal+0x44>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f64_array_nearly_equal>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
xor    %r14d,%r14d
cmp    %rcx,%rsi
jne    1169 <f64_array_nearly_equal+0x59>
mov    %rsi,%rbp
mov    $0x1,%r14d
test   %rsi,%rsi
je     1169 <f64_array_nearly_equal+0x59>
mov    %rdx,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
movsd  (%r12,%rbx,8),%xmm0
movsd  (%r15,%rbx,8),%xmm1
movsd  0x8(%rsp),%xmm2
call   1030 <f64_nearly_equal@plt>
test   %eax,%eax
je     1166 <f64_array_nearly_equal+0x56>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <f64_array_nearly_equal+0x30>
jmp    1169 <f64_array_nearly_equal+0x59>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @f64_array_nearly_equal(double* nocapture %0, i64 %1, double* nocapture %2, i64 %3, double %4) {
%6 = icmp eq i64 %1, %3
br i1 %6, label %7, label %20
7: ; preds = %5
%8 = icmp eq i64 %1, 0
br i1 %8, label %20, label %11
9: ; preds = %11
%10 = icmp eq i64 %19, %1
br i1 %10, label %20, label %11
11: ; preds = %7, %9
%12 = phi i64 [ %19, %9 ], [ 0, %7 ]
%13 = getelementptr inbounds double, double* %0, i64 %12
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 %12
%16 = load double, double* %15
%17 = tail call i32 @f64_nearly_equal(double %14, double %16, double %4)
%18 = icmp eq i32 %17, 0
%19 = add nuw i64 %12, 1
br i1 %18, label %20, label %9
20: ; preds = %11, %9, %7, %5
%21 = phi i32 [ 0, %5 ], [ 1, %7 ], [ 0, %11 ], [ 1, %9 ]
ret i32 %21
}