#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 homo_ch_cmpV(double A[3][4], double B[3][4], double precision) {
  int i, j, ret;
  ret = 0;
  for (j = 0; j < 3; j++)
    for (i = 0; i < 4; i++)
      if (fabs(A[j][i] - B[j][i]) > precision)
        ret = ret + 1;
  return ret;
}


x86 assembly (clang, -O0):
<homo_ch_cmpV>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x20(%rbp)
jge    11af <homo_ch_cmpV+0xaf>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    119c <homo_ch_cmpV+0x9c>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xe8f(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1189 <homo_ch_cmpV+0x89>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118e <homo_ch_cmpV+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1130 <homo_ch_cmpV+0x30>
jmp    11a1 <homo_ch_cmpV+0xa1>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111f <homo_ch_cmpV+0x1f>
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<homo_ch_cmpV>:
movupd (%rdi),%xmm3
movupd 0x10(%rdi),%xmm4
movupd 0x20(%rdi),%xmm5
movupd 0x30(%rdi),%xmm6
movupd (%rsi),%xmm1
subpd  %xmm1,%xmm3
movupd 0x10(%rsi),%xmm1
subpd  %xmm1,%xmm4
movupd 0x20(%rsi),%xmm1
subpd  %xmm1,%xmm5
movupd 0x30(%rsi),%xmm1
subpd  %xmm1,%xmm6
movapd 0xec2(%rip),%xmm7
andpd  %xmm7,%xmm3
andpd  %xmm7,%xmm4
andpd  %xmm7,%xmm5
andpd  %xmm7,%xmm6
movupd 0x40(%rdi),%xmm8
movupd 0x50(%rdi),%xmm2
movupd 0x40(%rsi),%xmm1
subpd  %xmm1,%xmm8
movupd 0x50(%rsi),%xmm1
subpd  %xmm1,%xmm2
andpd  %xmm7,%xmm8
andpd  %xmm7,%xmm2
unpcklpd %xmm0,%xmm0
movapd %xmm0,%xmm1
cmpltpd %xmm6,%xmm1
movapd %xmm0,%xmm6
cmpltpd %xmm5,%xmm6
packssdw %xmm1,%xmm6
movapd %xmm0,%xmm1
cmpltpd %xmm4,%xmm1
movapd %xmm0,%xmm4
cmpltpd %xmm3,%xmm4
packssdw %xmm1,%xmm4
packssdw %xmm6,%xmm4
packsswb %xmm4,%xmm4
pmovmskb %xmm4,%eax
mov    %eax,%ecx
shr    %cl
and    $0x55,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
movzbl %cl,%ecx
movapd %xmm0,%xmm1
cmpltpd %xmm2,%xmm1
cmpltpd %xmm8,%xmm0
packssdw %xmm1,%xmm0
movmskps %xmm0,%eax
mov    %eax,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%al
mov    %eax,%edx
and    $0x33,%dl
shr    $0x2,%al
and    $0x33,%al
add    %dl,%al
mov    %eax,%edx
shr    $0x4,%dl
add    %al,%dl
and    $0xf,%dl
movzbl %dl,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @homo_ch_cmpV([4 x double]* %0, [4 x double]* %1, double %2) {
%4 = alloca [4 x double]*
%5 = alloca [4 x double]*
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store [4 x double]* %0, [4 x double]** %4
store [4 x double]* %1, [4 x double]** %5
store double %2, double* %6
store i32 0, i32* %9
store i32 0, i32* %8
br label %10
10: ; preds = %46, %3
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %49
13: ; preds = %10
store i32 0, i32* %7
br label %14
14: ; preds = %42, %13
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %45
17: ; preds = %14
%18 = load [4 x double]*, [4 x double]** %4
%19 = load i32, i32* %8
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 %20
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x double], [4 x double]* %21, i64 0, i64 %23
%25 = load double, double* %24
%26 = load [4 x double]*, [4 x double]** %5
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [4 x double], [4 x double]* %26, i64 %28
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [4 x double], [4 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 ogt double %35, %36
br i1 %37, label %38, label %41
38: ; preds = %17
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %41
41: ; preds = %38, %17
br label %42
42: ; preds = %41
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %14
45: ; preds = %14
br label %46
46: ; preds = %45
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %10
49: ; preds = %10
%50 = load i32, i32* %9
ret i32 %50
}

LLVM IR (-O2):
define i32 @homo_ch_cmpV([4 x double]* nocapture %0, [4 x double]* nocapture %1, double %2) {
%4 = bitcast [4 x double]* %0 to <8 x double>*
%5 = load <8 x double>, <8 x double>* %4
%6 = bitcast [4 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 ogt <8 x double> %9, %11
%13 = getelementptr inbounds [4 x double], [4 x double]* %0, i64 2, i64 0
%14 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 2, i64 0
%15 = bitcast double* %13 to <4 x double>*
%16 = load <4 x double>, <4 x double>* %15
%17 = bitcast double* %14 to <4 x double>*
%18 = load <4 x double>, <4 x double>* %17
%19 = fsub <4 x double> %16, %18
%20 = call <4 x double> @llvm.fabs.v4f64(<4 x double> %19)
%21 = insertelement <4 x double> poison, double %2, i64 0
%22 = shufflevector <4 x double> %21, <4 x double> poison, <4 x i32> zeroinitializer
%23 = fcmp ogt <4 x double> %20, %22
%24 = bitcast <8 x i1> %12 to i8
%25 = call i8 @llvm.ctpop.i8(i8 %24)
%26 = zext i8 %25 to i32
%27 = bitcast <4 x i1> %23 to i4
%28 = call i4 @llvm.ctpop.i4(i4 %27)
%29 = zext i4 %28 to i32
%30 = add nuw nsw i32 %26, %29
ret i32 %30
}