// File: bonetblai[P]mdp-engine/ctp3/../engine/bdd_priority_queue.h
// Function: std::bdd_priority_queue<Online::Policy::AOT::node_t<state_t>*, Online::Policy::AOT::min_priority_t<state_t>, Online::Policy::AOT::max_priority_t<state_t>>::remove_from_max(unsigned int)
void remove_from_max(unsigned index) {
        if( !is_leaf_in_max(index) ) {
            unsigned leaf = max_subtree_leaf(index);
            assert(is_leaf_in_max(leaf));
            assert(!max_cmpfn_(max_array_[index]->element_, max_array_[leaf]->element_));
            assert(!min_cmpfn_(max_array_[index]->element_, max_array_[leaf]->element_));
            assert(max_array_[index]->xref_ == 1);
            max_array_[index]->xref_ = max_array_[leaf]->xref_;
            min_array_[max_array_[index]->xref_] = index;
            index = leaf;
        }

        // link pool of available containers
        max_array_[index]->next_ = pool_;
        pool_ = max_array_[index];

        // remove container from heap
        if( index != max_size_ ) {
            push_max(index, max_array_[max_size_]);
        }
        --max_size_;
        assert(check());
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movl 0x4c(%rsp), %esi
callq 0x482f0
testb $0x1, %al
jne 0x4803f
movq 0x40(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x48310
movq 0x40(%rsp), %rdi
movl %eax, 0x48(%rsp)
movl 0x48(%rsp), %esi
callq 0x482f0
testb $0x1, %al
jne 0x47e6e
jmp 0x47e70
jmp 0x47e8f
leaq 0x16fb4(%rip), %rdi     # 0x5ee2b
leaq 0x168cc(%rip), %rsi     # 0x5e74a
movl $0xa5, %edx
leaq 0x16fb6(%rip), %rcx     # 0x5ee40
callq 0x6220
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x40(%rsp), %rdi
movq (%rax), %rax
movq (%rax), %rax
movq %rax, 0x38(%rsp)
addq $0x20, %rdi
movl 0x48(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
movq (%rax), %rax
movq (%rax), %rdx
callq 0x47a60
xorb $-0x1, %al
testb $0x1, %al
jne 0x47edf
jmp 0x47ee1
jmp 0x47f00
leaq 0x170bb(%rip), %rdi     # 0x5efa3
leaq 0x1685b(%rip), %rsi     # 0x5e74a
movl $0xa6, %edx
leaq 0x16f45(%rip), %rcx     # 0x5ee40
callq 0x6220
movq 0x40(%rsp), %rdi
movq %rdi, %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x40(%rsp), %rdi
movq (%rax), %rax
movq (%rax), %rax
movq %rax, 0x30(%rsp)
addq $0x20, %rdi
movl 0x48(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq (%rax), %rax
movq (%rax), %rdx
callq 0x46a40
xorb $-0x1, %al
testb $0x1, %al
jne 0x47f5c
jmp 0x47f5e
jmp 0x47f7d
leaq 0x17083(%rip), %rdi     # 0x5efe8
leaq 0x167de(%rip), %rsi     # 0x5e74a
movl $0xa7, %edx
leaq 0x16ec8(%rip), %rcx     # 0x5ee40
callq 0x6220
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq (%rax), %rax
cmpl $0x1, 0x8(%rax)
jne 0x47f9c
jmp 0x47fbb
leaq 0x1708a(%rip), %rdi     # 0x5f02d
leaq 0x167a0(%rip), %rsi     # 0x5e74a
movl $0xa8, %edx
leaq 0x16e8a(%rip), %rcx     # 0x5ee40
callq 0x6220
movq 0x40(%rsp), %rdi
addq $0x20, %rdi
movl 0x48(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x40(%rsp), %rdi
movq (%rax), %rax
movl 0x8(%rax), %eax
movl %eax, 0x14(%rsp)
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movl 0x14(%rsp), %ecx
movq 0x40(%rsp), %rdi
movq (%rax), %rax
movl %ecx, 0x8(%rax)
movl 0x4c(%rsp), %eax
movl %eax, 0x24(%rsp)
movq %rdi, %rax
addq $0x40, %rax
movq %rax, 0x18(%rsp)
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x18(%rsp), %rdi
movq (%rax), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0x465b0
movl 0x24(%rsp), %ecx
movl %ecx, (%rax)
movl 0x48(%rsp), %eax
movl %eax, 0x4c(%rsp)
movq 0x40(%rsp), %rdi
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rsp)
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x8(%rsp), %rcx
movq 0x40(%rsp), %rdi
movq (%rax), %rax
movq %rcx, 0x10(%rax)
addq $0x20, %rdi
movl 0x4c(%rsp), %eax
movl %eax, %esi
callq 0x46590
movq 0x40(%rsp), %rcx
movq (%rax), %rax
movq %rax, 0x8(%rcx)
movl 0x4c(%rsp), %eax
cmpl 0x18(%rcx), %eax
je 0x480c0
movq 0x40(%rsp), %rax
movl 0x4c(%rsp), %ecx
movl %ecx, 0x4(%rsp)
movq %rax, %rdi
addq $0x20, %rdi
movl 0x18(%rax), %eax
movl %eax, %esi
callq 0x46590
movq 0x40(%rsp), %rdi
movl 0x4(%rsp), %esi
movq (%rax), %rdx
callq 0x478b0
movq 0x40(%rsp), %rdi
movl 0x18(%rdi), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rdi)
callq 0x465d0
testb $0x1, %al
jne 0x480d9
jmp 0x480db
jmp 0x480fa
leaq 0x16660(%rip), %rdi     # 0x5e742
leaq 0x16661(%rip), %rsi     # 0x5e74a
movl $0xb7, %edx
leaq 0x16d4b(%rip), %rcx     # 0x5ee40
callq 0x6220
addq $0x58, %rsp
retq
nop