void push_position(double (*xj)[3], double (*vj)[3], double (*a)[3], double dt,
                   int nj) {
  int j, k;
  for (j = 0; j < nj; j++) {
    for (k = 0; k < 3; k++) {
      xj[j][k] += dt * vj[j][k];
    }
  }
}


x86 assembly (clang, -O0):
<push_position>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    119f <push_position+0x9f>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    118c <push_position+0x8c>
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x28(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1132 <push_position+0x32>
jmp    1191 <push_position+0x91>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    111f <push_position+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_position>:
test   %ecx,%ecx
jle    1189 <push_position+0x89>
mov    %ecx,%eax
cmp    $0x1,%ecx
je     112c <push_position+0x2c>
lea    0x0(,%rax,8),%rcx
lea    (%rcx,%rcx,2),%rcx
lea    (%rsi,%rcx,1),%rdx
cmp    %rdi,%rdx
jbe    118a <push_position+0x8a>
add    %rdi,%rcx
cmp    %rsi,%rcx
jbe    118a <push_position+0x8a>
xor    %r8d,%r8d
lea    (%r8,%r8,2),%rcx
lea    0x10(,%rcx,8),%rcx
sub    %r8,%rax
xchg   %ax,%ax
movsd  -0x10(%rsi,%rcx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  -0x10(%rdi,%rcx,1),%xmm1
movsd  %xmm1,-0x10(%rdi,%rcx,1)
movsd  -0x8(%rsi,%rcx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  -0x8(%rdi,%rcx,1),%xmm1
movsd  %xmm1,-0x8(%rdi,%rcx,1)
movsd  (%rsi,%rcx,1),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi,%rcx,1),%xmm1
movsd  %xmm1,(%rdi,%rcx,1)
add    $0x18,%rcx
add    $0xffffffffffffffff,%rax
jne    1140 <push_position+0x40>
ret
mov    %eax,%r8d
and    $0xfffffffe,%r8d
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
xor    %edx,%edx
mov    %r8,%rcx
xchg   %ax,%ax
movsd  (%rsi,%rdx,1),%xmm2
movsd  0x8(%rsi,%rdx,1),%xmm3
movhpd 0x18(%rsi,%rdx,1),%xmm2
movsd  0x10(%rsi,%rdx,1),%xmm4
movsd  (%rdi,%rdx,1),%xmm5
movsd  0x8(%rdi,%rdx,1),%xmm6
movsd  0x10(%rdi,%rdx,1),%xmm7
movhpd 0x18(%rdi,%rdx,1),%xmm5
mulpd  %xmm1,%xmm2
addpd  %xmm5,%xmm2
movhpd 0x20(%rsi,%rdx,1),%xmm3
movhpd 0x20(%rdi,%rdx,1),%xmm6
mulpd  %xmm1,%xmm3
addpd  %xmm6,%xmm3
movhpd 0x28(%rsi,%rdx,1),%xmm4
movhpd 0x28(%rdi,%rdx,1),%xmm7
mulpd  %xmm1,%xmm4
addpd  %xmm7,%xmm4
movapd %xmm3,%xmm5
unpckhpd %xmm4,%xmm5
shufpd $0x2,%xmm2,%xmm4
unpcklpd %xmm3,%xmm2
movupd %xmm2,(%rdi,%rdx,1)
movupd %xmm4,0x10(%rdi,%rdx,1)
movupd %xmm5,0x20(%rdi,%rdx,1)
add    $0x30,%rdx
add    $0xfffffffffffffffe,%rcx
jne    11a0 <push_position+0xa0>
cmp    %rax,%r8
je     1189 <push_position+0x89>
jmp    112f <push_position+0x2f>

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

LLVM IR (-O2):
define void @push_position([3 x double]* nocapture %0, [3 x double]* nocapture %1, [3 x double]* nocapture readnone %2, double %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %94
7: ; preds = %5
%8 = zext i32 %4 to i64
%9 = icmp eq i32 %4, 1
br i1 %9, label %73, label %10
10: ; preds = %7
%11 = getelementptr [3 x double], [3 x double]* %0, i64 %8, i64 0
%12 = getelementptr [3 x double], [3 x double]* %1, i64 %8, i64 0
%13 = bitcast double* %12 to [3 x double]*
%14 = icmp ugt [3 x double]* %13, %0
%15 = bitcast double* %11 to [3 x double]*
%16 = icmp ugt [3 x double]* %15, %1
%17 = and i1 %14, %16
br i1 %17, label %73, label %18
18: ; preds = %10
%19 = and i64 %8, 4294967294
%20 = insertelement <2 x double> poison, double %3, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
br label %22
22: ; preds = %22, %18
%23 = phi i64 [ 0, %18 ], [ %69, %22 ]
%24 = or i64 %23, 1
%25 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %23, i64 0
%26 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %24, i64 0
%27 = load double, double* %25
%28 = load double, double* %26
%29 = insertelement <2 x double> poison, double %27, i64 0
%30 = insertelement <2 x double> %29, double %28, i64 1
%31 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %23, i64 0
%32 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %24, i64 0
%33 = load double, double* %31
%34 = load double, double* %32
%35 = insertelement <2 x double> poison, double %33, i64 0
%36 = insertelement <2 x double> %35, double %34, i64 1
%37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %30, <2 x double> %36)
%38 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %23, i64 1
%39 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %24, i64 1
%40 = load double, double* %38
%41 = load double, double* %39
%42 = insertelement <2 x double> poison, double %40, i64 0
%43 = insertelement <2 x double> %42, double %41, i64 1
%44 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %23, i64 1
%45 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %24, i64 1
%46 = load double, double* %44
%47 = load double, double* %45
%48 = insertelement <2 x double> poison, double %46, i64 0
%49 = insertelement <2 x double> %48, double %47, i64 1
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %43, <2 x double> %49)
%51 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %23, i64 2
%52 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %24, i64 2
%53 = load double, double* %51
%54 = load double, double* %52
%55 = insertelement <2 x double> poison, double %53, i64 0
%56 = insertelement <2 x double> %55, double %54, i64 1
%57 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %23, i64 2
%58 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %24, i64 2
%59 = load double, double* %57
%60 = load double, double* %58
%61 = insertelement <2 x double> poison, double %59, i64 0
%62 = insertelement <2 x double> %61, double %60, i64 1
%63 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %21, <2 x double> %56, <2 x double> %62)
%64 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %23, i64 0
%65 = bitcast double* %64 to <6 x double>*
%66 = shufflevector <2 x double> %37, <2 x double> %50, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%67 = shufflevector <2 x double> %63, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%68 = shufflevector <4 x double> %66, <4 x double> %67, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %68, <6 x double>* %65
%69 = add nuw i64 %23, 2
%70 = icmp eq i64 %69, %19
br i1 %70, label %71, label %22
71: ; preds = %22
%72 = icmp eq i64 %19, %8
br i1 %72, label %94, label %73
73: ; preds = %10, %7, %71
%74 = phi i64 [ 0, %10 ], [ 0, %7 ], [ %19, %71 ]
br label %75
75: ; preds = %73, %75
%76 = phi i64 [ %92, %75 ], [ %74, %73 ]
%77 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %76, i64 0
%78 = load double, double* %77
%79 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %76, i64 0
%80 = load double, double* %79
%81 = tail call double @llvm.fmuladd.f64(double %3, double %78, double %80)
store double %81, double* %79
%82 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %76, i64 1
%83 = load double, double* %82
%84 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %76, i64 1
%85 = load double, double* %84
%86 = tail call double @llvm.fmuladd.f64(double %3, double %83, double %85)
store double %86, double* %84
%87 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %76, i64 2
%88 = load double, double* %87
%89 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %76, i64 2
%90 = load double, double* %89
%91 = tail call double @llvm.fmuladd.f64(double %3, double %88, double %90)
store double %91, double* %89
%92 = add nuw nsw i64 %76, 1
%93 = icmp eq i64 %92, %8
br i1 %93, label %94, label %75
94: ; preds = %75, %71, %5
ret void
}