// File: /workspace/github_cpp_makefile_star2_O1/Cell-veto[P]postlhc/./ecmc.hpp
// Function: ChainRunner<LennardJones, Monodisperse2D>::find_sr_events(Storage<Monodisperse2D>*)
void find_sr_events (stor_t *stor)
    {
        // FIXME these should, in principle, depend on the active particle.
        const double attract_range = inter.sr_attraction_range ();
        const double repuls_range = inter.sr_repulsion_range ();
        const double strip_width = fmax (repuls_range, attract_range);

        // due to the design of the Storage, we cannot allow the enumerate to wrap
        double max_disp = stor->strip_max_extent (direction) - strip_width - attract_range;
        if (max_disp < planned_disp)
            planned_disp = max_disp;

        // loop over all particles in strip
        auto g = stor->enumerate_strip (active, direction, strip_width,
            -attract_range, planned_disp + strip_width);
        for (; g.not_done (); g.next ())
        {
            ++shortrange_predicts;

            vector_t r_now = stor->distance_vector (g.key (), active);
            double x_now = r_now[direction];
            double xsq = sq (x_now);
            double ortho_rsq = norm_ortho_sq (r_now, direction);
            double x_min = x_now - planned_disp;

            double disp;

            // repulsive interactions
            double rsq_min = ortho_rsq + (x_min > 0. ? sq (x_min) : 0.);
            if (x_now > 0. && rsq_min < sq (repuls_range))
            {
                double rsq = ortho_rsq + xsq;
                double delta = inter.random_sr_repulsion (rsq, &random);

                if (! (delta <= 0.))
                {
                    std::cerr << "computed short-range repulsive event is not in the future" << ABORT;
                }

                // delta <= -rsq signals 'no event' (will not enter the next if clause)
                if (xsq + delta > 0.)
                {
                    disp = -delta / (sqrt (xsq + delta) + x_now);
                    goto have_event;
                }
            }

            // attractive short-range interactions
            // these always occur at displacements later than repulsive ones.
            // FIXME more aggressive pruning
            if (x_min < 0. && ortho_rsq < sq (attract_range))
            {
                // note that even if the other particle is ahead _now_, we might
                // schedule an event after passing it.
                double x_virt = (x_now > 0.) ? 0. : x_now;
                double xsq_virt = sq (x_virt);
                double rsq_virt = ortho_rsq + xsq_virt;
                double delta = inter.random_sr_attraction (rsq_virt, &random);
                if (! (delta >= 0.))
                {
                    std::cerr << "computed short-range attractive event is not in the future" << ABORT;
                }

                disp = (x_now-x_virt) + delta / (sqrt (xsq_virt + delta) - x_virt);
                goto have_event;
            }

            // no event, try next particle
            continue;

        have_event:
            // when jumping here, disp will have been initialized.
            // see if this event preempts the previous one
            if (disp < planned_disp)
            {
                planned_disp = disp;
                planned_xdisp = x_now - disp;
                planned_next = g.key ();
#ifdef XDISP_HISTO
                planned_rsq_event = sq (planned_xdisp) + ortho_rsq;
#endif
                g.clip (active, disp + strip_width);
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x40(%rdi), %xmm2
movsd 0x58(%rdi), %xmm1
movapd %xmm1, %xmm0
mulsd %xmm2, %xmm0
cmpltsd 0x1a2c02(%rip), %xmm1   # 0x5ceea8
andnpd %xmm0, %xmm1
movapd %xmm1, 0x30(%rsp)
mulsd 0x50(%rdi), %xmm2
movapd %xmm2, %xmm3
cmpunordsd %xmm2, %xmm3
movapd %xmm3, %xmm0
andpd %xmm1, %xmm0
movsd %xmm2, 0x28(%rsp)
maxsd %xmm2, %xmm1
andnpd %xmm1, %xmm3
orpd %xmm0, %xmm3
movapd %xmm3, 0x60(%rsp)
movl 0xc88(%rdi), %esi
movq %rbx, %rdi
callq 0x411628
subsd 0x60(%rsp), %xmm0
subsd 0x30(%rsp), %xmm0
movsd 0xca0(%r14), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x42c310
movsd %xmm0, 0xca0(%r14)
movq 0xc80(%r14), %rdx
movl 0xc88(%r14), %ecx
movapd 0x19edaa(%rip), %xmm1   # 0x5cb0d0
xorpd 0x30(%rsp), %xmm1
movsd 0xca0(%r14), %xmm2
movapd 0x60(%rsp), %xmm0
addsd %xmm0, %xmm2
leaq 0x80(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4116a8
movl 0x50(%r15), %eax
movq 0x98(%rsp,%rax,8), %rcx
cmpq 0xc0(%rsp,%rax,8), %rcx
jne 0x42c37a
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%r14), %r15
leaq 0x88(%rbx), %r13
movsd 0x28(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0xb0(%r14), %r12
movapd 0x30(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
leaq 0x80(%rsp), %rbp
incq 0xd40(%r14)
movq 0x88(%rsp), %rax
movq 0xc80(%r14), %rcx
shlq $0x4, %rax
addq %r13, %rax
shlq $0x4, %rcx
addq %r13, %rcx
xorl %edx, %edx
movq (%rax,%rdx), %rsi
subq (%rcx,%rdx), %rsi
xorps %xmm0, %xmm0
cvtsi2sd %rsi, %xmm0
mulsd 0x78(%rbx,%rdx), %xmm0
movsd %xmm0, 0x50(%rsp,%rdx)
addq $0x8, %rdx
cmpq $0x10, %rdx
jne 0x42c3da
movups 0x50(%rsp), %xmm0
movups %xmm0, 0x50(%rsp)
movl 0xc88(%r14), %esi
movsd 0x50(%rsp,%rsi,8), %xmm0
movsd %xmm0, (%rsp)
leaq 0x50(%rsp), %rdi
callq 0x42ca7c
movapd %xmm0, %xmm3
movsd (%rsp), %xmm0
movapd %xmm0, %xmm4
subsd 0xca0(%r14), %xmm4
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jbe 0x42c52b
movapd %xmm4, %xmm0
mulsd %xmm4, %xmm0
xorpd %xmm1, %xmm1
cmpltsd %xmm4, %xmm1
andpd %xmm0, %xmm1
addsd %xmm3, %xmm1
movsd 0x28(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x42c52b
movsd %xmm4, 0x48(%rsp)
movsd (%rsp), %xmm1
mulsd %xmm1, %xmm1
movsd %xmm3, 0x8(%rsp)
movsd %xmm1, 0x78(%rsp)
addsd %xmm1, %xmm3
movq %r15, %rdi
movapd %xmm3, %xmm0
movq %r12, %rsi
callq 0x42cac4
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
jb 0x42c667
movapd %xmm0, %xmm1
movsd 0x78(%rsp), %xmm0
addsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm2, %xmm0
movsd 0x8(%rsp), %xmm3
movsd 0x48(%rsp), %xmm4
jbe 0x42c51a
ucomisd %xmm2, %xmm0
jb 0x42c4dd
sqrtsd %xmm0, %xmm0
jmp 0x42c4fe
movapd %xmm1, 0x10(%rsp)
callq 0x4ee410
movapd 0x10(%rsp), %xmm1
movsd 0x48(%rsp), %xmm4
movsd 0x8(%rsp), %xmm3
xorpd %xmm2, %xmm2
xorpd 0x19ebca(%rip), %xmm1   # 0x5cb0d0
addsd (%rsp), %xmm0
divsd %xmm0, %xmm1
movl $0x5, %eax
movsd %xmm1, 0x10(%rsp)
cmpl $0x5, %eax
je 0x42c647
testl %eax, %eax
jne 0x42c61d
ucomisd %xmm4, %xmm2
jbe 0x42c61d
movapd 0x30(%rsp), %xmm0
ucomisd %xmm3, %xmm0
jbe 0x42c61d
xorpd %xmm0, %xmm0
minsd (%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
addsd %xmm0, %xmm3
movq %r15, %rdi
movapd %xmm3, %xmm0
movq %r12, %rsi
callq 0x42cc26
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x42c652
movapd %xmm0, %xmm2
movsd 0x10(%rsp), %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
jb 0x42c599
sqrtsd %xmm0, %xmm0
jmp 0x42c5aa
movsd %xmm2, 0x10(%rsp)
callq 0x4ee410
movsd 0x10(%rsp), %xmm2
movsd (%rsp), %xmm1
movsd 0x8(%rsp), %xmm3
subsd %xmm3, %xmm1
subsd %xmm3, %xmm0
divsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movsd 0xca0(%r14), %xmm0
ucomisd %xmm2, %xmm0
movsd %xmm2, 0x10(%rsp)
jbe 0x42c61d
movsd %xmm2, 0xca0(%r14)
movsd (%rsp), %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, 0xca8(%r14)
movq 0x88(%rsp), %rax
movq %rax, 0xc98(%r14)
movq 0xc80(%r14), %rsi
movapd 0x60(%rsp), %xmm0
addsd %xmm2, %xmm0
movq %rbp, %rdi
callq 0x411940
movq %rbp, %rdi
callq 0x4119b8
movl 0xd0(%rsp), %eax
movq 0x98(%rsp,%rax,8), %rcx
cmpq 0xc0(%rsp,%rax,8), %rcx
jne 0x42c3b4
jmp 0x42c368
movsd 0x10(%rsp), %xmm2
jmp 0x42c5c5
movq $0x656aa0, %rbx         # imm = 0x656AA0
leaq 0x1a28cb(%rip), %rsi    # 0x5cef2b
movl $0x3a, %edx
jmp 0x42c67a
movq $0x656aa0, %rbx         # imm = 0x656AA0
leaq 0x19f1e0(%rip), %rsi    # 0x5cb855
movl $0x39, %edx
movq %rbx, %rdi
callq 0x4b14d0
leaq 0x229010(%rip), %rsi    # 0x655699
movq %rbx, %rdi
callq 0x440cc2
nop