void sub_dmatrix(double **m1, long nrl, long nrh, long ncl, long nch,
                 double **m2, double **m3) {
  long i, j;
  double x, y, z, *Xi, *Yi, *Zi;
  for (i = nrl; i <= nrh; i++) {
    Xi = m1[i];
    Yi = m2[i];
    Zi = m3[i];
    for (j = ncl; j <= nch; j++) {
      x = Xi[j];
      y = Yi[j];
      z = x - y;
      Zi[j] = z;
    }
  }
}


x86 assembly (clang, -O0):
<sub_dmatrix>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     11e8 <sub_dmatrix+0xe8>
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x68(%rbp)
mov    0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x70(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
jg     11d2 <sub_dmatrix+0xd2>
mov    -0x60(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x68(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x70(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    116e <sub_dmatrix+0x6e>
jmp    11d7 <sub_dmatrix+0xd7>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1128 <sub_dmatrix+0x28>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_dmatrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,-0x8(%rsp)
cmp    %rdx,%rsi
jle    111f <sub_dmatrix+0x1f>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rcx,%r11
lea    0x1(%r8),%rax
mov    %rax,-0x50(%rsp)
sub    %rcx,%rax
lea    -0x4(%rax),%rcx
mov    %rcx,-0x20(%rsp)
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %rax,-0x58(%rsp)
and    $0xfffffffffffffffc,%rax
mov    %rax,-0x30(%rsp)
add    %r11,%rax
mov    %rax,-0x38(%rsp)
mov    %rcx,%rax
mov    %rcx,-0x28(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,-0x40(%rsp)
lea    0x6(%r11),%rax
mov    %rax,-0x48(%rsp)
mov    %r9,-0x10(%rsp)
mov    %r8,-0x18(%rsp)
mov    %r11,-0x60(%rsp)
jmp    118c <sub_dmatrix+0x8c>
lea    0x1(%rsi),%rax
cmp    %rdx,%rsi
mov    %rax,%rsi
je     1114 <sub_dmatrix+0x14>
cmp    %r8,%r11
jg     1180 <sub_dmatrix+0x80>
mov    -0x8(%rsp),%rax
mov    (%rax,%rsi,8),%r12
mov    (%r9,%rsi,8),%r13
mov    0x38(%rsp),%rax
mov    (%rax,%rsi,8),%r14
mov    %r11,%rcx
cmpq   $0x4,-0x58(%rsp)
jae    1280 <sub_dmatrix+0x180>
mov    -0x50(%rsp),%rax
sub    %ecx,%eax
mov    %r8,%rbx
sub    %rcx,%rbx
and    $0x3,%rax
je     11ed <sub_dmatrix+0xed>
nopl   0x0(%rax)
movsd  (%r12,%rcx,8),%xmm0
subsd  0x0(%r13,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rax
jne    11d0 <sub_dmatrix+0xd0>
cmp    $0x3,%rbx
jb     1180 <sub_dmatrix+0x80>
mov    %r8,%rbx
sub    %rcx,%rbx
lea    (%r14,%rcx,8),%rax
add    $0x18,%rax
lea    0x18(,%rcx,8),%rdi
add    %r13,%rdi
lea    (%r12,%rcx,8),%rcx
add    $0x18,%rcx
mov    $0xffffffffffffffff,%rbp
nopl   0x0(%rax,%rax,1)
movsd  -0x10(%rcx,%rbp,8),%xmm0
subsd  -0x10(%rdi,%rbp,8),%xmm0
movsd  %xmm0,-0x10(%rax,%rbp,8)
movsd  -0x8(%rcx,%rbp,8),%xmm0
subsd  -0x8(%rdi,%rbp,8),%xmm0
movsd  %xmm0,-0x8(%rax,%rbp,8)
movsd  (%rcx,%rbp,8),%xmm0
subsd  (%rdi,%rbp,8),%xmm0
movsd  %xmm0,(%rax,%rbp,8)
movsd  0x8(%rcx,%rbp,8),%xmm0
subsd  0x8(%rdi,%rbp,8),%xmm0
movsd  %xmm0,0x8(%rax,%rbp,8)
add    $0x4,%rbp
cmp    %rbp,%rbx
jne    1220 <sub_dmatrix+0x120>
jmp    1180 <sub_dmatrix+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r14,%r11,8),%rax
mov    -0x50(%rsp),%rbx
lea    (%r14,%rbx,8),%rcx
lea    (%r12,%r11,8),%r10
lea    (%r12,%rbx,8),%rbp
mov    -0x60(%rsp),%rdi
lea    0x0(,%rdi,8),%r11
add    %r13,%r11
lea    0x0(,%rbx,8),%r15
add    %r13,%r15
cmp    %rbp,%rax
mov    %rdx,%rbp
setb   %dl
cmp    %rcx,%r10
setb   %bl
cmp    %r15,%rax
setb   %al
cmp    %rcx,%r11
mov    -0x60(%rsp),%r11
setb   %dil
mov    %r11,%rcx
test   %bl,%dl
mov    %rbp,%rdx
jne    11b6 <sub_dmatrix+0xb6>
mov    %r11,%rcx
and    %dil,%al
jne    11b6 <sub_dmatrix+0xb6>
cmpq   $0x4,-0x20(%rsp)
jae    12fa <sub_dmatrix+0x1fa>
xor    %ecx,%ecx
jmp    1387 <sub_dmatrix+0x287>
mov    -0x48(%rsp),%rax
lea    (%r14,%rax,8),%r15
lea    0x0(,%rax,8),%r10
add    %r13,%r10
lea    (%r12,%rax,8),%rbx
mov    -0x40(%rsp),%r11
xor    %ecx,%ecx
nopl   0x0(%rax)
movupd -0x30(%rbx,%rcx,8),%xmm0
movupd -0x20(%rbx,%rcx,8),%xmm1
movupd -0x30(%r10,%rcx,8),%xmm2
subpd  %xmm2,%xmm0
movupd -0x20(%r10,%rcx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,-0x30(%r15,%rcx,8)
movupd %xmm1,-0x20(%r15,%rcx,8)
movupd -0x10(%rbx,%rcx,8),%xmm0
movupd (%rbx,%rcx,8),%xmm1
movupd -0x10(%r10,%rcx,8),%xmm2
subpd  %xmm2,%xmm0
movupd (%r10,%rcx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,-0x10(%r15,%rcx,8)
movupd %xmm1,(%r15,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%r11
jne    1320 <sub_dmatrix+0x220>
testb  $0x1,-0x28(%rsp)
mov    -0x10(%rsp),%r9
mov    -0x18(%rsp),%r8
mov    %rbp,%rdx
mov    -0x60(%rsp),%r11
je     13d3 <sub_dmatrix+0x2d3>
add    %r11,%rcx
movupd (%r12,%rcx,8),%xmm0
movupd 0x10(%r12,%rcx,8),%xmm1
movupd 0x0(%r13,%rcx,8),%xmm2
subpd  %xmm2,%xmm0
movupd 0x10(%r13,%rcx,8),%xmm2
subpd  %xmm2,%xmm1
movupd %xmm0,(%r14,%rcx,8)
movupd %xmm1,0x10(%r14,%rcx,8)
mov    -0x38(%rsp),%rcx
mov    -0x30(%rsp),%rax
cmp    %rax,-0x58(%rsp)
je     1180 <sub_dmatrix+0x80>
jmp    11b6 <sub_dmatrix+0xb6>

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

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