// File: /workspace/github_cpp_makefile_star2_O2/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, %r13
movq %rsi, %r15
leaq -0x2c(%rbp), %rax
andl $0x0, (%rax)
movq %rax, %rdx
movq %rdi, %r14
movq (%rdi), %rax
leaq -0x90(%rbp), %rbx
movq %rax, (%rbx)
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rbx)
movq (%rsi), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%rsi), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%rsi), %rax
movq %rax, 0x20(%rbx)
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq %r13, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq %r12, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq %r13, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq %r12, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq %r13, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq %r13, 0x18(%rbx)
movq %r12, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq %r13, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq %r12, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq %r13, 0x10(%rbx)
movq %r12, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq %r12, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq %r12, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq %r12, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq (%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq %r12, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq %r12, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq (%r15), %rax
movq %rax, 0x10(%rbx)
movq %r12, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq %r13, 0x8(%rbx)
movq %r12, 0x10(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x18(%rbx)
movq 0x10(%r15), %rax
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
leaq -0x60(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x2cf5
cmpl $0x0, -0x64(%rbp)
je 0x34e5
leaq -0x60(%rbp), %rdi
pushq $0x5
popq %rsi
callq 0x2932
movl -0x2c(%rbp), %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop