#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 */
scalar_t__ fabs(double const);
double diffArray(const int datasize, const double *data1, const double *data2) {
  int i;
  double diff_sum;
  for (i = 0; i < datasize; i++) {
    diff_sum += fabs(data1[i] - data2[i]);
  }
}


x86 assembly (clang, -O0):
<diffArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1172 <diffArray+0x62>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112a <diffArray+0x1a>
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffArray>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
jle    11da <diffArray+0xca>
mov    %rdx,%r14
mov    %rsi,%r13
mov    %edi,%r12d
lea    -0x1(%r12),%rax
mov    %r12d,%r15d
and    $0x3,%r15d
cmp    $0x3,%rax
jae    1140 <diffArray+0x30>
xor    %ebx,%ebx
jmp    11a4 <diffArray+0x94>
and    $0xfffffffc,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsd  0x0(%r13,%rbx,8),%xmm0
subsd  (%r14,%rbx,8),%xmm0
call   1030 <fabs@plt>
movsd  0x8(%r13,%rbx,8),%xmm0
subsd  0x8(%r14,%rbx,8),%xmm0
call   1030 <fabs@plt>
movsd  0x10(%r13,%rbx,8),%xmm0
subsd  0x10(%r14,%rbx,8),%xmm0
call   1030 <fabs@plt>
movsd  0x18(%r13,%rbx,8),%xmm0
subsd  0x18(%r14,%rbx,8),%xmm0
call   1030 <fabs@plt>
add    $0x4,%rbx
cmp    %rbx,%r12
jne    1150 <diffArray+0x40>
test   %r15,%r15
je     11da <diffArray+0xca>
lea    (%r14,%rbx,8),%r14
lea    0x0(,%rbx,8),%r12
add    %r13,%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rbx,8),%xmm0
subsd  (%r14,%rbx,8),%xmm0
call   1030 <fabs@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11c0 <diffArray+0xb0>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define double @diffArray(i32 %0, double* nocapture %1, double* nocapture %2) {
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %60
5: ; preds = %3
%6 = zext i32 %0 to i64
%7 = add nsw i64 %6, -1
%8 = and i64 %6, 3
%9 = icmp ult i64 %7, 3
br i1 %9, label %45, label %10
10: ; preds = %5
%11 = and i64 %6, 4294967292
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %42, %12 ]
%14 = phi i64 [ 0, %10 ], [ %43, %12 ]
%15 = getelementptr inbounds double, double* %1, i64 %13
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %2, i64 %13
%18 = load double, double* %17
%19 = fsub double %16, %18
%20 = tail call i64 @fabs(double %19)
%21 = or i64 %13, 1
%22 = getelementptr inbounds double, double* %1, i64 %21
%23 = load double, double* %22
%24 = getelementptr inbounds double, double* %2, i64 %21
%25 = load double, double* %24
%26 = fsub double %23, %25
%27 = tail call i64 @fabs(double %26)
%28 = or i64 %13, 2
%29 = getelementptr inbounds double, double* %1, i64 %28
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %2, i64 %28
%32 = load double, double* %31
%33 = fsub double %30, %32
%34 = tail call i64 @fabs(double %33)
%35 = or i64 %13, 3
%36 = getelementptr inbounds double, double* %1, i64 %35
%37 = load double, double* %36
%38 = getelementptr inbounds double, double* %2, i64 %35
%39 = load double, double* %38
%40 = fsub double %37, %39
%41 = tail call i64 @fabs(double %40)
%42 = add nuw nsw i64 %13, 4
%43 = add i64 %14, 4
%44 = icmp eq i64 %43, %11
br i1 %44, label %45, label %12
45: ; preds = %12, %5
%46 = phi i64 [ 0, %5 ], [ %42, %12 ]
%47 = icmp eq i64 %8, 0
br i1 %47, label %60, label %48
48: ; preds = %45, %48
%49 = phi i64 [ %57, %48 ], [ %46, %45 ]
%50 = phi i64 [ %58, %48 ], [ 0, %45 ]
%51 = getelementptr inbounds double, double* %1, i64 %49
%52 = load double, double* %51
%53 = getelementptr inbounds double, double* %2, i64 %49
%54 = load double, double* %53
%55 = fsub double %52, %54
%56 = tail call i64 @fabs(double %55)
%57 = add nuw nsw i64 %49, 1
%58 = add i64 %50, 1
%59 = icmp eq i64 %58, %8
br i1 %59, label %60, label %48
60: ; preds = %45, %48, %3
ret double undef
}