// File: mitchblank[P]qiksolve/qiksolve.cpp
// Function: Dictionary::recursiveInteractive(std::vector<unsigned int, std::allocator<unsigned int>> const&) const
void Dictionary::recursiveInteractive(Words const& active_words) const
{
	if (active_words.empty()) {
		puts("No choices remain.\n");
	} else if (active_words.size() == 1) {
		fputs("Only choice remaining is: ", stdout);
		describeWord(stdout, active_words.front());
		puts("\n");
	} else {
		printf("%u choices remain", static_cast<unsigned>(active_words.size()));
		if (active_words.size() <= 5) {
			// If we're near the end, print a list
			fputs(": ", stdout);
			auto it = active_words.cbegin();
			describeWord(stdout, *it);
			do {
				fputs(", ", stdout);
				describeWord(stdout, *it);
			} while (++it != active_words.cend());
			putchar('\n');
		} else {
			puts(".");
		}
		putchar('\n');

		string cmd;
		for (;;) {
			printInteractiveSuggestions(active_words);
			fputs("Give your move in form \"<word> <result>\" like \"TAXI 2\"\n\n"
			      "> ", stdout);
			fflush(stdout);
			if (!read_uppercase_word(stdin, &cmd))
				break;	// EOF
			Word tried;
			unsigned matched;
			if (parse_move(cmd, wordLength(), &tried, &matched)) {
				DividedWordList dl(wordLength());
				dl.build(*this, active_words, tried);
				recursiveInteractive(dl[matched].choices());
				break;
			}
			puts("Invalid move.\n");
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4550
testb $0x1, %al
jne 0x399a
jmp 0x39ab
leaq 0x995c(%rip), %rdi      # 0xd2fd
callq 0x2220
jmp 0x3c8f
movq -0x10(%rbp), %rdi
callq 0x4df0
cmpq $0x1, %rax
jne 0x3a07
movq 0x115ff(%rip), %rax     # 0x14fc0
movq (%rax), %rsi
leaq 0x9946(%rip), %rdi      # 0xd311
callq 0x2180
movq 0x115e9(%rip), %rax     # 0x14fc0
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4e40
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movl (%rax), %edx
callq 0x4f20
leaq 0x9a21(%rip), %rdi      # 0xd41e
callq 0x2220
jmp 0x3c8d
movq -0x10(%rbp), %rdi
callq 0x4df0
movl %eax, %esi
leaq 0x9913(%rip), %rdi      # 0xd32c
movb $0x0, %al
callq 0x2040
movq -0x10(%rbp), %rdi
callq 0x4df0
cmpq $0x5, %rax
ja 0x3b01
movq 0x11586(%rip), %rax     # 0x14fc0
movq (%rax), %rsi
leaq 0x985d(%rip), %rdi      # 0xd2a1
callq 0x2180
movq -0x10(%rbp), %rdi
callq 0x4590
movq %rax, -0x18(%rbp)
movq 0x11563(%rip), %rax     # 0x14fc0
movq (%rax), %rax
movq %rax, -0x88(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x45c0
movq -0x78(%rbp), %rdi
movq -0x88(%rbp), %rsi
movl (%rax), %edx
callq 0x4f20
movq 0x11537(%rip), %rax     # 0x14fc0
movq (%rax), %rsi
leaq 0x98ab(%rip), %rdi      # 0xd33e
callq 0x2180
movq 0x11521(%rip), %rax     # 0x14fc0
movq (%rax), %rax
movq %rax, -0x90(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x45c0
movq -0x78(%rbp), %rdi
movq -0x90(%rbp), %rsi
movl (%rax), %edx
callq 0x4f20
leaq -0x18(%rbp), %rdi
callq 0x4620
movq %rax, -0x98(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4640
movq -0x98(%rbp), %rdi
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x45e0
testb $0x1, %al
jne 0x3a82
movl $0xa, %edi
callq 0x21e0
jmp 0x3b0d
leaq 0x99ef(%rip), %rdi      # 0xd4f7
callq 0x2220
movl $0xa, %edi
callq 0x21e0
leaq -0x40(%rbp), %rdi
callq 0x21d0
movq -0x78(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0xa, %edx
callq 0x3cb0
jmp 0x3b34
movq 0x11485(%rip), %rax     # 0x14fc0
movq (%rax), %rsi
leaq 0x97fc(%rip), %rdi      # 0xd341
callq 0x2180
jmp 0x3b4c
movq 0x1146d(%rip), %rax     # 0x14fc0
movq (%rax), %rdi
callq 0x21a0
jmp 0x3b5d
movq 0x11474(%rip), %rax     # 0x14fd8
movq (%rax), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2850
movb %al, -0x99(%rbp)
jmp 0x3b78
movb -0x99(%rbp), %al
testb $0x1, %al
jne 0x3b9a
jmp 0x3b84
jmp 0x3c77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3c82
movq -0x78(%rbp), %rdi
callq 0x4bb0
movl %eax, -0xa0(%rbp)
jmp 0x3bab
movl -0xa0(%rbp), %esi
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rdx
leaq -0x54(%rbp), %rcx
callq 0x4020
movb %al, -0xa1(%rbp)
jmp 0x3bca
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0x3bd9
jmp 0x3c64
movq -0x78(%rbp), %rdi
callq 0x4bb0
movl %eax, -0xa8(%rbp)
jmp 0x3bea
movl -0xa8(%rbp), %esi
leaq -0x70(%rbp), %rdi
callq 0x4e70
jmp 0x3bfb
movq -0x78(%rbp), %rsi
movq -0x10(%rbp), %rdx
movl -0x50(%rbp), %ecx
leaq -0x70(%rbp), %rdi
callq 0x2990
jmp 0x3c11
movl -0x54(%rbp), %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
callq 0x4ce0
movq %rax, %rdi
callq 0x4de0
movq %rax, -0xb0(%rbp)
jmp 0x3c30
movq -0xb0(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0x3970
jmp 0x3c42
leaq -0x70(%rbp), %rdi
callq 0x4f00
jmp 0x3c77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4f00
jmp 0x3c82
leaq 0x9711(%rip), %rdi      # 0xd37c
callq 0x2220
jmp 0x3c72
jmp 0x3b20
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x3c8d
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x3c98
jmp 0x3c8f
addq $0xb0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x2290
nopw %cs:(%rax,%rax)