void force_energy_calc(int nAtoms, int iter, int deltaWrite, double box,
                       double cutoff2, double Ar_eps, double Ar_sigma6,
                       double *Tot_potential_en, double **coord,
                       double **atomForces, double **old_atomForces) {
  int atom1;
  int atom2;
  double dist2;
  double dist2d;
  double dist6d;
  double sigma_dist_6;
  int j;
  double component[3] = {0.0, 0.0, 0.0};
  double ff;
  double sump;
  sump = 0.0;
  for (atom1 = 0; atom1 < nAtoms; atom1++) {
    for (j = 0; j < 3; j++) {
      old_atomForces[atom1][j] = atomForces[atom1][j];
      atomForces[atom1][j] = 0.0;
    }
  }
  for (atom1 = 0; atom1 < nAtoms - 1; atom1++) {
    for (atom2 = atom1 + 1; atom2 < nAtoms; atom2++) {
      dist2 = 0;
      for (j = 0; j < 3; j++) {
        component[j] = coord[atom1][j] - coord[atom2][j];
        if (component[j] < -box / 2.0) {
          component[j] += box;
        } else if (component[j] > box / 2.0) {
          component[j] -= box;
        }
        dist2 += component[j] * component[j];
      }
      if (dist2 < cutoff2) {
        dist2d = 1.0 / dist2;
        dist6d = dist2d * dist2d * dist2d;
        sigma_dist_6 = Ar_sigma6 * dist6d;
        ff = 48 * Ar_eps * dist2d * sigma_dist_6 * (sigma_dist_6 - 0.5);
        for (j = 0; j < 3; j++) {
          atomForces[atom1][j] += ff * component[j];
          atomForces[atom2][j] += -ff * component[j];
        }
        if (iter % deltaWrite == 0) {
          sump += sigma_dist_6 * (sigma_dist_6 - 1.0);
        }
      } else {
        for (j = 0; j < 3; j++) {
          atomForces[atom1][j] += 0.0;
          atomForces[atom2][j] += 0.0;
        }
      }
    }
  }
  if (iter % deltaWrite == 0) {
    *Tot_potential_en = 4.0 * Ar_eps * sump;
  }
}


