#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*/ f32_nearly_equal(float, float, float);
uint8_t f32_array_nearly_equal(float *a, size_t a_len, float *b, size_t b_len,
                               float error_margin) {
  size_t index = 0;
  if (!(a_len == b_len)) {
    return (0);
  };
  while ((index < a_len)) {
    if (!f32_nearly_equal((a[index]), (b[index]), error_margin)) {
      return (0);
    };
    index = (1 + index);
  };
  return (1);
}


x86 assembly (clang, -O0):
<f32_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)
movss  %xmm0,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     114f <f32_array_nearly_equal+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <f32_array_nearly_equal+0xa3>
jmp    1154 <f32_array_nearly_equal+0x44>
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11ac <f32_array_nearly_equal+0x9c>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movss  -0x2c(%rbp),%xmm2
call   1030 <f32_nearly_equal@plt>
cmp    $0x0,%eax
jne    119b <f32_array_nearly_equal+0x8b>
movl   $0x0,-0x4(%rbp)
jmp    11b3 <f32_array_nearly_equal+0xa3>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1154 <f32_array_nearly_equal+0x44>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f32_array_nearly_equal>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
xor    %r14d,%r14d
cmp    %rcx,%rsi
jne    1169 <f32_array_nearly_equal+0x59>
mov    %rsi,%rbp
mov    $0x1,%r14d
test   %rsi,%rsi
je     1169 <f32_array_nearly_equal+0x59>
mov    %rdx,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
movss  (%r12,%rbx,4),%xmm0
movss  (%r15,%rbx,4),%xmm1
movss  0xc(%rsp),%xmm2
call   1030 <f32_nearly_equal@plt>
test   %eax,%eax
je     1166 <f32_array_nearly_equal+0x56>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <f32_array_nearly_equal+0x30>
jmp    1169 <f32_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 @f32_array_nearly_equal(float* %0, i64 %1, float* %2, i64 %3, float %4) {
%6 = alloca i32
%7 = alloca float*
%8 = alloca i64
%9 = alloca float*
%10 = alloca i64
%11 = alloca float
%12 = alloca i64
store float* %0, float** %7
store i64 %1, i64* %8
store float* %2, float** %9
store i64 %3, i64* %10
store float %4, float* %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 float*, float** %7
%24 = load i64, i64* %12
%25 = getelementptr inbounds float, float* %23, i64 %24
%26 = load float, float* %25
%27 = load float*, float** %9
%28 = load i64, i64* %12
%29 = getelementptr inbounds float, float* %27, i64 %28
%30 = load float, float* %29
%31 = load float, float* %11
%32 = call i32 @f32_nearly_equal(float %26, float %30, float %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 @f32_array_nearly_equal(float* nocapture %0, i64 %1, float* nocapture %2, i64 %3, float %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 float, float* %0, i64 %12
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %2, i64 %12
%16 = load float, float* %15
%17 = tail call i32 @f32_nearly_equal(float %14, float %16, float %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
}