// File: /workspace/github_cpp_makefile_star2_O2/bonetblai[P]mdp-engine/ctp3/./ctp3.h
// Function: problem_t::next(state_t const&, int, std::vector<std::pair<state_t, float>, std::allocator<std::pair<state_t, float>>>&) const
virtual void next(const state_t &s,
                      Problem::action_t a,
                      std::vector<std::pair<state_t, float> > &outcomes) const {

        if( use_cache_ ) {
            const std::vector<std::pair<state_t, float> > *ptr = next_cache_.lookup(s, a);
            if( ptr != 0 ) {
                outcomes = *ptr;
                return;
            }
        }

        //std::cout << "next" << s << " w/ a=" << a << " is:" << std::endl;

        ++expansions_;

        int to_node = -1;
        if( s.current_ == -1 ) {
            to_node = start_;
        } else {
            to_node = a;
            assert(to_node != s.current_);
        }

        // collect edges adjacent at to_node of unknown status
        int k = 0;
        std::vector<int> unknown_edges;
        unknown_edges.reserve(graph_.num_edges_);
        for( int i = 0, isz = graph_.at_[to_node].size(); i < isz; ++i ) {
            int e = graph_.at_[to_node][i];
            if( !s.known(e) ) {
                unknown_edges.push_back(e);
                ++k;
            }
        }
        max_branching_ = (1<<k) > max_branching_ ? (1<<k) : max_branching_;
        avg_branching_ = (expansions_ - 1) * avg_branching_ + (float)(1<<k);
        avg_branching_ /= (float)expansions_;

        // generate subsets of unknowns edges and update weathers
        outcomes.clear();
        outcomes.reserve(1 << k);
        for( int i = 0, isz = 1 << k; i < isz; ++i ) {
            state_t next(s);
            float p = 1;
            int subset = i;
            for( int j = 0; j < k; ++j ) {
                int e = unknown_edges[j];
                p *= (subset & 1) ? 1 - graph_.prob(e) : graph_.prob(e);
                next.info_.set_edge_status(e, subset & 1);
                subset = subset >> 1;
            }
            next.move_to(to_node);
            next.heuristic_ = -1;
            if( next.shared_ ) {
                next.distances_ = 0;
            } else {
                assert(next.distances_ != 0);
                delete[] next.distances_;
                next.distances_ = 0;
                next.shared_ = true;
            }
            assert(next.distances_ == 0);
            if( p > 0 ) {
                //next.preprocess();
                outcomes.push_back(std::make_pair(next, p));
                //std::cout << "    " << next << " w.p. " << p << std::endl;
            }
        }

        if( use_cache_ ) next_cache_.insert(s, a, outcomes);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rcx, 0x18(%rsp)
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
cmpb $0x1, 0xa0(%rdi)
jne 0x8f8d
leaq 0xa8(%r15), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0xa2b8
testq %rax, %rax
je 0x8f8d
movq 0x18(%rsp), %rdi
movq %rax, %rsi
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa2e2
incq 0x10(%r15)
movl (%r14), %eax
cmpl $-0x1, %eax
movq %r14, 0x20(%rsp)
je 0x8fc5
movl %ebx, 0xc(%rsp)
cmpl %ebx, %eax
jne 0x8fd0
leaq 0x17527(%rip), %rdi     # 0x204d4
leaq 0x174f6(%rip), %rsi     # 0x204aa
leaq 0x1752f(%rip), %rcx     # 0x204ea
movl $0x25e, %edx            # imm = 0x25E
callq 0x51b0
movl 0x90(%r15), %eax
movl %eax, 0xc(%rsp)
leaq 0x40(%rsp), %rdi
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq 0x18(%r15), %rax
movslq 0x4(%rax), %rsi
callq 0xa3aa
movl %ebx, 0x2c(%rsp)
movq 0x18(%r15), %rax
movslq 0xc(%rsp), %rcx
movq 0x28(%rax), %rax
imulq $0x18, %rcx, %r14
movq 0x8(%rax,%r14), %rbp
subq (%rax,%r14), %rbp
shrq $0x2, %rbp
xorl %ebx, %ebx
testl %ebp, %ebp
cmovlel %ebx, %ebp
leaq 0xd0(%rsp), %r12
xorl %r13d, %r13d
cmpq %rbx, %rbp
je 0x9067
movq 0x18(%r15), %rax
movq 0x28(%rax), %rax
movq (%rax,%r14), %rax
movl (%rax,%rbx,4), %eax
movl %eax, 0xd0(%rsp)
movl %eax, %ecx
sarl $0x5, %ecx
movslq %ecx, %rcx
movq 0x20(%rsp), %rdx
movl 0x4(%rdx,%rcx,4), %ecx
btl %eax, %ecx
jb 0x9062
leaq 0x40(%rsp), %rdi
movq %r12, %rsi
callq 0x8804
incl %r13d
incq %rbx
jmp 0x9021
pushq $0x1
popq %r12
movl %r12d, 0x14(%rsp)
movl %r13d, %ecx
shll %cl, %r12d
movl 0x98(%r15), %eax
cmpl %eax, %r12d
cmovgl %r12d, %eax
movl %eax, 0x98(%r15)
movq 0x10(%r15), %rax
movq %rax, %rcx
decq %rcx
js 0x909e
cvtsi2ss %rcx, %xmm1
jmp 0x90b3
movq %rcx, %rdx
shrq %rdx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm1
addss %xmm1, %xmm1
cvtsi2ss %r12d, %xmm0
mulss 0x9c(%r15), %xmm1
addss %xmm1, %xmm0
testq %rax, %rax
js 0x90d1
cvtsi2ss %rax, %xmm1
jmp 0x90e6
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x9c(%r15)
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0xa43a
movslq %r12d, %rsi
movq %rbx, %rdi
callq 0xa442
leaq 0x64(%rsp), %rbp
movl 0xc(%rsp), %ecx
movl %ecx, %eax
sarl $0x5, %eax
shll %cl, 0x14(%rsp)
xorl %ebx, %ebx
testl %r13d, %r13d
cmovlel %ebx, %r13d
cltq
movq %rax, 0x38(%rsp)
testl %r12d, %r12d
cmovlel %ebx, %r12d
cmpl %r12d, %ebx
je 0x927c
leaq 0x60(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0xa4d8
xorl %r14d, %r14d
movss 0x16eb5(%rip), %xmm0    # 0x2000c
movss %xmm0, 0x10(%rsp)
movq %rbx, 0x30(%rsp)
cmpq %r14, %r13
je 0x91bd
movq 0x40(%rsp), %rax
movslq (%rax,%r14,4), %rsi
movq 0x18(%r15), %rax
movq 0x10(%rax), %rax
movq %rsi, %rcx
shlq $0x4, %rcx
movss 0xc(%rax,%rcx), %xmm0
testb $0x1, %bl
je 0x9199
movss 0x16e7a(%rip), %xmm1    # 0x2000c
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
movl %ebx, %edx
andl $0x1, %edx
movss 0x10(%rsp), %xmm1
mulss %xmm0, %xmm1
movss %xmm1, 0x10(%rsp)
movq %rbp, %rdi
callq 0xa4fe
shrl %ebx
incq %r14
jmp 0x9162
movl 0xc(%rsp), %eax
movl %eax, 0x60(%rsp)
movl 0x14(%rsp), %eax
movq 0x38(%rsp), %rcx
orl %eax, 0xac(%rsp,%rcx,4)
orl $-0x1, 0xc8(%rsp)
cmpb $0x0, 0xbc(%rsp)
je 0x91f7
andq $0x0, 0xc0(%rsp)
movq 0x30(%rsp), %rbx
jmp 0x9223
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
movq 0x30(%rsp), %rbx
je 0x92bf
callq 0x5330
andq $0x0, 0xc0(%rsp)
movb $0x1, 0xbc(%rsp)
movss 0x10(%rsp), %xmm0
ucomiss 0x16de0(%rip), %xmm0    # 0x20010
jbe 0x926b
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
leaq 0x60(%rsp), %rsi
callq 0xa4d8
movss 0x10(%rsp), %xmm0
movss %xmm0, 0x140(%rsp)
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0xab6a
movq %r14, %rdi
callq 0x8e90
leaq 0x60(%rsp), %rdi
callq 0x8e90
incl %ebx
jmp 0x9134
cmpb $0x0, 0xa0(%r15)
je 0x92a3
addq $0xa8, %r15
movq %r15, %rdi
movq 0x20(%rsp), %rsi
movl 0x2c(%rsp), %edx
movq 0x18(%rsp), %rcx
callq 0xa51e
leaq 0x40(%rsp), %rdi
callq 0x85dc
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17295(%rip), %rdi     # 0x2055b
leaq 0x171dd(%rip), %rsi     # 0x204aa
leaq 0x17216(%rip), %rcx     # 0x204ea
movl $0x282, %edx            # imm = 0x282
callq 0x51b0
jmp 0x9303
jmp 0x9303
movq %rax, %rbx
jmp 0x92f7
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x8e90
leaq 0x60(%rsp), %rdi
callq 0x8e90
jmp 0x9306
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x85dc
movq %rbx, %rdi
callq 0x5410