void push_velocity(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++) {
      vj[j][k] += dt * a[j][k];
    }
  }
}


x86 assembly (clang, -O0):
<push_velocity>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119b <push_velocity+0x9b>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1188 <push_velocity+0x88>
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <push_velocity+0x2e>
jmp    118d <push_velocity+0x8d>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111b <push_velocity+0x1b>
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_velocity>:
test   %edx,%edx
jle    1189 <push_velocity+0x89>
mov    %edx,%eax
cmp    $0x1,%edx
je     112c <push_velocity+0x2c>
lea    0x0(,%rax,8),%rcx
lea    (%rcx,%rcx,2),%rcx
lea    (%rsi,%rcx,1),%rdx
cmp    %rdi,%rdx
jbe    118a <push_velocity+0x8a>
add    %rdi,%rcx
cmp    %rsi,%rcx
jbe    118a <push_velocity+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_velocity+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_velocity+0xa0>
cmp    %rax,%r8
je     1189 <push_velocity+0x89>
jmp    112f <push_velocity+0x2f>

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

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