// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movsd 0x40(%rdi), %xmm0
movsd 0x58(%rdi), %xmm1
movapd %xmm1, %xmm2
cmpltsd 0x19ee1c(%rip), %xmm1   # 0x5c3388
mulsd %xmm0, %xmm2
andnpd %xmm2, %xmm1
movapd %xmm1, 0x30(%rsp)
mulsd 0x50(%rdi), %xmm0
movsd %xmm0, 0x28(%rsp)
callq 0x4e1c90
movsd %xmm0, 0x20(%rsp)
movl 0xc88(%r14), %esi
movq %rbx, %rdi
callq 0x40e3b8
subsd 0x20(%rsp), %xmm0
movapd 0x30(%rsp), %xmm1
movapd %xmm1, %xmm3
subsd %xmm1, %xmm0
movsd 0xca0(%r14), %xmm2
ucomisd %xmm0, %xmm2
jbe 0x4245cf
movsd %xmm0, 0xca0(%r14)
movapd %xmm0, %xmm2
leaq 0x30(%r14), %r15
movq 0xc80(%r14), %rdx
movl 0xc88(%r14), %ecx
movapd 0x19aa77(%rip), %xmm1   # 0x5bf060
xorpd %xmm3, %xmm1
movsd 0x20(%rsp), %xmm0
addsd %xmm0, %xmm2
leaq 0x60(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x40e424
movsd 0x28(%rsp), %xmm0
mulsd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0xb0(%r14), %r13
movapd 0x30(%rsp), %xmm0
mulsd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
leaq 0x50(%rsp), %rbp
movl 0xb0(%rsp), %eax
movq 0x78(%rsp,%rax,8), %rcx
cmpq 0xa0(%rsp,%rax,8), %rcx
je 0x424862
incq 0xd40(%r14)
movq 0x68(%rsp), %rsi
movq 0xc80(%r14), %rdx
movq %rbx, %rdi
callq 0x40e556
movsd %xmm0, 0x50(%rsp)
movsd %xmm1, 0x58(%rsp)
movl 0xc88(%r14), %esi
movsd 0x50(%rsp,%rsi,8), %xmm0
movsd %xmm0, (%rsp)
movq %rbp, %rdi
callq 0x424bc4
movsd (%rsp), %xmm3
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm5
movapd %xmm3, %xmm6
subsd 0xca0(%r14), %xmm6
ucomisd %xmm2, %xmm3
jbe 0x424746
movapd %xmm6, %xmm0
mulsd %xmm6, %xmm0
xorpd %xmm1, %xmm1
cmpltsd %xmm6, %xmm1
andpd %xmm0, %xmm1
addsd %xmm5, %xmm1
movsd 0x28(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x424746
movsd %xmm6, 0x10(%rsp)
mulsd %xmm3, %xmm3
movsd %xmm5, 0x8(%rsp)
movsd %xmm3, 0x48(%rsp)
addsd %xmm3, %xmm5
movq %r15, %rdi
movapd %xmm5, %xmm0
movq %r13, %rsi
callq 0x424c0e
xorpd %xmm2, %xmm2
ucomisd %xmm0, %xmm2
jb 0x424884
movapd %xmm0, %xmm4
movsd 0x48(%rsp), %xmm0
addsd %xmm4, %xmm0
ucomisd %xmm2, %xmm0
movsd (%rsp), %xmm3
movsd 0x8(%rsp), %xmm5
movsd 0x10(%rsp), %xmm6
jbe 0x424746
ucomisd %xmm2, %xmm0
jb 0x4247e5
sqrtsd %xmm0, %xmm0
jmp 0x4247fb
ucomisd %xmm6, %xmm2
jbe 0x424855
movapd 0x30(%rsp), %xmm0
ucomisd %xmm5, %xmm0
jbe 0x424855
xorpd %xmm0, %xmm0
minsd %xmm3, %xmm0
movsd %xmm0, 0x8(%rsp)
mulsd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
addsd %xmm0, %xmm5
movq %r15, %rdi
movapd %xmm5, %xmm0
movq %r13, %rsi
callq 0x424cea
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x424874
movapd %xmm0, %xmm4
movsd 0x10(%rsp), %xmm0
addsd %xmm4, %xmm0
ucomisd %xmm1, %xmm0
jb 0x4247b3
sqrtsd %xmm0, %xmm0
jmp 0x4247c4
movapd %xmm4, 0x10(%rsp)
callq 0x4e1e90
movapd 0x10(%rsp), %xmm4
movsd (%rsp), %xmm3
movsd 0x8(%rsp), %xmm2
movapd %xmm3, %xmm1
subsd %xmm2, %xmm1
subsd %xmm2, %xmm0
divsd %xmm0, %xmm4
addsd %xmm1, %xmm4
jmp 0x42480b
movapd %xmm4, 0x10(%rsp)
callq 0x4e1e90
movapd 0x10(%rsp), %xmm4
movsd (%rsp), %xmm3
xorpd 0x19a85d(%rip), %xmm4   # 0x5bf060
addsd %xmm3, %xmm0
divsd %xmm0, %xmm4
movsd 0xca0(%r14), %xmm0
ucomisd %xmm4, %xmm0
jbe 0x424855
movsd %xmm4, 0xca0(%r14)
subsd %xmm4, %xmm3
movsd %xmm3, 0xca8(%r14)
movq 0x68(%rsp), %rax
movq %rax, 0xc98(%r14)
movq 0xc80(%r14), %rsi
addsd 0x20(%rsp), %xmm4
movq %r12, %rdi
movapd %xmm4, %xmm0
callq 0x40e648
movq %r12, %rdi
callq 0x40e69a
jmp 0x424633
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x64eaa0, %rdi         # imm = 0x64EAA0
leaq 0x19b13a(%rip), %rsi    # 0x5bf9bc
jmp 0x424892
movq $0x64eaa0, %rdi         # imm = 0x64EAA0
leaq 0x19b0f0(%rip), %rsi    # 0x5bf982
callq 0x4a4910
leaq 0x228dfb(%rip), %rsi    # 0x64d699
movq %rax, %rdi
callq 0x434f95