// File: /workspace/github_cpp_makefile_star2_O1/Cell-veto[P]postlhc/./ecmc.hpp
// Function: ChainRunner<Jellium3, Monodisperse2D>::measure_chain_expansion(Storage<Monodisperse2D>*, unsigned int, unsigned int)
double measure_chain_expansion (stor_t *stor, unsigned direction_, unsigned num_samples = 100)
    {
        inter.notify_random_context (&random);
        inter.notify_error_bound (stor, stor->cell_diagonal ());

        direction = direction_;
        disp_left = stor->periods () [direction_];

        // estimate median of disp and xdisp
        std::vector <double> ds, xs;

        for (unsigned n = 0; n != num_samples; ++n)
        {
            planned_next = active = stor->random_particle (&random);
            planned_disp = disp_left;
            planned_xdisp = 0.;

            find_sr_events (stor);
            find_lr_events (stor);

            ds.push_back (planned_disp);
            xs.push_back (planned_xdisp);
        }

        std::sort (ds.begin (), ds.end ());
        std::cerr << "calib_stat disp " << ds[0] << " " << ds[num_samples/2]
            << " " << ds.back () << "\n";
        std::sort (xs.begin (), xs.end ());
        std::cerr << "calib_stat xdisp " << xs[0] << " " << xs[num_samples/2]
            << " " << xs.back () << "\n";

        double ret = 1. + xs[num_samples/2]/ds[num_samples/2];
        std::cerr << "calib_stat chexp " << ret << "\n";
        return (ret < 0.) ? 1. : ret;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, %r13d
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rdi), %r12
xorpd %xmm1, %xmm1
xorl %ebp, %ebp
movsd %xmm1, 0x40(%rsp)
movq %r14, %rdi
movl %ebp, %esi
callq 0x4115c4
movsd 0x40(%rsp), %xmm1
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm1
incl %ebp
cmpl $0x2, %ebp
jne 0x41222d
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x412265
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x41226e
movapd %xmm1, %xmm0
callq 0x4ee410
movq %r12, %rdi
movq %r14, %rsi
callq 0x40e800
movl %ebx, 0x2448(%r15)
movq (%r14), %rax
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq *0x28(%rax)
movl %ebx, %eax
movsd 0x20(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x2450(%r15)
xorl %eax, %eax
movq %rax, 0x10(%r12)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r12)
movq %rax, 0x10(%rsp)
movapd %xmm0, (%rsp)
movq %r13, 0x40(%rsp)
testl %r13d, %r13d
je 0x412394
leaq 0x1870(%r15), %r12
leaq 0x2460(%r15), %r13
leaq 0x2468(%r15), %rbp
movq 0x40(%rsp), %rax
movl %eax, %ebx
movq %r14, %rdi
movq %r12, %rsi
callq 0x40e976
movq %rax, 0x2440(%r15)
movq %rax, 0x2458(%r15)
movsd 0x2450(%r15), %xmm0
movsd %xmm0, 0x2460(%r15)
movq $0x0, 0x2468(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x40e9d2
movq %r15, %rdi
movq %r14, %rsi
callq 0x40ecf8
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x412354
movsd (%r13), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x412361
leaq 0x20(%rsp), %rdi
movq %r13, %rdx
callq 0x4126f8
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x412381
movsd (%rbp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x41238c
movq %rsp, %rdi
movq %rbp, %rdx
callq 0x4126f8
decl %ebx
jne 0x4122e7
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r14
cmpq %r14, %rbx
movq 0x40(%rsp), %r15
je 0x4123d5
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x412837
movq %rbx, %rdi
movq %r14, %rsi
callq 0x412930
movq $0x656aa0, %rdi         # imm = 0x656AA0
leaq 0x1b9aa4(%rip), %rsi    # 0x5cbe87
movl $0x10, %edx
callq 0x4b14d0
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movq $0x656aa0, %rdi         # imm = 0x656AA0
callq 0x4b2730
movq %rax, %rbx
leaq 0x1bec8d(%rip), %rsi    # 0x5d1099
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
shrl %r15d
movq 0x20(%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbx, %rdi
callq 0x4b2730
movq %rax, %rbx
leaq 0x1bec60(%rip), %rsi    # 0x5d1099
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq 0x28(%rsp), %rax
movsd -0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x4b2730
leaq 0x1c978b(%rip), %rsi    # 0x5dbbea
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
cmpq %r14, %rbx
je 0x4124a7
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x412837
movq %rbx, %rdi
movq %r14, %rsi
callq 0x412930
movq $0x656aa0, %rdi         # imm = 0x656AA0
leaq 0x1b99e3(%rip), %rsi    # 0x5cbe98
movl $0x11, %edx
callq 0x4b14d0
movq (%rsp), %rax
movsd (%rax), %xmm0
movq $0x656aa0, %rdi         # imm = 0x656AA0
callq 0x4b2730
movq %rax, %rbx
leaq 0x1bebbc(%rip), %rsi    # 0x5d1099
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq (%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq %rbx, %rdi
callq 0x4b2730
movq %rax, %rbx
leaq 0x1beb93(%rip), %rsi    # 0x5d1099
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq 0x8(%rsp), %rax
movsd -0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x4b2730
leaq 0x1c96be(%rip), %rsi    # 0x5dbbea
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq (%rsp), %rax
movsd (%rax,%r15,8), %xmm0
movq 0x20(%rsp), %rax
divsd (%rax,%r15,8), %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x656aa0, %rdi         # imm = 0x656AA0
leaq 0x1b9948(%rip), %rsi    # 0x5cbeaa
movl $0x11, %edx
callq 0x4b14d0
movapd 0x40(%rsp), %xmm0
addsd 0x1b7a9e(%rip), %xmm0   # 0x5ca018
movq $0x656aa0, %rdi         # imm = 0x656AA0
movapd %xmm0, 0x40(%rsp)
callq 0x4b2730
leaq 0x1c9657(%rip), %rsi    # 0x5dbbea
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b14d0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4125b6
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4440d0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4125cd
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4440d0
xorpd %xmm1, %xmm1
movapd 0x40(%rsp), %xmm2
movapd %xmm2, %xmm0
cmpltsd %xmm1, %xmm0
movsd 0x1b7a30(%rip), %xmm1   # 0x5ca018
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x412607
jmp 0x412607
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x412620
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4440d0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x412637
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x4440d0
movq %rbx, %rdi
callq 0x4f77a0