// File: 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
subq $0xbe0, %rsp            # imm = 0xBE0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x6b40(%rip), %rdi      # 0x8fd0
leaq 0x3b6d(%rip), %rsi      # 0x6004
callq 0x21a0
movq %rax, %rdi
movq 0x6b1a(%rip), %rsi      # 0x8fc0
callq 0x21c0
movq 0x6b1e(%rip), %rdi      # 0x8fd0
leaq 0x3b7e(%rip), %rsi      # 0x6037
callq 0x21a0
movq %rax, %rdi
movq 0x6af8(%rip), %rsi      # 0x8fc0
callq 0x21c0
movq 0x6afc(%rip), %rdi      # 0x8fd0
leaq 0x3b8c(%rip), %rsi      # 0x6067
callq 0x21a0
movq %rax, %rdi
movq 0x6ad6(%rip), %rsi      # 0x8fc0
callq 0x21c0
leaq -0x28(%rbp), %rdi
callq 0x3bd0
leaq -0x48(%rbp), %rdi
callq 0x2220
cmpl $0x1, -0x8(%rbp)
jne 0x27eb
movq 0x6abe(%rip), %rdi      # 0x8fd0
leaq 0x3b81(%rip), %rsi      # 0x609a
callq 0x21a0
movq %rax, -0x978(%rbp)
jmp 0x2527
movq -0x978(%rbp), %rdi
movq 0x6a8b(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x253c
movq 0x6a8d(%rip), %rdi      # 0x8fd0
leaq 0x3b6b(%rip), %rsi      # 0x60b5
callq 0x21a0
jmp 0x2551
movq 0x6a78(%rip), %rdi      # 0x8fd0
leaq 0x3b8c(%rip), %rsi      # 0x60eb
callq 0x21a0
jmp 0x2566
movq 0x6a63(%rip), %rdi      # 0x8fd0
leaq 0x3bb6(%rip), %rsi      # 0x612a
callq 0x21a0
movq %rax, -0x980(%rbp)
jmp 0x2582
movq -0x980(%rbp), %rdi
movq 0x6a30(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2597
movq 0x6a42(%rip), %rdi      # 0x8fe0
leaq -0x48(%rbp), %rsi
callq 0x2040
jmp 0x25a9
jmp 0x25ab
xorl %eax, %eax
movl %eax, %esi
leaq -0x48(%rbp), %rdi
callq 0x22e0
movq %rax, -0x988(%rbp)
jmp 0x25c1
movq -0x988(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x27b8
leaq -0x28(%rbp), %rdi
callq 0x3bf0
cmpq $0x14, %rax
jne 0x26c1
movq 0x69e2(%rip), %rdi      # 0x8fd0
leaq 0x3a15(%rip), %rsi      # 0x600a
callq 0x21a0
movq %rax, -0x990(%rbp)
jmp 0x2603
movq -0x990(%rbp), %rdi
movq 0x69af(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2618
movq 0x69b1(%rip), %rdi      # 0x8fd0
leaq 0x3b1f(%rip), %rsi      # 0x6145
callq 0x21a0
movq %rax, -0x998(%rbp)
jmp 0x2634
movq -0x998(%rbp), %rdi
movq 0x697e(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2649
movq 0x6980(%rip), %rdi      # 0x8fd0
leaq 0x39b3(%rip), %rsi      # 0x600a
callq 0x21a0
movq %rax, -0x9a0(%rbp)
jmp 0x2665
movq -0x9a0(%rbp), %rdi
movq 0x694d(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x267a
movq 0x694f(%rip), %rdi      # 0x8fd0
leaq 0x3a10(%rip), %rsi      # 0x6098
callq 0x21a0
movq %rax, -0x9a8(%rbp)
jmp 0x2696
movq -0x9a8(%rbp), %rdi
movq 0x691c(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x26ab
jmp 0x27b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x3890
leaq -0x78(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x20c0
jmp 0x26d0
leaq -0x78(%rbp), %rdi
callq 0x38b0
movb %al, -0x9a9(%rbp)
jmp 0x26e1
leaq -0x78(%rbp), %rdi
callq 0x2120
movb -0x9a9(%rbp), %al
testb $0x1, %al
jne 0x26f6
jmp 0x2724
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3c10
jmp 0x2705
jmp 0x27a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0x3890
movq 0x68a5(%rip), %rdi      # 0x8fd0
leaq 0x3a3f(%rip), %rsi      # 0x6171
callq 0x21a0
movq %rax, -0x9b8(%rbp)
jmp 0x2740
movq -0x9b8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2180
movq %rax, -0x9c0(%rbp)
jmp 0x2759
movq -0x9c0(%rbp), %rdi
leaq 0x3a12(%rip), %rsi      # 0x6179
callq 0x21a0
jmp 0x276e
movq 0x685b(%rip), %rdi      # 0x8fd0
leaq 0x3a12(%rip), %rsi      # 0x618e
callq 0x21a0
movq %rax, -0x9c8(%rbp)
jmp 0x278a
movq -0x9c8(%rbp), %rdi
movq 0x6828(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x279f
jmp 0x27a1
movq 0x6838(%rip), %rdi      # 0x8fe0
leaq -0x48(%rbp), %rsi
callq 0x2040
jmp 0x27b3
jmp 0x25ab
movq 0x6811(%rip), %rdi      # 0x8fd0
leaq 0x39ea(%rip), %rsi      # 0x61b0
callq 0x21a0
movq %rax, -0x9d0(%rbp)
jmp 0x27d4
movq -0x9d0(%rbp), %rdi
movq 0x67de(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x27e9
jmp 0x27eb
cmpl $0x2, -0x8(%rbp)
je 0x27fb
cmpl $0x3, -0x8(%rbp)
jne 0x2c2b
leaq -0x280(%rbp), %rdi
callq 0x21e0
jmp 0x2809
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x9e0(%rbp)
leaq -0x2a1(%rbp), %rdi
movq %rdi, -0x9d8(%rbp)
callq 0x22b0
movq -0x9e0(%rbp), %rsi
movq -0x9d8(%rbp), %rdx
leaq -0x2a0(%rbp), %rdi
callq 0x2210
jmp 0x2847
leaq -0x2a1(%rbp), %rdi
callq 0x21d0
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
movl $0x8, %edx
callq 0x2150
jmp 0x286d
jmp 0x286f
movq -0x280(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x280(%rbp,%rax), %rdi
callq 0x20d0
movb %al, -0x9e1(%rbp)
jmp 0x288f
movb -0x9e1(%rbp), %al
testb $0x1, %al
jne 0x289e
jmp 0x29d1
movq 0x672b(%rip), %rdi      # 0x8fd0
leaq 0x392a(%rip), %rsi      # 0x61d6
callq 0x21a0
jmp 0x28b3
movq 0x6716(%rip), %rdi      # 0x8fd0
leaq 0x3943(%rip), %rsi      # 0x6204
callq 0x21a0
movq %rax, -0x9f0(%rbp)
jmp 0x28cf
movq -0x9f0(%rbp), %rdi
movq 0x66e3(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x28e4
movq 0x66f5(%rip), %rdi      # 0x8fe0
leaq -0x2a0(%rbp), %rsi
callq 0x2040
jmp 0x28f9
leaq 0x3929(%rip), %rsi      # 0x6229
leaq -0x2a0(%rbp), %rdi
callq 0x3c80
movb %al, -0x9f1(%rbp)
jmp 0x2914
movb -0x9f1(%rbp), %al
testb $0x1, %al
jne 0x296e
jmp 0x2920
leaq 0x3907(%rip), %rsi      # 0x622e
leaq -0x2a0(%rbp), %rdi
callq 0x3c80
movb %al, -0x9f2(%rbp)
jmp 0x293b
movb -0x9f2(%rbp), %al
testb $0x1, %al
jne 0x296e
jmp 0x2947
leaq 0x38e5(%rip), %rsi      # 0x6233
leaq -0x2a0(%rbp), %rdi
callq 0x3c80
movb %al, -0x9f3(%rbp)
jmp 0x2962
movb -0x9f3(%rbp), %al
testb $0x1, %al
jne 0x296e
jmp 0x29b2
movl $0x1, -0x4(%rbp)
movl $0x1, -0x2a8(%rbp)
jmp 0x2be4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2a1(%rbp), %rdi
callq 0x21d0
jmp 0x2c1a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2c0e
leaq -0x280(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
movl $0x8, %edx
callq 0x2150
jmp 0x29cc
jmp 0x286f
jmp 0x29d3
leaq -0x280(%rbp), %rdi
callq 0x20a0
movl %eax, -0x9f8(%rbp)
jmp 0x29e7
movl -0x9f8(%rbp), %eax
cmpl $0x2e, %eax
je 0x2bda
leaq -0x28(%rbp), %rdi
callq 0x3bf0
cmpq $0x14, %rax
jne 0x2ad2
movq 0x65c0(%rip), %rdi      # 0x8fd0
leaq 0x35f3(%rip), %rsi      # 0x600a
callq 0x21a0
movq %rax, -0xa00(%rbp)
jmp 0x2a25
movq -0xa00(%rbp), %rdi
movq 0x658d(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2a3a
movq 0x658f(%rip), %rdi      # 0x8fd0
leaq 0x36fd(%rip), %rsi      # 0x6145
callq 0x21a0
movq %rax, -0xa08(%rbp)
jmp 0x2a56
movq -0xa08(%rbp), %rdi
movq 0x655c(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2a6b
movq 0x655e(%rip), %rdi      # 0x8fd0
leaq 0x3591(%rip), %rsi      # 0x600a
callq 0x21a0
movq %rax, -0xa10(%rbp)
jmp 0x2a87
movq -0xa10(%rbp), %rdi
movq 0x652b(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2a9c
movq 0x652d(%rip), %rdi      # 0x8fd0
leaq 0x35ee(%rip), %rsi      # 0x6098
callq 0x21a0
movq %rax, -0xa18(%rbp)
jmp 0x2ab8
movq -0xa18(%rbp), %rdi
movq 0x64fa(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2acd
jmp 0x2bda
leaq -0x280(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0xa, %edx
callq 0x22c0
jmp 0x2ae9
leaq -0x2c8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x20c0
jmp 0x2afb
leaq -0x2c8(%rbp), %rdi
callq 0x38b0
movb %al, -0xa19(%rbp)
jmp 0x2b0f
leaq -0x2c8(%rbp), %rdi
callq 0x2120
movb -0xa19(%rbp), %al
testb $0x1, %al
jne 0x2b27
jmp 0x2b58
leaq -0x28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x3c10
jmp 0x2b36
jmp 0x2bd5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x2c8(%rbp), %rdi
callq 0x2120
jmp 0x2c0e
movq 0x6471(%rip), %rdi      # 0x8fd0
leaq 0x360b(%rip), %rsi      # 0x6171
callq 0x21a0
movq %rax, -0xa28(%rbp)
jmp 0x2b74
movq -0xa28(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2180
movq %rax, -0xa30(%rbp)
jmp 0x2b8d
movq -0xa30(%rbp), %rdi
leaq 0x35de(%rip), %rsi      # 0x6179
callq 0x21a0
jmp 0x2ba2
movq 0x6427(%rip), %rdi      # 0x8fd0
leaq 0x35de(%rip), %rsi      # 0x618e
callq 0x21a0
movq %rax, -0xa38(%rbp)
jmp 0x2bbe
movq -0xa38(%rbp), %rdi
movq 0x63f4(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2bd3
jmp 0x2bd5
jmp 0x29d3
movl $0x0, -0x2a8(%rbp)
leaq -0x2a0(%rbp), %rdi
callq 0x2120
leaq -0x280(%rbp), %rdi
callq 0x2050
movl -0x2a8(%rbp), %eax
testl %eax, %eax
jne 0x3872
jmp 0x2c0c
jmp 0x2c2b
leaq -0x2a0(%rbp), %rdi
callq 0x2120
leaq -0x280(%rbp), %rdi
callq 0x2050
jmp 0x3890
leaq -0x6d8(%rbp), %rdi
callq 0x4b40
jmp 0x2c39
leaq -0x28(%rbp), %rdi
callq 0x3980
jmp 0x2c44
leaq -0x28(%rbp), %rdi
callq 0x3b00
jmp 0x2c4f
movq 0x637a(%rip), %rdi      # 0x8fd0
leaq 0x35db(%rip), %rsi      # 0x6238
callq 0x21a0
movq %rax, -0xa40(%rbp)
jmp 0x2c6b
movq -0xa40(%rbp), %rdi
movq 0x6347(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2c80
movq 0x6349(%rip), %rdi      # 0x8fd0
leaq 0x3382(%rip), %rsi      # 0x6010
callq 0x21a0
movq %rax, -0xa48(%rbp)
jmp 0x2c9c
movq -0xa48(%rbp), %rdi
movq 0x6316(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2cb1
movl $0x0, -0x6dc(%rbp)
movslq -0x6dc(%rbp), %rax
movq %rax, -0xa50(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3bf0
movq %rax, %rcx
movq -0xa50(%rbp), %rax
cmpq %rcx, %rax
jae 0x2d42
movslq -0x6dc(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x3cb0
movq %rax, %rsi
movq 0x62d5(%rip), %rdi      # 0x8fd0
callq 0x2180
movq %rax, -0xa58(%rbp)
jmp 0x2d09
movq -0xa58(%rbp), %rdi
movq 0x62a9(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2d1e
jmp 0x2d20
movl -0x6dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6dc(%rbp)
jmp 0x2cbb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x3864
movq 0x6287(%rip), %rdi      # 0x8fd0
movq 0x6270(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2d57
leaq -0x6d8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x4ef0
jmp 0x2d69
movq 0x6260(%rip), %rdi      # 0x8fd0
leaq 0x3292(%rip), %rsi      # 0x6009
callq 0x21a0
movq %rax, -0xa60(%rbp)
jmp 0x2d85
movq -0xa60(%rbp), %rdi
movq 0x622d(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2d9a
movq 0x622f(%rip), %rdi      # 0x8fd0
leaq 0x34b9(%rip), %rsi      # 0x6261
callq 0x21a0
movq %rax, -0xa68(%rbp)
jmp 0x2db6
movq -0xa68(%rbp), %rdi
movq 0x61fc(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2dcb
movq 0x61fe(%rip), %rdi      # 0x8fd0
leaq 0x34b2(%rip), %rsi      # 0x628b
callq 0x21a0
movq %rax, -0xa70(%rbp)
jmp 0x2de7
movq -0xa70(%rbp), %rdi
movq 0x61cb(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2dfc
leaq -0x6d8(%rbp), %rdi
callq 0x4d20
jmp 0x2e0a
movq 0x61bf(%rip), %rdi      # 0x8fd0
leaq 0x3489(%rip), %rsi      # 0x62a1
callq 0x21a0
movq %rax, -0xa78(%rbp)
jmp 0x2e26
movq -0xa78(%rbp), %rdi
movq 0x618c(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2e3b
leaq -0x6d8(%rbp), %rdi
callq 0x4dc0
jmp 0x2e49
movq 0x6180(%rip), %rdi      # 0x8fd0
leaq 0x3471(%rip), %rsi      # 0x62c8
callq 0x21a0
movq %rax, -0xa80(%rbp)
jmp 0x2e65
movq -0xa80(%rbp), %rdi
movq 0x614d(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x2e7a
movl $0x0, -0x6e0(%rbp)
movslq -0x6e0(%rbp), %rax
movq %rax, -0xa88(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3bf0
movq %rax, %rcx
movq -0xa88(%rbp), %rax
cmpq %rcx, %rax
jae 0x2f1d
movslq -0x6e0(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xa90(%rbp)
callq 0x3cb0
movq %rax, %rdi
callq 0x2160
movq -0xa90(%rbp), %rdi
movq %rax, -0x6e8(%rbp)
movslq -0x6e0(%rbp), %rsi
callq 0x3cb0
movq %rax, %rdi
callq 0x2100
movq %rax, -0x6f0(%rbp)
movq -0x6e8(%rbp), %rdi
movq -0x6f0(%rbp), %rsi
callq 0x3cd0
jmp 0x2f07
jmp 0x2f09
movl -0x6e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6e0(%rbp)
jmp 0x2e84
movl $0x0, -0x6f4(%rbp)
movslq -0x6f4(%rbp), %rax
movq %rax, -0xa98(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3bf0
movq %rax, %rcx
movq -0xa98(%rbp), %rax
cmpq %rcx, %rax
jae 0x310a
movslq -0x6f4(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x3cb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22e0
movq %rax, -0xaa0(%rbp)
jmp 0x2f76
movq -0xaa0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x30f4
movq 0x6040(%rip), %rdi      # 0x8fd0
leaq 0x3370(%rip), %rsi      # 0x6307
callq 0x21a0
movq %rax, -0xaa8(%rbp)
jmp 0x2fa5
movl -0x6f4(%rbp), %esi
leaq -0x6d8(%rbp), %rdi
callq 0x4eb0
movl %eax, -0xaac(%rbp)
jmp 0x2fbf
movl -0xaac(%rbp), %esi
movq -0xaa8(%rbp), %rdi
callq 0x2290
movq %rax, -0xab8(%rbp)
jmp 0x2fda
movq -0xab8(%rbp), %rdi
leaq 0x3325(%rip), %rsi      # 0x630d
callq 0x21a0
movq %rax, -0xac0(%rbp)
jmp 0x2ff6
movl -0x6f4(%rbp), %esi
leaq -0x6d8(%rbp), %rdi
callq 0x4ed0
movl %eax, -0xac4(%rbp)
jmp 0x3010
movl -0xac4(%rbp), %esi
movq -0xac0(%rbp), %rdi
callq 0x2290
jmp 0x3024
movq 0x5fa5(%rip), %rdi      # 0x8fd0
leaq 0x32e7(%rip), %rsi      # 0x6319
callq 0x21a0
movq %rax, -0xad0(%rbp)
jmp 0x3040
movl -0x6f4(%rbp), %edx
leaq -0x718(%rbp), %rdi
leaq -0x6d8(%rbp), %rsi
callq 0x5af0
jmp 0x305b
movq -0xad0(%rbp), %rdi
leaq -0x718(%rbp), %rsi
callq 0x2180
jmp 0x3070
leaq -0x718(%rbp), %rdi
callq 0x2120
movq 0x5f4d(%rip), %rdi      # 0x8fd0
leaq 0x328e(%rip), %rsi      # 0x6318
callq 0x21a0
movq %rax, -0xad8(%rbp)
jmp 0x3098
movslq -0x6f4(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x3cb0
movq -0xad8(%rbp), %rdi
movq %rax, %rsi
callq 0x2180
movq %rax, -0xae0(%rbp)
jmp 0x30c0
movq -0xae0(%rbp), %rdi
movq 0x5ef2(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x30d5
jmp 0x30f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x718(%rbp), %rdi
callq 0x2120
jmp 0x3864
jmp 0x30f6
movl -0x6f4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6f4(%rbp)
jmp 0x2f27
cmpl $0x3, -0x8(%rbp)
jne 0x3845
leaq -0x918(%rbp), %rdi
callq 0x2280
jmp 0x3122
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xaf0(%rbp)
leaq -0x939(%rbp), %rdi
movq %rdi, -0xae8(%rbp)
callq 0x22b0
movq -0xaf0(%rbp), %rsi
movq -0xae8(%rbp), %rdx
leaq -0x938(%rbp), %rdi
callq 0x2210
jmp 0x3160
leaq -0x939(%rbp), %rdi
callq 0x21d0
leaq -0x918(%rbp), %rdi
leaq -0x938(%rbp), %rsi
movl $0x10, %edx
callq 0x20e0
jmp 0x3186
movq -0x918(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x918(%rbp,%rax), %rdi
callq 0x20d0
movb %al, -0xaf1(%rbp)
jmp 0x31a6
movb -0xaf1(%rbp), %al
testb $0x1, %al
jne 0x31b5
jmp 0x32b0
movq 0x5e14(%rip), %rdi      # 0x8fd0
leaq 0x3158(%rip), %rsi      # 0x631b
callq 0x21a0
movq %rax, -0xb00(%rbp)
jmp 0x31d1
movq -0xb00(%rbp), %rdi
movq 0x5de1(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x31e6
movq 0x5de3(%rip), %rdi      # 0x8fd0
leaq 0x314e(%rip), %rsi      # 0x6342
callq 0x21a0
movq %rax, -0xb08(%rbp)
jmp 0x3202
movq -0xb08(%rbp), %rdi
leaq -0x938(%rbp), %rsi
callq 0x2180
movq %rax, -0xb10(%rbp)
jmp 0x321e
movq -0xb10(%rbp), %rdi
leaq 0x3131(%rip), %rsi      # 0x635d
callq 0x21a0
movq %rax, -0xb18(%rbp)
jmp 0x323a
movq -0xb18(%rbp), %rdi
movq 0x5d78(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x324f
movq 0x5d7a(%rip), %rdi      # 0x8fd0
leaq 0x3102(%rip), %rsi      # 0x635f
callq 0x21a0
movq %rax, -0xb20(%rbp)
jmp 0x326b
movq -0xb20(%rbp), %rdi
movq 0x5d47(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x3280
jmp 0x32b0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x939(%rbp), %rdi
callq 0x21d0
jmp 0x3837
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x382b
leaq 0x30cf(%rip), %rsi      # 0x6386
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb28(%rbp)
jmp 0x32cc
movq -0xb28(%rbp), %rdi
movq 0x5ce6(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x32e1
leaq 0x30bd(%rip), %rsi      # 0x63a5
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb30(%rbp)
jmp 0x32fd
movq -0xb30(%rbp), %rdi
movq 0x5cb5(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x3312
leaq 0x304e(%rip), %rsi      # 0x6367
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb38(%rbp)
jmp 0x332e
movq -0xb38(%rbp), %rdi
movq 0x5c84(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x3343
movl $0x0, -0x940(%rbp)
cmpl $0xf, -0x940(%rbp)
jge 0x33fe
movl $0x0, -0x944(%rbp)
cmpl $0xf, -0x944(%rbp)
jge 0x33d3
movl -0x940(%rbp), %esi
movl -0x944(%rbp), %edx
leaq -0x6d8(%rbp), %rdi
callq 0x5ac0
movb %al, -0xb39(%rbp)
jmp 0x338d
movb -0xb39(%rbp), %al
movsbl %al, %esi
leaq -0x918(%rbp), %rdi
callq 0x21f0
movq %rax, -0xb48(%rbp)
jmp 0x33ab
movq -0xb48(%rbp), %rdi
leaq 0x302a(%rip), %rsi      # 0x63e3
callq 0x21a0
jmp 0x33c0
jmp 0x33c2
movl -0x944(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x944(%rbp)
jmp 0x3364
movq 0x5be6(%rip), %rsi      # 0x8fc0
leaq -0x918(%rbp), %rdi
callq 0x21c0
jmp 0x33e8
jmp 0x33ea
movl -0x940(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x940(%rbp)
jmp 0x334d
leaq 0x2c92(%rip), %rsi      # 0x6097
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb50(%rbp)
jmp 0x341a
movq -0xb50(%rbp), %rdi
movq 0x5b98(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x342f
leaq 0x2f50(%rip), %rsi      # 0x6386
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb58(%rbp)
jmp 0x344b
movq -0xb58(%rbp), %rdi
movq 0x5b67(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x3460
leaq 0x2f5e(%rip), %rsi      # 0x63c5
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb60(%rbp)
jmp 0x347c
movq -0xb60(%rbp), %rdi
movq 0x5b36(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x3491
leaq 0x2ecf(%rip), %rsi      # 0x6367
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb68(%rbp)
jmp 0x34ad
movq -0xb68(%rbp), %rdi
movq 0x5b05(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x34c2
movl $0x0, -0x948(%rbp)
cmpl $0xf, -0x948(%rbp)
jge 0x3586
movl $0x0, -0x94c(%rbp)
cmpl $0xf, -0x94c(%rbp)
jge 0x355b
movl -0x948(%rbp), %esi
movl -0x94c(%rbp), %edx
leaq -0x6d8(%rbp), %rdi
callq 0x5ac0
movb %al, -0xb69(%rbp)
jmp 0x350c
movb -0xb69(%rbp), %al
movsbl %al, %eax
cmpl $0x5f, %eax
jne 0x3531
leaq 0x2ec4(%rip), %rsi      # 0x63e5
leaq -0x918(%rbp), %rdi
callq 0x21a0
jmp 0x352f
jmp 0x3548
leaq 0x2eb0(%rip), %rsi      # 0x63e8
leaq -0x918(%rbp), %rdi
callq 0x21a0
jmp 0x3546
jmp 0x3548
jmp 0x354a
movl -0x94c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94c(%rbp)
jmp 0x34e3
movq 0x5a5e(%rip), %rsi      # 0x8fc0
leaq -0x918(%rbp), %rdi
callq 0x21c0
jmp 0x3570
jmp 0x3572
movl -0x948(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x948(%rbp)
jmp 0x34cc
leaq 0x2b0a(%rip), %rsi      # 0x6097
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb78(%rbp)
jmp 0x35a2
movq -0xb78(%rbp), %rdi
movq 0x5a10(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x35b7
leaq 0x2e2d(%rip), %rsi      # 0x63eb
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb80(%rbp)
jmp 0x35d3
movq -0xb80(%rbp), %rdi
movq 0x59df(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x35e8
leaq 0x2e38(%rip), %rsi      # 0x6427
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xb88(%rbp)
jmp 0x3604
movq -0xb88(%rbp), %rdi
movq 0x59ae(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x3619
movl $0x0, -0x950(%rbp)
movslq -0x950(%rbp), %rax
movq %rax, -0xb90(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3bf0
movq %rax, %rcx
movq -0xb90(%rbp), %rax
cmpq %rcx, %rax
jae 0x3803
movslq -0x950(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x3cb0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x22e0
movq %rax, -0xb98(%rbp)
jmp 0x3672
movq -0xb98(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x37ed
leaq 0x2c7b(%rip), %rsi      # 0x6307
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xba0(%rbp)
jmp 0x36a1
movl -0x950(%rbp), %esi
leaq -0x6d8(%rbp), %rdi
callq 0x4eb0
movl %eax, -0xba4(%rbp)
jmp 0x36bb
movl -0xba4(%rbp), %esi
movq -0xba0(%rbp), %rdi
callq 0x2290
movq %rax, -0xbb0(%rbp)
jmp 0x36d6
movq -0xbb0(%rbp), %rdi
leaq 0x2c29(%rip), %rsi      # 0x630d
callq 0x21a0
movq %rax, -0xbb8(%rbp)
jmp 0x36f2
movl -0x950(%rbp), %esi
leaq -0x6d8(%rbp), %rdi
callq 0x4ed0
movl %eax, -0xbbc(%rbp)
jmp 0x370c
movl -0xbbc(%rbp), %esi
movq -0xbb8(%rbp), %rdi
callq 0x2290
jmp 0x3720
leaq 0x2bf1(%rip), %rsi      # 0x6318
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xbc8(%rbp)
jmp 0x373c
movl -0x950(%rbp), %edx
leaq -0x970(%rbp), %rdi
leaq -0x6d8(%rbp), %rsi
callq 0x5af0
jmp 0x3757
movq -0xbc8(%rbp), %rdi
leaq -0x970(%rbp), %rsi
callq 0x2180
jmp 0x376c
leaq -0x970(%rbp), %rdi
callq 0x2120
leaq 0x2b99(%rip), %rsi      # 0x6318
leaq -0x918(%rbp), %rdi
callq 0x21a0
movq %rax, -0xbd0(%rbp)
jmp 0x3794
movslq -0x950(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x3cb0
movq -0xbd0(%rbp), %rdi
movq %rax, %rsi
callq 0x2180
movq %rax, -0xbd8(%rbp)
jmp 0x37bc
movq -0xbd8(%rbp), %rdi
movq 0x57f6(%rip), %rsi      # 0x8fc0
callq 0x21c0
jmp 0x37d1
jmp 0x37ed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x970(%rbp), %rdi
callq 0x2120
jmp 0x382b
jmp 0x37ef
movl -0x950(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x950(%rbp)
jmp 0x3623
leaq -0x918(%rbp), %rdi
callq 0x2230
jmp 0x3811
leaq -0x938(%rbp), %rdi
callq 0x2120
leaq -0x918(%rbp), %rdi
callq 0x2250
jmp 0x3845
leaq -0x938(%rbp), %rdi
callq 0x2120
leaq -0x918(%rbp), %rdi
callq 0x2250
jmp 0x3864
movl $0x0, -0x4(%rbp)
movl $0x1, -0x2a8(%rbp)
leaq -0x6d8(%rbp), %rdi
callq 0x4cd0
jmp 0x3872
leaq -0x6d8(%rbp), %rdi
callq 0x4cd0
jmp 0x3890
leaq -0x48(%rbp), %rdi
callq 0x2120
leaq -0x28(%rbp), %rdi
callq 0x3da0
movl -0x4(%rbp), %eax
addq $0xbe0, %rsp            # imm = 0xBE0
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x2120
leaq -0x28(%rbp), %rdi
callq 0x3da0
movq -0x50(%rbp), %rdi
callq 0x22a0
nopl (%rax,%rax)