// File: /workspace/github_cpp_makefile_star2_O2/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 $0x48, %rsp
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x30(%rdi), %r13
leaq 0x1870(%rdi), %r12
movq %rsi, %rdi
callq 0x40be06
movq %r13, %rdi
movq %r14, %rsi
callq 0x40bcac
movl %ebx, 0x2448(%r15)
movq (%r14), %rax
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq *0x28(%rax)
movl %ebx, %eax
movsd 0x10(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x2450(%r15)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r13)
andq $0x0, 0x10(%r13)
leaq 0x30(%rsp), %rax
andq $0x0, 0x10(%rax)
movapd %xmm0, (%rax)
leaq 0x2460(%r15), %rbx
leaq 0x2468(%r15), %r13
movq %rbp, (%rsp)
subl $0x1, %ebp
jb 0x40f10e
movq %r14, %rdi
movq %r12, %rsi
callq 0x40be5c
movq %rax, 0x2440(%r15)
movq %rax, 0x2458(%r15)
movsd 0x2450(%r15), %xmm0
movsd %xmm0, 0x2460(%r15)
andq $0x0, 0x2468(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x40beb8
movq %r15, %rdi
movq %r14, %rsi
callq 0x40c1d6
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x40f3c2
leaq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x40f3c2
jmp 0x40f0a4
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x40f53f
movq $0x64eaa0, %rdi         # imm = 0x64EAA0
leaq 0x1b0f2b(%rip), %rsi    # 0x5c0056
callq 0x4a4910
movq 0x10(%rsp), %rcx
movsd (%rcx), %xmm0
movq %rax, %rdi
callq 0x4a5640
leaq 0x1b6765(%rip), %rsi    # 0x5c58ad
movq %rax, %rdi
callq 0x4a4910
movq (%rsp), %rdx
shrl %edx
movq 0x10(%rsp), %rcx
movq %rdx, %rbx
movsd (%rcx,%rdx,8), %xmm0
movq %rax, %rdi
callq 0x4a5640
leaq 0x1b673b(%rip), %rsi    # 0x5c58ad
movq %rax, %rdi
callq 0x4a4910
movq 0x18(%rsp), %rcx
movsd -0x8(%rcx), %xmm0
movq %rax, %rdi
callq 0x4a5640
leaq 0x1c1277(%rip), %rsi    # 0x5d040a
movq %rax, %rdi
callq 0x4a4910
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x40f53f
movq $0x64eaa0, %rdi         # imm = 0x64EAA0
leaq 0x1b0eaf(%rip), %rsi    # 0x5c0067
callq 0x4a4910
movq 0x30(%rsp), %rcx
movsd (%rcx), %xmm0
movq %rax, %rdi
callq 0x4a5640
leaq 0x1b66d8(%rip), %rsi    # 0x5c58ad
movq %rax, %rdi
callq 0x4a4910
movq 0x30(%rsp), %rcx
movsd (%rcx,%rbx,8), %xmm0
movq %rax, %rdi
callq 0x4a5640
leaq 0x1b66b7(%rip), %rsi    # 0x5c58ad
movq %rax, %rdi
callq 0x4a4910
movq 0x38(%rsp), %rcx
movsd -0x8(%rcx), %xmm0
movq %rax, %rdi
callq 0x4a5640
leaq 0x1c11f3(%rip), %rsi    # 0x5d040a
movq %rax, %rdi
callq 0x4a4910
movq 0x30(%rsp), %rax
movsd (%rax,%rbx,8), %xmm0
movq 0x10(%rsp), %rax
divsd (%rax,%rbx,8), %xmm0
movapd %xmm0, (%rsp)
movq $0x64eaa0, %rdi         # imm = 0x64EAA0
leaq 0x1b0e33(%rip), %rsi    # 0x5c0079
callq 0x4a4910
movapd (%rsp), %xmm0
addsd 0x1aedc0(%rip), %xmm0   # 0x5be018
movq %rax, %rdi
movapd %xmm0, (%rsp)
callq 0x4a5640
leaq 0x1c119e(%rip), %rsi    # 0x5d040a
movq %rax, %rdi
callq 0x4a4910
xorpd %xmm0, %xmm0
movapd (%rsp), %xmm1
movapd %xmm1, %xmm2
cmpltsd %xmm0, %xmm2
movsd 0x1aed8a(%rip), %xmm0   # 0x5be018
andpd %xmm2, %xmm0
andnpd %xmm1, %xmm2
orpd %xmm0, %xmm2
movapd %xmm2, (%rsp)
leaq 0x30(%rsp), %rdi
callq 0x40f9ac
leaq 0x10(%rsp), %rdi
callq 0x40f9ac
movaps (%rsp), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40f2ca
jmp 0x40f2ca
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x40f9ac
leaq 0x10(%rsp), %rdi
callq 0x40f9ac
movq %rbx, %rdi
callq 0x4eb220
nop