// File: /workspace/github_cpp_makefile_star2_O1/Cell-veto[P]postlhc/jellium4.cpp
// Function: Jellium4<2u, Monodisperse2D>::lr_event_rate(std::array<double, 2ul> const&, unsigned int, bool)
double lr_event_rate (const vector_t &r, unsigned direction, bool clip = true)
    {
        // FIXME 3D missing
        if (DIM != 2)
            std::cerr << "not impl" << ABORT;

        double pr = 0.;

        for (int i = -LATTICE_ORDER; i <= LATTICE_ORDER; ++i)
        {
            double x = r[direction] + i*periods[direction];
            for (int j = -LATTICE_ORDER; j <= LATTICE_ORDER; ++j)
            {
                double y = r[!direction] + j*periods[!direction];
                double rsq = x*x + y*y;
                if (rsq >= sr_lr_split*sr_lr_split)
                    pr += unit_directional_derivative (x, rsq);
            }
        }

        // screening charges
        double spr = 0;
        double xf = r[direction] + (LATTICE_ORDER+.5) * periods[direction];
        double xb = r[direction] - (LATTICE_ORDER+.5) * periods[direction];
        for (int j = -LATTICE_ORDER; j <= LATTICE_ORDER; ++j)
        {
            double y = r[!direction] + j*periods[!direction];
            spr += unit_potential (xf*xf + y*y);
            spr -= unit_potential (xb*xb + y*y);
        }

        pr += spr / periods[direction];

        if (clip && pr < 0.)
            return 0.;
        else
            return stren * pr;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, 0x2c(%rsp)
movq %rsi, %r15
movq %rdi, %r14
movl %edx, %r12d
xorl %r13d, %r13d
movl %edx, 0x8(%rsp)
testl %edx, %edx
sete %r13b
movl $0xfffffffc, %ebx       # imm = 0xFFFFFFFC
movsd 0x1b0b97(%rip), %xmm0   # 0x5cd860
xorpd %xmm2, %xmm2
shll $0x3, %r13d
movsd 0x1ad33f(%rip), %xmm3   # 0x5ca018
movsd 0x20(%r14,%r12,8), %xmm1
movsd %xmm0, 0x10(%rsp)
mulsd %xmm0, %xmm1
addsd (%r15,%r12,8), %xmm1
movl $0x9, %ebp
movsd %xmm1, 0x18(%rsp)
movapd %xmm1, %xmm4
mulsd %xmm1, %xmm4
movsd 0x1b0b55(%rip), %xmm5   # 0x5cd860
movsd %xmm4, (%rsp)
movsd 0x20(%r14,%r13), %xmm0
mulsd %xmm5, %xmm0
addsd (%r15,%r13), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm4, %xmm0
movsd 0x18(%r14), %xmm1
mulsd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x41cd83
movsd 0x10(%r14), %xmm1
addsd 0x1ae329(%rip), %xmm1   # 0x5cb070
mulsd 0x1ae311(%rip), %xmm1   # 0x5cb060
movapd %xmm2, 0x30(%rsp)
movsd %xmm5, 0x20(%rsp)
callq 0x4ee2f0
movsd 0x20(%rsp), %xmm5
movsd (%rsp), %xmm4
movsd 0x1ad2a5(%rip), %xmm3   # 0x5ca018
movapd 0x30(%rsp), %xmm2
mulsd 0x18(%rsp), %xmm0
addsd %xmm0, %xmm2
addsd %xmm3, %xmm5
decl %ebp
jne 0x41cd10
movsd 0x10(%rsp), %xmm0
addsd %xmm3, %xmm0
incl %ebx
cmpl $0x5, %ebx
jne 0x41ccd9
movsd (%r15,%r12,8), %xmm0
movsd 0x20(%r14,%r12,8), %xmm1
movsd 0x1b0ab3(%rip), %xmm3   # 0x5cd868
mulsd %xmm1, %xmm3
addsd %xmm0, %xmm3
mulsd 0x1b0aab(%rip), %xmm1   # 0x5cd870
addsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
xorl %r13d, %r13d
cmpl $0x0, 0x8(%rsp)
sete %r13b
movsd 0x1b0a7d(%rip), %xmm0   # 0x5cd860
movl $0x9, %ebp
shll $0x3, %r13d
mulsd %xmm3, %xmm3
movsd %xmm3, 0x8(%rsp)
xorpd %xmm1, %xmm1
movsd %xmm1, 0x18(%rsp)
movapd %xmm2, 0x30(%rsp)
movsd 0x20(%r14,%r13), %xmm1
movsd %xmm0, 0x20(%rsp)
mulsd %xmm0, %xmm1
addsd (%r15,%r13), %xmm1
mulsd %xmm1, %xmm1
movsd 0x8(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
addsd %xmm1, %xmm0
movsd 0x10(%r14), %xmm1
ucomisd 0x1ae1a9(%rip), %xmm1   # 0x5cafe8
jne 0x41ce52
jp 0x41ce52
callq 0x4ee2b0
mulsd 0x1ae210(%rip), %xmm0   # 0x5cb060
jmp 0x41ce65
mulsd 0x1ae206(%rip), %xmm1   # 0x5cb060
callq 0x4ee2f0
divsd 0x10(%r14), %xmm0
movsd %xmm0, (%rsp)
movsd 0x40(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd 0x10(%rsp), %xmm0
movsd 0x10(%r14), %xmm1
ucomisd 0x1ae160(%rip), %xmm1   # 0x5cafe8
jne 0x41ce9b
jp 0x41ce9b
callq 0x4ee2b0
mulsd 0x1ae1c7(%rip), %xmm0   # 0x5cb060
jmp 0x41ceae
mulsd 0x1ae1bd(%rip), %xmm1   # 0x5cb060
callq 0x4ee2f0
divsd 0x10(%r14), %xmm0
movsd 0x18(%rsp), %xmm1
addsd (%rsp), %xmm1
subsd %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
addsd 0x1ad14d(%rip), %xmm0   # 0x5ca018
decl %ebp
movapd 0x30(%rsp), %xmm2
jne 0x41cdfa
divsd 0x20(%r14,%r12,8), %xmm1
addsd %xmm1, %xmm2
movsd 0x8(%r14), %xmm0
mulsd %xmm2, %xmm0
cmpb $0x0, 0x2c(%rsp)
je 0x41cf06
xorpd %xmm1, %xmm1
cmpltsd %xmm1, %xmm2
andnpd %xmm0, %xmm2
movapd %xmm2, %xmm0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop