// File: Cell-veto[P]postlhc/./lj.hpp
// Function: LennardJones::random_sr_attraction(double, RandomContext*)
double random_sr_attraction (double rsq_, RandomContext *random)
    {
        double rsq = fmax (rsq_ / sq (scale), sq (LJ_MINIMUM));

        // add thermal energy increase on current interaction energy
        double e_now = evaluate_lj (rsq);
        double e_star = random->exponential (strength);
        double e_evt = e_now + e_star;

        if (e_evt >= lj_at_cutoff)
            return ESCAPES_TO_INFINITY ();

        // invert the LJ potential, picking the solution in attractive region
        // FIXME look at corner cases
        double rsix = .5 - sqrt (.25 + e_evt);
        double rsq_evt = pow (rsix, -1./3);
        assert (rsq_evt <= sq (attr_cutoff) && rsq_evt >= sq (LJ_MINIMUM));

        return rsq_evt * sq (scale) - rsq_;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd 0x10(%rax), %xmm0
callq 0x418110
movaps %xmm0, %xmm1
movsd -0x68(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd 0x1b5e93(%rip), %xmm0   # 0x600ea0
callq 0x418110
movsd -0x60(%rbp), %xmm3
movaps %xmm0, %xmm2
movaps %xmm2, %xmm4
movaps %xmm3, %xmm0
cmpunordsd %xmm0, %xmm0
movaps %xmm0, %xmm1
pand %xmm4, %xmm1
maxsd %xmm3, %xmm2
pandn %xmm2, %xmm0
por %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x28(%rbp), %xmm0
callq 0x449da0
movq -0x58(%rbp), %rax
movsd %xmm0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movsd (%rax), %xmm0
callq 0x41f030
movq -0x58(%rbp), %rax
movsd %xmm0, -0x38(%rbp)
movsd -0x30(%rbp), %xmm0
addsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
ucomisd 0x30(%rax), %xmm0
jb 0x44b090
callq 0x44b1b0
movsd %xmm0, -0x8(%rbp)
jmp 0x44b197
movsd 0x1b5e20(%rip), %xmm0   # 0x600eb8
addsd -0x40(%rbp), %xmm0
callq 0x51f030
movaps %xmm0, %xmm1
movsd 0x1b11f3(%rip), %xmm0   # 0x5fc2a0
subsd %xmm1, %xmm0
movsd %xmm0, -0x48(%rbp)
movsd -0x48(%rbp), %xmm0
movsd 0x1b5ded(%rip), %xmm1   # 0x600eb0
callq 0x51ef10
movq -0x58(%rbp), %rax
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movsd 0x28(%rax), %xmm0
callq 0x418110
movsd -0x78(%rbp), %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x69(%rbp)
jb 0x44b11e
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd 0x1b5d99(%rip), %xmm0   # 0x600ea0
callq 0x418110
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
ucomisd %xmm1, %xmm0
setae %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x44b127
jmp 0x44b129
jmp 0x44b148
leaq 0x1b5eed(%rip), %rdi    # 0x60101d
leaq 0x1b5e9b(%rip), %rsi    # 0x600fd2
movl $0x88, %edx
leaq 0x1b5f14(%rip), %rcx    # 0x601057
callq 0x53d020
movq -0x58(%rbp), %rax
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd 0x10(%rax), %xmm0
callq 0x418110
movaps %xmm0, %xmm2
movsd -0x88(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop