#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*/ almost_equal(double const, double const);
int /*<<< orphan*/ print_array_index_error(char const *, size_t,
                                           double const *const, double const);
bool assert_equal_arrays(const double *const arr_a, const double *const arr_b,
                         const size_t size, const char *arr_a_name) {
  bool equality = true;
  for (size_t i = 0; i < size; ++i) {
    if (!almost_equal(arr_a[i], arr_b[i])) {
      print_array_index_error(arr_a_name, i, arr_a, arr_b[i]);
      equality = false;
    }
  }
  return equality;
}


x86 assembly (clang, -O0):
<assert_equal_arrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11b8 <assert_equal_arrays+0x98>
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1040 <almost_equal@plt>
cmp    $0x0,%eax
jne    11a2 <assert_equal_arrays+0x82>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <print_array_index_error@plt>
movl   $0x0,-0x24(%rbp)
jmp    11a7 <assert_equal_arrays+0x87>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1147 <assert_equal_arrays+0x27>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_equal_arrays>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdx,%rdx
je     1187 <assert_equal_arrays+0x67>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
mov    $0x1,%ebp
xor    %ebx,%ebx
jmp    1159 <assert_equal_arrays+0x39>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    %rbx,%r15
je     118c <assert_equal_arrays+0x6c>
movsd  0x0(%r13,%rbx,8),%xmm0
movsd  (%r12,%rbx,8),%xmm1
call   1040 <almost_equal@plt>
test   %eax,%eax
jne    1150 <assert_equal_arrays+0x30>
movsd  (%r12,%rbx,8),%xmm0
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1030 <print_array_index_error@plt>
xor    %ebp,%ebp
jmp    1150 <assert_equal_arrays+0x30>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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