void move_position(double **d, long nr, long nc, double *mpos) {
  long i, j;
  for (i = 1; i <= nr; i++)
    for (j = 1; j <= nc; j++)
      d[i][j] -= mpos[j];
}


x86 assembly (clang, -O0):
<move_position>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1192 <move_position+0x92>
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     117c <move_position+0x7c>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1132 <move_position+0x32>
jmp    1181 <move_position+0x81>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <move_position+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_position>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rsi,%rsi
jle    1344 <move_position+0x244>
mov    %rdx,%r12
lea    0x1(%rdx),%r15
lea    0x8(%rcx),%rax
mov    %rax,-0x8(%rsp)
lea    (%rcx,%rdx,8),%r9
add    $0x8,%r9
lea    -0x4(%rdx),%r11
mov    %r11,-0x10(%rsp)
shr    $0x2,%r11
add    $0x1,%r11
mov    %rdx,%r8
and    $0xfffffffffffffffc,%r8
lea    0x1(%r8),%rax
mov    %rax,-0x18(%rsp)
mov    %r11,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,-0x20(%rsp)
lea    0x18(%rcx),%r13
mov    $0x1,%r10d
jmp    1180 <move_position+0x80>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%r10),%rax
cmp    %rsi,%r10
mov    %rax,%r10
je     1344 <move_position+0x244>
test   %r12,%r12
jle    1170 <move_position+0x70>
mov    (%rdi,%r10,8),%rbp
mov    $0x1,%r14d
cmp    $0x4,%r12
jb     1280 <move_position+0x180>
lea    0x8(%rbp),%rax
cmp    %r9,%rax
jae    11b8 <move_position+0xb8>
lea    0x0(,%r15,8),%rax
add    %rbp,%rax
cmp    %rax,-0x8(%rsp)
jb     1280 <move_position+0x180>
cmpq   $0x4,-0x10(%rsp)
jae    11c4 <move_position+0xc4>
xor    %eax,%eax
jmp    1232 <move_position+0x132>
mov    -0x20(%rsp),%rbx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movupd 0x8(%rcx,%rax,8),%xmm0
movupd 0x18(%rcx,%rax,8),%xmm1
movupd 0x8(%rbp,%rax,8),%xmm2
subpd  %xmm0,%xmm2
movupd 0x18(%rbp,%rax,8),%xmm0
subpd  %xmm1,%xmm0
movupd 0x28(%rbp,%rax,8),%xmm1
movupd 0x38(%rbp,%rax,8),%xmm3
movupd %xmm2,0x8(%rbp,%rax,8)
movupd %xmm0,0x18(%rbp,%rax,8)
movupd 0x28(%rcx,%rax,8),%xmm0
subpd  %xmm0,%xmm1
movupd 0x38(%rcx,%rax,8),%xmm0
subpd  %xmm0,%xmm3
movupd %xmm1,0x28(%rbp,%rax,8)
movupd %xmm3,0x38(%rbp,%rax,8)
add    $0x8,%rax
add    $0xfffffffffffffffe,%rbx
jne    11d0 <move_position+0xd0>
test   $0x1,%r11b
je     126b <move_position+0x16b>
shl    $0x3,%rax
or     $0x8,%rax
movupd (%rcx,%rax,1),%xmm0
movupd 0x10(%rcx,%rax,1),%xmm1
movupd 0x0(%rbp,%rax,1),%xmm2
subpd  %xmm0,%xmm2
movupd 0x10(%rbp,%rax,1),%xmm0
subpd  %xmm1,%xmm0
movupd %xmm2,0x0(%rbp,%rax,1)
movupd %xmm0,0x10(%rbp,%rax,1)
mov    -0x18(%rsp),%r14
cmp    %r12,%r8
je     1170 <move_position+0x70>
nopl   0x0(%rax)
mov    %r15d,%ebx
sub    %r14d,%ebx
mov    %r12,%rax
sub    %r14,%rax
and    $0x3,%rbx
je     12be <move_position+0x1be>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x0(%rbp,%r14,8),%xmm0
subsd  (%rcx,%r14,8),%xmm0
movsd  %xmm0,0x0(%rbp,%r14,8)
add    $0x1,%r14
add    $0xffffffffffffffff,%rbx
jne    12a0 <move_position+0x1a0>
cmp    $0x3,%rax
jb     1170 <move_position+0x70>
mov    %r12,%rdx
sub    %r14,%rdx
lea    0x18(,%r14,8),%rbx
add    %rbp,%rbx
lea    0x0(,%r14,8),%rbp
add    %r13,%rbp
mov    $0xffffffffffffffff,%rax
nopl   0x0(%rax,%rax,1)
movsd  -0x10(%rbx,%rax,8),%xmm0
subsd  -0x10(%rbp,%rax,8),%xmm0
movsd  -0x8(%rbx,%rax,8),%xmm1
movsd  %xmm0,-0x10(%rbx,%rax,8)
subsd  -0x8(%rbp,%rax,8),%xmm1
movsd  %xmm1,-0x8(%rbx,%rax,8)
movsd  (%rbx,%rax,8),%xmm0
subsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,(%rbx,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
subsd  0x8(%rbp,%rax,8),%xmm0
movsd  %xmm0,0x8(%rbx,%rax,8)
add    $0x4,%rax
cmp    %rax,%rdx
jne    12f0 <move_position+0x1f0>
jmp    1170 <move_position+0x70>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @move_position(double** %0, i64 %1, i64 %2, double* %3) {
%5 = alloca double**
%6 = alloca i64
%7 = alloca i64
%8 = alloca double*
%9 = alloca i64
%10 = alloca i64
store double** %0, double*** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store double* %3, double** %8
store i64 1, i64* %9
br label %11
11: ; preds = %37, %4
%12 = load i64, i64* %9
%13 = load i64, i64* %6
%14 = icmp sle i64 %12, %13
br i1 %14, label %15, label %40
15: ; preds = %11
store i64 1, i64* %10
br label %16
16: ; preds = %33, %15
%17 = load i64, i64* %10
%18 = load i64, i64* %7
%19 = icmp sle i64 %17, %18
br i1 %19, label %20, label %36
20: ; preds = %16
%21 = load double*, double** %8
%22 = load i64, i64* %10
%23 = getelementptr inbounds double, double* %21, i64 %22
%24 = load double, double* %23
%25 = load double**, double*** %5
%26 = load i64, i64* %9
%27 = getelementptr inbounds double*, double** %25, i64 %26
%28 = load double*, double** %27
%29 = load i64, i64* %10
%30 = getelementptr inbounds double, double* %28, i64 %29
%31 = load double, double* %30
%32 = fsub double %31, %24
store double %32, double* %30
br label %33
33: ; preds = %20
%34 = load i64, i64* %10
%35 = add nsw i64 %34, 1
store i64 %35, i64* %10
br label %16
36: ; preds = %16
br label %37
37: ; preds = %36
%38 = load i64, i64* %9
%39 = add nsw i64 %38, 1
store i64 %39, i64* %9
br label %11
40: ; preds = %11
ret void
}

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