// File: CMU-SAFARI[P]optimal-seed-solver/HashTree.cc
// Function: HashTree::addEntry(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int, unsigned int)
void HashTree::addEntry(const string& DNA, unsigned int chrNum, unsigned int location) {
	unsigned int hashVal = hashgen.calculateHash(DNA, hashLength);

	//cout << "DNA: " << DNA << endl;
	//cout << "hashVal: " << hashVal << endl;

	TreeNode* cursor = root[hashVal];
	TreeNode* parentCursor = NULL;
	TreeNode* nextCursor = NULL;

	//cout << "***location: " << location << endl;

	/*
	   if (DNA == "CCTGGTGCTCCCACAAAGGAGAAGGGCTGA") {
	   cout << "found something" << endl;
	   cout << "hashVal: " << hashVal << endl;
	   }
	 */

	//The depth depends on the length of the string: DNA
	for (int i = hashLength; i < static_cast<int>(DNA.length() ); i++) {
		//cout << i << ' ' << DNA[i] << ' ';
		//Create a root node if there isn't one
		if (cursor == NULL) {
			cursor = new LeafNode();
			root[hashVal] = cursor;
			cursor->setContent(chrNum, location);
			//Initialize the counter
			cursor->addLoc();
			return;
		}

		//cout << "i: " << i << " of DNA.length() - 1 = " << DNA.length() - 1 << endl;

		//This is a leaf node but it should no longer be one
		if (cursor->isLeaf() ) {
			//cout << "i: " << i << " Replacing!" << endl;
			// Creating a trunk
			TreeNode* newTrunk = new TreeNode(1);
			//cout << "cursor->getLocNum: " << cursor->getLocNum() << endl;
			//cout.flush();
			assert(cursor->getLocNum() == 1);

			assert(cursor->getChrNum() < refdb.getNumOfChromo() );

			//Push the LeafNode 1 level lower
			switch (checkdb[cursor->getChrNum()].getRefBase(cursor->getLocation(), i) ) {
				case 'A':
					newTrunk->setA(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getA()->addLoc();
					break;
				case 'C':
					newTrunk->setC(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getC()->addLoc();
					break;
				case 'G':
					newTrunk->setG(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getG()->addLoc();
					break;
				case 'T':
					newTrunk->setT(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getT()->addLoc();
					break;
				case 'M':
					newTrunk->setA(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getA()->addLoc();
					newTrunk->setC(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getC()->addLoc();
					break;
				case 'R':
					newTrunk->setA(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getA()->addLoc();
					newTrunk->setG(new LeafNode(cursor->getChrNum(), cursor->getLocation() ) );
					newTrunk->getG()->addLoc();
					break;
				default:
					cerr << "unrecognized character: " << DNA[i] << endl;
					break;
			}

			//Check if we need to update root or a trunk
			if (parentCursor == NULL)
				root[hashVal] = newTrunk;
			else {
				switch (DNA[i-1]) {
					case 'A':
						parentCursor->setA(newTrunk);
						break;
					case 'C':
						parentCursor->setC(newTrunk);
						break;
					case 'G':
						parentCursor->setG(newTrunk);
						break;
					case 'T':
						parentCursor->setT(newTrunk);
						break;
				}
			}

			delete cursor;
			cursor = newTrunk;
			newTrunk = NULL;
		}

		//Incrementing the counter along the path
		cursor->addLoc();

		switch (DNA[i]) {
			case 'A':
				nextCursor = cursor->getA();
				break;
			case 'C':
				nextCursor = cursor->getC();
				break;
			case 'G':
				nextCursor = cursor->getG();
				break;
			case 'T':
				nextCursor = cursor->getT();
				break;
			default:
				cerr << "unrecognized character: " << DNA[i] << endl;
				break;
		}

		if (nextCursor == NULL) {
			//cout << "WTF!!!!!" << "DNA[" << i << "]: " << DNA[i] << endl;

			nextCursor = new LeafNode(chrNum, location);
			//Incrementing the counter of the new node
			nextCursor->addLoc();

			switch (DNA[i]) {
				case 'A':
					cursor->setA(nextCursor);
					break;
				case 'C':
					cursor->setC(nextCursor);
					break;
				case 'G':
					cursor->setG(nextCursor);
					break;
				case 'T':
					cursor->setT(nextCursor);
					break;
				default:
					cerr << "unrecognized character: " << DNA[i] << endl;
					break;
			}

			return;
		}

		//if this is the last node, we have to increment the counter
		if (i == static_cast<int>(DNA.length() ) - 1)
			nextCursor->addLoc();

		parentCursor = cursor;
		cursor = nextCursor;
	}
}

// Assembly:
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, 0x1a0(%rsp)
movq %rsi, 0x198(%rsp)
movl %edx, 0x194(%rsp)
movl %ecx, 0x190(%rsp)
movq 0x1a0(%rsp), %rax
movq %rax, 0x148(%rsp)
movq %rax, %rdi
addq $0x318, %rdi            # imm = 0x318
movq 0x198(%rsp), %rsi
movl (%rax), %edx
callq 0x126e0
movl %eax, %ecx
movq 0x148(%rsp), %rax
movl %ecx, 0x18c(%rsp)
movq 0x320(%rax), %rcx
movl 0x18c(%rsp), %edx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x180(%rsp)
movq $0x0, 0x178(%rsp)
movq $0x0, 0x170(%rsp)
movl (%rax), %eax
movl %eax, 0x16c(%rsp)
movl 0x16c(%rsp), %eax
movl %eax, 0x144(%rsp)
movq 0x198(%rsp), %rdi
callq 0x34a0
movq %rax, %rcx
movl 0x144(%rsp), %eax
cmpl %ecx, %eax
jge 0x797a
cmpq $0x0, 0x180(%rsp)
jne 0x6db0
movl $0x40, %edi
callq 0x32b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x138(%rsp)
callq 0x66e0
jmp 0x6d25
movq 0x148(%rsp), %rax
movq 0x138(%rsp), %rcx
movq %rcx, 0x180(%rsp)
movq 0x180(%rsp), %rdx
movq 0x320(%rax), %rax
movl 0x18c(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x180(%rsp), %rdi
movl 0x194(%rsp), %esi
movl 0x190(%rsp), %edx
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x180(%rsp), %rdi
callq 0x65c0
jmp 0x797a
movq 0x138(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
testb $0x1, %al
jne 0x6dc7
jmp 0x76bb
movl $0x38, %edi
callq 0x32b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x130(%rsp)
movl $0x1, %esi
callq 0x6140
jmp 0x6deb
movq 0x130(%rsp), %rax
movq %rax, 0x150(%rsp)
movq 0x180(%rsp), %rdi
callq 0x6690
cmpl $0x1, %eax
jne 0x6e0f
jmp 0x6e59
leaq 0xc52a(%rip), %rdi      # 0x13340
leaq 0xc53c(%rip), %rsi      # 0x13359
movl $0xe5, %edx
leaq 0xc53c(%rip), %rcx      # 0x13365
callq 0x31d0
movq 0x130(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x38, %esi
callq 0x32c0
jmp 0x7982
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
callq *0x18(%rax)
movq 0x148(%rsp), %rdi
movl %eax, 0x12c(%rsp)
addq $0xa8, %rdi
callq 0x11190
movl %eax, %ecx
movl 0x12c(%rsp), %eax
cmpl %ecx, %eax
jae 0x6e91
jmp 0x6eb0
leaq 0xc511(%rip), %rdi      # 0x133a9
leaq 0xc4ba(%rip), %rsi      # 0x13359
movl $0xe7, %edx
leaq 0xc4ba(%rip), %rcx      # 0x13365
callq 0x31d0
movq 0x148(%rsp), %rax
movq 0x310(%rax), %rax
movq %rax, 0x110(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, %ecx
movq 0x110(%rsp), %rax
movl %ecx, %ecx
imulq $0x268, %rcx, %rcx      # imm = 0x268
addq %rcx, %rax
movq %rax, 0x118(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movq 0x118(%rsp), %rdi
movl %eax, %esi
movl 0x16c(%rsp), %edx
callq 0x11430
movsbl %al, %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, 0x120(%rsp)
subl $0x13, %eax
ja 0x756a
movq 0x120(%rsp), %rax
leaq 0xc1cb(%rip), %rcx      # 0x13110
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x150(%rsp), %rax
movq %rax, 0xf8(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0x100(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0x10c(%rsp)
jmp 0x6f8a
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0xf4(%rsp)
jmp 0x6fa4
movl 0xf4(%rsp), %edx
movl 0x10c(%rsp), %esi
movq 0x100(%rsp), %rdi
callq 0x6760
jmp 0x6fc1
movq 0x100(%rsp), %rsi
movq 0xf8(%rsp), %rdi
callq 0x65e0
movq 0x150(%rsp), %rdi
callq 0x66a0
movq %rax, %rdi
callq 0x65c0
jmp 0x75b3
movq 0x100(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x150(%rsp), %rax
movq %rax, 0xe0(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0xe8(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0xf0(%rsp)
jmp 0x7057
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0xdc(%rsp)
jmp 0x7071
movl 0xdc(%rsp), %edx
movl 0xf0(%rsp), %esi
movq 0xe8(%rsp), %rdi
callq 0x6760
jmp 0x708e
movq 0xe8(%rsp), %rsi
movq 0xe0(%rsp), %rdi
callq 0x6600
movq 0x150(%rsp), %rdi
callq 0x66b0
movq %rax, %rdi
callq 0x65c0
jmp 0x75b3
movq 0xe8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x150(%rsp), %rax
movq %rax, 0xc8(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0xd0(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0xd8(%rsp)
jmp 0x7124
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0xc4(%rsp)
jmp 0x713e
movl 0xc4(%rsp), %edx
movl 0xd8(%rsp), %esi
movq 0xd0(%rsp), %rdi
callq 0x6760
jmp 0x715b
movq 0xd0(%rsp), %rsi
movq 0xc8(%rsp), %rdi
callq 0x6620
movq 0x150(%rsp), %rdi
callq 0x66c0
movq %rax, %rdi
callq 0x65c0
jmp 0x75b3
movq 0xd0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x150(%rsp), %rax
movq %rax, 0xb0(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0xb8(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0xc0(%rsp)
jmp 0x71f1
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0xac(%rsp)
jmp 0x720b
movl 0xac(%rsp), %edx
movl 0xc0(%rsp), %esi
movq 0xb8(%rsp), %rdi
callq 0x6760
jmp 0x7228
movq 0xb8(%rsp), %rsi
movq 0xb0(%rsp), %rdi
callq 0x6640
movq 0x150(%rsp), %rdi
callq 0x66d0
movq %rax, %rdi
callq 0x65c0
jmp 0x75b3
movq 0xb8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x150(%rsp), %rax
movq %rax, 0x98(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0xa0(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0xa8(%rsp)
jmp 0x72be
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0x94(%rsp)
jmp 0x72d8
movl 0x94(%rsp), %edx
movl 0xa8(%rsp), %esi
movq 0xa0(%rsp), %rdi
callq 0x6760
jmp 0x72f5
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdi
callq 0x65e0
movq 0x150(%rsp), %rdi
callq 0x66a0
movq %rax, %rdi
callq 0x65c0
movq 0x150(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0x88(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0x90(%rsp)
jmp 0x735b
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0x7c(%rsp)
jmp 0x7372
movl 0x7c(%rsp), %edx
movl 0x90(%rsp), %esi
movq 0x88(%rsp), %rdi
callq 0x6760
jmp 0x738c
movq 0x88(%rsp), %rsi
movq 0x80(%rsp), %rdi
callq 0x6600
movq 0x150(%rsp), %rdi
callq 0x66b0
movq %rax, %rdi
callq 0x65c0
jmp 0x75b3
movq 0xa0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x88(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x150(%rsp), %rax
movq %rax, 0x68(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0x70(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0x78(%rsp)
jmp 0x7444
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0x64(%rsp)
jmp 0x745b
movl 0x64(%rsp), %edx
movl 0x78(%rsp), %esi
movq 0x70(%rsp), %rdi
callq 0x6760
jmp 0x746f
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdi
callq 0x65e0
movq 0x150(%rsp), %rdi
callq 0x66a0
movq %rax, %rdi
callq 0x65c0
movq 0x150(%rsp), %rax
movq %rax, 0x50(%rsp)
movl $0x40, %edi
callq 0x32b0
movq %rax, 0x58(%rsp)
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x18(%rax), %rax
callq *%rax
movl %eax, 0x60(%rsp)
jmp 0x74c6
movq 0x180(%rsp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, 0x4c(%rsp)
jmp 0x74dd
movl 0x4c(%rsp), %edx
movl 0x60(%rsp), %esi
movq 0x58(%rsp), %rdi
callq 0x6760
jmp 0x74f1
movq 0x58(%rsp), %rsi
movq 0x50(%rsp), %rdi
callq 0x6620
movq 0x150(%rsp), %rdi
callq 0x66c0
movq %rax, %rdi
callq 0x65c0
jmp 0x75b3
movq 0x70(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x13a7f(%rip), %rdi     # 0x1aff0
leaq 0xbe5e(%rip), %rsi      # 0x133d6
callq 0x32a0
movq %rax, 0x40(%rsp)
movq 0x198(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x3330
movq 0x40(%rsp), %rdi
movsbl (%rax), %esi
callq 0x3370
movq %rax, %rdi
movq 0x13a0a(%rip), %rsi     # 0x1afb8
callq 0x32f0
cmpq $0x0, 0x178(%rsp)
jne 0x75e5
movq 0x148(%rsp), %rax
movq 0x150(%rsp), %rdx
movq 0x320(%rax), %rax
movl 0x18c(%rsp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x7681
movq 0x198(%rsp), %rdi
movl 0x16c(%rsp), %eax
decl %eax
movslq %eax, %rsi
callq 0x3330
movsbl (%rax), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, 0x38(%rsp)
subl $0x13, %eax
ja 0x767f
movq 0x38(%rsp), %rax
leaq 0xbb44(%rip), %rcx      # 0x13160
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x178(%rsp), %rdi
movq 0x150(%rsp), %rsi
callq 0x65e0
jmp 0x767f
movq 0x178(%rsp), %rdi
movq 0x150(%rsp), %rsi
callq 0x6600
jmp 0x767f
movq 0x178(%rsp), %rdi
movq 0x150(%rsp), %rsi
callq 0x6620
jmp 0x767f
movq 0x178(%rsp), %rdi
movq 0x150(%rsp), %rsi
callq 0x6640
jmp 0x7681
movq 0x180(%rsp), %rax
movq %rax, 0x30(%rsp)
cmpq $0x0, %rax
je 0x769f
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x150(%rsp), %rax
movq %rax, 0x180(%rsp)
movq $0x0, 0x150(%rsp)
movq 0x180(%rsp), %rdi
callq 0x65c0
movq 0x198(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x3330
movsbl (%rax), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, 0x28(%rsp)
subl $0x13, %eax
ja 0x7763
movq 0x28(%rsp), %rax
leaq 0xbab5(%rip), %rcx      # 0x131b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x180(%rsp), %rdi
callq 0x66a0
movq %rax, 0x170(%rsp)
jmp 0x77ac
movq 0x180(%rsp), %rdi
callq 0x66b0
movq %rax, 0x170(%rsp)
jmp 0x77ac
movq 0x180(%rsp), %rdi
callq 0x66c0
movq %rax, 0x170(%rsp)
jmp 0x77ac
movq 0x180(%rsp), %rdi
callq 0x66d0
movq %rax, 0x170(%rsp)
jmp 0x77ac
movq 0x13886(%rip), %rdi     # 0x1aff0
leaq 0xbc65(%rip), %rsi      # 0x133d6
callq 0x32a0
movq %rax, 0x20(%rsp)
movq 0x198(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x3330
movq 0x20(%rsp), %rdi
movsbl (%rax), %esi
callq 0x3370
movq %rax, %rdi
movq 0x13811(%rip), %rsi     # 0x1afb8
callq 0x32f0
cmpq $0x0, 0x170(%rsp)
jne 0x7911
movl $0x40, %edi
callq 0x32b0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movl 0x194(%rsp), %esi
movl 0x190(%rsp), %edx
callq 0x6760
jmp 0x77e5
movq 0x18(%rsp), %rax
movq %rax, 0x170(%rsp)
movq 0x170(%rsp), %rdi
callq 0x65c0
movq 0x198(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x3330
movsbl (%rax), %eax
addl $-0x41, %eax
movl %eax, %ecx
movq %rcx, 0x10(%rsp)
subl $0x13, %eax
ja 0x78c6
movq 0x10(%rsp), %rax
leaq 0xb9ca(%rip), %rcx      # 0x13200
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x160(%rsp)
movl %eax, 0x15c(%rsp)
movl $0x40, %esi
callq 0x32c0
jmp 0x7982
movq 0x180(%rsp), %rdi
movq 0x170(%rsp), %rsi
callq 0x65e0
jmp 0x790f
movq 0x180(%rsp), %rdi
movq 0x170(%rsp), %rsi
callq 0x6600
jmp 0x790f
movq 0x180(%rsp), %rdi
movq 0x170(%rsp), %rsi
callq 0x6620
jmp 0x790f
movq 0x180(%rsp), %rdi
movq 0x170(%rsp), %rsi
callq 0x6640
jmp 0x790f
movq 0x13723(%rip), %rdi     # 0x1aff0
leaq 0xbb02(%rip), %rsi      # 0x133d6
callq 0x32a0
movq %rax, 0x8(%rsp)
movq 0x198(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x3330
movq 0x8(%rsp), %rdi
movsbl (%rax), %esi
callq 0x3370
movq %rax, %rdi
movq 0x136ae(%rip), %rsi     # 0x1afb8
callq 0x32f0
jmp 0x797a
movl 0x16c(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x198(%rsp), %rdi
callq 0x34a0
movq %rax, %rcx
movl 0x4(%rsp), %eax
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x7944
movq 0x170(%rsp), %rdi
callq 0x65c0
movq 0x180(%rsp), %rax
movq %rax, 0x178(%rsp)
movq 0x170(%rsp), %rax
movq %rax, 0x180(%rsp)
movl 0x16c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x16c(%rsp)
jmp 0x6cca
addq $0x1a8, %rsp            # imm = 0x1A8
retq
movq 0x160(%rsp), %rdi
callq 0x3590
nop