// File: /workspace/github_cpp_makefile_star2_O2/joraso[P]Glassius/Particles.cpp
// Function: Glass::UpdateForces()
void Glass::UpdateForces(){
    /* Excicutes the forceloop for the Kob-Anderson glass mixture, 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;
    
    // factors for adjusting the forces and distances:
    double rABinv = (1.0/0.8);
    double rBBinv = (1.0/0.88);
    double fAB = 1.5*rABinv*rABinv;
    double fBB = 0.5*rBBinv*rABinv;
    
    // The force loop - AA interactions
    for(i=0;i<Na;i++){
        for(j=i+1;j<Na;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];
            }
        }
        // AB interactions - sigma = 0.8, epsilon = 1.5
        for(j=Na;j<N;j++){
            r2 = 0;
            for(k=0;k<3;k++){
                rij[k] = (r[i][k] - r[j][k]);
                rij[k] -= sidelength*fastround(rij[k]*Linv);
                // effective radius adjusted by sigma
                rij[k] *= rABinv;
                r2 += rij[k]*rij[k];
            }
            r2inv = (1.0)/r2;
            r6inv = r2inv*r2inv*r2inv;
            // energy and forces adjusted by epsilon and force-factor
            potential_energy += (1.5)*4*r6inv*(r6inv-1);
            fij = fAB*r6inv*r2inv*(r6inv-0.5);
            for(k=0;k<3;k++){
                f[i][k] += fij*rij[k];
                f[j][k] -= fij*rij[k];
            }
        }
    }
    // BB interactions - sigma = 0.88, epsilon = 0.5
    for(i=Na;i<N;i++){
        for(j=i+1;j<N;j++){
            r2 = 0;
            for(k=0;k<3;k++){
                rij[k] = r[i][k] - r[j][k];
                rij[k] -= sidelength*fastround(rij[k]*Linv);
                // effective radius adjusted by sigma
                rij[k] *= rBBinv;
                r2 += rij[k]*rij[k];
            }
            r2inv = (1.0)/r2;
            r6inv = r2inv*r2inv*r2inv;
            // Update me!!
            potential_energy += (0.5)*4*r6inv*(r6inv-1);
            fij = fBB*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 %r13
pushq %r12
pushq %rbx
movslq 0x50(%rdi), %rax
movq 0x18(%rdi), %rcx
xorl %edx, %edx
testl %eax, %eax
movl $0x0, %esi
cmovgl %eax, %esi
cmpq %rsi, %rdx
je 0x34f6
movq (%rcx,%rdx,8), %r8
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0x34f1
andq $0x0, (%r8,%r9,8)
incq %r9
jmp 0x34e1
incq %rdx
jmp 0x34d5
andq $0x0, 0x80(%rdi)
movsd 0x2b52(%rip), %xmm0     # 0x6058
movapd %xmm0, %xmm1
divsd 0x60(%rdi), %xmm1
movslq 0x88(%rdi), %rcx
xorl %esi, %esi
testl %ecx, %ecx
movl $0x0, %r8d
cmovgl %ecx, %r8d
movabsq $0x1, %r9
movapd 0x2c2a(%rip), %xmm2     # 0x6160
movsd 0x2bda(%rip), %xmm5     # 0x6118
movsd 0x2bda(%rip), %xmm3     # 0x6120
movsd 0x2bda(%rip), %xmm4     # 0x6128
xorpd %xmm6, %xmm6
leaq 0x2c17(%rip), %rdx      # 0x6170
movsd 0x2bd7(%rip), %xmm7     # 0x6138
movsd 0x2bd6(%rip), %xmm8     # 0x6140
movsd 0x2bbd(%rip), %xmm9     # 0x6130
cmpq %r8, %rsi
je 0x37f5
movq 0x8(%rdi), %r10
movq 0x18(%rdi), %r11
movq %r9, %rbx
cmpl %ebx, %ecx
jle 0x36ab
movq (%r10,%rsi,8), %r14
movq (%r10,%rbx,8), %r15
movsd 0x60(%rdi), %xmm10
xorpd %xmm2, %xmm10
xorpd %xmm11, %xmm11
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0x3602
movsd (%r14,%r12,8), %xmm12
subsd (%r15,%r12,8), %xmm12
movapd %xmm1, %xmm13
mulsd %xmm12, %xmm13
xorl %r13d, %r13d
ucomisd %xmm6, %xmm13
setb %r13b
addsd (%rdx,%r13,8), %xmm13
cvttpd2dq %xmm13, %xmm13
cvtdq2pd %xmm13, %xmm13
mulsd %xmm10, %xmm13
addsd %xmm12, %xmm13
movsd %xmm13, -0x20(%rsp,%r12,8)
mulsd %xmm13, %xmm13
addsd %xmm13, %xmm11
incq %r12
jmp 0x35aa
movapd %xmm0, %xmm12
divsd %xmm11, %xmm12
movapd %xmm12, %xmm10
mulsd %xmm12, %xmm10
mulsd %xmm12, %xmm10
movapd %xmm10, %xmm11
mulsd %xmm5, %xmm11
movapd %xmm10, %xmm13
addsd %xmm3, %xmm13
mulsd %xmm11, %xmm13
addsd 0x80(%rdi), %xmm13
movsd %xmm13, 0x80(%rdi)
mulsd %xmm10, %xmm12
addsd %xmm4, %xmm10
mulsd %xmm12, %xmm10
movq (%r11,%rsi,8), %r14
movq (%r11,%rbx,8), %r15
movapd %xmm10, %xmm11
xorpd %xmm2, %xmm11
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0x36a3
movsd -0x20(%rsp,%r12,8), %xmm12
movapd %xmm10, %xmm13
mulsd %xmm12, %xmm13
addsd (%r14,%r12,8), %xmm13
movsd %xmm13, (%r14,%r12,8)
mulsd %xmm11, %xmm12
addsd (%r15,%r12,8), %xmm12
movsd %xmm12, (%r15,%r12,8)
incq %r12
jmp 0x366a
incq %rbx
jmp 0x3587
movq 0x8(%rdi), %r10
movq 0x18(%rdi), %r11
movq %rcx, %rbx
cmpq %rax, %rbx
jge 0x37ea
movq (%r10,%rsi,8), %r14
movq (%r10,%rbx,8), %r15
movsd 0x60(%rdi), %xmm10
xorpd %xmm2, %xmm10
xorpd %xmm11, %xmm11
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0x3737
movsd (%r14,%r12,8), %xmm12
subsd (%r15,%r12,8), %xmm12
movapd %xmm1, %xmm13
mulsd %xmm12, %xmm13
xorl %r13d, %r13d
ucomisd %xmm6, %xmm13
setb %r13b
addsd (%rdx,%r13,8), %xmm13
cvttpd2dq %xmm13, %xmm13
cvtdq2pd %xmm13, %xmm13
mulsd %xmm10, %xmm13
addsd %xmm12, %xmm13
mulsd %xmm9, %xmm13
movsd %xmm13, -0x20(%rsp,%r12,8)
mulsd %xmm13, %xmm13
addsd %xmm13, %xmm11
incq %r12
jmp 0x36da
movapd %xmm0, %xmm12
divsd %xmm11, %xmm12
movapd %xmm12, %xmm10
mulsd %xmm12, %xmm10
mulsd %xmm12, %xmm10
movapd %xmm10, %xmm11
mulsd %xmm7, %xmm11
movapd %xmm10, %xmm13
addsd %xmm3, %xmm13
mulsd %xmm11, %xmm13
addsd 0x80(%rdi), %xmm13
movsd %xmm13, 0x80(%rdi)
movapd %xmm10, %xmm11
mulsd %xmm8, %xmm11
mulsd %xmm12, %xmm11
addsd %xmm4, %xmm10
mulsd %xmm11, %xmm10
movq (%r11,%rsi,8), %r14
movq (%r11,%rbx,8), %r15
movapd %xmm10, %xmm11
xorpd %xmm2, %xmm11
xorl %r12d, %r12d
cmpq $0x3, %r12
je 0x37e2
movsd -0x20(%rsp,%r12,8), %xmm12
movapd %xmm10, %xmm13
mulsd %xmm12, %xmm13
addsd (%r14,%r12,8), %xmm13
movsd %xmm13, (%r14,%r12,8)
mulsd %xmm11, %xmm12
addsd (%r15,%r12,8), %xmm12
movsd %xmm12, (%r15,%r12,8)
incq %r12
jmp 0x37a9
incq %rbx
jmp 0x36b6
incq %rsi
incq %r9
jmp 0x3573
movsd 0x2953(%rip), %xmm5     # 0x6150
xorpd %xmm6, %xmm6
movsd 0x293f(%rip), %xmm7     # 0x6148
cmpq %rax, %rcx
jge 0x395d
leaq 0x1(%rcx), %rsi
movslq %esi, %r8
movq 0x8(%rdi), %r9
movq 0x18(%rdi), %r10
cmpq %rax, %r8
jge 0x3955
movq (%r9,%rcx,8), %r11
movq (%r9,%r8,8), %rbx
movsd 0x60(%rdi), %xmm8
xorpd %xmm2, %xmm8
xorpd %xmm9, %xmm9
xorl %r14d, %r14d
cmpq $0x3, %r14
je 0x38a2
movsd (%r11,%r14,8), %xmm10
subsd (%rbx,%r14,8), %xmm10
movapd %xmm1, %xmm11
mulsd %xmm10, %xmm11
xorl %r15d, %r15d
ucomisd %xmm6, %xmm11
setb %r15b
addsd (%rdx,%r15,8), %xmm11
cvttpd2dq %xmm11, %xmm11
cvtdq2pd %xmm11, %xmm11
mulsd %xmm8, %xmm11
addsd %xmm10, %xmm11
mulsd %xmm7, %xmm11
movsd %xmm11, -0x20(%rsp,%r14,8)
mulsd %xmm11, %xmm11
addsd %xmm11, %xmm9
incq %r14
jmp 0x3845
movapd %xmm0, %xmm10
divsd %xmm9, %xmm10
movapd %xmm10, %xmm8
mulsd %xmm10, %xmm8
mulsd %xmm10, %xmm8
movapd %xmm8, %xmm9
addsd %xmm8, %xmm9
movapd %xmm8, %xmm11
addsd %xmm3, %xmm11
mulsd %xmm9, %xmm11
addsd 0x80(%rdi), %xmm11
movsd %xmm11, 0x80(%rdi)
movapd %xmm8, %xmm9
mulsd %xmm5, %xmm9
mulsd %xmm10, %xmm9
addsd %xmm4, %xmm8
mulsd %xmm9, %xmm8
movq (%r10,%rcx,8), %r11
movq (%r10,%r8,8), %rbx
movapd %xmm8, %xmm9
xorpd %xmm2, %xmm9
xorl %r14d, %r14d
cmpq $0x3, %r14
je 0x394d
movsd -0x20(%rsp,%r14,8), %xmm10
movapd %xmm8, %xmm11
mulsd %xmm10, %xmm11
addsd (%r11,%r14,8), %xmm11
movsd %xmm11, (%r11,%r14,8)
mulsd %xmm9, %xmm10
addsd (%rbx,%r14,8), %xmm10
movsd %xmm10, (%rbx,%r14,8)
incq %r14
jmp 0x3914
incq %r8
jmp 0x3821
movq %rsi, %rcx
jmp 0x3809
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop