// File: /workspace/github_cpp_makefile_star2_O2/chrischute[P]are-you-the-one/src/ayto.cpp
// Function: getBestGuessFromSubset(ArgsForMinimaxThread const*)
void getBestGuessFromSubset(const ArgsForMinimaxThread *args)
{
    // Find the query in possibleGuesses which eliminates the most possible answers.
    Pm bestGuess = DIGITS;
    long numRemainingAfterBestGuess = args->_possibleAnswers->size();

    for (PmSet::const_iterator possibleGuess = args->_possibleGuesses->begin();
         possibleGuess != args->_possibleGuesses->end();
         ++possibleGuess) {
        Pm guess = *possibleGuess;

        if (!args->_guessesAlreadyMade->contains(guess)) {
            vector<int> numRemainingGivenResponse(PERM_LENGTH + 1, 0);
            // Check how many possibilities would remain after guessing guess
            for (PmSet::const_iterator it = args->_possibleAnswers->begin();
                 it != args->_possibleAnswers->end();
                 ++it) {
                numRemainingGivenResponse[numInCommon(guess, *it)] += 1;
            }
            // Find the # remaining in the worst-case scenario.
            int numRemainingAfterWorstResponse =
                    *max_element(numRemainingGivenResponse.begin(),
                                 numRemainingGivenResponse.end());
            // If this is lowest worst-case #remaining, set low water mark.
            if (numRemainingAfterWorstResponse < numRemainingAfterBestGuess) {
                bestGuess = guess;
                numRemainingAfterBestGuess = numRemainingAfterWorstResponse;
            }
        }
    }

    // After finding best guess in the chunk, write result to the shared dictionary.
    args->_writeLock->lock();
    args->_bestGuesses->insert(pair<Pm, int>(bestGuess, numRemainingAfterBestGuess));
    args->_writeLock->unlock();

    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x345b(%rip), %rsi      # 0x7025
leaq 0x48(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x4034
movq 0x8(%rbx), %rdi
callq 0x5b24
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x58ca
movq %rax, %r15
leaq 0x20(%rsp), %r12
leaq 0x8(%rsp), %r13
movq 0x10(%rbx), %rdi
callq 0x58f4
cmpq %rax, %r15
je 0x3cb7
movq %r12, %rdi
movq %r15, %rsi
callq 0x22c0
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0x58d2
testb %al, %al
jne 0x3ca6
andl $0x0, 0x4(%rsp)
movq %r13, %rdi
pushq $0xb
popq %rsi
leaq 0x4(%rsp), %rdx
leaq 0x3(%rsp), %rcx
callq 0x43d2
movq 0x8(%rbx), %rdi
callq 0x58ca
movq %rax, %rbp
movq 0x8(%rbx), %rdi
callq 0x58f4
cmpq %rax, %rbp
je 0x3c77
movq %r12, %rdi
movq %rbp, %rsi
callq 0x57fc
cltq
movq 0x8(%rsp), %rcx
incl (%rcx,%rax,4)
addq $0x20, %rbp
jmp 0x3c4e
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x46ab
movslq (%rax), %rbp
cmpq %rbp, %r14
jle 0x3c9e
leaq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x2120
movq %rbp, %r14
movq %r13, %rdi
callq 0x5488
movq %r12, %rdi
callq 0x20e0
addq $0x20, %r15
jmp 0x3bfb
movq 0x28(%rbx), %rdi
callq 0x4428
movq 0x20(%rbx), %r15
leaq 0x20(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x22c0
leaq 0x20(%rsp), %rsi
movl %r14d, 0x20(%rsi)
movq %r15, %rdi
callq 0x5544
leaq 0x20(%rsp), %rdi
callq 0x20e0
movq 0x28(%rbx), %rdi
callq 0x21c0
leaq 0x48(%rsp), %rdi
callq 0x20e0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d22
jmp 0x3d27
jmp 0x3d27
jmp 0x3d27
jmp 0x3d2e
jmp 0x3d2e
jmp 0x3d2e
jmp 0x3d22
jmp 0x3d27
movq %rax, %rbx
jmp 0x3d3b
movq %rax, %rbx
jmp 0x3d45
jmp 0x3d2e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5488
leaq 0x20(%rsp), %rdi
callq 0x20e0
leaq 0x48(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2380