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


x86 assembly (clang, -O0):
<init_old_coord>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11c0 <init_old_coord+0xc0>
movl   $0x0,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jge    11ad <init_old_coord+0xad>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%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    1132 <init_old_coord+0x32>
jmp    11b2 <init_old_coord+0xb2>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    111f <init_old_coord+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_old_coord>:
test   %edi,%edi
jle    1171 <init_old_coord+0x71>
xorpd  0xef4(%rip),%xmm0
mov    %edi,%r8d
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rdx,%rdi,8),%r9
mov    (%rsi,%rdi,8),%rax
mov    (%rcx,%rdi,8),%r10
movsd  (%rax),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%r9),%xmm1
movsd  %xmm1,(%r10)
movsd  0x8(%rax),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x8(%r9),%xmm1
movsd  %xmm1,0x8(%r10)
movsd  0x10(%rax),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x10(%r9),%xmm1
movsd  %xmm1,0x10(%r10)
add    $0x1,%rdi
cmp    %rdi,%r8
jne    1120 <init_old_coord+0x20>
ret

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

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