x86 assembly (clang, -O0):
<force_energy_calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11ed <force_energy_calc+0xdd>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    11da <force_energy_calc+0xca>
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1180 <force_energy_calc+0x70>
jmp    11df <force_energy_calc+0xcf>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    116d <force_energy_calc+0x5d>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1537 <force_energy_calc+0x427>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1524 <force_energy_calc+0x414>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    134f <force_energy_calc+0x23f>
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movslq -0x74(%rbp),%rax
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm1
ff ff
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd85(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    12c9 <force_energy_calc+0x1b9>
movsd  -0x18(%rbp),%xmm0
movslq -0x74(%rbp),%rax
addsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
jmp    1315 <force_energy_calc+0x205>
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  -0x18(%rbp),%xmm1
movsd  0xd3d(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1310 <force_energy_calc+0x200>
movsd  -0x18(%rbp),%xmm1
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
jmp    1315 <force_energy_calc+0x205>
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm2
ff ff
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1229 <force_energy_calc+0x119>
movsd  -0x58(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14b3 <force_energy_calc+0x3a3>
movsd  0xcad(%rip),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xc70(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  0xc4c(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    1470 <force_energy_calc+0x360>
movsd  -0x98(%rbp),%xmm0
ff
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm2
ff ff
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x98(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm2
ff ff
mov    -0x48(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    13d3 <force_energy_calc+0x2c3>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    14ae <force_energy_calc+0x39e>
movsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  0xb86(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    1511 <force_energy_calc+0x401>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    150c <force_energy_calc+0x3fc>
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
xorps  %xmm0,%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%rax
movslq -0x50(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x74(%rbp),%rcx
xorps  %xmm0,%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    14ba <force_energy_calc+0x3aa>
jmp    1511 <force_energy_calc+0x401>
jmp    1516 <force_energy_calc+0x406>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    120e <force_energy_calc+0xfe>
jmp    1529 <force_energy_calc+0x419>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11f4 <force_energy_calc+0xe4>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1564 <force_energy_calc+0x454>
movsd  0xab1(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<force_energy_calc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movsd  %xmm2,-0x10(%rsp)
mov    %edx,%r10d
mov    %esi,%r15d
xorpd  %xmm8,%xmm8
test   %edi,%edi
mov    %rcx,-0x8(%rsp)
jle    149f <force_energy_calc+0x39f>
mov    0x38(%rsp),%rax
mov    %edi,%ecx
cmp    $0x1,%edi
jne    113b <force_energy_calc+0x3b>
xor    %edx,%edx
jmp    11d9 <force_energy_calc+0xd9>
mov    %ecx,%esi
and    $0xfffffffe,%esi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r9,%rdx,8),%rbp
mov    (%rax,%rdx,8),%rbx
movsd  0x0(%rbp),%xmm2
movsd  %xmm2,(%rbx)
movq   $0x0,0x0(%rbp)
movsd  0x8(%rbp),%xmm2
movsd  %xmm2,0x8(%rbx)
movq   $0x0,0x8(%rbp)
movsd  0x10(%rbp),%xmm2
movsd  %xmm2,0x10(%rbx)
movq   $0x0,0x10(%rbp)
mov    0x8(%r9,%rdx,8),%rbp
mov    0x8(%rax,%rdx,8),%rbx
movsd  0x0(%rbp),%xmm2
movsd  %xmm2,(%rbx)
movq   $0x0,0x0(%rbp)
movsd  0x8(%rbp),%xmm2
movsd  %xmm2,0x8(%rbx)
movq   $0x0,0x8(%rbp)
movsd  0x10(%rbp),%xmm2
movsd  %xmm2,0x10(%rbx)
movq   $0x0,0x10(%rbp)
add    $0x2,%rdx
cmp    %rdx,%rsi
jne    1150 <force_energy_calc+0x50>
test   $0x1,%cl
je     1219 <force_energy_calc+0x119>
mov    (%r9,%rdx,8),%rsi
mov    (%rax,%rdx,8),%rax
movsd  (%rsi),%xmm2
movsd  %xmm2,(%rax)
movq   $0x0,(%rsi)
movsd  0x8(%rsi),%xmm2
movsd  %xmm2,0x8(%rax)
movq   $0x0,0x8(%rsi)
movsd  0x10(%rsi),%xmm2
movsd  %xmm2,0x10(%rax)
movq   $0x0,0x10(%rsi)
cmp    $0x2,%edi
jl     149f <force_energy_calc+0x39f>
add    $0xffffffff,%edi
movsd  0xdd2(%rip),%xmm15
mulsd  %xmm0,%xmm15
movsd  0xdcc(%rip),%xmm13
mulsd  %xmm0,%xmm13
movsd  0xdc6(%rip),%xmm12
mulsd  -0x10(%rsp),%xmm12
xorpd  %xmm14,%xmm14
xor    %r14d,%r14d
movsd  0xdb6(%rip),%xmm9
movsd  0xd95(%rip),%xmm10
mov    %rcx,%r13
mov    %r8,%rsi
mov    %r9,%rbp
xorpd  %xmm8,%xmm8
jmp    1295 <force_energy_calc+0x195>
nopl   0x0(%rax,%rax,1)
add    $0x8,%rbp
add    $0x8,%rsi
add    $0xffffffffffffffff,%r13
cmp    %rdi,%r14
je     149f <force_energy_calc+0x39f>
mov    %r14,%r12
add    $0x1,%r14
cmp    %rcx,%r14
jae    1280 <force_energy_calc+0x180>
mov    (%r8,%r12,8),%rbx
mov    $0x1,%r11d
jmp    131c <force_energy_calc+0x21c>
nopl   (%rax)
mov    (%r9,%r12,8),%rax
mov    0x0(%rbp,%r11,8),%rdx
movsd  (%rax),%xmm2
addsd  %xmm14,%xmm2
movsd  %xmm2,(%rax)
movsd  (%rdx),%xmm2
addsd  %xmm14,%xmm2
movsd  %xmm2,(%rdx)
movsd  0x8(%rax),%xmm2
addsd  %xmm14,%xmm2
movsd  %xmm2,0x8(%rax)
movsd  0x8(%rdx),%xmm2
addsd  %xmm14,%xmm2
movsd  %xmm2,0x8(%rdx)
movsd  0x10(%rax),%xmm2
addsd  %xmm14,%xmm2
movsd  %xmm2,0x10(%rax)
movsd  0x10(%rdx),%xmm2
addsd  %xmm14,%xmm2
movsd  %xmm2,0x10(%rdx)
add    $0x1,%r11
cmp    %r11,%r13
je     1280 <force_energy_calc+0x180>
mov    (%rsi,%r11,8),%rax
movsd  (%rbx),%xmm7
subsd  (%rax),%xmm7
ucomisd %xmm7,%xmm15
jbe    1340 <force_energy_calc+0x240>
addsd  %xmm0,%xmm7
jmp    134b <force_energy_calc+0x24b>
cs nopw 0x0(%rax,%rax,1)
nop
ucomisd %xmm13,%xmm7
jbe    134b <force_energy_calc+0x24b>
subsd  %xmm0,%xmm7
movsd  0x8(%rbx),%xmm2
subsd  0x8(%rax),%xmm2
ucomisd %xmm2,%xmm15
jbe    1370 <force_energy_calc+0x270>
addsd  %xmm0,%xmm2
jmp    137b <force_energy_calc+0x27b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
ucomisd %xmm13,%xmm2
jbe    137b <force_energy_calc+0x27b>
subsd  %xmm0,%xmm2
movsd  0x10(%rbx),%xmm4
subsd  0x10(%rax),%xmm4
ucomisd %xmm4,%xmm15
jbe    13a0 <force_energy_calc+0x2a0>
addsd  %xmm0,%xmm4
jmp    13ab <force_energy_calc+0x2ab>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
ucomisd %xmm13,%xmm4
jbe    13ab <force_energy_calc+0x2ab>
subsd  %xmm0,%xmm4
movapd %xmm7,%xmm5
mulsd  %xmm7,%xmm5
addsd  %xmm14,%xmm5
movapd %xmm2,%xmm6
mulsd  %xmm2,%xmm6
addsd  %xmm5,%xmm6
movapd %xmm4,%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm6,%xmm5
ucomisd %xmm5,%xmm1
jbe    12b0 <force_energy_calc+0x1b0>
movapd %xmm9,%xmm6
divsd  %xmm5,%xmm6
movapd %xmm6,%xmm11
mulsd  %xmm6,%xmm11
mulsd  %xmm6,%xmm11
mulsd  %xmm3,%xmm11
mulsd  %xmm12,%xmm6
mulsd  %xmm11,%xmm6
movapd %xmm11,%xmm5
addsd  %xmm10,%xmm5
mulsd  %xmm6,%xmm5
mov    (%r9,%r12,8),%rax
mov    0x0(%rbp,%r11,8),%rdx
mulsd  %xmm5,%xmm7
movsd  (%rax),%xmm6
addsd  %xmm7,%xmm6
movsd  %xmm6,(%rax)
movsd  (%rdx),%xmm6
subsd  %xmm7,%xmm6
movsd  %xmm6,(%rdx)
mulsd  %xmm5,%xmm2
movsd  0x8(%rax),%xmm6
addsd  %xmm2,%xmm6
movsd  %xmm6,0x8(%rax)
movsd  0x8(%rdx),%xmm6
subsd  %xmm2,%xmm6
movsd  %xmm6,0x8(%rdx)
mulsd  %xmm4,%xmm5
movsd  0x10(%rax),%xmm2
addsd  %xmm5,%xmm2
movsd  %xmm2,0x10(%rax)
movsd  0x10(%rdx),%xmm2
subsd  %xmm5,%xmm2
movsd  %xmm2,0x10(%rdx)
mov    %r15d,%eax
cltd
idiv   %r10d
test   %edx,%edx
jne    130f <force_energy_calc+0x20f>
movapd %xmm11,%xmm2
addsd  0xb90(%rip),%xmm2
mulsd  %xmm11,%xmm2
addsd  %xmm2,%xmm8
jmp    130f <force_energy_calc+0x20f>
mov    %r15d,%eax
cltd
idiv   %r10d
test   %edx,%edx
jne    14c6 <force_energy_calc+0x3c6>
movsd  -0x10(%rsp),%xmm0
mulsd  0xb70(%rip),%xmm0
mulsd  %xmm8,%xmm0
mov    -0x8(%rsp),%rax
movsd  %xmm0,(%rax)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @force_energy_calc(i32 %0, i32 %1, i32 %2, double %3, double %4, double %5, double %6, double* %7, double** %8, double** %9, double** %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double*
%20 = alloca double**
%21 = alloca double**
%22 = alloca double**
%23 = alloca i32
%24 = alloca i32
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca i32
%30 = alloca [3 x double]
%31 = alloca double
%32 = alloca double
store i32 %0, i32* %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store double %3, double* %15
store double %4, double* %16
store double %5, double* %17
store double %6, double* %18
store double* %7, double** %19
store double** %8, double*** %20
store double** %9, double*** %21
store double** %10, double*** %22
%33 = bitcast [3 x double]* %30 to i8*
store double 0.000000e+00, double* %32
store i32 0, i32* %23
br label %34
34: ; preds = %72, %11
%35 = load i32, i32* %23
%36 = load i32, i32* %12
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %75
38: ; preds = %34
store i32 0, i32* %29
br label %39
39: ; preds = %68, %38
%40 = load i32, i32* %29
%41 = icmp slt i32 %40, 3
br i1 %41, label %42, label %71
42: ; preds = %39
%43 = load double**, double*** %21
%44 = load i32, i32* %23
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double*, double** %43, i64 %45
%47 = load double*, double** %46
%48 = load i32, i32* %29
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double**, double*** %22
%53 = load i32, i32* %23
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double*, double** %52, i64 %54
%56 = load double*, double** %55
%57 = load i32, i32* %29
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
store double %51, double* %59
%60 = load double**, double*** %21
%61 = load i32, i32* %23
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double*, double** %60, i64 %62
%64 = load double*, double** %63
%65 = load i32, i32* %29
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
store double 0.000000e+00, double* %67
br label %68
68: ; preds = %42
%69 = load i32, i32* %29
%70 = add nsw i32 %69, 1
store i32 %70, i32* %29
br label %39
71: ; preds = %39
br label %72
72: ; preds = %71
%73 = load i32, i32* %23
%74 = add nsw i32 %73, 1
store i32 %74, i32* %23
br label %34
75: ; preds = %34
store i32 0, i32* %23
br label %76
76: ; preds = %268, %75
%77 = load i32, i32* %23
%78 = load i32, i32* %12
%79 = sub nsw i32 %78, 1
%80 = icmp slt i32 %77, %79
br i1 %80, label %81, label %271
81: ; preds = %76
%82 = load i32, i32* %23
%83 = add nsw i32 %82, 1
store i32 %83, i32* %24
br label %84
84: ; preds = %264, %81
%85 = load i32, i32* %24
%86 = load i32, i32* %12
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %267
88: ; preds = %84
store double 0.000000e+00, double* %25
store i32 0, i32* %29
br label %89
89: ; preds = %157, %88
%90 = load i32, i32* %29
%91 = icmp slt i32 %90, 3
br i1 %91, label %92, label %160
92: ; preds = %89
%93 = load double**, double*** %20
%94 = load i32, i32* %23
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double*, double** %93, i64 %95
%97 = load double*, double** %96
%98 = load i32, i32* %29
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %97, i64 %99
%101 = load double, double* %100
%102 = load double**, double*** %20
%103 = load i32, i32* %24
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double*, double** %102, i64 %104
%106 = load double*, double** %105
%107 = load i32, i32* %29
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = fsub double %101, %110
%112 = load i32, i32* %29
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %113
store double %111, double* %114
%115 = load i32, i32* %29
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %116
%118 = load double, double* %117
%119 = load double, double* %15
%120 = fneg double %119
%121 = fdiv double %120, 2.000000e+00
%122 = fcmp olt double %118, %121
br i1 %122, label %123, label %130
123: ; preds = %92
%124 = load double, double* %15
%125 = load i32, i32* %29
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %126
%128 = load double, double* %127
%129 = fadd double %128, %124
store double %129, double* %127
br label %146
130: ; preds = %92
%131 = load i32, i32* %29
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %132
%134 = load double, double* %133
%135 = load double, double* %15
%136 = fdiv double %135, 2.000000e+00
%137 = fcmp ogt double %134, %136
br i1 %137, label %138, label %145
138: ; preds = %130
%139 = load double, double* %15
%140 = load i32, i32* %29
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %141
%143 = load double, double* %142
%144 = fsub double %143, %139
store double %144, double* %142
br label %145
145: ; preds = %138, %130
br label %146
146: ; preds = %145, %123
%147 = load i32, i32* %29
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %148
%150 = load double, double* %149
%151 = load i32, i32* %29
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %152
%154 = load double, double* %153
%155 = load double, double* %25
%156 = call double @llvm.fmuladd.f64(double %150, double %154, double %155)
store double %156, double* %25
br label %157
157: ; preds = %146
%158 = load i32, i32* %29
%159 = add nsw i32 %158, 1
store i32 %159, i32* %29
br label %89
160: ; preds = %89
%161 = load double, double* %25
%162 = load double, double* %16
%163 = fcmp olt double %161, %162
br i1 %163, label %164, label %234
164: ; preds = %160
%165 = load double, double* %25
%166 = fdiv double 1.000000e+00, %165
store double %166, double* %26
%167 = load double, double* %26
%168 = load double, double* %26
%169 = fmul double %167, %168
%170 = load double, double* %26
%171 = fmul double %169, %170
store double %171, double* %27
%172 = load double, double* %18
%173 = load double, double* %27
%174 = fmul double %172, %173
store double %174, double* %28
%175 = load double, double* %17
%176 = fmul double 4.800000e+01, %175
%177 = load double, double* %26
%178 = fmul double %176, %177
%179 = load double, double* %28
%180 = fmul double %178, %179
%181 = load double, double* %28
%182 = fsub double %181, 5.000000e-01
%183 = fmul double %180, %182
store double %183, double* %31
store i32 0, i32* %29
br label %184
184: ; preds = %219, %164
%185 = load i32, i32* %29
%186 = icmp slt i32 %185, 3
br i1 %186, label %187, label %222
187: ; preds = %184
%188 = load double, double* %31
%189 = load i32, i32* %29
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %190
%192 = load double, double* %191
%193 = load double**, double*** %21
%194 = load i32, i32* %23
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds double*, double** %193, i64 %195
%197 = load double*, double** %196
%198 = load i32, i32* %29
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %197, i64 %199
%201 = load double, double* %200
%202 = call double @llvm.fmuladd.f64(double %188, double %192, double %201)
store double %202, double* %200
%203 = load double, double* %31
%204 = fneg double %203
%205 = load i32, i32* %29
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %206
%208 = load double, double* %207
%209 = load double**, double*** %21
%210 = load i32, i32* %24
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds double*, double** %209, i64 %211
%213 = load double*, double** %212
%214 = load i32, i32* %29
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double, double* %213, i64 %215
%217 = load double, double* %216
%218 = call double @llvm.fmuladd.f64(double %204, double %208, double %217)
store double %218, double* %216
br label %219
219: ; preds = %187
%220 = load i32, i32* %29
%221 = add nsw i32 %220, 1
store i32 %221, i32* %29
br label %184
222: ; preds = %184
%223 = load i32, i32* %13
%224 = load i32, i32* %14
%225 = srem i32 %223, %224
%226 = icmp eq i32 %225, 0
br i1 %226, label %227, label %233
227: ; preds = %222
%228 = load double, double* %28
%229 = load double, double* %28
%230 = fsub double %229, 1.000000e+00
%231 = load double, double* %32
%232 = call double @llvm.fmuladd.f64(double %228, double %230, double %231)
store double %232, double* %32
br label %233
233: ; preds = %227, %222
br label %263
234: ; preds = %160
store i32 0, i32* %29
br label %235
235: ; preds = %259, %234
%236 = load i32, i32* %29
%237 = icmp slt i32 %236, 3
br i1 %237, label %238, label %262
238: ; preds = %235
%239 = load double**, double*** %21
%240 = load i32, i32* %23
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds double*, double** %239, i64 %241
%243 = load double*, double** %242
%244 = load i32, i32* %29
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %243, i64 %245
%247 = load double, double* %246
%248 = fadd double %247, 0.000000e+00
store double %248, double* %246
%249 = load double**, double*** %21
%250 = load i32, i32* %24
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds double*, double** %249, i64 %251
%253 = load double*, double** %252
%254 = load i32, i32* %29
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds double, double* %253, i64 %255
%257 = load double, double* %256
%258 = fadd double %257, 0.000000e+00
store double %258, double* %256
br label %259
259: ; preds = %238
%260 = load i32, i32* %29
%261 = add nsw i32 %260, 1
store i32 %261, i32* %29
br label %235
262: ; preds = %235
br label %263
263: ; preds = %262, %233
br label %264
264: ; preds = %263
%265 = load i32, i32* %24
%266 = add nsw i32 %265, 1
store i32 %266, i32* %24
br label %84
267: ; preds = %84
br label %268
268: ; preds = %267
%269 = load i32, i32* %23
%270 = add nsw i32 %269, 1
store i32 %270, i32* %23
br label %76
271: ; preds = %76
%272 = load i32, i32* %13
%273 = load i32, i32* %14
%274 = srem i32 %272, %273
%275 = icmp eq i32 %274, 0
br i1 %275, label %276, label %282
276: ; preds = %271
%277 = load double, double* %17
%278 = fmul double 4.000000e+00, %277
%279 = load double, double* %32
%280 = fmul double %278, %279
%281 = load double*, double** %19
store double %280, double* %281
br label %282
282: ; preds = %276, %271
ret void
}

LLVM IR (-O2):
define void @force_energy_calc(i32 %0, i32 %1, i32 %2, double %3, double %4, double %5, double %6, double* nocapture writeonly %7, double** nocapture %8, double** nocapture %9, double** nocapture %10) {
%12 = icmp sgt i32 %0, 0
br i1 %12, label %13, label %194
13: ; preds = %11
%14 = zext i32 %0 to i64
%15 = and i64 %14, 1
%16 = icmp eq i32 %0, 1
br i1 %16, label %48, label %17
17: ; preds = %13
%18 = and i64 %14, 4294967294
br label %19
19: ; preds = %19, %17
%20 = phi i64 [ 0, %17 ], [ %45, %19 ]
%21 = phi i64 [ 0, %17 ], [ %46, %19 ]
%22 = getelementptr inbounds double*, double** %9, i64 %20
%23 = load double*, double** %22
%24 = getelementptr inbounds double*, double** %10, i64 %20
%25 = load double*, double** %24
%26 = load double, double* %23
store double %26, double* %25
store double 0.000000e+00, double* %23
%27 = getelementptr inbounds double, double* %23, i64 1
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %25, i64 1
store double %28, double* %29
store double 0.000000e+00, double* %27
%30 = getelementptr inbounds double, double* %23, i64 2
%31 = load double, double* %30
%32 = getelementptr inbounds double, double* %25, i64 2
store double %31, double* %32
store double 0.000000e+00, double* %30
%33 = or i64 %20, 1
%34 = getelementptr inbounds double*, double** %9, i64 %33
%35 = load double*, double** %34
%36 = getelementptr inbounds double*, double** %10, i64 %33
%37 = load double*, double** %36
%38 = load double, double* %35
store double %38, double* %37
store double 0.000000e+00, double* %35
%39 = getelementptr inbounds double, double* %35, i64 1
%40 = load double, double* %39
%41 = getelementptr inbounds double, double* %37, i64 1
store double %40, double* %41
store double 0.000000e+00, double* %39
%42 = getelementptr inbounds double, double* %35, i64 2
%43 = load double, double* %42
%44 = getelementptr inbounds double, double* %37, i64 2
store double %43, double* %44
store double 0.000000e+00, double* %42
%45 = add nuw nsw i64 %20, 2
%46 = add i64 %21, 2
%47 = icmp eq i64 %46, %18
br i1 %47, label %48, label %19
48: ; preds = %19, %13
%49 = phi i64 [ 0, %13 ], [ %45, %19 ]
%50 = icmp eq i64 %15, 0
br i1 %50, label %63, label %51
51: ; preds = %48
%52 = getelementptr inbounds double*, double** %9, i64 %49
%53 = load double*, double** %52
%54 = getelementptr inbounds double*, double** %10, i64 %49
%55 = load double*, double** %54
%56 = load double, double* %53
store double %56, double* %55
store double 0.000000e+00, double* %53
%57 = getelementptr inbounds double, double* %53, i64 1
%58 = load double, double* %57
%59 = getelementptr inbounds double, double* %55, i64 1
store double %58, double* %59
store double 0.000000e+00, double* %57
%60 = getelementptr inbounds double, double* %53, i64 2
%61 = load double, double* %60
%62 = getelementptr inbounds double, double* %55, i64 2
store double %61, double* %62
store double 0.000000e+00, double* %60
br label %63
63: ; preds = %48, %51
%64 = icmp sgt i32 %0, 1
br i1 %64, label %65, label %194
65: ; preds = %63
%66 = add nsw i32 %0, -1
%67 = fmul double %3, -5.000000e-01
%68 = fmul double %3, 5.000000e-01
%69 = fmul double %5, 4.800000e+01
%70 = zext i32 %0 to i64
%71 = zext i32 %66 to i64
%72 = zext i32 %0 to i64
br label %77
73: ; preds = %190, %77
%74 = phi double [ %80, %77 ], [ %191, %190 ]
%75 = add nuw nsw i64 %79, 1
%76 = icmp eq i64 %81, %71
br i1 %76, label %194, label %77
77: ; preds = %65, %73
%78 = phi i64 [ 0, %65 ], [ %81, %73 ]
%79 = phi i64 [ 1, %65 ], [ %75, %73 ]
%80 = phi double [ 0.000000e+00, %65 ], [ %74, %73 ]
%81 = add nuw nsw i64 %78, 1
%82 = icmp ult i64 %81, %70
br i1 %82, label %83, label %73
83: ; preds = %77
%84 = getelementptr inbounds double*, double** %8, i64 %78
%85 = load double*, double** %84
%86 = getelementptr inbounds double*, double** %9, i64 %78
%87 = getelementptr inbounds double, double* %85, i64 1
%88 = getelementptr inbounds double, double* %85, i64 2
br label %89
89: ; preds = %83, %190
%90 = phi i64 [ %79, %83 ], [ %192, %190 ]
%91 = phi double [ %80, %83 ], [ %191, %190 ]
%92 = getelementptr inbounds double*, double** %8, i64 %90
%93 = load double*, double** %92
%94 = load double, double* %85
%95 = load double, double* %93
%96 = fsub double %94, %95
%97 = fcmp olt double %96, %67
br i1 %97, label %98, label %100
98: ; preds = %89
%99 = fadd double %96, %3
br label %104
100: ; preds = %89
%101 = fcmp ogt double %96, %68
br i1 %101, label %102, label %104
102: ; preds = %100
%103 = fsub double %96, %3
br label %104
104: ; preds = %100, %102, %98
%105 = phi double [ %99, %98 ], [ %103, %102 ], [ %96, %100 ]
%106 = tail call double @llvm.fmuladd.f64(double %105, double %105, double 0.000000e+00)
%107 = load double, double* %87
%108 = getelementptr inbounds double, double* %93, i64 1
%109 = load double, double* %108
%110 = fsub double %107, %109
%111 = fcmp olt double %110, %67
br i1 %111, label %116, label %112
112: ; preds = %104
%113 = fcmp ogt double %110, %68
br i1 %113, label %114, label %118
114: ; preds = %112
%115 = fsub double %110, %3
br label %118
116: ; preds = %104
%117 = fadd double %110, %3
br label %118
118: ; preds = %116, %114, %112
%119 = phi double [ %117, %116 ], [ %115, %114 ], [ %110, %112 ]
%120 = tail call double @llvm.fmuladd.f64(double %119, double %119, double %106)
%121 = load double, double* %88
%122 = getelementptr inbounds double, double* %93, i64 2
%123 = load double, double* %122
%124 = fsub double %121, %123
%125 = fcmp olt double %124, %67
br i1 %125, label %130, label %126
126: ; preds = %118
%127 = fcmp ogt double %124, %68
br i1 %127, label %128, label %132
128: ; preds = %126
%129 = fsub double %124, %3
br label %132
130: ; preds = %118
%131 = fadd double %124, %3
br label %132
132: ; preds = %130, %128, %126
%133 = phi double [ %131, %130 ], [ %129, %128 ], [ %124, %126 ]
%134 = tail call double @llvm.fmuladd.f64(double %133, double %133, double %120)
%135 = fcmp olt double %134, %4
br i1 %135, label %156, label %136
136: ; preds = %132
%137 = load double*, double** %86
%138 = getelementptr inbounds double*, double** %9, i64 %90
%139 = load double*, double** %138
%140 = load double, double* %137
%141 = fadd double %140, 0.000000e+00
store double %141, double* %137
%142 = load double, double* %139
%143 = fadd double %142, 0.000000e+00
store double %143, double* %139
%144 = getelementptr inbounds double, double* %137, i64 1
%145 = load double, double* %144
%146 = fadd double %145, 0.000000e+00
store double %146, double* %144
%147 = getelementptr inbounds double, double* %139, i64 1
%148 = load double, double* %147
%149 = fadd double %148, 0.000000e+00
store double %149, double* %147
%150 = getelementptr inbounds double, double* %137, i64 2
%151 = load double, double* %150
%152 = fadd double %151, 0.000000e+00
store double %152, double* %150
%153 = getelementptr inbounds double, double* %139, i64 2
%154 = load double, double* %153
%155 = fadd double %154, 0.000000e+00
store double %155, double* %153
br label %190
156: ; preds = %132
%157 = fdiv double 1.000000e+00, %134
%158 = fmul double %157, %157
%159 = fmul double %157, %158
%160 = fmul double %159, %6
%161 = fmul double %69, %157
%162 = fmul double %161, %160
%163 = fadd double %160, -5.000000e-01
%164 = fmul double %162, %163
%165 = load double*, double** %86
%166 = fneg double %164
%167 = getelementptr inbounds double*, double** %9, i64 %90
%168 = load double*, double** %167
%169 = load double, double* %165
%170 = tail call double @llvm.fmuladd.f64(double %164, double %105, double %169)
store double %170, double* %165
%171 = load double, double* %168
%172 = tail call double @llvm.fmuladd.f64(double %166, double %105, double %171)
store double %172, double* %168
%173 = getelementptr inbounds double, double* %165, i64 1
%174 = load double, double* %173
%175 = tail call double @llvm.fmuladd.f64(double %164, double %119, double %174)
store double %175, double* %173
%176 = getelementptr inbounds double, double* %168, i64 1
%177 = load double, double* %176
%178 = tail call double @llvm.fmuladd.f64(double %166, double %119, double %177)
store double %178, double* %176
%179 = getelementptr inbounds double, double* %165, i64 2
%180 = load double, double* %179
%181 = tail call double @llvm.fmuladd.f64(double %164, double %133, double %180)
store double %181, double* %179
%182 = getelementptr inbounds double, double* %168, i64 2
%183 = load double, double* %182
%184 = tail call double @llvm.fmuladd.f64(double %166, double %133, double %183)
store double %184, double* %182
%185 = srem i32 %1, %2
%186 = icmp eq i32 %185, 0
br i1 %186, label %187, label %190
187: ; preds = %156
%188 = fadd double %160, -1.000000e+00
%189 = tail call double @llvm.fmuladd.f64(double %160, double %188, double %91)
br label %190
190: ; preds = %136, %187, %156
%191 = phi double [ %189, %187 ], [ %91, %156 ], [ %91, %136 ]
%192 = add nuw nsw i64 %90, 1
%193 = icmp eq i64 %192, %72
br i1 %193, label %73, label %89
194: ; preds = %73, %11, %63
%195 = phi double [ 0.000000e+00, %63 ], [ 0.000000e+00, %11 ], [ %74, %73 ]
%196 = srem i32 %1, %2
%197 = icmp eq i32 %196, 0
br i1 %197, label %198, label %201
198: ; preds = %194
%199 = fmul double %5, 4.000000e+00
%200 = fmul double %199, %195
store double %200, double* %7
br label %201
201: ; preds = %198, %194
ret void
}