void init_old_coord(double nAtoms, double delta_t, double **coord,
                    double **atomVelocities, double **old_coord) {
  int i, j;
  for (i = 0; i < nAtoms; i++) {
    for (j = 0; j < 3; j++) {
      old_coord[i][j] = coord[i][j] - atomVelocities[i][j] * delta_t;
    }
  }
}


x86 assembly (clang, -O0):
<init_old_coord>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11ca <init_old_coord+0xca>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    11b7 <init_old_coord+0xb7>
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    113c <init_old_coord+0x3c>
jmp    11bc <init_old_coord+0xbc>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1121 <init_old_coord+0x21>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_old_coord>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jbe    1175 <init_old_coord+0x75>
xor    %eax,%eax
nopl   0x0(%rax)
mov    (%rdi,%rax,8),%r8
mov    (%rsi,%rax,8),%rcx
mov    (%rdx,%rax,8),%r9
movsd  (%r8),%xmm2
movsd  (%rcx),%xmm3
mulsd  %xmm1,%xmm3
subsd  %xmm3,%xmm2
movsd  %xmm2,(%r9)
movsd  0x8(%r8),%xmm2
movsd  0x8(%rcx),%xmm3
mulsd  %xmm1,%xmm3
subsd  %xmm3,%xmm2
movsd  %xmm2,0x8(%r9)
movsd  0x10(%rcx),%xmm2
movsd  0x10(%r8),%xmm3
mulsd  %xmm1,%xmm2
add    $0x1,%rax
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
subsd  %xmm2,%xmm3
ucomisd %xmm4,%xmm0
movsd  %xmm3,0x10(%r9)
ja     1110 <init_old_coord+0x10>
ret

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

LLVM IR (-O2):
define void @init_old_coord(double %0, double %1, double** nocapture %2, double** nocapture %3, double** nocapture %4) {
%6 = fcmp ogt double %0, 0.000000e+00
br i1 %6, label %7, label %37
7: ; preds = %5, %7
%8 = phi i64 [ %33, %7 ], [ 0, %5 ]
%9 = getelementptr inbounds double*, double** %2, i64 %8
%10 = load double*, double** %9
%11 = getelementptr inbounds double*, double** %3, i64 %8
%12 = load double*, double** %11
%13 = getelementptr inbounds double*, double** %4, i64 %8
%14 = load double*, double** %13
%15 = load double, double* %10
%16 = load double, double* %12
%17 = fneg double %16
%18 = tail call double @llvm.fmuladd.f64(double %17, double %1, double %15)
store double %18, double* %14
%19 = getelementptr inbounds double, double* %10, i64 1
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %12, i64 1
%22 = load double, double* %21
%23 = fneg double %22
%24 = tail call double @llvm.fmuladd.f64(double %23, double %1, double %20)
%25 = getelementptr inbounds double, double* %14, i64 1
store double %24, double* %25
%26 = getelementptr inbounds double, double* %10, i64 2
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %12, i64 2
%29 = load double, double* %28
%30 = fneg double %29
%31 = tail call double @llvm.fmuladd.f64(double %30, double %1, double %27)
%32 = getelementptr inbounds double, double* %14, i64 2
store double %31, double* %32
%33 = add nuw i64 %8, 1
%34 = trunc i64 %33 to i32
%35 = sitofp i32 %34 to double
%36 = fcmp olt double %35, %0
br i1 %36, label %7, label %37
37: ; preds = %7, %5
ret void
}