// File: /workspace/github_cpp_makefile_star2_O2/AngelPn[P]L5R-card_game/src/Player.cpp
// Function: Player::battlePhase(Player*)
void Player::battlePhase(Player *p){
	//All of the cards in Army are untapped because of the startingPhase
	cout<< this->name<< ", choose the number of untapped Personalities in Army to defense/battle: "<< endl<<
		"The number of existing untapped Personalities in Army is "<< army.size()<< endl<<
		"Type a number (1-"<< army.size()<< "): ";
	int c= 0;
	while(c< 1 || c> army.size()){
		cin>> c;
		cout<< c<< endl;
	}

	//Built up the arena
	printArmy();
	cout<< this->name<< ", choose which of the Personalities in Army you want in Arena: "<< endl<<
		"Type "<< c<< " different numbers: (1-"<< army.size()<< "): ";
	int n= 0;
	arena.clear(); //Clear the previous arena
	for(int i=0; i< c; i++){
		cin>> n;
		arena.push_back(n -1); //vector of army's indexes that keeps track of personalities in arena
	}
	printArena();

	if(p!= NULL){ //If the player has chosen battle

		cout<< "Enemy's provinces: "<< endl;
		p->printProvinces();
		cout<< this->name<< ", choose the enemy's province to attack: "<< endl<<
			"The number of enemy's provinces is "<< p->numberOfProvinces<< endl<<
			"Type a number: (1-"<< p->numberOfProvinces<< "): ";
		n= 0;
		while(n< 1 || n> p->numberOfProvinces)
			cin>> n;

		//Calculate the total points of attacker and defender
		int points_attacker= 0, points_defender= 0;

		for(int i= 0; i< arena.size(); i++)
			points_attacker+= army[arena[i]]->get_attack();

		for(int i= 0; i< p->arena.size(); i++)
			points_defender+= p->army[p->arena[i]]->get_defense();

		int province_defense= p->holdings[0]->get_initialDefense(); //Get the province defense points from StrongHold
		points_defender+= province_defense;

		cout<< "Attacker's points= "<< points_attacker<< endl<<
			"Province's defense= "<< province_defense<< endl<<
			"Defender's points= "<< points_defender<< endl<< endl;

		if(points_attacker - points_defender > province_defense){ //Attacker won the battle, province is destroyed
			p->provinces.erase(p->provinces.begin()+ n-1); //Destroy defender's province
			p->numberOfProvinces--; //Decrement defender's total number of provinces
			//Defender loses all of the defensive personalities
			for(int i=0; i< p->arena.size(); i++){
				p->army.erase(p->army.begin()+ p->arena[i]); //Destroy the Personality
				p->decrease_arena(i);
				p->arena.erase(p->arena.begin()+ i); //Erase the Personality from Arena
				i--;
			}
			//Print a message
			cout<< "Attacker's points - Defender's points > Province's defense"<< endl<<
				"Attacker "<< this->name<< " won the battle. Enemy's province is destroyed!"<< endl<<
				"Print Enemy's provinces: "<< endl;
			p->printProvinces();
		}
		else{ //Province is not destroyed
			if(points_attacker > points_defender){
				//Defender loses all of the defensive personalities
				for(int i=0; i< p->arena.size(); i++){
					p->army.erase(p->army.begin()+ p->arena[i]); //Destroy the Personality
					p->decrease_arena(i);
					p->arena.erase(p->arena.begin()+ i); //Erase the Personality from Arena
					i--;
				}

				//Attacker loses followers or personalities from arena's army that attack>= points_attacker- points_defender
				int lost_points= 0, k= 0;
				while(lost_points < (points_attacker - points_defender)){

					if(army[arena[k]]->hasFollowers()){ //If the Personality has followers
						army[arena[k]]->destroyFollower(&lost_points);
						continue;
					}
					else{
						lost_points+= army[arena[k]]->get_attack();
						army.erase(army.begin()+ arena[k]); //delete the Personality
						decrease_arena(k);
						arena.erase(arena.begin()+ k);
						k--;
					}

					if(k == army.size()) break;
					k++;
				}

				//Tap every Personality and Followers that have survived
				for(int i= 0; i< arena.size(); i++){
					army[arena[i]]->tap_followers();
					army[arena[i]]->tap();
					//Items of Personality lose one durability
					army[arena[i]]->decrement_durability();
				}
				//Print a message
				cout<< "Attacker's points - Defender's points < Province's defense"<< endl<<
					"Province is not destroyed!"<< endl<<
					"Attacker's points > Defender's points"<< endl<<
					"Defender loses all of the defensive Personalities"<< endl<<
					"Attacker loses followers or personalities from Arena's army that attack>= attacker's points - defender's points"<< endl<<
					"Tapped every Personality and Followers that have survived. Items of Personality lose one durability"<< endl;
			}
			else if(points_attacker == points_defender){
				//Attacker loses all of the attacking personalities and followers
				for(int i=0; i< arena.size(); i++){
					army.erase(army.begin()+ arena[i]); //Destroy the Personality
					decrease_arena(i);
					arena.erase(arena.begin()+ i); //Erase the Personality from Arena
					i--;
				}

				//Defender loses all of the defensive personalities and followers
				for(int i=0; i< p->arena.size(); i++){
					p->army.erase(p->army.begin()+ p->arena[i]); //Destroy the Personality
					p->decrease_arena(i);
					p->arena.erase(p->arena.begin()+ i); //Erase the Personality from Arena
					i--;
				}

				//Print a message
				cout<< "Attacker's points - Defender's points < Province's defense"<< endl<<
					"Province is not destroyed!"<< endl<<
					"Attacker's points == Defender's points"<< endl<<
					"Defender loses all of the defensive Personalities and Followers"<< endl<<
					"Attacker loses all of the attacking Personalities and Followers"<< endl;
			}
			else{
				//Attacker loses all of the attacking personalities and followers
				for(int i=0; i< arena.size(); i++){
					army.erase(army.begin()+ arena[i]); //Destroy the Personality
					decrease_arena(i);
					arena.erase(arena.begin()+ i); //Erase the Personality from Arena
					i--;
				}

				//Defender loses followers or personalities from arena's army that attack>= points_attacker- points_defender
				int lost_points= 0, k= 0;
				while(lost_points < (points_defender - points_attacker)){

					if(p->army[p->arena[k]]->hasFollowers()){ //If the Personality has followers
						p->army[p->arena[k]]->destroyFollower(&lost_points);
						continue;
					}
					else{
						lost_points+= p->army[p->arena[k]]->get_attack();
						p->army.erase(p->army.begin()+ p->arena[k]); //destroy the Personality
						p->decrease_arena(k);
						p->arena.erase(p->arena.begin()+ k);
						k--;
					}

					if(k == p->army.size()) break;
					k++;
				}
				//Print a message
				cout<< "Attacker's points - Defender's points < Province's defense"<< endl<<
					"Province is not destroyed!"<< endl<<
					"Attacker's points < Defender's points"<< endl<<
					"Defender loses followers or personalities from arena's army that attack>= defender's points - attacker's points"<< endl<<
					"Attacker loses all of the attacking Personalities and Followers"<< endl;
			}
			cout<< "Surviving Personalities lose a point of honour"<< endl;
			//Surviving Personalities lose a point of honour
			for(int i= 0; i< arena.size(); i++){
				army[arena[i]]->decrement_honour();
				if(army[arena[i]]->get_honour() == 0){ //Perfom suicide
					army[arena[i]]->performSeppuku();
					army.erase(army.begin()+ arena[i]); //Destroy the Personality
					decrease_arena(i);
					arena.erase(arena.begin()+ i); //Erase the Personality from Arena
					i--;
				}
			}
			for(int i= 0; i< p->arena.size(); i++){
				p->army[p->arena[i]]->decrement_honour();
				if(p->army[p->arena[i]]->get_honour() == 0){ //Perfom suicide
					p->army[p->arena[i]]->performSeppuku();
					p->army.erase(p->army.begin()+ p->arena[i]); //Destroy the Personality
					p->decrease_arena(i);
					p->arena.erase(p->arena.begin()+ i); //Erase the Personality from Arena
					i--;
				}
			}
		}
		cout<< "Print "<< this->name<< "'s Arena:"<< endl;
		printArena();
		cout<< "Print "<< p->name<< "'s Arena: "<< endl;
		p->printArena();
	}

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa8(%rdi), %rbp
movq 0x954c(%rip), %r15      # 0x10fd0
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3170
leaq 0x33ff(%rip), %rsi      # 0xae95
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3432(%rip), %rsi      # 0xaedf
movq %rax, %rdi
callq 0x31a0
leaq 0x50(%r14), %rcx
movq %rcx, 0x40(%rsp)
movq 0x58(%r14), %rsi
subq 0x50(%r14), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x3120
movq %rax, %rdi
callq 0x30d0
leaq 0x3438(%rip), %rsi      # 0xaf19
movq %rax, %rdi
callq 0x31a0
movq 0x58(%r14), %rsi
subq 0x50(%r14), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x3120
leaq 0x2525(%rip), %rsi      # 0xa029
movq %rax, %rdi
callq 0x31a0
leaq 0x14(%rsp), %r12
andl $0x0, (%r12)
xorl %eax, %eax
movq 0x94c1(%rip), %r13      # 0x10fe0
testl %eax, %eax
jle 0x7b36
movl %eax, %eax
movq 0x58(%r14), %rcx
subq 0x50(%r14), %rcx
sarq $0x3, %rcx
cmpq %rax, %rcx
jae 0x7b5b
movq %r13, %rdi
movq %r12, %rsi
callq 0x3110
movl 0x14(%rsp), %esi
movq %r15, %rdi
callq 0x3240
movq %rax, %rdi
callq 0x30d0
movl 0x14(%rsp), %eax
jmp 0x7b1f
movq %r14, %rdi
callq 0x782e
movq 0x9466(%rip), %rdi      # 0x10fd0
movq %rbp, 0x30(%rsp)
movq %rbp, %rsi
callq 0x3170
leaq 0x33ad(%rip), %rsi      # 0xaf2b
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x33d6(%rip), %rsi      # 0xaf6b
movq %rax, %rdi
callq 0x31a0
movl 0x14(%rsp), %esi
movq %rax, %rdi
callq 0x3240
leaq 0x33c1(%rip), %rsi      # 0xaf71
movq %rax, %rdi
callq 0x31a0
movq 0x58(%r14), %rsi
subq 0x50(%r14), %rsi
sarq $0x3, %rsi
movq %rax, %rdi
callq 0x3120
leaq 0x2456(%rip), %rsi      # 0xa029
movq %rax, %rdi
callq 0x31a0
andl $0x0, 0x10(%rsp)
movq 0x68(%r14), %rax
cmpq %rax, 0x70(%r14)
je 0x7bee
movq %rax, 0x70(%r14)
leaq 0x68(%r14), %rax
movq %rax, 0x28(%rsp)
xorl %r13d, %r13d
movq 0x93df(%rip), %r15      # 0x10fe0
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %rbp
cmpl 0x14(%rsp), %r13d
jge 0x7c39
movq %r15, %rdi
movq %r12, %rsi
callq 0x3110
movl 0x10(%rsp), %eax
decl %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x9498
incl %r13d
jmp 0x7c0b
movq %r14, %rdi
callq 0x84ec
testq %rbx, %rbx
je 0x7fc8
movq 0x937f(%rip), %r15      # 0x10fd0
leaq 0x344a(%rip), %rsi      # 0xb0a2
movq %r15, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x7272
movq %r15, %rdi
movq 0x30(%rsp), %rsi
callq 0x3170
leaq 0x3305(%rip), %rsi      # 0xaf89
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3318(%rip), %rsi      # 0xafb3
movq %rax, %rdi
callq 0x31a0
movl 0x80(%rbx), %esi
movq %rax, %rdi
callq 0x3240
movq %rax, %rdi
callq 0x30d0
leaq 0x3317(%rip), %rsi      # 0xafd7
movq %rax, %rdi
callq 0x31a0
movl 0x80(%rbx), %esi
movq %rax, %rdi
callq 0x3240
leaq 0x234c(%rip), %rsi      # 0xa029
movq %rax, %rdi
callq 0x31a0
leaq 0x10(%rsp), %r15
andl $0x0, (%r15)
xorl %eax, %eax
movq 0x92e9(%rip), %r12      # 0x10fe0
movq 0x40(%rsp), %r13
testl %eax, %eax
jle 0x7d08
cmpl 0x80(%rbx), %eax
jle 0x7d19
movq %r12, %rdi
movq %r15, %rsi
callq 0x3110
movl 0x10(%rsp), %eax
jmp 0x7cfc
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x68(%r14), %rax
movq 0x70(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
jbe 0x7d4c
movslq (%rax,%r15,4), %rax
movq (%r13), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x6882
addl %eax, %r12d
incq %r15
jmp 0x7d1f
leaq 0x68(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x50(%rbx), %rax
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
jbe 0x7d93
movslq (%rax,%r15,4), %rax
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x6886
addl %eax, %ebp
incq %r15
jmp 0x7d63
movq 0x38(%rbx), %rax
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x30(%rax)
movl %eax, %r15d
addl %eax, %ebp
movq 0x9224(%rip), %rdi      # 0x10fd0
leaq 0x3237(%rip), %rsi      # 0xafea
callq 0x31a0
movq %rax, %rdi
movl %r12d, %esi
callq 0x3240
movq %rax, %rdi
callq 0x30d0
leaq 0x322c(%rip), %rsi      # 0xaffe
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movl %r15d, %esi
callq 0x3240
movq %rax, %rdi
callq 0x30d0
leaq 0x321f(%rip), %rsi      # 0xb013
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movl %ebp, %esi
callq 0x3240
movq %rax, %rdi
callq 0x30d0
movq %rax, %rdi
callq 0x30d0
movl %r12d, %eax
subl %ebp, %eax
movl %eax, 0x3c(%rsp)
cmpl %r15d, %eax
jle 0x7e8e
leaq 0x88(%rbx), %rdi
movq 0x88(%rbx), %rax
movslq 0x10(%rsp), %rcx
leaq (%rax,%rcx,8), %rsi
addq $-0x8, %rsi
callq 0x8fc8
decl 0x80(%rbx)
movq 0x30(%rsp), %r15
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %r13
movq 0x68(%rbx), %rax
cmpq %rax, 0x70(%rbx)
je 0x7edf
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
movq %r13, %rdi
callq 0x9002
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%rbx), %rsi
movq %r12, %rdi
callq 0x903c
jmp 0x7e59
cmpl %ebp, %r12d
jle 0x7fd7
movq 0x28(%rsp), %r15
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rbp
movq 0x68(%rbx), %rax
cmpq %rax, 0x70(%rbx)
je 0x80f9
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
movq %rbp, %rdi
callq 0x9002
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%rbx), %rsi
movq %r12, %rdi
callq 0x903c
jmp 0x7ea6
movq 0x90ea(%rip), %rdi      # 0x10fd0
leaq 0x313a(%rip), %rsi      # 0xb027
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3161(%rip), %rsi      # 0xb062
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
movq %r15, %rsi
callq 0x3170
leaq 0x3151(%rip), %rsi      # 0xb06c
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x316a(%rip), %rsi      # 0xb09c
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x7272
movq 0x907f(%rip), %r15      # 0x10fd0
leaq 0x344c(%rip), %r12      # 0xb3a4
movq %r15, %rdi
movq %r12, %rsi
callq 0x31a0
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x3170
leaq 0x3434(%rip), %rsi      # 0xb3ab
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
movq %r14, %rdi
callq 0x84ec
movq %r15, %rdi
movq %r12, %rsi
callq 0x31a0
leaq 0xa8(%rbx), %rsi
movq %rax, %rdi
callq 0x3170
leaq 0x3405(%rip), %rsi      # 0xb3b5
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x84ec
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rsp), %r15
jne 0x8021
movq 0x20(%rsp), %r12
movq 0x18(%rsp), %rbp
movq 0x68(%r14), %rax
cmpq %rax, 0x70(%r14)
je 0x8083
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%r14), %rsi
movq %r13, %rdi
callq 0x9002
movq %r14, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%r14), %rsi
movq %r15, %rdi
callq 0x903c
jmp 0x7fe8
movq 0x68(%r14), %rax
cmpq %rax, 0x70(%r14)
je 0x826e
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%r14), %rsi
movq %r13, %rdi
callq 0x9002
movq %r14, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%r14), %rsi
movq %r15, %rdi
callq 0x903c
jmp 0x8021
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
movq %rbp, %rdi
callq 0x9002
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%rbx), %rsi
movq %r12, %rdi
callq 0x903c
movq 0x68(%rbx), %rax
cmpq %rax, 0x70(%rbx)
jne 0x805a
movq 0x8f3c(%rip), %rdi      # 0x10fd0
leaq 0x301b(%rip), %rsi      # 0xb0b6
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3042(%rip), %rsi      # 0xb0f1
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3172(%rip), %rsi      # 0xb238
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x3182(%rip), %rsi      # 0xb25f
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x31ab(%rip), %rsi      # 0xb29f
jmp 0x8259
leaq 0xc(%rsp), %r12
andl $0x0, (%r12)
xorl %eax, %eax
movl 0x3c(%rsp), %ebp
cmpl %ebp, %eax
jge 0x8196
movq (%r13), %rax
movq (%r15), %rcx
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x688e
movq (%r15), %rcx
movslq (%rcx), %rcx
movq (%r13), %rdx
movq (%rdx,%rcx,8), %rdi
testb %al, %al
jne 0x8185
callq 0x6882
addl %eax, 0xc(%rsp)
movq 0x68(%r14), %rax
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%r14), %rsi
movq %r13, %rdi
callq 0x9002
movq %r14, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%r14), %rsi
movq %r15, %rdi
callq 0x903c
movq 0x50(%r14), %rax
movq 0x58(%r14), %rcx
subq %rax, %rcx
cmpq $-0x8, %rcx
je 0x8196
cmpl %ebp, 0xc(%rsp)
jl 0x8115
jmp 0x8196
movq %r12, %rsi
callq 0x689a
movl 0xc(%rsp), %eax
jmp 0x8109
xorl %r12d, %r12d
movq 0x68(%r14), %rax
movq 0x70(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x81db
movslq (%rax,%r12,4), %rax
movq (%r13), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x68b0
movq (%r15), %rax
movslq (%rax,%r12,4), %rax
movq (%r13), %rcx
movq (%rcx,%rax,8), %rdi
movb $0x1, 0x2c(%rdi)
callq 0x68ca
incq %r12
jmp 0x8199
movq 0x8dee(%rip), %rdi      # 0x10fd0
leaq 0x2ecd(%rip), %rsi      # 0xb0b6
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2ef4(%rip), %rsi      # 0xb0f1
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2ef8(%rip), %rsi      # 0xb10c
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2f07(%rip), %rsi      # 0xb132
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2f22(%rip), %rsi      # 0xb164
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2f7b(%rip), %rsi      # 0xb1d4
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
jmp 0x8380
leaq 0xc(%rsp), %rax
andl $0x0, (%rax)
subl %r12d, %ebp
xorl %eax, %eax
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %r12
cmpl %ebp, %eax
jge 0x8304
movq (%r15), %rax
movslq (%rax), %rax
movq (%r12), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x688e
movq (%r15), %rcx
movslq (%rcx), %rcx
movq (%r12), %rdx
movq (%rdx,%rcx,8), %rdi
testb %al, %al
je 0x82ba
leaq 0xc(%rsp), %rsi
callq 0x689a
jmp 0x82fe
callq 0x6882
addl %eax, 0xc(%rsp)
movq 0x68(%rbx), %rax
movslq (%rax), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
movq %r12, %rdi
callq 0x9002
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7a42
movq 0x68(%rbx), %rsi
movq %r15, %rdi
callq 0x903c
movq 0x58(%rbx), %rax
subq 0x50(%rbx), %rax
cmpq $-0x8, %rax
je 0x8304
movl 0xc(%rsp), %eax
jmp 0x8285
movq 0x8cc5(%rip), %rdi      # 0x10fd0
leaq 0x2da4(%rip), %rsi      # 0xb0b6
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2dcb(%rip), %rsi      # 0xb0f1
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2fa2(%rip), %rsi      # 0xb2df
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2fb1(%rip), %rsi      # 0xb305
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
leaq 0x2f34(%rip), %rsi      # 0xb29f
movq %rax, %rdi
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
movq 0x28(%rsp), %r15
movq 0x8c49(%rip), %rdi      # 0x10fd0
leaq 0x2fe7(%rip), %rsi      # 0xb375
callq 0x31a0
movq %rax, %rdi
callq 0x30d0
xorl %ebp, %ebp
movslq %ebp, %r12
movq 0x68(%r14), %rax
movq 0x70(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x843d
movslq (%rax,%r12,4), %rax
movq (%r13), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x6900
movq (%r15), %rax
movslq (%rax,%r12,4), %rax
movq (%r13), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x688a
testl %eax, %eax
jne 0x8436
movq 0x50(%r14), %rax
movq 0x68(%r14), %rcx
leaq (,%r12,4), %rbp
movslq (%rcx,%r12,4), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6904
movq 0x68(%r14), %rax
movslq (%rax,%r12,4), %rsi
shlq $0x3, %rsi
addq 0x50(%r14), %rsi
movq %r13, %rdi
callq 0x9002
movq %r14, %rdi
movl %r12d, %esi
callq 0x7a42
addq 0x68(%r14), %rbp
movq %r15, %rdi
movq %rbp, %rsi
callq 0x903c
decl %r12d
movl %r12d, %ebp
incl %ebp
jmp 0x839d
xorl %ebp, %ebp
movq 0x18(%rsp), %r15
movslq %ebp, %r12
movq 0x68(%rbx), %rax
movq 0x70(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x7f4a
movslq (%rax,%r12,4), %rax
movq (%r15), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x6900
movq 0x20(%rsp), %rax
movq (%rax), %rax
movslq (%rax,%r12,4), %rax
movq (%r15), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x688a
testl %eax, %eax
jne 0x84e4
movq 0x50(%rbx), %rax
movq 0x68(%rbx), %rcx
leaq (,%r12,4), %r13
movslq (%rcx,%r12,4), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6904
movq 0x68(%rbx), %rax
movslq (%rax,%r12,4), %rsi
shlq $0x3, %rsi
addq 0x50(%rbx), %rsi
movq 0x18(%rsp), %rdi
callq 0x9002
movq %rbx, %rdi
movl %r12d, %esi
callq 0x7a42
addq 0x68(%rbx), %r13
movq 0x20(%rsp), %rdi
movq %r13, %rsi
callq 0x903c
decl %r12d
movl %r12d, %ebp
incl %ebp
jmp 0x8444
nop