// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/Particles.cpp
// Function: Fluid::UpdateForces()
void Fluid::UpdateForces(){
    /* Exicutes the forceloop for the simple Lennard-Jones fluid, updating the
    forces and potential energy. */
    int i, j, k;
    
    // Zero out the forces and potential energy
    for(i=0;i<N;i++){for(k=0;k<3;k++){f[i][k]=0;};};
    potential_energy = 0;
    
    // force-loop variables we need
    double rij[3], r2, r2inv, r6inv, fij;
    double Linv = 1.0 / sidelength;
    
    // The force loop (dun dun duuuuun)
    for(i=0;i<N;i++){
        for(j=i+1;j<N;j++){
            // calculating the radius
            r2 = 0;
            for(k=0;k<3;k++){
                rij[k] = r[i][k] - r[j][k];
                // imposing periodic boundary conditions
                rij[k] -= sidelength*fastround(rij[k]*Linv);
                r2 += rij[k]*rij[k];
            }
            r2inv = (1.0)/r2;
            r6inv = r2inv*r2inv*r2inv;
            // Updating the potential energy
            potential_energy += 4*r6inv*(r6inv-1);
            // Updating the forces
            fij = r6inv*r2inv*(r6inv-0.5);
            for(k=0;k<3;k++){
                f[i][k] += fij*rij[k];
                f[j][k] -= fij*rij[k];
            }
        }
    }
    return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x50(%rdi), %eax
movq 0x18(%rdi), %rdx
xorl %esi, %esi
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
cmpq %rcx, %rsi
je 0x331f
movq (%rdx,%rsi,8), %r8
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0x331a
andq $0x0, (%r8,%r9,8)
incq %r9
jmp 0x330a
incq %rsi
jmp 0x32fe
andq $0x0, 0x80(%rdi)
movsd 0x2d29(%rip), %xmm0     # 0x6058
movapd %xmm0, %xmm1
divsd 0x60(%rdi), %xmm1
movabsq $0x1, %rdx
xorl %esi, %esi
movapd 0x2e14(%rip), %xmm2     # 0x6160
movsd 0x2dc4(%rip), %xmm3     # 0x6118
movsd 0x2dc4(%rip), %xmm4     # 0x6120
movsd 0x2dc4(%rip), %xmm5     # 0x6128
xorpd %xmm6, %xmm6
leaq 0x2e01(%rip), %r8       # 0x6170
cmpq %rcx, %rsi
je 0x34b0
movq 0x8(%rdi), %r9
movq 0x18(%rdi), %r10
movq %rdx, %r11
cmpl %r11d, %eax
jle 0x34a5
movq (%r9,%rsi,8), %rbx
movq (%r9,%r11,8), %r14
movsd 0x60(%rdi), %xmm7
xorpd %xmm2, %xmm7
xorpd %xmm8, %xmm8
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x33fd
movsd (%rbx,%r15,8), %xmm9
subsd (%r14,%r15,8), %xmm9
movapd %xmm1, %xmm10
mulsd %xmm9, %xmm10
xorl %r12d, %r12d
ucomisd %xmm6, %xmm10
setb %r12b
addsd (%r8,%r12,8), %xmm10
cvttpd2dq %xmm10, %xmm10
cvtdq2pd %xmm10, %xmm10
mulsd %xmm7, %xmm10
addsd %xmm9, %xmm10
movsd %xmm10, -0x18(%rsp,%r15,8)
mulsd %xmm10, %xmm10
addsd %xmm10, %xmm8
incq %r15
jmp 0x33a5
movapd %xmm0, %xmm9
divsd %xmm8, %xmm9
movapd %xmm9, %xmm7
mulsd %xmm9, %xmm7
mulsd %xmm9, %xmm7
movapd %xmm7, %xmm8
mulsd %xmm3, %xmm8
movapd %xmm7, %xmm10
addsd %xmm4, %xmm10
mulsd %xmm8, %xmm10
addsd 0x80(%rdi), %xmm10
movsd %xmm10, 0x80(%rdi)
mulsd %xmm7, %xmm9
addsd %xmm5, %xmm7
mulsd %xmm9, %xmm7
movq (%r10,%rsi,8), %rbx
movq (%r10,%r11,8), %r14
movapd %xmm7, %xmm8
xorpd %xmm2, %xmm8
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x349d
movsd -0x18(%rsp,%r15,8), %xmm9
movapd %xmm7, %xmm10
mulsd %xmm9, %xmm10
addsd (%rbx,%r15,8), %xmm10
movsd %xmm10, (%rbx,%r15,8)
mulsd %xmm8, %xmm9
addsd (%r14,%r15,8), %xmm9
movsd %xmm9, (%r14,%r15,8)
incq %r15
jmp 0x3464
incq %r11
jmp 0x3383
incq %rsi
incq %rdx
jmp 0x336f
popq %rbx
popq %r12
popq %r14
popq %r15
retq