// File: /workspace/github_cpp_makefile_star2_O1/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 $0x138, %rsp            # imm = 0x138
movq %rcx, 0x10(%rsp)
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r13
cmpb $0x1, 0xa0(%rdi)
jne 0xba59
leaq 0xa8(%r13), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0xcebc
testq %rax, %rax
je 0xba59
movq 0x10(%rsp), %rdi
movq %rax, %rsi
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcee6
incq 0x10(%r13)
movl (%r14), %eax
cmpl $-0x1, %eax
movl %ebx, 0x24(%rsp)
movq %r14, 0x18(%rsp)
je 0xba95
movl %ebx, 0x8(%rsp)
cmpl %ebx, %eax
jne 0xbaa0
leaq 0x21a87(%rip), %rdi     # 0x2d504
leaq 0x21a56(%rip), %rsi     # 0x2d4da
leaq 0x21a8f(%rip), %rcx     # 0x2d51a
movl $0x25e, %edx            # imm = 0x25E
callq 0x61c0
movl 0x90(%r13), %eax
movl %eax, 0x8(%rsp)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x18(%r13), %rax
movslq 0x4(%rax), %rsi
callq 0xd076
movq 0x18(%r13), %rax
movslq 0x8(%rsp), %rcx
movq 0x28(%rax), %rax
leaq (%rcx,%rcx,2), %r14
movq 0x8(%rax,%r14,8), %r12
subq (%rax,%r14,8), %r12
shrq $0x2, %r12
testl %r12d, %r12d
jle 0xbb5f
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
leaq 0x30(%rsp), %r15
leaq 0xc0(%rsp), %rbp
movl $0x0, 0x4(%rsp)
movq 0x18(%r13), %rax
movq 0x28(%rax), %rax
movq (%rax,%r14,8), %rax
movl (%rax,%rbx,4), %eax
movl %eax, 0xc0(%rsp)
movl %eax, %ecx
sarl $0x5, %ecx
movslq %ecx, %rcx
movq 0x18(%rsp), %rdx
movl 0x4(%rdx,%rcx,4), %ecx
btl %eax, %ecx
jb 0xbb55
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xbb46
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xbb51
movq %r15, %rdi
movq %rbp, %rdx
callq 0xb4a0
incl 0x4(%rsp)
incq %rbx
cmpq %rbx, %r12
jne 0xbb01
jmp 0xbb67
movl $0x0, 0x4(%rsp)
movl $0x1, %edx
movl 0x4(%rsp), %r14d
movl %r14d, %ecx
shll %cl, %edx
movl 0x98(%r13), %eax
cmpl %eax, %edx
movl %edx, %ebp
cmovgl %edx, %eax
movl %eax, 0x98(%r13)
movq 0x10(%r13), %rax
movq %rax, %rcx
decq %rcx
js 0xbb9e
cvtsi2ss %rcx, %xmm1
jmp 0xbbb3
movq %rcx, %rdx
shrq %rdx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm1
addss %xmm1, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
mulss 0x9c(%r13), %xmm1
addss %xmm1, %xmm0
testq %rax, %rax
js 0xbbd6
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
jmp 0xbbee
movq %rax, %rcx
shrq %rcx
andl $0x1, %eax
orq %rcx, %rax
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
movss %xmm0, 0x9c(%r13)
movq 0x10(%rsp), %rbx
movq (%rbx), %rsi
movq %rbx, %rdi
callq 0xd710
movslq %ebp, %rsi
movq %rbx, %rdi
callq 0xd104
cmpl $0x1f, %r14d
je 0xbe71
leaq 0x54(%rsp), %r12
movl 0x8(%rsp), %ecx
movl %ecx, %eax
sarl $0x5, %eax
movl $0x1, %edx
movl $0x1, %esi
shll %cl, %esi
movl %esi, 0x2c(%rsp)
cltq
movq %rax, 0x48(%rsp)
cmpl $0x2, %ebp
cmovll %edx, %ebp
movl %ebp, 0x28(%rsp)
movl %r14d, %ebx
leaq 0xc0(%rsp), %rcx
xorl %ebp, %ebp
movq %rcx, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r12)
movups %xmm0, 0x20(%r12)
movups %xmm0, 0x10(%r12)
movups %xmm0, (%r12)
xorl %eax, %eax
movq %rax, 0x40(%r12)
movb $0x1, 0xac(%rsp)
movq %rax, 0xb0(%rsp)
leaq 0x50(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xd546
movss 0x21361(%rip), %xmm1    # 0x2d008
movaps %xmm1, %xmm2
testl %r14d, %r14d
jle 0xbd2d
movq 0x30(%rsp), %rax
movq 0x18(%r13), %rdx
xorl %esi, %esi
movl %ebp, %edi
movaps %xmm1, %xmm2
movslq (%rax,%rsi,4), %rcx
testb $0x1, %dil
jne 0xbcdd
movq 0x10(%rdx), %r8
movq %rcx, %r9
shlq $0x4, %r9
movss 0xc(%r8,%r9), %xmm0
jmp 0xbcf2
movq 0x10(%rdx), %r8
movq %rcx, %r9
shlq $0x4, %r9
movaps %xmm1, %xmm0
subss 0xc(%r8,%r9), %xmm0
movl %ecx, %r9d
sarl $0x5, %r9d
movl $0x1, %r8d
shll %cl, %r8d
movslq %r9d, %rcx
orl %r8d, 0x54(%rsp,%rcx,4)
testb $0x1, %dil
jne 0xbd1a
notl %r8d
andl %r8d, 0x78(%rsp,%rcx,4)
jmp 0xbd1f
orl %r8d, 0x78(%rsp,%rcx,4)
mulss %xmm0, %xmm2
shrl %edi
incq %rsi
cmpq %rsi, %rbx
jne 0xbcbf
movl 0x8(%rsp), %eax
movl %eax, 0x50(%rsp)
movl 0x2c(%rsp), %eax
movq 0x48(%rsp), %rcx
orl %eax, 0x9c(%rsp,%rcx,4)
movl $0xffffffff, 0xb8(%rsp) # imm = 0xFFFFFFFF
cmpb $0x0, 0xac(%rsp)
movss %xmm2, 0xc(%rsp)
je 0xbd6e
movq $0x0, 0xb0(%rsp)
jmp 0xbd9e
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xbed8
callq 0x6340
movq $0x0, 0xb0(%rsp)
movb $0x1, 0xac(%rsp)
movss 0xc(%rsp), %xmm2
cmpq $0x0, 0xb0(%rsp)
jne 0xbeb9
movq %r15, %rcx
ucomiss 0x21259(%rip), %xmm2    # 0x2d010
jbe 0xbe46
movq %r13, %r14
leaq 0xc4(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
xorl %edx, %edx
movq %rdx, 0x40(%rax)
movb $0x1, 0x11c(%rsp)
movq %rdx, 0x120(%rsp)
movq %rcx, %rdi
movq %rcx, %r13
leaq 0x50(%rsp), %rsi
callq 0xd546
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x130(%rsp)
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xd896
cmpb $0x0, 0x11c(%rsp)
movq %r15, %rcx
movq %r14, %r13
jne 0xbe41
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xbe41
callq 0x6340
movq %r15, %rcx
movl 0x4(%rsp), %r14d
cmpb $0x0, 0xac(%rsp)
jne 0xbe65
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xbe65
callq 0x6340
movq %r15, %rcx
incl %ebp
cmpl 0x28(%rsp), %ebp
jne 0xbc5c
cmpb $0x0, 0xa0(%r13)
je 0xbe98
addq $0xa8, %r13
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movl 0x24(%rsp), %edx
movq 0x10(%rsp), %rcx
callq 0xd1cc
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xbea7
callq 0x6260
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x216e0(%rip), %rdi     # 0x2d5a0
leaq 0x21613(%rip), %rsi     # 0x2d4da
leaq 0x2164c(%rip), %rcx     # 0x2d51a
movl $0x287, %edx            # imm = 0x287
callq 0x61c0
leaq 0x216ac(%rip), %rdi     # 0x2d58b
leaq 0x215f4(%rip), %rsi     # 0x2d4da
leaq 0x2162d(%rip), %rcx     # 0x2d51a
movl $0x282, %edx            # imm = 0x282
callq 0x61c0
jmp 0xbf3d
jmp 0xbf3d
movq %rax, %rbx
jmp 0xbf1f
movq %rax, %rbx
cmpb $0x0, 0x11c(%rsp)
jne 0xbf1f
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xbf1f
callq 0x6340
cmpb $0x0, 0xac(%rsp)
jne 0xbf40
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xbf40
callq 0x6340
jmp 0xbf40
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xbf4f
callq 0x6260
movq %rbx, %rdi
callq 0x6410
nop