// File: /workspace/github_cpp_makefile_star2_O3/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 0xa8cb
leaq 0xa8(%r13), %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0xbc58
testq %rax, %rax
je 0xa8cb
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 0xbc82
incq 0x10(%r13)
movl (%r14), %eax
cmpl $-0x1, %eax
movl %ebx, 0x24(%rsp)
movq %r14, 0x18(%rsp)
je 0xa907
movl %ebx, 0x8(%rsp)
cmpl %ebx, %eax
jne 0xa912
leaq 0x20c25(%rip), %rdi     # 0x2b514
leaq 0x20bf4(%rip), %rsi     # 0x2b4ea
leaq 0x20c2d(%rip), %rcx     # 0x2b52a
movl $0x25e, %edx            # imm = 0x25E
callq 0x51c0
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 0xbe32
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 0xa9d1
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 0xa9c7
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xa9b8
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xa9c3
movq %r15, %rdi
movq %rbp, %rdx
callq 0xa316
incl 0x4(%rsp)
incq %rbx
cmpq %rbx, %r12
jne 0xa973
jmp 0xa9d9
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 0xaa10
cvtsi2ss %rcx, %xmm1
jmp 0xaa25
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 0xaa48
xorps %xmm1, %xmm1
cvtsi2ss %rax, %xmm1
jmp 0xaa60
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 0xc4da
movslq %ebp, %rsi
movq %rbx, %rdi
callq 0xbec4
cmpl $0x1f, %r14d
je 0xacc7
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 0xc30a
movss 0x204ef(%rip), %xmm2    # 0x2b008
movaps %xmm2, %xmm3
testl %r14d, %r14d
jle 0xab8e
movq 0x30(%rsp), %rax
movq 0x18(%r13), %rcx
movq 0x10(%rcx), %rdx
xorl %esi, %esi
movl %ebp, %edi
movaps %xmm2, %xmm3
movslq (%rax,%rsi,4), %rcx
movl %ecx, %r9d
movq %rcx, %r8
shlq $0x4, %r8
movss 0xc(%rdx,%r8), %xmm0
sarl $0x5, %r9d
movl $0x1, %r8d
shll %cl, %r8d
movslq %r9d, %rcx
orl %r8d, 0x54(%rsp,%rcx,4)
testb $0x1, %dil
je 0xab6f
movaps %xmm2, %xmm1
subss %xmm0, %xmm1
movaps %xmm1, %xmm0
jne 0xab7b
notl %r8d
andl %r8d, 0x78(%rsp,%rcx,4)
jmp 0xab80
orl %r8d, 0x78(%rsp,%rcx,4)
mulss %xmm0, %xmm3
shrl %edi
incq %rsi
cmpq %rsi, %rbx
jne 0xab35
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
movb 0xac(%rsp), %al
testb %al, %al
movss %xmm3, 0xc(%rsp)
je 0xabd0
movq $0x0, 0xb0(%rsp)
jmp 0xac02
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xad0f
callq 0x5340
movq $0x0, 0xb0(%rsp)
movb $0x1, 0xac(%rsp)
movb $0x1, %al
movss 0xc(%rsp), %xmm3
ucomiss 0x20407(%rip), %xmm3    # 0x2b010
movq %r15, %rcx
jbe 0xaca2
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 0xc30a
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x130(%rsp)
movq 0x10(%rsp), %rdi
movq %r13, %rsi
callq 0xc660
cmpb $0x0, 0x11c(%rsp)
movq %r15, %rcx
movq %r14, %r13
jne 0xac96
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xac96
callq 0x5340
movq %r15, %rcx
movb 0xac(%rsp), %al
movl 0x4(%rsp), %r14d
testb $0x1, %al
jne 0xacbb
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xacbb
callq 0x5340
movq %r15, %rcx
incl %ebp
cmpl 0x28(%rsp), %ebp
jne 0xaace
cmpb $0x0, 0xa0(%r13)
je 0xacee
addq $0xa8, %r13
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movl 0x24(%rsp), %edx
movq 0x10(%rsp), %rcx
callq 0xbf92
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xacfd
callq 0x5260
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20885(%rip), %rdi     # 0x2b59b
leaq 0x207cd(%rip), %rsi     # 0x2b4ea
leaq 0x20806(%rip), %rcx     # 0x2b52a
movl $0x282, %edx            # imm = 0x282
callq 0x51c0
jmp 0xad74
jmp 0xad74
movq %rax, %rbx
jmp 0xad56
movq %rax, %rbx
cmpb $0x0, 0x11c(%rsp)
jne 0xad56
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0xad56
callq 0x5340
cmpb $0x0, 0xac(%rsp)
jne 0xad77
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xad77
callq 0x5340
jmp 0xad77
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xad86
callq 0x5260
movq %rbx, %rdi
callq 0x5410