// File: bonetblai[P]mdp-engine/ctp3/../engine/online_rtdp.h
// Function: Online::Policy::RTDP::finite_horizon_lrtdp_t<state_t>::best_action(Online::Policy::RTDP::node_t<state_t> const&, bool) const
Problem::action_t best_action(const node_t<T> &node, bool random_ties) const {
        std::vector<Problem::action_t> actions;
        int nactions = problem_.number_actions(node.state());
        float best_value = std::numeric_limits<float>::max();
        actions.reserve(random_ties ? nactions : 1);
        for( Problem::action_t a = 0; a < nactions; ++a ) {
            if( problem_.applicable(node.state(), a) ) {
                std::pair<float, bool> p = q_value(node, a);
                if( p.first <= best_value ) {
                    if( p.first < best_value ) {
                        best_value = p.first;
                        actions.clear();
                    }
                    if( random_ties || actions.empty() )
                        actions.push_back(a);
                }
            }
        }
        assert(!actions.empty());
        assert(actions.size() == 1);
        return actions[Random::random(actions.size())];
    }

// Assembly:
subq $0x88, %rsp
movb %dl, %al
movq %rdi, 0x80(%rsp)
movq %rsi, 0x78(%rsp)
andb $0x1, %al
movb %al, 0x77(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x58(%rsp), %rdi
callq 0xe840
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x78(%rsp), %rdi
callq 0x54f00
movq 0x28(%rsp), %rdi
movq %rax, %rsi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, 0x30(%rsp)
jmp 0x546c2
movl 0x30(%rsp), %eax
movl %eax, 0x54(%rsp)
callq 0x23160
movss %xmm0, 0x40(%rsp)
testb $0x1, 0x77(%rsp)
je 0x546e6
movl 0x54(%rsp), %eax
movl %eax, 0x1c(%rsp)
jmp 0x546f1
movl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x546f1
movl 0x1c(%rsp), %eax
movslq %eax, %rsi
leaq 0x58(%rsp), %rdi
callq 0x163b0
jmp 0x54704
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x54(%rsp), %eax
jge 0x5481e
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x78(%rsp), %rdi
callq 0x54f00
movq 0x10(%rsp), %rdi
movq %rax, %rsi
movl 0x3c(%rsp), %edx
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
movb %al, 0x1b(%rsp)
jmp 0x5474d
movb 0x1b(%rsp), %al
testb $0x1, %al
jne 0x5475a
jmp 0x5480c
movq 0x20(%rsp), %rdi
movq 0x78(%rsp), %rsi
movl 0x3c(%rsp), %edx
callq 0x572e0
movq %rax, 0x8(%rsp)
jmp 0x54774
movq 0x8(%rsp), %rax
movl %eax, %ecx
movl %ecx, 0x34(%rsp)
shrq $0x20, %rax
movb %al, 0x38(%rsp)
movss 0x34(%rsp), %xmm1
movss 0x40(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x5480a
movss 0x34(%rsp), %xmm1
movss 0x40(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0x547de
movss 0x34(%rsp), %xmm0
movss %xmm0, 0x40(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x38350
jmp 0x547de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x58(%rsp), %rdi
callq 0xdfb0
jmp 0x548c5
testb $0x1, 0x77(%rsp)
jne 0x547f5
leaq 0x58(%rsp), %rdi
callq 0x1a320
testb $0x1, %al
jne 0x547f5
jmp 0x54808
leaq 0x58(%rsp), %rdi
leaq 0x3c(%rsp), %rsi
callq 0xedb0
jmp 0x54806
jmp 0x54808
jmp 0x5480a
jmp 0x5480c
jmp 0x5480e
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x5470c
leaq 0x58(%rsp), %rdi
callq 0x1a320
xorb $-0x1, %al
testb $0x1, %al
jne 0x54830
jmp 0x54832
jmp 0x54851
leaq 0xb850(%rip), %rdi      # 0x60089
leaq 0xb6bb(%rip), %rsi      # 0x5fefb
movl $0xf7, %edx
leaq 0xb84e(%rip), %rcx      # 0x6009a
callq 0x6220
leaq 0x58(%rsp), %rdi
callq 0xdcb0
cmpq $0x1, %rax
jne 0x54863
jmp 0x54882
leaq 0xb8b2(%rip), %rdi      # 0x6011c
leaq 0xb68a(%rip), %rsi      # 0x5fefb
movl $0xf8, %edx
leaq 0xb81d(%rip), %rcx      # 0x6009a
callq 0x6220
leaq 0x58(%rsp), %rdi
callq 0xdcb0
movl %eax, %edi
callq 0x1a370
movl %eax, 0x4(%rsp)
jmp 0x54899
movl 0x4(%rsp), %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x58(%rsp), %rdi
callq 0xdcf0
movl (%rax), %eax
movl %eax, (%rsp)
leaq 0x58(%rsp), %rdi
callq 0xdfb0
movl (%rsp), %eax
addq $0x88, %rsp
retq
movq 0x48(%rsp), %rdi
callq 0x6520
nop