void MtrxSum(double *pM1, double *pM2, int m, int n, double *pM3) {
  for (int i = 0; i <= m - 1; i = i + 1) {
    for (int j = 0; j <= n - 1; j = j + 1) {
      *(pM3 + i * n + j) = *(pM1 + i * n + j) + *(pM2 + i * n + j);
    }
  }
}


x86 assembly (clang, -O0):
<MtrxSum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11c1 <MtrxSum+0xc1>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     11ae <MtrxSum+0xae>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1135 <MtrxSum+0x35>
jmp    11b3 <MtrxSum+0xb3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111d <MtrxSum+0x1d>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MtrxSum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,-0x48(%rsp)
mov    %rsi,-0x50(%rsp)
mov    %rdi,-0x58(%rsp)
test   %edx,%edx
jle    1411 <MtrxSum+0x311>
movslq %ecx,%rax
mov    %edx,%r15d
mov    %eax,%r9d
mov    %r9d,%edx
and    $0xfffffffc,%edx
mov    %rdx,-0x28(%rsp)
add    $0xfffffffffffffffc,%rdx
mov    %rdx,-0x30(%rsp)
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %rsi,%rdx
mov    %rsi,-0x38(%rsp)
and    $0xfffffffffffffffe,%rsi
mov    %rsi,-0x40(%rsp)
mov    %r9d,%r10d
and    $0x3,%r10d
mov    -0x58(%rsp),%rdi
lea    0x30(%rdi),%rdx
mov    %rax,-0x20(%rsp)
lea    0x0(,%rax,8),%r13
mov    -0x50(%rsp),%rsi
lea    0x30(%rsi),%rbp
mov    -0x48(%rsp),%r8
lea    0x30(%r8),%r14
xor    %r11d,%r11d
mov    %ecx,-0x74(%rsp)
mov    %r10,-0x60(%rsp)
mov    %r15,-0x68(%rsp)
mov    %r13,-0x70(%rsp)
jmp    11cf <MtrxSum+0xcf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r11
add    %r13,%rdx
add    %r13,%rbp
add    %r13,%r14
add    %r13,%r8
add    %r13,%rsi
add    %r13,%rdi
cmp    %r15,%r11
je     1411 <MtrxSum+0x311>
test   %ecx,%ecx
jle    11b0 <MtrxSum+0xb0>
cmp    $0x4,%ecx
jae    11e0 <MtrxSum+0xe0>
xor    %r12d,%r12d
jmp    1350 <MtrxSum+0x250>
mov    %r11,%rax
imul   -0x20(%rsp),%rax
lea    (%rax,%r9,1),%rbx
mov    -0x48(%rsp),%rcx
lea    (%rcx,%rax,8),%r10
lea    (%rcx,%rbx,8),%rcx
mov    -0x58(%rsp),%r15
lea    (%r15,%rax,8),%r13
lea    (%r15,%rbx,8),%r12
mov    -0x50(%rsp),%r15
lea    (%r15,%rax,8),%rax
lea    (%r15,%rbx,8),%rbx
cmp    %r12,%r10
setb   %r12b
mov    %r13,-0x18(%rsp)
cmp    %rcx,%r13
setb   %r15b
mov    %r10,-0x8(%rsp)
cmp    %rbx,%r10
setb   %bl
mov    %rax,-0x10(%rsp)
cmp    %rcx,%rax
setb   %cl
test   %r15b,%r12b
jne    133a <MtrxSum+0x23a>
mov    $0x0,%r12d
and    %cl,%bl
mov    -0x74(%rsp),%ecx
mov    -0x68(%rsp),%r15
mov    -0x60(%rsp),%r10
mov    -0x70(%rsp),%r13
jne    1350 <MtrxSum+0x250>
cmpq   $0x0,-0x30(%rsp)
je     13ff <MtrxSum+0x2ff>
mov    -0x40(%rsp),%rax
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movupd -0x30(%rdx,%rbx,8),%xmm0
movupd -0x20(%rdx,%rbx,8),%xmm1
movupd -0x30(%rbp,%rbx,8),%xmm2
addpd  %xmm0,%xmm2
movupd -0x20(%rbp,%rbx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,-0x30(%r14,%rbx,8)
movupd %xmm0,-0x20(%r14,%rbx,8)
movupd -0x10(%rdx,%rbx,8),%xmm0
movupd (%rdx,%rbx,8),%xmm1
movupd -0x10(%rbp,%rbx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x0(%rbp,%rbx,8),%xmm0
addpd  %xmm1,%xmm0
movupd %xmm2,-0x10(%r14,%rbx,8)
movupd %xmm0,(%r14,%rbx,8)
add    $0x8,%rbx
add    $0xfffffffffffffffe,%rax
jne    1280 <MtrxSum+0x180>
testb  $0x1,-0x38(%rsp)
je     1323 <MtrxSum+0x223>
mov    -0x18(%rsp),%rax
movupd (%rax,%rbx,8),%xmm0
movupd 0x10(%rax,%rbx,8),%xmm1
mov    -0x10(%rsp),%rax
movupd (%rax,%rbx,8),%xmm2
addpd  %xmm0,%xmm2
movupd 0x10(%rax,%rbx,8),%xmm0
addpd  %xmm1,%xmm0
mov    -0x8(%rsp),%rax
movupd %xmm2,(%rax,%rbx,8)
movupd %xmm0,0x10(%rax,%rbx,8)
mov    -0x28(%rsp),%rax
mov    %rax,%r12
cmp    %r9,%rax
mov    -0x74(%rsp),%ecx
je     11b0 <MtrxSum+0xb0>
jmp    1350 <MtrxSum+0x250>
xor    %r12d,%r12d
mov    -0x74(%rsp),%ecx
mov    -0x68(%rsp),%r15
mov    -0x60(%rsp),%r10
mov    -0x70(%rsp),%r13
mov    %r12,%rax
not    %rax
add    %r9,%rax
test   %r10,%r10
je     138c <MtrxSum+0x28c>
mov    %r10,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rdi,%r12,8),%xmm0
addsd  (%rsi,%r12,8),%xmm0
movsd  %xmm0,(%r8,%r12,8)
add    $0x1,%r12
add    $0xffffffffffffffff,%rbx
jne    1370 <MtrxSum+0x270>
cmp    $0x3,%rax
jb     11b0 <MtrxSum+0xb0>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdi,%r12,8),%xmm0
addsd  (%rsi,%r12,8),%xmm0
movsd  %xmm0,(%r8,%r12,8)
movsd  0x8(%rdi,%r12,8),%xmm0
addsd  0x8(%rsi,%r12,8),%xmm0
movsd  %xmm0,0x8(%r8,%r12,8)
movsd  0x10(%rdi,%r12,8),%xmm0
addsd  0x10(%rsi,%r12,8),%xmm0
movsd  %xmm0,0x10(%r8,%r12,8)
movsd  0x18(%rdi,%r12,8),%xmm0
addsd  0x18(%rsi,%r12,8),%xmm0
movsd  %xmm0,0x18(%r8,%r12,8)
add    $0x4,%r12
cmp    %r12,%r9
jne    13a0 <MtrxSum+0x2a0>
jmp    11b0 <MtrxSum+0xb0>
xor    %ebx,%ebx
testb  $0x1,-0x38(%rsp)
jne    12eb <MtrxSum+0x1eb>
jmp    1323 <MtrxSum+0x223>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @MtrxSum(double* nocapture %0, double* nocapture %1, i32 %2, i32 %3, double* nocapture writeonly %4) {
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %133
7: ; preds = %5
%8 = icmp sgt i32 %3, 0
%9 = sext i32 %3 to i64
%10 = zext i32 %2 to i64
%11 = zext i32 %3 to i64
%12 = and i64 %11, 4294967292
%13 = add nsw i64 %12, -4
%14 = lshr exact i64 %13, 2
%15 = add nuw nsw i64 %14, 1
%16 = icmp ult i32 %3, 4
%17 = and i64 %11, 4294967292
%18 = and i64 %15, 1
%19 = icmp eq i64 %13, 0
%20 = and i64 %15, 9223372036854775806
%21 = icmp eq i64 %18, 0
%22 = icmp eq i64 %17, %11
%23 = and i64 %11, 3
%24 = icmp eq i64 %23, 0
br label %25
25: ; preds = %7, %134
%26 = phi i64 [ 0, %7 ], [ %135, %134 ]
%27 = mul i64 %26, %9
%28 = getelementptr double, double* %4, i64 %27
%29 = add i64 %27, %11
%30 = getelementptr double, double* %4, i64 %29
%31 = getelementptr double, double* %0, i64 %27
%32 = getelementptr double, double* %0, i64 %29
%33 = getelementptr double, double* %1, i64 %27
%34 = getelementptr double, double* %1, i64 %29
br i1 %8, label %35, label %134
35: ; preds = %25
%36 = mul nsw i64 %26, %9
%37 = getelementptr inbounds double, double* %0, i64 %36
%38 = getelementptr inbounds double, double* %1, i64 %36
%39 = getelementptr inbounds double, double* %4, i64 %36
br i1 %16, label %114, label %40
40: ; preds = %35
%41 = icmp ult double* %28, %32
%42 = icmp ult double* %31, %30
%43 = and i1 %41, %42
%44 = icmp ult double* %28, %34
%45 = icmp ult double* %33, %30
%46 = and i1 %44, %45
%47 = or i1 %43, %46
br i1 %47, label %114, label %48
48: ; preds = %40
br i1 %19, label %92, label %49
49: ; preds = %48, %49
%50 = phi i64 [ %89, %49 ], [ 0, %48 ]
%51 = phi i64 [ %90, %49 ], [ 0, %48 ]
%52 = getelementptr inbounds double, double* %37, i64 %50
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %52, i64 2
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = getelementptr inbounds double, double* %38, i64 %50
%59 = bitcast double* %58 to <2 x double>*
%60 = load <2 x double>, <2 x double>* %59
%61 = getelementptr inbounds double, double* %58, i64 2
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = fadd <2 x double> %54, %60
%65 = fadd <2 x double> %57, %63
%66 = getelementptr inbounds double, double* %39, i64 %50
%67 = bitcast double* %66 to <2 x double>*
store <2 x double> %64, <2 x double>* %67
%68 = getelementptr inbounds double, double* %66, i64 2
%69 = bitcast double* %68 to <2 x double>*
store <2 x double> %65, <2 x double>* %69
%70 = or i64 %50, 4
%71 = getelementptr inbounds double, double* %37, i64 %70
%72 = bitcast double* %71 to <2 x double>*
%73 = load <2 x double>, <2 x double>* %72
%74 = getelementptr inbounds double, double* %71, i64 2
%75 = bitcast double* %74 to <2 x double>*
%76 = load <2 x double>, <2 x double>* %75
%77 = getelementptr inbounds double, double* %38, i64 %70
%78 = bitcast double* %77 to <2 x double>*
%79 = load <2 x double>, <2 x double>* %78
%80 = getelementptr inbounds double, double* %77, i64 2
%81 = bitcast double* %80 to <2 x double>*
%82 = load <2 x double>, <2 x double>* %81
%83 = fadd <2 x double> %73, %79
%84 = fadd <2 x double> %76, %82
%85 = getelementptr inbounds double, double* %39, i64 %70
%86 = bitcast double* %85 to <2 x double>*
store <2 x double> %83, <2 x double>* %86
%87 = getelementptr inbounds double, double* %85, i64 2
%88 = bitcast double* %87 to <2 x double>*
store <2 x double> %84, <2 x double>* %88
%89 = add nuw i64 %50, 8
%90 = add i64 %51, 2
%91 = icmp eq i64 %90, %20
br i1 %91, label %92, label %49
92: ; preds = %49, %48
%93 = phi i64 [ 0, %48 ], [ %89, %49 ]
br i1 %21, label %113, label %94
94: ; preds = %92
%95 = getelementptr inbounds double, double* %37, i64 %93
%96 = bitcast double* %95 to <2 x double>*
%97 = load <2 x double>, <2 x double>* %96
%98 = getelementptr inbounds double, double* %95, i64 2
%99 = bitcast double* %98 to <2 x double>*
%100 = load <2 x double>, <2 x double>* %99
%101 = getelementptr inbounds double, double* %38, i64 %93
%102 = bitcast double* %101 to <2 x double>*
%103 = load <2 x double>, <2 x double>* %102
%104 = getelementptr inbounds double, double* %101, i64 2
%105 = bitcast double* %104 to <2 x double>*
%106 = load <2 x double>, <2 x double>* %105
%107 = fadd <2 x double> %97, %103
%108 = fadd <2 x double> %100, %106
%109 = getelementptr inbounds double, double* %39, i64 %93
%110 = bitcast double* %109 to <2 x double>*
store <2 x double> %107, <2 x double>* %110
%111 = getelementptr inbounds double, double* %109, i64 2
%112 = bitcast double* %111 to <2 x double>*
store <2 x double> %108, <2 x double>* %112
br label %113
113: ; preds = %92, %94
br i1 %22, label %134, label %114
114: ; preds = %40, %35, %113
%115 = phi i64 [ 0, %40 ], [ 0, %35 ], [ %17, %113 ]
%116 = xor i64 %115, -1
%117 = add nsw i64 %116, %11
br i1 %24, label %130, label %118
118: ; preds = %114, %118
%119 = phi i64 [ %127, %118 ], [ %115, %114 ]
%120 = phi i64 [ %128, %118 ], [ 0, %114 ]
%121 = getelementptr inbounds double, double* %37, i64 %119
%122 = load double, double* %121
%123 = getelementptr inbounds double, double* %38, i64 %119
%124 = load double, double* %123
%125 = fadd double %122, %124
%126 = getelementptr inbounds double, double* %39, i64 %119
store double %125, double* %126
%127 = add nuw nsw i64 %119, 1
%128 = add i64 %120, 1
%129 = icmp eq i64 %128, %23
br i1 %129, label %130, label %118
130: ; preds = %118, %114
%131 = phi i64 [ %115, %114 ], [ %127, %118 ]
%132 = icmp ult i64 %117, 3
br i1 %132, label %134, label %137
133: ; preds = %134, %5
ret void
134: ; preds = %130, %137, %113, %25
%135 = add nuw nsw i64 %26, 1
%136 = icmp eq i64 %135, %10
br i1 %136, label %133, label %25
137: ; preds = %130, %137
%138 = phi i64 [ %166, %137 ], [ %131, %130 ]
%139 = getelementptr inbounds double, double* %37, i64 %138
%140 = load double, double* %139
%141 = getelementptr inbounds double, double* %38, i64 %138
%142 = load double, double* %141
%143 = fadd double %140, %142
%144 = getelementptr inbounds double, double* %39, i64 %138
store double %143, double* %144
%145 = add nuw nsw i64 %138, 1
%146 = getelementptr inbounds double, double* %37, i64 %145
%147 = load double, double* %146
%148 = getelementptr inbounds double, double* %38, i64 %145
%149 = load double, double* %148
%150 = fadd double %147, %149
%151 = getelementptr inbounds double, double* %39, i64 %145
store double %150, double* %151
%152 = add nuw nsw i64 %138, 2
%153 = getelementptr inbounds double, double* %37, i64 %152
%154 = load double, double* %153
%155 = getelementptr inbounds double, double* %38, i64 %152
%156 = load double, double* %155
%157 = fadd double %154, %156
%158 = getelementptr inbounds double, double* %39, i64 %152
store double %157, double* %158
%159 = add nuw nsw i64 %138, 3
%160 = getelementptr inbounds double, double* %37, i64 %159
%161 = load double, double* %160
%162 = getelementptr inbounds double, double* %38, i64 %159
%163 = load double, double* %162
%164 = fadd double %161, %163
%165 = getelementptr inbounds double, double* %39, i64 %159
store double %164, double* %165
%166 = add nuw nsw i64 %138, 4
%167 = icmp eq i64 %166, %11
br i1 %167, label %134, label %137
}