// File: /workspace/github_cpp_makefile_star2_O3/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 0x4114cc
movsd 0x40(%rsp), %xmm1
mulsd %xmm0, %xmm0
addsd %xmm0, %xmm1
incl %ebp
cmpl $0x2, %ebp
jne 0x41213f
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jb 0x412177
xorps %xmm0, %xmm0
sqrtsd %xmm1, %xmm0
jmp 0x412180
movapd %xmm1, %xmm0
callq 0x4ed060
movq %r12, %rdi
movq %r14, %rsi
callq 0x40e834
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)
testl %r13d, %r13d
je 0x4122e5
leaq 0x1870(%r15), %r12
movq %r13, %rax
leaq 0x2460(%r15), %r13
leaq 0x2468(%r15), %rbp
movq %rax, 0x40(%rsp)
movl %eax, %ebx
movq %r14, %rdi
movq %r12, %rsi
callq 0x40e9b8
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 0x40ea14
movq %r15, %rdi
movq %r14, %rsi
callq 0x40ed14
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x412264
movsd (%r13), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x28(%rsp)
jmp 0x412271
leaq 0x20(%rsp), %rdi
movq %r13, %rdx
callq 0x41258c
movq 0x8(%rsp), %rsi
cmpq 0x10(%rsp), %rsi
je 0x412291
movsd (%rbp), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x8(%rsp)
jmp 0x41229c
movq %rsp, %rdi
movq %rbp, %rdx
callq 0x41258c
decl %ebx
jne 0x4121f7
movq 0x20(%rsp), %rbx
movq 0x28(%rsp), %r14
cmpq %r14, %rbx
movq 0x40(%rsp), %r13
je 0x4122e5
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 0x4126cb
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4127c4
movq $0x655aa0, %rdi         # imm = 0x655AA0
leaq 0x1b8c84(%rip), %rsi    # 0x5caf77
movl $0x10, %edx
callq 0x4b0120
movq 0x20(%rsp), %rax
movsd (%rax), %xmm0
movq $0x655aa0, %rdi         # imm = 0x655AA0
callq 0x4b1380
movq %rax, %rbx
leaq 0x1bdefd(%rip), %rsi    # 0x5d0219
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
shrl %r13d
movq 0x20(%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
callq 0x4b1380
movq %rax, %rbx
leaq 0x1bded0(%rip), %rsi    # 0x5d0219
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq 0x28(%rsp), %rax
movsd -0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x4b1380
leaq 0x1c89fb(%rip), %rsi    # 0x5dad6a
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq (%rsp), %rbx
movq 0x8(%rsp), %r14
cmpq %r14, %rbx
je 0x4123b7
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 0x4126cb
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4127c4
movq $0x655aa0, %rdi         # imm = 0x655AA0
leaq 0x1b8bc3(%rip), %rsi    # 0x5caf88
movl $0x11, %edx
callq 0x4b0120
movq (%rsp), %rax
movsd (%rax), %xmm0
movq $0x655aa0, %rdi         # imm = 0x655AA0
callq 0x4b1380
movq %rax, %rbx
leaq 0x1bde2c(%rip), %rsi    # 0x5d0219
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq (%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movq %rbx, %rdi
callq 0x4b1380
movq %rax, %rbx
leaq 0x1bde03(%rip), %rsi    # 0x5d0219
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq 0x8(%rsp), %rax
movsd -0x8(%rax), %xmm0
movq %rbx, %rdi
callq 0x4b1380
leaq 0x1c892e(%rip), %rsi    # 0x5dad6a
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq (%rsp), %rax
movsd (%rax,%r13,8), %xmm0
movq 0x20(%rsp), %rax
divsd (%rax,%r13,8), %xmm0
movapd %xmm0, 0x40(%rsp)
movq $0x655aa0, %rdi         # imm = 0x655AA0
leaq 0x1b8b28(%rip), %rsi    # 0x5caf9a
movl $0x11, %edx
callq 0x4b0120
movapd 0x40(%rsp), %xmm0
addsd 0x1b6b8e(%rip), %xmm0   # 0x5c9018
movq $0x655aa0, %rdi         # imm = 0x655AA0
movapd %xmm0, 0x40(%rsp)
callq 0x4b1380
leaq 0x1c88c7(%rip), %rsi    # 0x5dad6a
movl $0x1, %edx
movq %rax, %rdi
callq 0x4b0120
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x4124c6
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x442d20
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x4124dd
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x442d20
xorpd %xmm1, %xmm1
movapd 0x40(%rsp), %xmm2
movapd %xmm2, %xmm0
cmpltsd %xmm1, %xmm0
movsd 0x1b6b20(%rip), %xmm1   # 0x5c9018
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 0x412517
jmp 0x412517
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x412530
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x442d20
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x412547
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x442d20
movq %rbx, %rdi
callq 0x4f63f0
nop