// File: mitchblank[P]qiksolve/qiksolve.cpp
// Function: Dictionary::batch(_IO_FILE*, _IO_FILE*) const
void Dictionary::batch(FILE * const fin, FILE * const fout) const
{
	SolutionTree tree;
	{
		AnswerSequence seq;
		recursiveSolve(&tree, keys_, &seq);
	}
	string wstr;
	string key;
	while (read_uppercase_word(fin, &wstr)) {
		Word const target = string_to_bitmask(wstr.c_str(), wordLength());
		if (target == 0) {
			fprintf(stderr, "Bad word: %s\n", wstr.c_str());
		} else if (words_.find(target) == words_.end()) {
			fprintf(stderr, "Unknown  word: %s\n", wstr.c_str());
		} else {
			key.clear();
			printf("%s: ", wstr.c_str());
			for (;;) {
				Word const play = tree[key];
				assert(words_.find(play) != words_.end());
				if (play == target) {
					describeWord(fout, target);
					putc('\n', fout);
					break;
				}
				fputs(words_.find(play)->second.cbegin()->c_str(), fout);
				putc(' ', fout);
				append_unsigned_period(&key, correct_letters(target, play));
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x51d0
leaq -0x68(%rbp), %rdi
callq 0x4fb0
jmp 0x3596
movq -0x100(%rbp), %rdi
movq %rdi, %rdx
addq $0x30, %rdx
leaq -0x50(%rbp), %rsi
leaq -0x68(%rbp), %rcx
callq 0x2d80
jmp 0x35b3
leaq -0x68(%rbp), %rdi
callq 0x5040
leaq -0x98(%rbp), %rdi
callq 0x21d0
leaq -0xb8(%rbp), %rdi
callq 0x21d0
movq -0x10(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x2850
movb %al, -0x101(%rbp)
jmp 0x35ec
movb -0x101(%rbp), %al
testb $0x1, %al
jne 0x35fb
jmp 0x392c
leaq -0x98(%rbp), %rdi
callq 0x20a0
movq -0x100(%rbp), %rdi
movq %rax, -0x110(%rbp)
callq 0x4bb0
movl %eax, -0x108(%rbp)
jmp 0x3622
movl -0x108(%rbp), %esi
movq -0x110(%rbp), %rdi
callq 0x28d0
movl %eax, -0x114(%rbp)
jmp 0x363c
movl -0x114(%rbp), %eax
movl %eax, -0xbc(%rbp)
cmpl $0x0, -0xbc(%rbp)
jne 0x36e3
movq 0x11984(%rip), %rax     # 0x14fe0
movq (%rax), %rax
movq %rax, -0x120(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x20a0
movq -0x120(%rbp), %rdi
movq %rax, %rdx
leaq 0x9bfb(%rip), %rsi      # 0xd27e
movb $0x0, %al
callq 0x2200
jmp 0x3927
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x3956
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5040
jmp 0x3956
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x20d0
leaq -0x98(%rbp), %rdi
callq 0x20d0
jmp 0x3956
movq -0x100(%rbp), %rdi
leaq -0xbc(%rbp), %rsi
callq 0x5240
movq %rax, -0x128(%rbp)
jmp 0x36ff
movq -0x100(%rbp), %rdi
movq -0x128(%rbp), %rax
movq %rax, -0xc8(%rbp)
callq 0x5270
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x5210
testb $0x1, %al
jne 0x3739
jmp 0x3773
movq 0x118a0(%rip), %rax     # 0x14fe0
movq (%rax), %rax
movq %rax, -0x130(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x20a0
movq -0x130(%rbp), %rdi
movq %rax, %rdx
leaq 0x9b25(%rip), %rsi      # 0xd28c
movb $0x0, %al
callq 0x2200
jmp 0x3925
leaq -0xb8(%rbp), %rdi
callq 0x21c0
leaq -0x98(%rbp), %rdi
callq 0x20a0
movq %rax, %rsi
leaq 0x9b0a(%rip), %rdi      # 0xd29f
xorl %eax, %eax
callq 0x2040
jmp 0x379e
jmp 0x37a0
leaq -0x50(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x52a0
movl %eax, -0x134(%rbp)
jmp 0x37b8
movq -0x100(%rbp), %rdi
movl -0x134(%rbp), %eax
movl %eax, -0xd4(%rbp)
leaq -0xd4(%rbp), %rsi
callq 0x5240
movq %rax, -0x140(%rbp)
jmp 0x37e0
movq -0x100(%rbp), %rdi
movq -0x140(%rbp), %rax
movq %rax, -0xe0(%rbp)
callq 0x5270
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x4950
testb $0x1, %al
jne 0x381a
jmp 0x381c
jmp 0x383b
leaq 0x9a81(%rip), %rdi      # 0xd2a4
leaq 0x982f(%rip), %rsi      # 0xd059
movl $0x21f, %edx            # imm = 0x21F
leaq 0x9a90(%rip), %rcx      # 0xd2c6
callq 0x20e0
movl -0xd4(%rbp), %eax
cmpl -0xbc(%rbp), %eax
jne 0x3876
movq -0x100(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0xbc(%rbp), %edx
callq 0x4f20
jmp 0x3861
movq -0x18(%rbp), %rsi
movl $0xa, %edi
callq 0x22c0
jmp 0x3871
jmp 0x3923
movq -0x100(%rbp), %rdi
leaq -0xd4(%rbp), %rsi
callq 0x5240
movq %rax, -0x148(%rbp)
jmp 0x3892
movq -0x148(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x49b0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x4460
movq %rax, -0xf0(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x4490
movq %rax, %rdi
callq 0x20a0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
callq 0x2180
jmp 0x38e1
movq -0x18(%rbp), %rsi
movl $0x20, %edi
callq 0x22c0
jmp 0x38f1
movl -0xbc(%rbp), %edi
movl -0xd4(%rbp), %esi
callq 0x2b40
movl %eax, -0x14c(%rbp)
jmp 0x390a
movl -0x14c(%rbp), %esi
leaq -0xb8(%rbp), %rdi
callq 0x3520
jmp 0x391e
jmp 0x37a0
jmp 0x3925
jmp 0x3927
jmp 0x35d4
leaq -0xb8(%rbp), %rdi
callq 0x20d0
leaq -0x98(%rbp), %rdi
callq 0x20d0
leaq -0x50(%rbp), %rdi
callq 0x5320
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
leaq -0x50(%rbp), %rdi
callq 0x5320
movq -0x70(%rbp), %rdi
callq 0x2290
nopl (%rax,%rax)