// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
movl %esi, %eax
movsd 0x20(%rdi,%rax,8), %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0x18(%rdi), %xmm1
movsd %xmm1, 0x18(%rsp)
addsd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq $0x656aa0, %r14         # imm = 0x656AA0
leaq 0x1bc36a(%rip), %rsi    # 0x5cb452
movl $0x1a, %edx
movq %r14, %rdi
callq 0x4b14d0
movq %r14, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x4b2730
movq %rax, %r15
leaq 0x1c1f8c(%rip), %rsi    # 0x5d1099
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq %r15, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x4b2730
leaq 0x1ccabb(%rip), %r15    # 0x5dbbea
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4b14d0
leaq 0x1bc327(%rip), %rsi    # 0x5cb46d
movl $0x1a, %edx
movq %r14, %rdi
callq 0x4b14d0
movsd 0x38(%rbx), %xmm0
movq %r14, %rdi
callq 0x4b2730
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4b14d0
leaq 0x40(%rbx), %r14
movl 0xc(%rsp), %eax
shlq $0xb, %rax
leaq (%rbx,%rax), %rdi
addq $0x40, %rdi
movsd 0x10(%rbx), %xmm3
movsd 0x1bbe1f(%rip), %xmm1   # 0x5cafb0
addsd %xmm3, %xmm1
addsd 0x1bbe73(%rip), %xmm3   # 0x5cb010
movl $0x2, %esi
movsd 0x18(%rsp), %xmm0
movsd 0x10(%rsp), %xmm2
callq 0x40f79e
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
xorl %r13d, %r13d
xorpd %xmm0, %xmm0
leaq 0x20(%rsp), %r15
movsd %xmm0, 0x18(%rsp)
mulsd 0x1bbe49(%rip), %xmm0   # 0x5cb020
movsd %xmm0, 0x10(%rsp)
callq 0x4010f0
movsd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x401098
movsd %xmm0, 0x48(%rsp)
movsd 0x18(%rbx), %xmm1
movl 0xc(%rsp), %r12d
xorl %eax, %eax
movsd 0x40(%rsp,%rax,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp,%rax,8)
incq %rax
cmpq $0x2, %rax
jne 0x40f205
movupd 0x20(%rsp), %xmm0
movupd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movl %r12d, %edx
movsd %xmm1, 0x10(%rsp)
callq 0x40fafa
movapd %xmm0, %xmm1
addsd %xmm0, %xmm1
shlq $0xb, %r12
addq %r14, %r12
movsd 0x38(%rbx), %xmm2
movq %r12, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x4106b8
movsd 0x1badb0(%rip), %xmm0   # 0x5ca018
movsd 0x18(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
incl %r13d
cmpl $0x64, %r13d
jne 0x40f1c9
movl $0xfffffff6, %ebp       # imm = 0xFFFFFFF6
movsd 0x1bbd98(%rip), %xmm1   # 0x5cb028
leaq 0x20(%rsp), %r15
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movsd 0x50(%rsp), %xmm0
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm0
movl 0xc(%rsp), %r12d
movsd %xmm0, 0x20(%rsp,%r12,8)
movsd 0x18(%rbx), %xmm1
mulsd 0x1bbd48(%rip), %xmm1   # 0x5cb010
ucomisd %xmm0, %xmm1
jbe 0x40f354
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm0
mulsd %xmm1, %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
ucomisd 0x1bbcf6(%rip), %xmm0   # 0x5cafe8
jb 0x40f2fa
sqrtsd %xmm0, %xmm0
jmp 0x40f2ff
callq 0x4ee410
movsd %xmm0, 0x18(%rsp)
movl 0xc(%rsp), %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x40fafa
movapd %xmm0, %xmm1
addsd %xmm0, %xmm1
shlq $0xb, %r12
addq %r14, %r12
movsd 0x38(%rbx), %xmm2
movq %r12, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x4106b8
movl 0xc(%rsp), %r12d
movsd 0x18(%rbx), %xmm0
mulsd 0x1bbce8(%rip), %xmm0   # 0x5cb030
addsd 0x20(%rsp,%r12,8), %xmm0
jmp 0x40f2b4
movsd 0x10(%rsp), %xmm1
addsd 0x1bacb6(%rip), %xmm1   # 0x5ca018
incl %ebp
cmpl $0xb, %ebp
jne 0x40f295
leaq 0x50(%rsp), %rax
leaq 0x20(%rsp), %r15
movq %rax, (%r15)
movq %rbx, 0x8(%r15)
leaq 0xc(%rsp), %rax
movq %rax, 0x10(%r15)
xorpd %xmm0, %xmm0
leaq 0x40(%rsp), %rbx
movapd %xmm0, (%rbx)
xorpd %xmm0, %xmm0
movl $0x1e, %ebp
movsd %xmm0, 0x18(%rsp)
mulsd 0x1bbc8d(%rip), %xmm0   # 0x5cb038
movsd %xmm0, 0x10(%rsp)
callq 0x4010f0
movsd %xmm0, 0x40(%rsp)
movsd 0x10(%rsp), %xmm0
callq 0x401098
movsd %xmm0, 0x48(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4108c8
movsd 0x18(%rsp), %xmm0
addsd 0x1bac32(%rip), %xmm0   # 0x5ca018
decl %ebp
jne 0x40f39d
movl 0xc(%rsp), %eax
shlq $0xb, %rax
addq %rax, %r14
movq %r14, %rdi
movl $0x2, %esi
callq 0x41003c
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop