double sigmaArray(double A[1000][1000], double sigma[1000], int n, int m) {
  double max;
  int i, j;
  clean(sigma, m);
  max = maxMatriz(A, n, m);
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      sigma[j] += ((A[i][j]) * (A[i][j]));
  return max;
}


x86 assembly (clang, -O0):
<sigmaArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    $0x0,%al
call   1040 <clean@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x0,%al
call   1030 <maxMatriz@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f5 <sigmaArray+0xd5>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11e2 <sigmaArray+0xc2>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x1f40,%rcx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1178 <sigmaArray+0x58>
jmp    11e7 <sigmaArray+0xc7>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1165 <sigmaArray+0x45>
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigmaArray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %ecx,%r12d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %ecx,%esi
xor    %eax,%eax
call   1040 <clean@plt>
mov    %r14,%rdi
mov    %r15d,%esi
mov    %r12d,%edx
xor    %eax,%eax
call   1030 <maxMatriz@plt>
mov    %eax,0xc(%rsp)
test   %r15d,%r15d
jle    1333 <sigmaArray+0x213>
mov    %r15d,%r13d
mov    %r12d,%edx
lea    (%rbx,%rdx,8),%rax
mov    %rax,0x20(%rsp)
mov    %edx,%r15d
and    $0xfffffffc,%r15d
lea    -0x4(%r15),%r11
mov    %r11,0x18(%rsp)
shr    $0x2,%r11
add    $0x1,%r11
mov    %r11,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,0x10(%rsp)
mov    %rdx,%r9
neg    %r9
lea    0x30(%r14),%rdi
lea    0x8(%r14),%rsi
xor    %ecx,%ecx
jmp    11cb <sigmaArray+0xab>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rcx
add    $0x1f40,%rdi
add    $0x1f40,%rsi
cmp    %r13,%rcx
je     1333 <sigmaArray+0x213>
test   %r12d,%r12d
jle    11b0 <sigmaArray+0x90>
imul   $0x1f40,%rcx,%r10
add    %r14,%r10
cmp    $0x4,%r12d
jb     11f0 <sigmaArray+0xd0>
lea    (%r10,%rdx,8),%rax
cmp    %rbx,%rax
jbe    1257 <sigmaArray+0x137>
cmp    0x20(%rsp),%r10
jae    1257 <sigmaArray+0x137>
xor    %ebp,%ebp
mov    %rbp,%rax
test   $0x1,%dl
je     1215 <sigmaArray+0xf5>
movsd  (%r10,%rbp,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  (%rbx,%rbp,8),%xmm0
movsd  %xmm0,(%rbx,%rbp,8)
mov    %rbp,%rax
or     $0x1,%rax
not    %rbp
cmp    %r9,%rbp
je     11b0 <sigmaArray+0x90>
nopl   (%rax)
movsd  -0x8(%rsi,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
movsd  (%rsi,%rax,8),%xmm0
mulsd  %xmm0,%xmm0
addsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rax,8)
add    $0x2,%rax
cmp    %rax,%rdx
jne    1220 <sigmaArray+0x100>
jmp    11b0 <sigmaArray+0x90>
cmpq   $0x0,0x18(%rsp)
je     1329 <sigmaArray+0x209>
mov    0x10(%rsp),%r8
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movupd -0x30(%rdi,%rax,8),%xmm0
movupd -0x20(%rdi,%rax,8),%xmm1
mulpd  %xmm0,%xmm0
movupd (%rbx,%rax,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rbx,%rax,8),%xmm0
movupd 0x20(%rbx,%rax,8),%xmm3
movupd 0x30(%rbx,%rax,8),%xmm4
mulpd  %xmm1,%xmm1
addpd  %xmm0,%xmm1
movupd %xmm2,(%rbx,%rax,8)
movupd %xmm1,0x10(%rbx,%rax,8)
movupd -0x10(%rdi,%rax,8),%xmm0
movupd (%rdi,%rax,8),%xmm1
mulpd  %xmm0,%xmm0
addpd  %xmm3,%xmm0
mulpd  %xmm1,%xmm1
addpd  %xmm4,%xmm1
movupd %xmm0,0x20(%rbx,%rax,8)
movupd %xmm1,0x30(%rbx,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%r8
jne    1270 <sigmaArray+0x150>
test   $0x1,%r11b
je     1318 <sigmaArray+0x1f8>
movupd (%r10,%rax,8),%xmm0
movupd 0x10(%r10,%rax,8),%xmm1
movupd (%rbx,%rax,8),%xmm2
movupd 0x10(%rbx,%rax,8),%xmm3
mulpd  %xmm0,%xmm0
addpd  %xmm2,%xmm0
mulpd  %xmm1,%xmm1
addpd  %xmm3,%xmm1
movupd %xmm0,(%rbx,%rax,8)
movupd %xmm1,0x10(%rbx,%rax,8)
mov    %r15,%rbp
cmp    %rdx,%r15
je     11b0 <sigmaArray+0x90>
jmp    11f2 <sigmaArray+0xd2>
xor    %eax,%eax
test   $0x1,%r11b
jne    12e5 <sigmaArray+0x1c5>
jmp    1318 <sigmaArray+0x1f8>
xorps  %xmm0,%xmm0
cvtsi2sdl 0xc(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @sigmaArray([1000 x double]* %0, double* %1, i32 %2, i32 %3) {
%5 = alloca [1000 x double]*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
store [1000 x double]* %0, [1000 x double]** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load double*, double** %6
%13 = load i32, i32* %8
%14 = call i32 (double*, i32, ...) bitcast (i32 (...)* @clean to i32 (double*, i32, ...)*)(double* %12, i32 %13)
%15 = load [1000 x double]*, [1000 x double]** %5
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = call i32 ([1000 x double]*, i32, i32, ...) bitcast (i32 (...)* @maxMatriz to i32 ([1000 x double]*, i32, i32, ...)*)([1000 x double]* %15, i32 %16, i32 %17)
%19 = sitofp i32 %18 to double
store double %19, double* %9
store i32 0, i32* %10
br label %20
20: ; preds = %56, %4
%21 = load i32, i32* %10
%22 = load i32, i32* %7
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %59
24: ; preds = %20
store i32 0, i32* %11
br label %25
25: ; preds = %52, %24
%26 = load i32, i32* %11
%27 = load i32, i32* %8
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %55
29: ; preds = %25
%30 = load [1000 x double]*, [1000 x double]** %5
%31 = load i32, i32* %10
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [1000 x double], [1000 x double]* %30, i64 %32
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [1000 x double], [1000 x double]* %33, i64 0, i64 %35
%37 = load double, double* %36
%38 = load [1000 x double]*, [1000 x double]** %5
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [1000 x double], [1000 x double]* %38, i64 %40
%42 = load i32, i32* %11
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [1000 x double], [1000 x double]* %41, i64 0, i64 %43
%45 = load double, double* %44
%46 = load double*, double** %6
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
%50 = load double, double* %49
%51 = call double @llvm.fmuladd.f64(double %37, double %45, double %50)
store double %51, double* %49
br label %52
52: ; preds = %29
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
store i32 %54, i32* %11
br label %25
55: ; preds = %25
br label %56
56: ; preds = %55
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %10
br label %20
59: ; preds = %20
%60 = load double, double* %9
ret double %60
}

LLVM IR (-O2):
define double @sigmaArray([1000 x double]* %0, double* %1, i32 %2, i32 %3) {
%5 = tail call i32 (double*, i32, ...) bitcast (i32 (...)* @clean to i32 (double*, i32, ...)*)(double* %1, i32 %3)
%6 = tail call i32 ([1000 x double]*, i32, i32, ...) bitcast (i32 (...)* @maxMatriz to i32 ([1000 x double]*, i32, i32, ...)*)([1000 x double]* %0, i32 %2, i32 %3)
%7 = icmp sgt i32 %2, 0
br i1 %7, label %8, label %127
8: ; preds = %4
%9 = icmp sgt i32 %3, 0
%10 = zext i32 %2 to i64
%11 = zext i32 %3 to i64
%12 = getelementptr double, double* %1, i64 %11
%13 = and i64 %11, 4294967292
%14 = add nsw i64 %13, -4
%15 = lshr exact i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = icmp ult i32 %3, 4
%18 = and i64 %11, 4294967292
%19 = and i64 %16, 1
%20 = icmp eq i64 %14, 0
%21 = and i64 %16, 9223372036854775806
%22 = icmp eq i64 %19, 0
%23 = icmp eq i64 %18, %11
%24 = and i64 %11, 1
%25 = icmp eq i64 %24, 0
%26 = sub nsw i64 0, %11
br label %27
27: ; preds = %8, %124
%28 = phi i64 [ 0, %8 ], [ %125, %124 ]
%29 = getelementptr [1000 x double], [1000 x double]* %0, i64 %28, i64 0
%30 = getelementptr [1000 x double], [1000 x double]* %0, i64 %28, i64 %11
br i1 %9, label %31, label %124
31: ; preds = %27
br i1 %17, label %96, label %32
32: ; preds = %31
%33 = icmp ugt double* %30, %1
%34 = icmp ult double* %29, %12
%35 = and i1 %33, %34
br i1 %35, label %96, label %36
36: ; preds = %32
br i1 %20, label %76, label %37
37: ; preds = %36, %37
%38 = phi i64 [ %73, %37 ], [ 0, %36 ]
%39 = phi i64 [ %74, %37 ], [ 0, %36 ]
%40 = getelementptr inbounds [1000 x double], [1000 x double]* %0, i64 %28, i64 %38
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
%43 = getelementptr inbounds double, double* %40, i64 2
%44 = bitcast double* %43 to <2 x double>*
%45 = load <2 x double>, <2 x double>* %44
%46 = getelementptr inbounds double, double* %1, i64 %38
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = getelementptr inbounds double, double* %46, i64 2
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %42, <2 x double> %42, <2 x double> %48)
%53 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %45, <2 x double> %45, <2 x double> %51)
%54 = bitcast double* %46 to <2 x double>*
store <2 x double> %52, <2 x double>* %54
%55 = bitcast double* %49 to <2 x double>*
store <2 x double> %53, <2 x double>* %55
%56 = or i64 %38, 4
%57 = getelementptr inbounds [1000 x double], [1000 x double]* %0, i64 %28, i64 %56
%58 = bitcast double* %57 to <2 x double>*
%59 = load <2 x double>, <2 x double>* %58
%60 = getelementptr inbounds double, double* %57, i64 2
%61 = bitcast double* %60 to <2 x double>*
%62 = load <2 x double>, <2 x double>* %61
%63 = getelementptr inbounds double, double* %1, i64 %56
%64 = bitcast double* %63 to <2 x double>*
%65 = load <2 x double>, <2 x double>* %64
%66 = getelementptr inbounds double, double* %63, i64 2
%67 = bitcast double* %66 to <2 x double>*
%68 = load <2 x double>, <2 x double>* %67
%69 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %59, <2 x double> %59, <2 x double> %65)
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %62, <2 x double> %62, <2 x double> %68)
%71 = bitcast double* %63 to <2 x double>*
store <2 x double> %69, <2 x double>* %71
%72 = bitcast double* %66 to <2 x double>*
store <2 x double> %70, <2 x double>* %72
%73 = add nuw i64 %38, 8
%74 = add i64 %39, 2
%75 = icmp eq i64 %74, %21
br i1 %75, label %76, label %37
76: ; preds = %37, %36
%77 = phi i64 [ 0, %36 ], [ %73, %37 ]
br i1 %22, label %95, label %78
78: ; preds = %76
%79 = getelementptr inbounds [1000 x double], [1000 x double]* %0, i64 %28, i64 %77
%80 = bitcast double* %79 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = getelementptr inbounds double, double* %79, i64 2
%83 = bitcast double* %82 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = getelementptr inbounds double, double* %1, i64 %77
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = getelementptr inbounds double, double* %85, i64 2
%89 = bitcast double* %88 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %81, <2 x double> %81, <2 x double> %87)
%92 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %84, <2 x double> %84, <2 x double> %90)
%93 = bitcast double* %85 to <2 x double>*
store <2 x double> %91, <2 x double>* %93
%94 = bitcast double* %88 to <2 x double>*
store <2 x double> %92, <2 x double>* %94
br label %95
95: ; preds = %76, %78
br i1 %23, label %124, label %96
96: ; preds = %32, %31, %95
%97 = phi i64 [ 0, %32 ], [ 0, %31 ], [ %18, %95 ]
%98 = xor i64 %97, -1
br i1 %25, label %106, label %99
99: ; preds = %96
%100 = getelementptr inbounds [1000 x double], [1000 x double]* %0, i64 %28, i64 %97
%101 = load double, double* %100
%102 = getelementptr inbounds double, double* %1, i64 %97
%103 = load double, double* %102
%104 = tail call double @llvm.fmuladd.f64(double %101, double %101, double %103)
store double %104, double* %102
%105 = or i64 %97, 1
br label %106
106: ; preds = %99, %96
%107 = phi i64 [ %97, %96 ], [ %105, %99 ]
%108 = icmp eq i64 %98, %26
br i1 %108, label %124, label %109
109: ; preds = %106, %109
%110 = phi i64 [ %122, %109 ], [ %107, %106 ]
%111 = getelementptr inbounds [1000 x double], [1000 x double]* %0, i64 %28, i64 %110
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %1, i64 %110
%114 = load double, double* %113
%115 = tail call double @llvm.fmuladd.f64(double %112, double %112, double %114)
store double %115, double* %113
%116 = add nuw nsw i64 %110, 1
%117 = getelementptr inbounds [1000 x double], [1000 x double]* %0, i64 %28, i64 %116
%118 = load double, double* %117
%119 = getelementptr inbounds double, double* %1, i64 %116
%120 = load double, double* %119
%121 = tail call double @llvm.fmuladd.f64(double %118, double %118, double %120)
store double %121, double* %119
%122 = add nuw nsw i64 %110, 2
%123 = icmp eq i64 %122, %11
br i1 %123, label %124, label %109
124: ; preds = %106, %109, %95, %27
%125 = add nuw nsw i64 %28, 1
%126 = icmp eq i64 %125, %10
br i1 %126, label %127, label %27
127: ; preds = %124, %4
%128 = sitofp i32 %6 to double
ret double %128
}