// File: /workspace/github_cpp_makefile_star2_O3/Cell-veto[P]postlhc/jellium3.cpp
// Function: void Jellium3::calibrate<2u>(unsigned int)
void calibrate (unsigned direction)
    {
        typedef vector <DIM> vector_t;
        const double L = period[direction];
        const double r_decay = sr_lr_split; // first decaying inner shell
        const double r_tail  = 2*L;  // last (decaying) inner shell, begin tail
        std::cerr << "jellium3_init shell_radii " << r_decay << " " << r_tail << "\n";
        std::cerr << "jellium3_init error_bound " << error_bound << "\n";

        prober[direction].calib_begin (DIM,
            r_decay, exponent+0.5,               // inner paralpha
            r_tail,  exponent+3);                // tail paralpha (= exponent+4 decay)

        // scan along the sr_lr_split
        for_all_angles <DIM> (100, [&] (const vector_t &unit_vec)
        {
            const double r = sr_lr_split;
            add_sample (direction, r, lr_event_rate (r*unit_vec, direction));
        });

        // in extremely small systems, the first few copies can cause trouble
        for (int i = -10; i <= 10; ++i)
        {
            vector_t ridge = zero_vector <DIM> ();
            ridge[direction] = i*L;
            for (; ridge[direction] < 3*sr_lr_split; ridge[direction] += 1e-3*sr_lr_split)
                add_sample (direction, norm (ridge), lr_event_rate (ridge, direction));
        }

        for_all_angles <DIM> (30, [&] (const vector_t &unit_vec)
        {
            for (double r = 0; r < 2*L; r += 1e-3*sr_lr_split)
                add_sample (direction, r, lr_event_rate (r*unit_vec, direction));

            for (double r = 1.; r < 1e15*L; r *= 1.0001)
                add_sample (direction, r, lr_event_rate (r*unit_vec, direction));
        });

        prober[direction].calib_finish (DIM);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
movl %esi, %r13d
movsd 0x20(%rdi,%r13,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x18(%rdi), %xmm1
movsd %xmm1, (%rsp)
movsd %xmm0, 0x48(%rsp)
addsd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq $0x655aa0, %r14         # imm = 0x655AA0
leaq 0x1bb451(%rip), %rsi    # 0x5ca542
movl $0x1a, %edx
movq %r14, %rdi
callq 0x4b0120
movq %r14, %rdi
movsd (%rsp), %xmm0
callq 0x4b1380
movq %rax, %r15
leaq 0x1c1104(%rip), %rsi    # 0x5d0219
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq %r15, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x4b1380
leaq 0x1cbc33(%rip), %r15    # 0x5dad6a
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4b0120
leaq 0x1bb40f(%rip), %rsi    # 0x5ca55d
movl $0x1a, %edx
movq %r14, %rdi
callq 0x4b0120
movsd 0x38(%rbx), %xmm0
movq %r14, %rdi
callq 0x4b1380
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4b0120
leaq 0x40(%rbx), %r14
movq %r13, %rax
shlq $0xb, %rax
leaq (%rbx,%rax), %r15
addq $0x40, %r15
movsd 0x10(%rbx), %xmm3
movsd 0x1baf58(%rip), %xmm1   # 0x5ca0f0
addsd %xmm3, %xmm1
addsd 0x1bafac(%rip), %xmm3   # 0x5ca150
movq %r15, %rdi
movl $0x2, %esi
movsd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm2
callq 0x40f794
xorpd %xmm0, %xmm0
movl $0x64, %r12d
movsd %xmm0, (%rsp)
mulsd 0x1baf8d(%rip), %xmm0   # 0x5ca160
movsd %xmm0, 0x28(%rsp)
callq 0x4010f0
movapd %xmm0, 0x10(%rsp)
movsd 0x28(%rsp), %xmm0
callq 0x401098
movapd 0x10(%rsp), %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movsd 0x18(%rbx), %xmm0
movapd %xmm0, 0x10(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm1, %xmm0
movapd %xmm0, 0x30(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
movl %ebp, %edx
callq 0x40faf6
movapd %xmm0, %xmm1
addsd %xmm0, %xmm1
movsd 0x38(%rbx), %xmm2
movq %r15, %rdi
movaps 0x10(%rsp), %xmm0
callq 0x410662
movsd 0x1b9dd5(%rip), %xmm0   # 0x5c9018
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
decl %r12d
jne 0x40f1c6
movsd 0x18(%rbx), %xmm0
movl $0xfffffff6, %eax       # imm = 0xFFFFFFF6
movsd 0x1baef7(%rip), %xmm2   # 0x5ca168
movsd 0x1baed7(%rip), %xmm3   # 0x5ca150
leaq 0x30(%rsp), %r15
movl %eax, 0x10(%rsp)
movsd 0x48(%rsp), %xmm1
movsd %xmm2, 0x28(%rsp)
mulsd %xmm2, %xmm1
xorpd %xmm2, %xmm2
movapd %xmm2, 0x30(%rsp)
movsd %xmm1, 0x30(%rsp,%r13,8)
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
jbe 0x40f34a
movq %r13, %r12
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
mulsd %xmm0, %xmm0
mulsd %xmm1, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x40faf6
movapd %xmm0, %xmm1
addsd %xmm0, %xmm1
shlq $0xb, %r12
addq %r14, %r12
movsd 0x38(%rbx), %xmm2
movq %r12, %rdi
movsd (%rsp), %xmm0
callq 0x410662
movsd 0x1bae5e(%rip), %xmm2   # 0x5ca170
movsd 0x1bae36(%rip), %xmm3   # 0x5ca150
movsd 0x18(%rbx), %xmm0
movapd %xmm0, %xmm1
mulsd %xmm2, %xmm1
addsd 0x30(%rsp,%r13,8), %xmm1
movsd %xmm1, 0x30(%rsp,%r13,8)
movapd %xmm0, %xmm2
mulsd %xmm3, %xmm2
ucomisd %xmm1, %xmm2
movq %r13, %r12
ja 0x40f2b8
movsd 0x28(%rsp), %xmm2
addsd 0x1b9cc0(%rip), %xmm2   # 0x5c9018
movl 0x10(%rsp), %eax
incl %eax
cmpl $0xb, %eax
jne 0x40f27e
leaq 0x50(%rsp), %rax
leaq 0x30(%rsp), %r15
movq %rax, (%r15)
movq %rbx, 0x8(%r15)
leaq 0xc(%rsp), %rax
movq %rax, 0x10(%r15)
xorpd %xmm0, %xmm0
movl $0x1e, %ebp
leaq 0x58(%rsp), %rbx
movsd %xmm0, (%rsp)
mulsd 0x1baddc(%rip), %xmm0   # 0x5ca178
movsd %xmm0, 0x10(%rsp)
callq 0x4010f0
movsd %xmm0, 0x58(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x401098
movsd %xmm0, 0x60(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x410872
movsd (%rsp), %xmm0
addsd 0x1b9c42(%rip), %xmm0   # 0x5c9018
decl %ebp
jne 0x40f38f
movl 0xc(%rsp), %eax
shlq $0xb, %rax
addq %rax, %r14
movq %r14, %rdi
movl $0x2, %esi
callq 0x40ffec
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop