// File: Cell-veto[P]postlhc/./ecmc.hpp
// Function: ChainRunner<Jellium3, 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
movq %rsp, %rbp
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x110(%rbp)
callq 0x41e010
movq -0x110(%rbp), %rdi
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x18(%rbp)
addq $0x30, %rdi
callq 0x41e020
movq -0x110(%rbp), %rax
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm3
movsd -0x18(%rbp), %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)
movq -0x10(%rbp), %rdi
movl 0x2448(%rax), %esi
callq 0x41e040
movq -0x110(%rbp), %rax
subsd -0x28(%rbp), %xmm0
subsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x30(%rbp), %xmm1
movsd 0x2460(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x419494
movq -0x110(%rbp), %rax
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0x2460(%rax)
movq -0x110(%rbp), %rax
movq -0x10(%rbp), %rsi
movq 0x2440(%rax), %rdx
movl 0x2448(%rax), %ecx
movsd -0x28(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movq %xmm1, %rdi
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
xorq %r8, %rdi
movq %rdi, %xmm1
movsd 0x2460(%rax), %xmm2
addsd -0x28(%rbp), %xmm2
leaq -0x88(%rbp), %rdi
callq 0x41e0f0
leaq -0x88(%rbp), %rdi
callq 0x41e2e0
movb %al, -0x111(%rbp)
jmp 0x4194fa
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x419509
jmp 0x419a55
movq -0x110(%rbp), %rax
movq 0x2500(%rax), %rcx
incq %rcx
movq %rcx, 0x2500(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x128(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x41e3c0
movq %rax, -0x120(%rbp)
jmp 0x419541
movq -0x120(%rbp), %rsi
movq -0x128(%rbp), %rdi
movq -0x110(%rbp), %rax
movq 0x2440(%rax), %rdx
callq 0x41e310
movsd %xmm1, -0x138(%rbp)
movsd %xmm0, -0x130(%rbp)
jmp 0x419574
movq -0x110(%rbp), %rax
movsd -0x138(%rbp), %xmm0
movsd -0x130(%rbp), %xmm1
movsd %xmm1, -0xa8(%rbp)
movsd %xmm0, -0xa0(%rbp)
movl 0x2448(%rax), %eax
movl %eax, %esi
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x418e10
movsd (%rax), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0xb0(%rbp), %xmm0
callq 0x418110
movq -0x110(%rbp), %rax
movq -0x148(%rbp), %rdi
movsd %xmm0, -0xb8(%rbp)
movl 0x2448(%rax), %eax
movl %eax, %esi
callq 0x41e3e0
movsd %xmm0, -0x140(%rbp)
jmp 0x4195fc
movq -0x110(%rbp), %rax
movsd -0x140(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xb0(%rbp), %xmm0
subsd 0x2460(%rax), %xmm0
movsd %xmm0, -0xc8(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x150(%rbp)
movsd -0xc8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x419663
movsd -0xc8(%rbp), %xmm0
callq 0x418110
movsd %xmm0, -0x158(%rbp)
jmp 0x419670
xorps %xmm0, %xmm0
movsd %xmm0, -0x158(%rbp)
jmp 0x419670
movsd -0x150(%rbp), %xmm0
movsd -0x158(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
movsd -0xb0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x419801
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x160(%rbp)
movsd -0x20(%rbp), %xmm0
callq 0x418110
movsd -0x160(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x419801
movq -0x110(%rbp), %rsi
movsd -0xc0(%rbp), %xmm0
movsd -0xb8(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xe0(%rbp)
movq %rsi, %rdi
addq $0x30, %rdi
movsd -0xe0(%rbp), %xmm0
addq $0x1870, %rsi           # imm = 0x1870
callq 0x41e4a0
movsd %xmm0, -0x168(%rbp)
jmp 0x419715
movsd -0x168(%rbp), %xmm0
movsd %xmm0, -0xe8(%rbp)
xorps %xmm0, %xmm0
ucomisd -0xe8(%rbp), %xmm0
jae 0x419786
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x1e358d(%rip), %rsi    # 0x5fcccd
callq 0x4e1b60
movq %rax, -0x170(%rbp)
jmp 0x41974e
movq -0x170(%rbp), %rdi
leaq 0x27dec5(%rip), %rsi    # 0x697621
callq 0x46d700
jmp 0x419763
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x41e640
jmp 0x419a6a
movsd -0xb8(%rbp), %xmm0
addsd -0xe8(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x4197ff
movsd -0xe8(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, -0x178(%rbp)
movsd -0xb8(%rbp), %xmm0
addsd -0xe8(%rbp), %xmm0
callq 0x51f030
movaps %xmm0, %xmm1
movsd -0x178(%rbp), %xmm0
addsd -0xb0(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
jmp 0x41999a
jmp 0x419801
xorps %xmm0, %xmm0
ucomisd -0xc8(%rbp), %xmm0
jbe 0x419995
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x180(%rbp)
movsd -0x18(%rbp), %xmm0
callq 0x418110
movsd -0x180(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x419995
movsd -0xb0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x41985c
xorps %xmm0, %xmm0
movsd %xmm0, -0x188(%rbp)
jmp 0x41986c
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x188(%rbp)
movsd -0x188(%rbp), %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xf0(%rbp), %xmm0
callq 0x418110
movq -0x110(%rbp), %rsi
movsd %xmm0, -0xf8(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd -0xf8(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x100(%rbp)
movq %rsi, %rdi
addq $0x30, %rdi
movsd -0x100(%rbp), %xmm0
addq $0x1870, %rsi           # imm = 0x1870
callq 0x41e4f0
movsd %xmm0, -0x190(%rbp)
jmp 0x4198d9
movsd -0x190(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movsd -0x108(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jae 0x41992b
movq $0x698ac0, %rdi         # imm = 0x698AC0
leaq 0x1e33ff(%rip), %rsi    # 0x5fcd07
callq 0x4e1b60
movq %rax, -0x198(%rbp)
jmp 0x419916
movq -0x198(%rbp), %rdi
leaq 0x27dcfd(%rip), %rsi    # 0x697621
callq 0x46d700
jmp 0x41992b
movsd -0xb0(%rbp), %xmm0
subsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x1a0(%rbp)
movsd -0x108(%rbp), %xmm0
movsd %xmm0, -0x1a8(%rbp)
movsd -0xf8(%rbp), %xmm0
addsd -0x108(%rbp), %xmm0
callq 0x51f030
movsd -0x1a8(%rbp), %xmm1
movaps %xmm0, %xmm2
movsd -0x1a0(%rbp), %xmm0
subsd -0xf0(%rbp), %xmm2
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0xd0(%rbp)
jmp 0x41999a
jmp 0x419a42
movq -0x110(%rbp), %rax
movsd -0xd0(%rbp), %xmm1
movsd 0x2460(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x419a40
movq -0x110(%rbp), %rax
movsd -0xd0(%rbp), %xmm0
movsd %xmm0, 0x2460(%rax)
movsd -0xb0(%rbp), %xmm0
movsd -0xd0(%rbp), %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, 0x2468(%rax)
leaq -0x88(%rbp), %rdi
callq 0x41e3c0
movq %rax, -0x1b0(%rbp)
jmp 0x419a03
movq -0x110(%rbp), %rax
movq -0x1b0(%rbp), %rcx
movq %rcx, 0x2458(%rax)
movq 0x2440(%rax), %rsi
movsd -0xd0(%rbp), %xmm0
movsd -0x28(%rbp), %xmm1
addsd %xmm1, %xmm0
leaq -0x88(%rbp), %rdi
callq 0x41e530
jmp 0x419a3e
jmp 0x419a40
jmp 0x419a42
leaq -0x88(%rbp), %rdi
callq 0x41e5e0
jmp 0x419a50
jmp 0x4194e6
leaq -0x88(%rbp), %rdi
callq 0x41e640
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x5283c0
nopw %cs:(%rax,%rax)