// File: /workspace/github_cpp_makefile_star2_O3/fredericmarchand[P]TexasHoldem/Player.cpp
// Function: Player::bestHand(Card**, Card*, Card*, bool)
Hand Player::bestHand(Card** flop, Card *turn, Card *river, bool verbose)
{
    Card *combo[5];
    Hand maxValue = NOTHING;
    Card *retCombo[5];

    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = turn;
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = river;
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = flop[0]; combo[3] = turn;    combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = flop[0]; combo[3] = river;   combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = turn;    combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = river;   combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = flop[0]; combo[3] = turn;    combo[4] = river;
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = turn;    combo[3] = flop[1]; combo[4] = river;
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = hand[1]; combo[2] = turn;    combo[3] = river;   combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);

    combo[0] = hand[0]; combo[1] = turn;  combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = river; combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = turn;  combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = river;
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = turn;  combo[2] = flop[0]; combo[3] = river;   combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[0]; combo[1] = turn;  combo[2] = river;   combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);

    combo[0] = hand[1]; combo[1] = turn;  combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[1]; combo[1] = river; combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[1]; combo[1] = turn;  combo[2] = flop[0]; combo[3] = flop[1]; combo[4] = river;
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[1]; combo[1] = turn;  combo[2] = flop[0]; combo[3] = river;   combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);
    combo[0] = hand[1]; combo[1] = turn;  combo[2] = river;   combo[3] = flop[1]; combo[4] = flop[2];
    checkHand(combo, retCombo, &maxValue);

    if (verbose)
    {
        printCardArray(retCombo, 5);
    }

    return maxValue;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %r8d, -0x64(%rbp)
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
leaq -0x2c(%rbp), %rax
movl $0x0, (%rax)
movq %rax, %rdx
movq (%rdi), %rax
leaq -0x90(%rbp), %r13
movq %rax, (%r13)
movq 0x8(%rdi), %rax
movq %rax, 0x8(%r13)
movq (%rsi), %rax
movq %rax, 0x10(%r13)
movq 0x8(%rsi), %rax
movq %rax, 0x18(%r13)
movq 0x10(%rsi), %rax
movq %rax, 0x20(%r13)
leaq -0x60(%rbp), %rsi
movq %r13, %rdi
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq %rbx, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq %r12, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq %rbx, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq %r12, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq %rbx, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq %r12, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq %rbx, 0x18(%r13)
movq %r12, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq %rbx, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq %r12, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq 0x8(%r14), %rax
movq %rax, 0x8(%r13)
movq %rbx, 0x10(%r13)
movq %r12, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq %r12, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq %r12, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq %r12, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq (%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq %r12, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %r12, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq %r12, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq (%r15), %rax
movq %rax, 0x10(%r13)
movq %r12, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
movq 0x8(%r14), %rax
movq %rax, (%r13)
movq %rbx, 0x8(%r13)
movq %r12, 0x10(%r13)
movq 0x8(%r15), %rax
movq %rax, 0x18(%r13)
movq 0x10(%r15), %rax
movq %rax, 0x20(%r13)
movq %r13, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x31e2
cmpl $0x0, -0x64(%rbp)
je 0x39e8
leaq -0x60(%rbp), %rdi
movl $0x5, %esi
callq 0x2af3
movl -0x2c(%rbp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq