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;
  *Tot_potential_en = 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
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f8 <force_energy_calc+0xe8>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    11e5 <force_energy_calc+0xd5>
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    118b <force_energy_calc+0x7b>
jmp    11ea <force_energy_calc+0xda>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1178 <force_energy_calc+0x68>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1542 <force_energy_calc+0x432>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    152f <force_energy_calc+0x41f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    135a <force_energy_calc+0x24a>
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  0xd7a(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    12d4 <force_energy_calc+0x1c4>
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    1320 <force_energy_calc+0x210>
movslq -0x74(%rbp),%rax
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
movsd  -0x18(%rbp),%xmm1
movsd  0xd32(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    131b <force_energy_calc+0x20b>
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    1320 <force_energy_calc+0x210>
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    1234 <force_energy_calc+0x124>
movsd  -0x58(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    14be <force_energy_calc+0x3ae>
movsd  0xca2(%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  0xc65(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  0xc41(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    147b <force_energy_calc+0x36b>
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    13de <force_energy_calc+0x2ce>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    14b9 <force_energy_calc+0x3a9>
movsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  0xb7b(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    151c <force_energy_calc+0x40c>
movl   $0x0,-0x74(%rbp)
cmpl   $0x3,-0x74(%rbp)
jge    1517 <force_energy_calc+0x407>
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    14c5 <force_energy_calc+0x3b5>
jmp    151c <force_energy_calc+0x40c>
jmp    1521 <force_energy_calc+0x411>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1219 <force_energy_calc+0x109>
jmp    1534 <force_energy_calc+0x424>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11ff <force_energy_calc+0xef>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    156f <force_energy_calc+0x45f>
movsd  0xaa6(%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
movq   $0x0,(%rcx)
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    1142 <force_energy_calc+0x42>
xor    %edx,%edx
jmp    11d9 <force_energy_calc+0xd9>
mov    %ecx,%esi
and    $0xfffffffe,%esi
xor    %edx,%edx
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
%34 = load double*, double** %19
store double 0.000000e+00, double* %34
store i32 0, i32* %23
br label %35
35: ; preds = %73, %11
%36 = load i32, i32* %23
%37 = load i32, i32* %12
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %76
39: ; preds = %35
store i32 0, i32* %29
br label %40
40: ; preds = %69, %39
%41 = load i32, i32* %29
%42 = icmp slt i32 %41, 3
br i1 %42, label %43, label %72
43: ; preds = %40
%44 = load double**, double*** %21
%45 = load i32, i32* %23
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double*, double** %44, i64 %46
%48 = load double*, double** %47
%49 = load i32, i32* %29
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
%53 = load double**, double*** %22
%54 = load i32, i32* %23
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double*, double** %53, i64 %55
%57 = load double*, double** %56
%58 = load i32, i32* %29
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
store double %52, double* %60
%61 = load double**, double*** %21
%62 = load i32, i32* %23
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double*, double** %61, i64 %63
%65 = load double*, double** %64
%66 = load i32, i32* %29
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
store double 0.000000e+00, double* %68
br label %69
69: ; preds = %43
%70 = load i32, i32* %29
%71 = add nsw i32 %70, 1
store i32 %71, i32* %29
br label %40
72: ; preds = %40
br label %73
73: ; preds = %72
%74 = load i32, i32* %23
%75 = add nsw i32 %74, 1
store i32 %75, i32* %23
br label %35
76: ; preds = %35
store i32 0, i32* %23
br label %77
77: ; preds = %269, %76
%78 = load i32, i32* %23
%79 = load i32, i32* %12
%80 = sub nsw i32 %79, 1
%81 = icmp slt i32 %78, %80
br i1 %81, label %82, label %272
82: ; preds = %77
%83 = load i32, i32* %23
%84 = add nsw i32 %83, 1
store i32 %84, i32* %24
br label %85
85: ; preds = %265, %82
%86 = load i32, i32* %24
%87 = load i32, i32* %12
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %268
89: ; preds = %85
store double 0.000000e+00, double* %25
store i32 0, i32* %29
br label %90
90: ; preds = %158, %89
%91 = load i32, i32* %29
%92 = icmp slt i32 %91, 3
br i1 %92, label %93, label %161
93: ; preds = %90
%94 = load double**, double*** %20
%95 = load i32, i32* %23
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double*, double** %94, i64 %96
%98 = load double*, double** %97
%99 = load i32, i32* %29
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = load double**, double*** %20
%104 = load i32, i32* %24
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double*, double** %103, i64 %105
%107 = load double*, double** %106
%108 = load i32, i32* %29
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %107, i64 %109
%111 = load double, double* %110
%112 = fsub double %102, %111
%113 = load i32, i32* %29
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %114
store double %112, double* %115
%116 = load i32, i32* %29
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %117
%119 = load double, double* %118
%120 = load double, double* %15
%121 = fneg double %120
%122 = fdiv double %121, 2.000000e+00
%123 = fcmp olt double %119, %122
br i1 %123, label %124, label %131
124: ; preds = %93
%125 = load double, double* %15
%126 = load i32, i32* %29
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %127
%129 = load double, double* %128
%130 = fadd double %129, %125
store double %130, double* %128
br label %147
131: ; preds = %93
%132 = load i32, i32* %29
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %133
%135 = load double, double* %134
%136 = load double, double* %15
%137 = fdiv double %136, 2.000000e+00
%138 = fcmp ogt double %135, %137
br i1 %138, label %139, label %146
139: ; preds = %131
%140 = load double, double* %15
%141 = load i32, i32* %29
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %142
%144 = load double, double* %143
%145 = fsub double %144, %140
store double %145, double* %143
br label %146
146: ; preds = %139, %131
br label %147
147: ; preds = %146, %124
%148 = load i32, i32* %29
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %149
%151 = load double, double* %150
%152 = load i32, i32* %29
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %153
%155 = load double, double* %154
%156 = load double, double* %25
%157 = call double @llvm.fmuladd.f64(double %151, double %155, double %156)
store double %157, double* %25
br label %158
158: ; preds = %147
%159 = load i32, i32* %29
%160 = add nsw i32 %159, 1
store i32 %160, i32* %29
br label %90
161: ; preds = %90
%162 = load double, double* %25
%163 = load double, double* %16
%164 = fcmp olt double %162, %163
br i1 %164, label %165, label %235
165: ; preds = %161
%166 = load double, double* %25
%167 = fdiv double 1.000000e+00, %166
store double %167, double* %26
%168 = load double, double* %26
%169 = load double, double* %26
%170 = fmul double %168, %169
%171 = load double, double* %26
%172 = fmul double %170, %171
store double %172, double* %27
%173 = load double, double* %18
%174 = load double, double* %27
%175 = fmul double %173, %174
store double %175, double* %28
%176 = load double, double* %17
%177 = fmul double 4.800000e+01, %176
%178 = load double, double* %26
%179 = fmul double %177, %178
%180 = load double, double* %28
%181 = fmul double %179, %180
%182 = load double, double* %28
%183 = fsub double %182, 5.000000e-01
%184 = fmul double %181, %183
store double %184, double* %31
store i32 0, i32* %29
br label %185
185: ; preds = %220, %165
%186 = load i32, i32* %29
%187 = icmp slt i32 %186, 3
br i1 %187, label %188, label %223
188: ; preds = %185
%189 = load double, double* %31
%190 = load i32, i32* %29
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %191
%193 = load double, double* %192
%194 = load double**, double*** %21
%195 = load i32, i32* %23
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds double*, double** %194, i64 %196
%198 = load double*, double** %197
%199 = load i32, i32* %29
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds double, double* %198, i64 %200
%202 = load double, double* %201
%203 = call double @llvm.fmuladd.f64(double %189, double %193, double %202)
store double %203, double* %201
%204 = load double, double* %31
%205 = fneg double %204
%206 = load i32, i32* %29
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 %207
%209 = load double, double* %208
%210 = load double**, double*** %21
%211 = load i32, i32* %24
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds double*, double** %210, i64 %212
%214 = load double*, double** %213
%215 = load i32, i32* %29
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %214, i64 %216
%218 = load double, double* %217
%219 = call double @llvm.fmuladd.f64(double %205, double %209, double %218)
store double %219, double* %217
br label %220
220: ; preds = %188
%221 = load i32, i32* %29
%222 = add nsw i32 %221, 1
store i32 %222, i32* %29
br label %185
223: ; preds = %185
%224 = load i32, i32* %13
%225 = load i32, i32* %14
%226 = srem i32 %224, %225
%227 = icmp eq i32 %226, 0
br i1 %227, label %228, label %234
228: ; preds = %223
%229 = load double, double* %28
%230 = load double, double* %28
%231 = fsub double %230, 1.000000e+00
%232 = load double, double* %32
%233 = call double @llvm.fmuladd.f64(double %229, double %231, double %232)
store double %233, double* %32
br label %234
234: ; preds = %228, %223
br label %264
235: ; preds = %161
store i32 0, i32* %29
br label %236
236: ; preds = %260, %235
%237 = load i32, i32* %29
%238 = icmp slt i32 %237, 3
br i1 %238, label %239, label %263
239: ; preds = %236
%240 = load double**, double*** %21
%241 = load i32, i32* %23
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds double*, double** %240, i64 %242
%244 = load double*, double** %243
%245 = load i32, i32* %29
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %244, i64 %246
%248 = load double, double* %247
%249 = fadd double %248, 0.000000e+00
store double %249, double* %247
%250 = load double**, double*** %21
%251 = load i32, i32* %24
%252 = sext i32 %251 to i64
%253 = getelementptr inbounds double*, double** %250, i64 %252
%254 = load double*, double** %253
%255 = load i32, i32* %29
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds double, double* %254, i64 %256
%258 = load double, double* %257
%259 = fadd double %258, 0.000000e+00
store double %259, double* %257
br label %260
260: ; preds = %239
%261 = load i32, i32* %29
%262 = add nsw i32 %261, 1
store i32 %262, i32* %29
br label %236
263: ; preds = %236
br label %264
264: ; preds = %263, %234
br label %265
265: ; preds = %264
%266 = load i32, i32* %24
%267 = add nsw i32 %266, 1
store i32 %267, i32* %24
br label %85
268: ; preds = %85
br label %269
269: ; preds = %268
%270 = load i32, i32* %23
%271 = add nsw i32 %270, 1
store i32 %271, i32* %23
br label %77
272: ; preds = %77
%273 = load i32, i32* %13
%274 = load i32, i32* %14
%275 = srem i32 %273, %274
%276 = icmp eq i32 %275, 0
br i1 %276, label %277, label %283
277: ; preds = %272
%278 = load double, double* %17
%279 = fmul double 4.000000e+00, %278
%280 = load double, double* %32
%281 = fmul double %279, %280
%282 = load double*, double** %19
store double %281, double* %282
br label %283
283: ; preds = %277, %272
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) {
store double 0.000000e+00, double* %7
%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
}