// File: /workspace/github_cpp_makefile_star2_O1/scattana[P]Crossword-Anagram-CPP/crossword.cpp
// Function: main
int main(int argc, char *argv[]){
	// display welcome message
	cout << "\n\n------------------------------------------------" << endl;
	cout << "Welcome to the Crossword Anagram Puzzle Program" << endl;
	cout << "------------------------------------------------\n\n" << endl;
	// create a vector list of strings either from user input
	// or from a text file passed at command line
	vector<string> list;
	string temp;

	if(argc == 1) {
		// create vector<string> list from user input
		cout << "Entering manual input mode" << endl;
		cout << "Instructions: Enter  a list of up to 20 words, max 15";
		cout << " letters each.\nType RETURN after each word, and enter a period";
		cout << " '.' after the final word:" << endl;
		getline(cin, temp);
		while(temp[0] != '.'){
			if(list.size()==20){
				cout << "--------------------------------------------" << endl;
				cout << "20 words have been placed - Maximum Reached" << endl;
				cout << "--------------------------------------------" << endl;
				cout << "\n" << endl;
				break;
			}
			if(checkForLetters(temp)){
				list.push_back(temp);
			}
			else{
				cout << "Error: " << temp << " is not a valid word";
				cout << " or has too many letters (max 15)" << endl;
			}

			getline(cin, temp);
		}

		cout << "\nThank you, the list has been saved.\n" << endl;
	}
	if(argc==2 || argc==3) {
		// read data file from argument and create vector<string> list
		ifstream ifs;
		string file = argv[1];
		ifs.open(file);

		// check for valid file; if not valid, prompt for valid file or exit
		while(!ifs){
			cout << "\nInvalid file name. Please enter valid file, ";
			cout << "or type 'quit' to exit the program: " << endl;
			getline(cin, file);
			if(file=="quit"||file=="Quit"||file=="QUIT"){
				return 1;
			}
			ifs.open(file);
		}

		// populate list from file
		while(ifs.peek() != '.'){
			if(list.size()==20){
				cout << "--------------------------------------------" << endl;
				cout << "20 words have been placed - Maximum Reached" << endl;
				cout << "--------------------------------------------" << endl;
				cout << "\n" << endl;
				break;
			}
			getline(ifs, temp, '\n');
			if(checkForLetters(temp)){
				list.push_back(temp);
			}
			else{
				cout << "Error: " << temp << " is not a valid word";
				cout << " or has too many letters (max 15)" << endl;
			}
		}
	}

	// create Board object
	Board board;

	// sort list and make all capital
	sortHighLow(list);
	makeCaps(list);

	// print list in sorted order
	cout << "\nHere's the list of words to be placed: " << endl;
	cout << "--------------------------------------" << endl;
	for(int a=0; a<list.size(); a++){
		cout << list[a] << endl;
	}
	cout << endl;

	// place list on board
	board.placeList(list);

	// print solution board
	cout << "---------------------------------------------" << endl;
	cout << "Your crossword puzzle has been generated!" << endl;
	cout << "Here's the solution:\n" << endl;
	board.printBoard();

	// print "disguised" crossword
	cout << "\n\nHere's the hidden crossword puzzle:\n" << endl;
	board.printHidden();

	// generate and display clues (anagrams)
	cout<<"\n\nHere are the clues! Each clue is an anagram of its solution\n"<<endl;
	for(int s=0; s<list.size(); s++){
		random_shuffle(list[s].begin(), list[s].end());
	}

	for(int t=0; t<list.size(); t++){
		if(list[t][0] != ' '){
			cout << "Row: "<<board.getRowLoc(t)<<", Column: "<<board.getColLoc(t);
			cout << "\t" << board.getDir(t);
			cout << "\t\t" << list[t] << endl;
		}
	}

	// lastly, if 3 arguments are provided at the command line, output
	// the words, solution, crossword, and clues to the file
	if(argc==3){
		ofstream ofs;
		string fileout = argv[2];
		ofs.open(fileout);
		if(!ofs){
			cout << "\n-------------------------------------" << endl;
			cout << "Error: Could not open file '" << fileout << "'" << endl;
			cout << "-------------------------------------\n" << endl;
		}

		ofs << "\n-----------------------------" << endl;
		ofs << "   CROSSWORD PUZZLE SOLUTION   " << endl;
		ofs << "-----------------------------\n" << endl;
		// output to file the solution board
		for(int i=0; i<15; i++){
			for(int j=0; j<15; j++){
				ofs << board.getSpot(i,j) << " ";
			}
			ofs << endl;
		}
		ofs << "\n\n" << endl;

		// output to file the  hidden board
		ofs << "\n-----------------------------" << endl;
		ofs << "  GENERATED CROSSWORD PUZZLE   " << endl;
		ofs << "-----------------------------\n" << endl;
		for(int i=0; i<15; i++){
			for(int j=0; j<15; j++){
				if(board.getSpot(i,j)=='_') ofs << "# ";
				else ofs << "_ ";
			}
			ofs << endl;
		}
		ofs << "\n\n" << endl;

		// lastly, output to file the anagram clues
		ofs << "Here are the clues! Each clue is an anagram of its solution" << endl;
		ofs <<"-----------------------------------------------------------" << endl;
		for(int t=0; t<list.size(); t++){
			if(list[t][0] != ' '){
				ofs << "Row: "<<board.getRowLoc(t)<<", Column: "<<board.getColLoc(t);
				ofs << "\t\t" << board.getDir(t);
				ofs << "\t\t" << list[t] << endl;
			}
		}

		ofs.close();
	} // end of "if(argc==3)" statement

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6d8, %rsp            # imm = 0x6D8
movq %rsi, -0x70(%rbp)
movl %edi, %ebx
movq 0x4b53(%rip), %r15      # 0x6fd0
leaq 0x2b80(%rip), %rsi      # 0x5004
movl $0x32, %edx
movq %r15, %rdi
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x2b78(%rip), %rsi      # 0x5037
movl $0x2f, %edx
movq %r15, %rdi
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x2b6d(%rip), %rsi      # 0x5067
movl $0x32, %edx
movq %r15, %rdi
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
xorl %eax, %eax
movq %rax, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
leaq -0x58(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
movl %ebx, -0x44(%rbp)
cmpl $0x1, %ebx
jne 0x2928
movq 0x4a73(%rip), %rbx      # 0x6fd0
leaq 0x2b36(%rip), %rsi      # 0x509a
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4a41(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x4a2d(%rip), %rdi      # 0x6fd0
leaq 0x2b0b(%rip), %rsi      # 0x50b5
movl $0x35, %edx
callq 0x21d0
movq 0x4a15(%rip), %rdi      # 0x6fd0
leaq 0x2b29(%rip), %rsi      # 0x50eb
movl $0x3e, %edx
callq 0x21d0
movq 0x49fd(%rip), %rbx      # 0x6fd0
leaq 0x2b50(%rip), %rsi      # 0x512a
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x49cb(%rip), %r12      # 0x6fd0
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x49c4(%rip), %rdi      # 0x6fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq 0x49a9(%rip), %r13      # 0x6fe0
leaq -0x68(%rbp), %rsi
movq %r13, %rdi
callq 0x2280
leaq -0xe0(%rbp), %rbx
leaq -0x68(%rbp), %r14
movq -0x68(%rbp), %rsi
cmpb $0x2e, (%rsi)
je 0x28e2
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
cmpq $0x280, %rax            # imm = 0x280
je 0x27ca
movq %rbx, -0xf0(%rbp)
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x3c86
movq -0xe8(%rbp), %rax
cmpq $0xf, %rax
ja 0x26c5
testq %rax, %rax
sete %r15b
je 0x26c8
movq -0xf0(%rbp), %rcx
movb (%rcx), %dl
leal -0x7b(%rdx), %esi
cmpb $-0x3a, %sil
setb %sil
addb $-0x5b, %dl
cmpb $0x6, %dl
setb %dl
orb %sil, %dl
je 0x2796
xorl %r15d, %r15d
movq -0xf0(%rbp), %rdi
cmpq %rbx, %rdi
je 0x26d9
callq 0x2180
testb %r15b, %r15b
je 0x26f3
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x3bde
movq 0x48df(%rip), %r15      # 0x6fd0
jmp 0x276e
movl $0x7, %edx
movq %r12, %rdi
leaq 0x2a6f(%rip), %rsi      # 0x5171
callq 0x21d0
movq 0x48c2(%rip), %r15      # 0x6fd0
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %r12, %rdi
callq 0x21d0
movl $0x14, %edx
movq %rax, %rdi
leaq 0x2a4c(%rip), %rsi      # 0x5179
callq 0x21d0
movl $0x21, %edx
movq %r12, %rdi
leaq 0x2a4d(%rip), %rsi      # 0x518e
callq 0x21d0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r13, %rdi
movq %r14, %rsi
callq 0x2280
jmp 0x264e
movl $0x1, %edi
movq %rdi, %rdx
cmpq %rdi, %rax
je 0x27be
movb (%rcx,%rdx), %sil
leal -0x7b(%rsi), %edi
cmpb $-0x3a, %dil
jb 0x27be
addb $-0x5b, %sil
leaq 0x1(%rdx), %rdi
cmpb $0x5, %sil
ja 0x279b
cmpq %rdx, %rax
setbe %r15b
jmp 0x26c8
movq 0x47ff(%rip), %rbx      # 0x6fd0
leaq 0x2832(%rip), %rsi      # 0x500a
movl $0x2c, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x47cd(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x47b9(%rip), %rbx      # 0x6fd0
leaq 0x2927(%rip), %rsi      # 0x5145
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4787(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x4773(%rip), %rbx      # 0x6fd0
leaq 0x27a6(%rip), %rsi      # 0x500a
movl $0x2c, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4741(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x472d(%rip), %rbx      # 0x6fd0
leaq 0x27ee(%rip), %rsi      # 0x5098
movl $0x1, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x46fb(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x46e7(%rip), %rbx      # 0x6fd0
leaq 0x28c0(%rip), %rsi      # 0x51b0
movl $0x25, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x46b5(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movl -0x44(%rbp), %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x2d39
leaq -0x700(%rbp), %rdi
callq 0x21c0
movq -0x70(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x2f0(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x20b0
leaq -0x700(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
movl $0x8, %edx
callq 0x2160
movq 0x4663(%rip), %r13      # 0x6fe0
leaq -0x2f0(%rbp), %rbx
movl $0x1, %r12d
movq -0x700(%rbp), %rax
movq -0x18(%rax), %rax
movl -0x6e0(%rbp,%rax), %r14d
testb $0x5, %r14b
je 0x2a77
movl $0x2d, %edx
movq %r15, %rdi
leaq 0x2820(%rip), %rsi      # 0x51d6
callq 0x21d0
movl $0x24, %edx
movq %r15, %rdi
leaq 0x283a(%rip), %rsi      # 0x5204
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2280
movq %rbx, %rdi
leaq 0x2806(%rip), %rsi      # 0x5229
callq 0x2070
testl %eax, %eax
je 0x2d0e
movq %rbx, %rdi
leaq 0x27f4(%rip), %rsi      # 0x522e
callq 0x2070
testl %eax, %eax
je 0x2d0e
movq %rbx, %rdi
leaq 0x27e2(%rip), %rsi      # 0x5233
callq 0x2070
testl %eax, %eax
je 0x2d0e
leaq -0x700(%rbp), %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x2160
jmp 0x298a
leaq -0xc0(%rbp), %r13
leaq -0x700(%rbp), %rbx
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x20a0
cmpl $0x2e, %eax
je 0x2d0e
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
cmpq $0x280, %rax            # imm = 0x280
je 0x2bf6
movq %rbx, %rdi
leaq -0x68(%rbp), %rsi
movl $0xa, %edx
callq 0x2280
movq %r13, -0xd0(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x3c86
movq -0xc8(%rbp), %rax
cmpq $0xf, %rax
ja 0x2b18
testq %rax, %rax
sete %r15b
je 0x2b1b
movq -0xd0(%rbp), %rcx
movb (%rcx), %dl
leal -0x7b(%rdx), %esi
cmpb $-0x3a, %sil
setb %sil
addb $-0x5b, %dl
cmpb $0x6, %dl
setb %dl
orb %sil, %dl
je 0x2bc2
xorl %r15d, %r15d
movq -0xd0(%rbp), %rdi
cmpq %r13, %rdi
je 0x2b2c
callq 0x2180
testb %r15b, %r15b
je 0x2b43
leaq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x3bde
jmp 0x2a88
movl $0x7, %edx
movq 0x4481(%rip), %r15      # 0x6fd0
movq %r15, %rdi
leaq 0x2618(%rip), %rsi      # 0x5171
callq 0x21d0
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq %r15, %rdi
callq 0x21d0
movl $0x14, %edx
movq %rax, %rdi
leaq 0x25fc(%rip), %rsi      # 0x5179
callq 0x21d0
movl $0x21, %edx
movq %r15, %rdi
leaq 0x25fd(%rip), %rsi      # 0x518e
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
jmp 0x2a88
movl $0x1, %edi
movq %rdi, %rdx
cmpq %rdi, %rax
je 0x2bea
movb (%rcx,%rdx), %sil
leal -0x7b(%rsi), %edi
cmpb $-0x3a, %dil
jb 0x2bea
addb $-0x5b, %sil
leaq 0x1(%rdx), %rdi
cmpb $0x5, %sil
ja 0x2bc7
cmpq %rdx, %rax
setbe %r15b
jmp 0x2b1b
movq 0x43d3(%rip), %rbx      # 0x6fd0
leaq 0x2406(%rip), %rsi      # 0x500a
movl $0x2c, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x43a1(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x438d(%rip), %rbx      # 0x6fd0
leaq 0x24fb(%rip), %rsi      # 0x5145
movl $0x2b, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x435b(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x4347(%rip), %rbx      # 0x6fd0
leaq 0x237a(%rip), %rsi      # 0x500a
movl $0x2c, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4315(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x4301(%rip), %rbx      # 0x6fd0
leaq 0x23c2(%rip), %rsi      # 0x5098
movl $0x1, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x42cf(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq -0x2e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2d23
callq 0x2180
leaq -0x700(%rbp), %rdi
callq 0x2040
testb $0x5, %r14b
jne 0x38c4
leaq -0x700(%rbp), %rdi
callq 0x3f60
leaq -0x40(%rbp), %rdi
callq 0x3a47
leaq -0x40(%rbp), %rdi
callq 0x3b63
movq 0x4272(%rip), %rbx      # 0x6fd0
leaq 0x24d3(%rip), %rsi      # 0x5238
movl $0x28, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4240(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x422c(%rip), %rbx      # 0x6fd0
leaq 0x2265(%rip), %rsi      # 0x5010
movl $0x26, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x41fa(%rip), %rbx      # 0x6fd0
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x2e56
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x41d0(%rip), %r14      # 0x6fd0
movq -0x8(%rax,%r12), %rsi
movq (%rax,%r12), %rdx
movq %r14, %rdi
callq 0x21d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incq %r13
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r12
cmpq %r13, %rcx
ja 0x2e00
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x415c(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq -0x700(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x4200
movq 0x4138(%rip), %rbx      # 0x6fd0
leaq 0x216a(%rip), %rsi      # 0x5009
movl $0x2d, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4106(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x40f2(%rip), %rbx      # 0x6fd0
leaq 0x237c(%rip), %rsi      # 0x5261
movl $0x29, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x40c0(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x40ac(%rip), %rbx      # 0x6fd0
leaq 0x2360(%rip), %rsi      # 0x528b
movl $0x15, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x407a(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq -0x700(%rbp), %rdi
callq 0x4056
movq 0x405a(%rip), %rbx      # 0x6fd0
leaq 0x2324(%rip), %rsi      # 0x52a1
movl $0x26, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x4028(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq -0x700(%rbp), %rdi
callq 0x40fe
movq 0x4008(%rip), %rbx      # 0x6fd0
leaq 0x22f9(%rip), %rsi      # 0x52c8
movl $0x3e, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x3fd6(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x3077
xorl %ebx, %ebx
movq %rbx, %rcx
shlq $0x5, %rcx
movq 0x8(%rax,%rcx), %r14
cmpq $0x2, %r14
jb 0x3060
movq (%rax,%rcx), %r15
movl $0x1, %r12d
callq 0x2050
cltq
leaq 0x1(%r12), %rcx
cqto
idivq %rcx
cmpq %rdx, %r12
je 0x3058
addq %r15, %r12
addq %r15, %rdx
movb (%r12), %al
movb (%rdx), %sil
movb %sil, (%r12)
movb %al, (%rdx)
movq %rcx, %r12
cmpq %rcx, %r14
jne 0x302f
incq %rbx
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rbx, %rcx
ja 0x3013
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x31c1
xorl %r12d, %r12d
movq 0x3f41(%rip), %rbx      # 0x6fd0
leaq -0x700(%rbp), %r15
xorl %r13d, %r13d
movq (%rax,%r12), %rax
cmpb $0x20, (%rax)
je 0x31a2
movl $0x5, %edx
movq %rbx, %rdi
leaq 0x2252(%rip), %rsi      # 0x5307
callq 0x21d0
movq %r15, %rdi
movl %r13d, %esi
callq 0x41dc
movq %rbx, %rdi
movl %eax, %esi
callq 0x2250
movq %rax, %r14
movl $0xa, %edx
movq %rax, %rdi
leaq 0x222c(%rip), %rsi      # 0x530d
callq 0x21d0
movq %r15, %rdi
movl %r13d, %esi
callq 0x41ee
movq %r14, %rdi
movl %eax, %esi
callq 0x2250
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x220f(%rip), %rsi      # 0x5319
callq 0x21d0
leaq -0x2f0(%rbp), %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x4a14
movq -0x2f0(%rbp), %rsi
movq -0x2e8(%rbp), %rdx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rdi
leaq -0x2e0(%rbp), %rax
cmpq %rax, %rdi
je 0x314f
callq 0x2180
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x21ba(%rip), %rsi      # 0x5318
callq 0x21d0
movq -0x40(%rbp), %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incq %r13
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r12
cmpq %r13, %rcx
ja 0x3099
cmpl $0x3, -0x44(%rbp)
jne 0x38b5
leaq -0x2f0(%rbp), %rdi
callq 0x2240
movq -0x70(%rbp), %rax
movq 0x10(%rax), %rsi
leaq -0xb0(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x20b0
leaq -0x2f0(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movl $0x10, %edx
callq 0x20d0
movq -0x2f0(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2d0(%rbp,%rax)
je 0x331f
movq 0x3da6(%rip), %rbx      # 0x6fd0
leaq 0x20ea(%rip), %rsi      # 0x531b
movl $0x26, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x3d74(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x3d60(%rip), %rdi      # 0x6fd0
leaq 0x20cb(%rip), %rsi      # 0x5342
movl $0x1c, %edx
callq 0x21d0
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq 0x3d3a(%rip), %rdi      # 0x6fd0
callq 0x21d0
movq %rax, %rbx
leaq 0x20b8(%rip), %rsi      # 0x535d
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq 0x3cf0(%rip), %rbx      # 0x6fd0
leaq 0x2078(%rip), %rsi      # 0x535f
movl $0x26, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq 0x3cbe(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x2060(%rip), %rsi      # 0x5386
leaq -0x2f0(%rbp), %rbx
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x2035(%rip), %rsi      # 0x53a5
leaq -0x2f0(%rbp), %rbx
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x1fad(%rip), %rsi      # 0x5367
leaq -0x2f0(%rbp), %rbx
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
xorl %r14d, %r14d
leaq -0x700(%rbp), %r15
leaq -0x90(%rbp), %r12
leaq 0x1fce(%rip), %r13      # 0x53e3
xorl %ebx, %ebx
movq %r15, %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x49fa
movb %al, -0x90(%rbp)
movl $0x1, %edx
leaq -0x2f0(%rbp), %rdi
movq %r12, %rsi
callq 0x21d0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x21d0
incl %ebx
cmpl $0xf, %ebx
jne 0x3417
movq -0x2f0(%rbp), %rax
movq -0x18(%rax), %rdi
leaq -0x2f0(%rbp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incl %r14d
cmpl $0xf, %r14d
jne 0x3415
leaq 0x1bfc(%rip), %rsi      # 0x5097
leaq -0x2f0(%rbp), %rbx
movl $0x2, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x1ea1(%rip), %rsi      # 0x5386
leaq -0x2f0(%rbp), %rbx
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x1e96(%rip), %rsi      # 0x53c5
leaq -0x2f0(%rbp), %rbx
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x1dee(%rip), %rsi      # 0x5367
leaq -0x2f0(%rbp), %rbx
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rbx
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
xorl %r14d, %r14d
leaq -0x700(%rbp), %r15
leaq 0x1e15(%rip), %r13      # 0x53e5
xorl %r12d, %r12d
movq %r15, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x49fa
movq %r13, %rsi
cmpb $0x5f, %al
je 0x35ef
leaq 0x1df9(%rip), %rsi      # 0x53e8
movl $0x2, %edx
movq %rbx, %rdi
callq 0x21d0
incl %r12d
cmpl $0xf, %r12d
jne 0x35d3
movq -0x2f0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incl %r14d
cmpl $0xf, %r14d
jne 0x35d0
leaq 0x1a57(%rip), %rsi      # 0x5097
leaq -0x2f0(%rbp), %rbx
movl $0x2, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x1d61(%rip), %rsi      # 0x53eb
leaq -0x2f0(%rbp), %rbx
movl $0x3b, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
leaq 0x1d53(%rip), %rsi      # 0x5427
leaq -0x2f0(%rbp), %rbx
movl $0x3b, %edx
movq %rbx, %rdi
callq 0x21d0
movq -0x2f0(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
leaq -0x2f0(%rbp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
movq -0x40(%rbp), %rax
cmpq %rax, -0x38(%rbp)
je 0x385e
xorl %r13d, %r13d
leaq -0x2f0(%rbp), %r14
leaq -0x700(%rbp), %r15
xorl %r12d, %r12d
movq (%rax,%r13), %rax
cmpb $0x20, (%rax)
je 0x383f
movl $0x5, %edx
movq %r14, %rdi
leaq 0x1bb2(%rip), %rsi      # 0x5307
callq 0x21d0
movq %r15, %rdi
movl %r12d, %esi
callq 0x41dc
movq %r14, %rdi
movl %eax, %esi
callq 0x2250
movq %rax, %rbx
movl $0xa, %edx
movq %rax, %rdi
leaq 0x1b8c(%rip), %rsi      # 0x530d
callq 0x21d0
movq %r15, %rdi
movl %r12d, %esi
callq 0x41ee
movq %rbx, %rdi
movl %eax, %esi
callq 0x2250
movl $0x2, %edx
movq %r14, %rdi
leaq 0x1b6e(%rip), %rsi      # 0x5318
callq 0x21d0
leaq -0x90(%rbp), %rdi
movq %r15, %rsi
movl %r12d, %edx
callq 0x4a14
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq %r14, %rdi
callq 0x21d0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x37ec
callq 0x2180
movl $0x2, %edx
movq %r14, %rdi
leaq 0x1b1d(%rip), %rsi      # 0x5318
callq 0x21d0
movq -0x40(%rbp), %rax
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %r14, %rdi
callq 0x21d0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2110
incq %r12
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r13
cmpq %r12, %rcx
ja 0x3739
leaq -0x2f0(%rbp), %rdi
callq 0x21e0
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x387f
callq 0x2180
movq 0x3742(%rip), %rax      # 0x6fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2e8(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2f0(%rbp,%rcx)
callq 0x2150
leaq -0x1f8(%rbp), %rdi
callq 0x2080
leaq -0x700(%rbp), %rdi
callq 0x401a
xorl %r12d, %r12d
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x38d6
callq 0x2180
leaq -0x40(%rbp), %rdi
callq 0x3c2a
movl %r12d, %eax
addq $0x6d8, %rsp            # imm = 0x6D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x39a1
jmp 0x3982
movq %rax, %rbx
jmp 0x3967
jmp 0x397b
jmp 0x397b
jmp 0x394f
jmp 0x3989
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x398c
callq 0x2180
jmp 0x398c
jmp 0x3982
movq %rax, %rbx
movq -0x2f0(%rbp), %rdi
leaq -0x2e0(%rbp), %rax
cmpq %rax, %rdi
je 0x39ad
callq 0x2180
jmp 0x39ad
jmp 0x397b
jmp 0x394f
jmp 0x3989
jmp 0x3982
movq %rax, %rbx
leaq -0x2e0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3967
callq 0x2180
leaq -0x700(%rbp), %rdi
callq 0x2040
jmp 0x39b9
jmp 0x3989
jmp 0x3989
jmp 0x3989
movq %rax, %rbx
jmp 0x39b9
jmp 0x3982
movq %rax, %rbx
jmp 0x39ad
jmp 0x3989
movq %rax, %rbx
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39a1
callq 0x2180
leaq -0x2f0(%rbp), %rdi
callq 0x2200
leaq -0x700(%rbp), %rdi
callq 0x401a
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x39cb
callq 0x2180
leaq -0x40(%rbp), %rdi
callq 0x3c2a
movq %rbx, %rdi
callq 0x2260