int tml_dr_vEqual(const double *srcA, const double *srcB, int n) {
  int i = 0;
  int ret = 1;
  for (i = 0; i < n && ret; i++)
    ret = (srcA[i] == srcB[i]);
  return ret;
}


x86 assembly (clang, -O0):
<tml_dr_vEqual>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jge    113f <tml_dr_vEqual+0x3f>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    114f <tml_dr_vEqual+0x4f>
jmp    1187 <tml_dr_vEqual+0x87>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1124 <tml_dr_vEqual+0x24>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tml_dr_vEqual>:
test   %edx,%edx
jle    113b <tml_dr_vEqual+0x3b>
mov    %edx,%eax
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rdi,%rcx,8),%xmm0
movsd  -0x8(%rsi,%rcx,8),%xmm1
cmp    %rax,%rcx
jae    112d <tml_dr_vEqual+0x2d>
add    $0x1,%rcx
ucomisd %xmm1,%xmm0
jne    112d <tml_dr_vEqual+0x2d>
jnp    1110 <tml_dr_vEqual+0x10>
cmpeqsd %xmm1,%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @tml_dr_vEqual(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
store i32 0, i32* %7
br label %9
9: ; preds = %31, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %13, %9
%17 = phi i1 [ false, %9 ], [ %15, %13 ]
br i1 %17, label %18, label %34
18: ; preds = %16
%19 = load double*, double** %4
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %19, i64 %21
%23 = load double, double* %22
%24 = load double*, double** %5
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = fcmp oeq double %23, %28
%30 = zext i1 %29 to i32
store i32 %30, i32* %8
br label %31
31: ; preds = %18
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %9
34: ; preds = %16
%35 = load i32, i32* %8
ret i32 %35
}

LLVM IR (-O2):
define i32 @tml_dr_vEqual(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %19
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %14, %7 ]
%9 = getelementptr inbounds double, double* %0, i64 %8
%10 = load double, double* %9
%11 = getelementptr inbounds double, double* %1, i64 %8
%12 = load double, double* %11
%13 = fcmp oeq double %10, %12
%14 = add nuw nsw i64 %8, 1
%15 = icmp ult i64 %14, %6
%16 = select i1 %15, i1 %13, i1 false
br i1 %16, label %7, label %17
17: ; preds = %7
%18 = zext i1 %13 to i32
br label %19
19: ; preds = %17, %3
%20 = phi i32 [ 1, %3 ], [ %18, %17 ]
ret i32 %20
}