// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/ctp3/../engine/problem.h
// Function: Problem::problem_t<state_t>::nsample(state_t const&, int, Problem::hash_t<state_t> const&) const
std::pair<T, bool> nsample(const T &s, action_t a, const hash_t<T> &hash) const {
        std::vector<std::pair<T, float> > outcomes;
        next(s, a, outcomes);
        unsigned osize = outcomes.size();
        std::vector<bool> label(osize, false);

        size_t n = 0;
        float mass = 0;
        for( unsigned i = 0; i < osize; ++i ) {
            if( (label[i] = hash.solved(outcomes[i].first)) ) {
                mass += outcomes[i].second;
                ++n;
            }
        }

        mass = 1.0 - mass;
        n = osize - n;
        if( n == 0 ) return std::make_pair(s, false);

        float d = Random::real();
        for( unsigned i = 0; i < osize; ++i ) {
            if( !label[i] && ((n == 1) || (d <= outcomes[i].second / mass)) ) {
                return std::make_pair(outcomes[i].first, true);
            } else if( !label[i] ) {
                --n;
                d -= outcomes[i].second / mass;
            }
        }
        assert(0);
        return std::make_pair(s, false);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r15
movq %rdx, %rbx
movq %rdi, 0x38(%rsp)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq (%rsi), %r8
movq %rsi, %rdi
movq %rdx, %rsi
movl %ecx, %edx
movq %rax, %rcx
callq *0x60(%r8)
movq %rbx, 0x10(%rsp)
movq 0x28(%rsp), %rax
subq 0x20(%rsp), %rax
pushq $0x78
popq %rcx
cqto
idivq %rcx
movl %eax, %r12d
leaq 0xf(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x40(%rsp), %rdi
leaq 0xe(%rsp), %rcx
movq %r12, %rsi
callq 0x10898
xorps %xmm0, %xmm0
movss %xmm0, 0x8(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpq %rbp, %r12
je 0x10371
movq 0x20(%rsp), %rsi
addq %r14, %rsi
movq %r15, %rdi
callq 0xe7c8
movl %eax, %ebx
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0x108fc
testb %bl, %bl
je 0x1033c
movq (%rax), %rcx
orq %rdx, %rcx
jmp 0x10345
movq %rdx, %rcx
notq %rcx
andq (%rax), %rcx
movq %rcx, (%rax)
testq %rdx, %rcx
je 0x10368
movq 0x20(%rsp), %rax
movss 0x8(%rsp), %xmm0
addss 0x70(%rax,%r14), %xmm0
movss %xmm0, 0x8(%rsp)
incq %r13
incq %rbp
addq $0x78, %r14
jmp 0x1030c
movq %r12, %rbx
subq %r13, %rbx
je 0x10451
movss 0xfc87(%rip), %xmm0     # 0x2000c
movss %xmm0, 0x10(%rsp)
subss 0x8(%rsp), %xmm0
movss %xmm0, 0x1c(%rsp)
callq 0xb216
movss %xmm0, 0x8(%rsp)
movss 0x10(%rsp), %xmm0
divss 0x1c(%rsp), %xmm0
movss %xmm0, 0x10(%rsp)
imulq $0x78, %r12, %r13
xorl %r12d, %r12d
leaq 0x40(%rsp), %r14
xorl %r15d, %r15d
cmpq %r12, %r13
je 0x1048f
movq %r14, %rdi
movq %r15, %rsi
callq 0x108fc
testq %rdx, (%rax)
jne 0x103ff
movq 0x20(%rsp), %rsi
cmpq $0x1, %rbx
je 0x1043d
movss 0x70(%rsi,%r12), %xmm0
mulss 0x10(%rsp), %xmm0
movss 0x8(%rsp), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x1043d
movq %r14, %rdi
movq %r15, %rsi
callq 0x108fc
testq %rdx, (%rax)
jne 0x10434
decq %rbx
movq 0x20(%rsp), %rax
movss 0x70(%rax,%r12), %xmm0
mulss 0x10(%rsp), %xmm0
movss 0x8(%rsp), %xmm1
subss %xmm0, %xmm1
movss %xmm1, 0x8(%rsp)
incq %r15
addq $0x78, %r12
jmp 0x103c3
addq %r12, %rsi
movb $0x1, %bl
movq 0x38(%rsp), %r14
movq %r14, %rdi
callq 0xa4d8
jmp 0x10465
movq 0x38(%rsp), %r14
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0xa4d8
xorl %ebx, %ebx
movb %bl, 0x70(%r14)
leaq 0x40(%rsp), %rdi
callq 0x1091a
leaq 0x20(%rsp), %rdi
callq 0xb53c
movq %r14, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10bb4(%rip), %rdi     # 0x2104a
leaq 0x1018d(%rip), %rsi     # 0x2062a
leaq 0x108cc(%rip), %rcx     # 0x20d70
movl $0xc5, %edx
callq 0x51b0
jmp 0x104bf
jmp 0x104bf
jmp 0x104b4
movq %rax, %rbx
jmp 0x104cc
jmp 0x104bf
jmp 0x104bf
jmp 0x104bf
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x1091a
leaq 0x20(%rsp), %rdi
callq 0xb53c
movq %rbx, %rdi
callq 0x5410