#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);
int mequal(double A[3][3], double B[3][3], double t) {
  int e = 1;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      e &= (fabs(A[i][j] - B[i][j]) <= t);
    }
  }
  return e;
}


x86 assembly (clang, -O0):
<mequal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11ad <mequal+0xad>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    119a <mequal+0x9a>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
movaps 0xe8f(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1130 <mequal+0x30>
jmp    119f <mequal+0x9f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111f <mequal+0x1f>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mequal>:
movupd (%rdi),%xmm1
movupd 0x10(%rdi),%xmm3
movupd 0x20(%rdi),%xmm2
movupd 0x30(%rdi),%xmm4
movupd (%rsi),%xmm5
subpd  %xmm5,%xmm1
movupd 0x10(%rsi),%xmm5
subpd  %xmm5,%xmm3
movupd 0x20(%rsi),%xmm5
subpd  %xmm5,%xmm2
movupd 0x30(%rsi),%xmm5
subpd  %xmm5,%xmm4
movapd 0xec2(%rip),%xmm5
andpd  %xmm5,%xmm1
andpd  %xmm5,%xmm3
andpd  %xmm5,%xmm2
andpd  %xmm5,%xmm4
movsd  0x40(%rdi),%xmm6
subsd  0x40(%rsi),%xmm6
andpd  %xmm5,%xmm6
ucomisd %xmm6,%xmm0
unpcklpd %xmm0,%xmm0
setae  %al
cmpnlepd %xmm0,%xmm4
cmpnlepd %xmm0,%xmm2
packssdw %xmm4,%xmm2
cmpnlepd %xmm0,%xmm3
cmpnlepd %xmm0,%xmm1
packssdw %xmm3,%xmm1
packssdw %xmm2,%xmm1
pmovmskb %xmm1,%ecx
test   $0xaaaa,%ecx
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @mequal([3 x double]* nocapture %0, [3 x double]* nocapture %1, double %2) {
%4 = bitcast [3 x double]* %0 to <8 x double>*
%5 = load <8 x double>, <8 x double>* %4
%6 = bitcast [3 x double]* %1 to <8 x double>*
%7 = load <8 x double>, <8 x double>* %6
%8 = fsub <8 x double> %5, %7
%9 = call <8 x double> @llvm.fabs.v8f64(<8 x double> %8)
%10 = insertelement <8 x double> poison, double %2, i64 0
%11 = shufflevector <8 x double> %10, <8 x double> poison, <8 x i32> zeroinitializer
%12 = fcmp ugt <8 x double> %9, %11
%13 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 2, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 2, i64 2
%16 = load double, double* %15
%17 = fsub double %14, %16
%18 = tail call double @llvm.fabs.f64(double %17)
%19 = fcmp ole double %18, %2
%20 = bitcast <8 x i1> %12 to i8
%21 = icmp eq i8 %20, 0
%22 = and i1 %21, %19
%23 = zext i1 %22 to i32
ret i32 %23
}