// File: /workspace/github_cpp_makefile_star2_O2/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: player_turn(actor*)
void player_turn(actor* a)
{
	update_map_seen();
	//draw_scene(true);
	int turn = -1;
	while(turn)
	{
		draw_scene(true);
		int kp;
		if(!forcefed_help)
		{
			kp = '?';
			//forcefed_help = true;
		}
		else
		{
			kp = fgetch();
		}
		switch(kp)
		{
		case KEY_UP: case 'k': case '8': case KEY_A2:
			turn = move_actor(a,0,-1); break;
		case KEY_DOWN: case 'j':case '2': case KEY_C2:
			turn = move_actor(a,0,1); break;
		case KEY_LEFT: case 'h': case '4': case KEY_B1:
			turn = move_actor(a,-1,0); break;
		case KEY_RIGHT: case 'l': case '6': case KEY_B3:
			turn = move_actor(a,1,0); break;
		case 'y':case '7': case KEY_A1:
			turn = move_actor(a,-1,-1); break;
		case 'u':case '9': case KEY_A3:
			turn = move_actor(a,1,-1); break;
		case 'b':case '1': case KEY_C1:
			turn = move_actor(a,-1,1); break;
		case 'n':case '3': case KEY_C3:
			turn = move_actor(a,1,1); break;
		case '.': case '5': case KEY_B2:
			turn = 0; break;
		case '?':
			{
				int kp = '?';
				int page = 0;
				while(kp == '?')
				{
					switch(page)
				{
					case 4:
					page = 0;
					case 0:
				pretty_print
				(
				/*"01234567890123456789012345678901234567890123456789"*/
				  "                                                  "
				  "      Find and destroy the radio transmitter      "
				  "            so that you can escape!               "
				  "                                                  "
				  "Movement: y/7  k/8  u/9  Fire:             f      "
				  "hjklyubn     \\  |  /     Throw:            t      "
				  "42867913      \\ | /      Run:              R      "
				  "          h/4--5/.--l/6  Check radio:      r      "
				  "              / | \\      Wield pistol      X      "
				  "             /  |  \\     Wield rifle       Y      "
				  "          b/1  j/2  n/3  Wield cannon      Z      "
				  "                         Mute advice       M      "
				  "                         Close ship doors  C      "
				  "               fire or //Autotarget:     tab      "
				  "               throw   ||Manual target: movement  "
				  "               mode    \\\\Info on tile:     i      "
				  "                         Quit game:        Q      "
				  "                         See this help:    ?      "
				  "                                                  "
				  "        Press ? again for more info.              "
				  "   You might also want to read the README.        "
				  "                                                  "
				); break;
				case 1:
				pretty_print
					(
				/*"01234567890123456789012345678901234567890123456789"*/
				  "Your guns:                           f to fire    "
				  " Pistol (low damage),                             "
				  " Rifle (med damage),                              "
				  " Cannon (high splash damage)                      "
				  "Your devices:                        t to throw   "
				  " Low explosives (rad. 2),                         "
				  " High explosives (rad. 4),                        "
				  " Distractions:                                    "
				  "  Hologram (C), Noise (D), Scent (E),             "
				  "  Brain slice (F) (for psychic aliens)            "
				  " Set a timer from 0 to 9 when throwing.           "
				  " All of these have very useful spy cameras.       "
				  "                                                  "
				  "       Press ? again for more info.               "
				  "                                                  "
					);break;
				case 2: pretty_print
			(
				/*"01234567890123456789012345678901234567890123456789"*/
				  "Monster memory:                                   "
				  "No-one has seen this planet or these aliens       "
				  "before and lived to tell the tale.                "
				  "To survive, you keep a note of your observations  "
				  "In the status panel.                              "
				  "The first column is size (small, medium, huge),   "
				  "The second is walk speed (slow, average, fast)    "
				  "   (relative to your walk speed)                  "
				  "The third is max run speed (slow, average, fast)  "
				  "   (relative to your max run speed)               "
				  "   (as stamina runs out, you get slower)          "
				  "The fourth is damage (weak, strong, dangerous)    "
				  "The last is health (frail or tough)               "
				  "Frail aliens are very easy to kill.               "
				  "Some tough aliens are easier to kill than others  "
				  "                                                  "
				  "     Press ? again for more info.                 "
				  "                                                  "
			);break;
				case 3:
					pretty_print
			(
				/*"01234567890123456789012345678901234567890123456789"*/
				  " Your ship is claiming, despite the surrounding   "
				  "   trees and hostile aliens, to be safely docked "
				  "    at a space station.                           "
				  "  You need to fix this malfunction and get off    "
				  "    this planet.                                  "
				  "  The ship uses automated radio signals to dock,  "
				  "    so there must be a radio transmitter here.    "
				  "  You can use your portable radio to try to find  "
				  "    the source of the transmissions,              "
				  "    then disable it with explosives and escape.   "
				  "                                                  "
				  "       Press ? again for more info.               "
				  "                                                  "
			);break;
				}
				page++;
				kp = fgetch();
				draw_scene();
				//clear_area(0,0,viewport_width,message_area_height+1);
				if(!forcefed_help && page != 4)
				{
					kp = '?';
					if(page == 3) {forcefed_help = true;}
				}
				}
			}break;
		case 'X':
			if(current_weapon != PISTOL) {turn = 0; add_message("You wield your pistol."); current_weapon = PISTOL;} break;
		case 'Y':
			if(current_weapon != RIFLE) {turn = 0; add_message("You wield your automatic rifle!"); current_weapon = RIFLE;} break;
		case 'Z':
			if(current_weapon != CANNON) {turn = 0; add_message("You get out the plasma cannon!!"); current_weapon = CANNON;} break;
		case 'r':
			turn = 0; add_message(signal_receive(p_ptr->x,p_ptr->y)); /*draw_last_msg();*/ break;
		case 'g':
			if(count_inv_devices(BRAIN_SLICE) > 0)
			{
				add_message("You wash a brain slice with Tx-PBS three times with gentle shaking.");
				draw_last_msg();
			}
			break;
		case 'Q':
			pretty_print("Are you sure you want to quit? press Y if you are.");
			if(fgetch() == 'Y')
			{
				endwin();
				exit(0);
			}
			break;
		case 'd':break;
			debug = !debug; break;
		case ' ':
			last_message_seen = rlmessages.size();
			last_word_seen  = rlmessage_words.size()-1;
			draw_last_msg(); break;
		case 'R':
			p_ptr->running = !p_ptr->running; draw_stats(); break;
		case 't':
			{

				current_mode = THROW_MODE;
				draw_scene();
				
				int tab_ind = autotarget();
				int lx = current_target->x; int ly = current_target->y;
				item* dev = select_individual_device();
				//item* dev = dev_inv[device_type][UNCONFIGURED].back();
				int t = ask_for_time();
				if(dev == NULL) break;
			while(current_mode==THROW_MODE)
			{
				draw_scene();
				draw_tile_description(lx,ly);
				draw_line(p_ptr->x,p_ptr->y,lx,ly,'*');
				clear_area(0,0,viewport_width,1);
				attron(COLOR_PAIR(COLOR_WHITE));
				mvaddstr(0,0,"Tab or movement to target, t to throw");
				int kpp = fgetch();
				undraw_line(p_ptr->x,p_ptr->y,lx,ly);
				undraw_tile_description();
				switch(kpp)
				{
				case '\t':
					if(visible_actors.size() > 0)
					{
						tab_ind = (tab_ind + 1)%visible_actors.size();
						lx = visible_actors[tab_ind]->x;
						ly = visible_actors[tab_ind]->y;
					}
					break;
				case KEY_UP: case 'k': case '8': case KEY_A2:
					ly = std::max(ly-1,viewport_top_edge()); break;
				case KEY_DOWN: case 'j': case '2': case KEY_C2:
					ly = std::min(ly+1,viewport_bottom_edge()); break;
				case KEY_LEFT: case 'h': case '4': case KEY_B1:
					lx = std::max(lx-1,viewport_left_edge()); break;
				case KEY_RIGHT: case 'l': case '6': case KEY_B3:
					lx = std::min(lx+1,viewport_right_edge()); break;
				case 'y': case '7': case KEY_A1:
					lx = std::max(lx-1,viewport_left_edge()); ly = std::max(ly-1,viewport_top_edge()); break;
				case 'u': case '9': case KEY_A3:
					lx = std::min(lx+1,viewport_right_edge()); ly = std::max(ly-1,viewport_top_edge()); break;
				case 'b': case '1': case KEY_C1:
					lx = std::max(lx-1,viewport_left_edge()); ly = std::min(ly+1,viewport_bottom_edge()); break;
				case 'n': case '3': case KEY_C3:
					lx = std::min(lx+1,viewport_right_edge()); ly = std::min(ly+1,viewport_bottom_edge()); break;
				case 't':
					{
						if(los_exists(p_ptr->x,p_ptr->y,lx,ly,blocks_shots))
						{
							//if(dev != NULL)
							{
								item_to_location(dev,lx,ly);
								inv_remove(dev);
								set_timer(dev,t);
								turn = 0;
								current_mode = WALK_MODE;
								dev->player_has = false;
							}
						}
						else
						{
							add_message("There's too much in the way!");
							draw_last_msg();
						}
					}
					break;
				case KEY_ESC:
					 current_mode = WALK_MODE; draw_scene(); break;
				case 'i':
					draw_info(lx,ly);
					current_mode = THROW_MODE; draw_stats();
					draw_line(p_ptr->x,p_ptr->y,lx,ly,'*');break;
				default: ;
				}
			}
			}
			break;
		case 'M':
			cycle_advice = !cycle_advice;
			draw_stats();
			break;
		case 'C':
			if(door_closable())
			{
				if(map_terrain[ship_x+2][ship_y] == DOOR)
				{
					map_terrain[ship_x+2][ship_y] = NS;
					turn = 0;
					add_message("You tell the computer to close the doors.");
					closed_doors = true;
				}
				else
				{
					add_message("Not going to open them again. No way.");
				}
			}
			else {add_message("Can't close the doors right now.");}
			break;
		case 'f':
		{
			current_mode = FIRE_MODE;
			draw_scene();
			int tab_ind = autotarget();
			int lx = current_target->x; int ly = current_target->y;
				
			
			while (current_mode == FIRE_MODE)
			{
				draw_tile_description(lx,ly);
				draw_line(p_ptr->x,p_ptr->y,lx,ly,'*');
				int kpp = fgetch();
				undraw_line(p_ptr->x,p_ptr->y,lx,ly);
				undraw_tile_description();
				
				switch(kpp)
				{
				case '\t':
					if(visible_actors.size() > 0)
					{
						tab_ind = (tab_ind + 1)%visible_actors.size();
						lx = visible_actors[tab_ind]->x;
						ly = visible_actors[tab_ind]->y;
					}
					break;
				case KEY_UP: case 'k': case '8': case KEY_A2:
					ly = std::max(ly-1,viewport_top_edge()); break;
				case KEY_DOWN: case 'j': case '2': case KEY_C2:
					ly = std::min(ly+1,viewport_bottom_edge()); break;
				case KEY_LEFT: case 'h': case '4': case KEY_B1:
					lx = std::max(lx-1,viewport_left_edge()); break;
				case KEY_RIGHT: case 'l': case '6': case KEY_B3:
					lx = std::min(lx+1,viewport_right_edge()); break;
				case 'y': case '7': case KEY_A1:
					lx = std::max(lx-1,viewport_left_edge()); ly = std::max(ly-1,viewport_top_edge()); break;
				case 'u': case '9': case KEY_A3:
					lx = std::min(lx+1,viewport_right_edge()); ly = std::max(ly-1,viewport_top_edge()); break;
				case 'b': case '1': case KEY_C1:
					lx = std::max(lx-1,viewport_left_edge()); ly = std::min(ly+1,viewport_bottom_edge()); break;
				case 'n': case '3': case KEY_C3:
					lx = std::min(lx+1,viewport_right_edge()); ly = std::min(ly+1,viewport_bottom_edge()); break;
				case 'f':
					if(ammo[current_weapon] == 0)
					{add_message("Can't fire this weapon, no ammo.");draw_last_msg();}
					else if(lx==p_ptr->x && ly==p_ptr->y)
					{
						add_message("Don't shoot yourself!");
						draw_last_msg();
					}
					else
					{
						if(fire_weapon(p_ptr->x,p_ptr->y,lx,ly))
						{
							current_mode = WALK_MODE;
							turn = 0;
						}
					}
					break;
				case KEY_ESC:
					 current_mode = WALK_MODE; 
					 draw_scene();
					 break;
				case 'i':
					draw_info(lx,ly);
					current_mode = FIRE_MODE; draw_stats();
					draw_line(p_ptr->x,p_ptr->y,lx,ly,'*');
				default:;
				}
			}
			if(map_occupants[lx][ly] != NULL)
			{
				current_target = map_occupants[lx][ly];
			}
			undraw_line(p_ptr->x,p_ptr->y,lx,ly);
			undraw_tile_description();
		}
		break;
			
		default: ;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, 0x10(%rsp)
callq 0xe5de
pushq $-0x1
popq %rax
pushq $0x1
popq %r12
leaq 0x1b(%rsp), %r13
leaq 0x4d7e(%rip), %r14      # 0x14480
leaq 0x208(%rsp), %rbp
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x102ee
movl %r12d, %edi
callq 0xcc13
cmpb $0x1, 0xebe0(%rip)      # 0x1e308
pushq $0x3f
popq %rax
movl %eax, %ebx
jne 0xf752
callq 0x11424
movl %eax, %ebx
leal -0x2e(%rbx), %eax
cmpl $0x47, %eax
ja 0xf866
leaq 0x4a4f(%rip), %rcx      # 0x14198
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r15d, %r15d
cmpl $0x3f, %ebx
jne 0xf70e
cmpl $0x4, %r15d
ja 0xf825
movl %r15d, %eax
movslq (%r14,%rax,4), %rax
addq %r14, %rax
jmpq *%rax
movq %rbp, %rdi
leaq 0x5e82(%rip), %rsi      # 0x155fc
movq %r13, %rdx
callq 0x5110
movq %rbp, %rdi
callq 0x633b
movq %rbp, %rdi
callq 0x5418
xorl %r15d, %r15d
jmp 0xf825
leaq 0x1a8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x6911(%rip), %rsi      # 0x160bd
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x633b
movq %rbx, %rdi
callq 0x5418
pushq $0x3
jmp 0xf823
leaq 0x1e8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x626f(%rip), %rsi      # 0x15a49
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x633b
movq %rbx, %rdi
callq 0x5418
movl %r12d, %r15d
jmp 0xf825
leaq 0x1c8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x652f(%rip), %rsi      # 0x15d38
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x633b
movq %rbx, %rdi
callq 0x5418
pushq $0x2
popq %r15
incl %r15d
callq 0x11424
movl %eax, %ebx
xorl %edi, %edi
callq 0xcc13
cmpl $0x4, %r15d
sete %al
orb 0xeac5(%rip), %al       # 0x1e308
jne 0xf755
pushq $0x3f
popq %rax
movl %eax, %ebx
cmpl $0x3, %r15d
jne 0xf755
movb $0x1, 0xeaa9(%rip)      # 0x1e308
movl %eax, %ebx
jmp 0xf755
leal -0x15c(%rbx), %eax
cmpl $0x4, %eax
jbe 0xf89b
leal -0x102(%rbx), %eax
cmpl $0x3, %eax
jbe 0x1027e
leal -0x1c2(%rbx), %eax
cmpl $0x6, %eax
ja 0xf8ab
leaq 0x4a4a(%rip), %rcx      # 0x142dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4a26(%rip), %rcx      # 0x142c8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x20, %ebx
je 0x101ef
cmpl $0x79, %ebx
je 0x102da
jmp 0xf70e
movq 0x5bc17(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %esi
movl 0x24(%rax), %edx
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
callq 0xe691
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
jmp 0xfdc6
movl $0x1, 0xea1a(%rip)      # 0x1e318
xorl %edi, %edi
callq 0xcc13
callq 0xf63e
movq %rax, 0x8(%rsp)
movq 0x5bbaa(%rip), %rax     # 0x6b4c0
movl 0x20(%rax), %ebx
movl 0x24(%rax), %r15d
cmpl $0x1, 0xe9f4(%rip)      # 0x1e318
jne 0x101a7
movl %ebx, %edi
movl %r15d, %esi
callq 0xc391
movq 0x5bba5(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebx, %edx
movl %r15d, %ecx
pushq $0x2a
popq %r8
callq 0xc941
callq 0x11424
movl %eax, %r12d
movq 0x5bb82(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebx, %edx
movl %r15d, %ecx
callq 0xcae9
callq 0xc65b
leal -0x62(%r12), %eax
cmpl $0x17, %eax
jbe 0xf9d2
leal -0x31(%r12), %eax
cmpl $0x8, %eax
jbe 0xfa44
leal -0x102(%r12), %eax
cmpl $0x3, %eax
jbe 0xfa81
leal -0x15c(%r12), %eax
cmpl $0x4, %eax
jbe 0xfa58
leal -0x1c2(%r12), %eax
cmpl $0x6, %eax
ja 0xfb21
leaq 0x4a9f(%rip), %rcx      # 0x14464
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
leaq 0x4a07(%rip), %rcx      # 0x143e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
movslq 0xe8f7(%rip), %rax      # 0x1e2e4
leaq 0x5b7f4(%rip), %rcx     # 0x6b1e8
cmpl $0x0, (%rcx,%rax,4)
je 0xfba1
movq 0x5badb(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
cmpl %edi, %ebx
jne 0xfbd3
cmpl %esi, %r15d
jne 0xfbd3
leaq 0x28(%rsp), %rdi
leaq 0x6ac2(%rip), %rsi      # 0x164ea
movq %r13, %rdx
callq 0x5110
leaq 0x28(%rsp), %rdi
callq 0x5c6e
leaq 0x28(%rsp), %rdi
jmp 0xfbc4
leaq 0x4971(%rip), %rcx      # 0x143bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
leaq 0x49f1(%rip), %rcx      # 0x14450
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
decl %ebx
movl 0x5b76c(%rip), %eax     # 0x6b1e0
addl $-0x18, %eax
cmpl %eax, %ebx
cmovlel %eax, %ebx
jmp 0xfb09
leaq 0x49b8(%rip), %rcx      # 0x14440
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
decl %ebx
movl 0x5b743(%rip), %eax     # 0x6b1e0
addl $-0x18, %eax
cmpl %eax, %ebx
cmovlel %eax, %ebx
jmp 0xf91d
incl %ebx
movl 0x5b72e(%rip), %eax     # 0x6b1e0
addl $0x18, %eax
cmpl %ebx, %eax
cmovll %eax, %ebx
jmp 0xf91d
incl %ebx
movl 0x5b719(%rip), %eax     # 0x6b1e0
addl $0x18, %eax
cmpl %ebx, %eax
cmovll %eax, %ebx
jmp 0xfae1
decl %ebx
movl 0x5b707(%rip), %eax     # 0x6b1e0
addl $-0x18, %eax
cmpl %eax, %ebx
cmovlel %eax, %ebx
incl %r15d
movl 0x5b6fa(%rip), %eax     # 0x6b1e4
addl $0xa, %eax
cmpl %r15d, %eax
cmovll %eax, %r15d
jmp 0xf91d
incl %ebx
movl 0x5b6df(%rip), %eax     # 0x6b1e0
addl $0x18, %eax
cmpl %ebx, %eax
cmovll %eax, %ebx
decl %r15d
movl 0x5b6d2(%rip), %eax     # 0x6b1e4
addl $-0x8, %eax
cmpl %eax, %r15d
cmovlel %eax, %r15d
jmp 0xf91d
cmpl $0x1b, %r12d
je 0xfb8a
cmpl $0x9, %r12d
pushq $0x1
popq %r12
jne 0xf91d
movq 0x5b994(%rip), %rsi     # 0x6b4d0
movq 0x5b985(%rip), %rcx     # 0x6b4c8
subq %rcx, %rsi
jne 0xfbf9
jmp 0xf91d
movl %ebx, %edi
movl %r15d, %esi
callq 0xce29
movl $0x1, 0xe7b3(%rip)      # 0x1e318
callq 0xbd86
movq 0x5b96f(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebx, %edx
movl %r15d, %ecx
pushq $0x2a
popq %r8
callq 0xc941
jmp 0xf91d
andl $0x0, 0xe787(%rip)      # 0x1e318
xorl %edi, %edi
callq 0xcc13
pushq $0x1
popq %r12
jmp 0xf91d
leaq 0x48(%rsp), %rdi
leaq 0x691c(%rip), %rsi      # 0x164c9
movq %r13, %rdx
callq 0x5110
leaq 0x48(%rsp), %rdi
callq 0x5c6e
leaq 0x48(%rsp), %rdi
callq 0x5418
callq 0x6b38
jmp 0xf91d
movl %ebx, %edx
movl %r15d, %ecx
callq 0xd908
testb %al, %al
je 0xf91d
andl $0x0, 0xe72c(%rip)      # 0x1e318
movl $0x0, 0x4(%rsp)
jmp 0xf91d
sarq $0x3, %rsi
movq 0x8(%rsp), %rax
incl %eax
cltq
xorl %edx, %edx
divq %rsi
movq %rdx, 0x8(%rsp)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
jmp 0xf916
cmpl $0x2, 0xe6c1(%rip)      # 0x1e2e4
je 0xf70e
leaq 0x148(%rsp), %rbx
movq %rbx, %rdi
leaq 0x6743(%rip), %rsi      # 0x1637e
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
movl $0x2, 0xe687(%rip)      # 0x1e2e4
jmp 0xfdc6
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x676e(%rip), %rsi      # 0x163e2
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x633b
movq %rbx, %rdi
callq 0x5418
callq 0x11424
cmpl $0x59, %eax
jne 0xf70e
jmp 0x10300
movq 0x5b83a(%rip), %rax     # 0x6b4e0
xorb $0x1, 0x14(%rax)
callq 0xbd86
jmp 0xf70e
callq 0xa272
testb %al, %al
je 0x1022b
movslq 0x5b534(%rip), %rax     # 0x6b1fc
imulq $0x258, %rax, %rax      # imm = 0x258
leaq 0xe66a(%rip), %rcx      # 0x1e340
addq %rcx, %rax
movslq 0x5b520(%rip), %rcx     # 0x6b200
cmpl $0x5, 0x4b0(%rax,%rcx,4)
jne 0x1024f
leaq (%rax,%rcx,4), %rax
addq $0x4b0, %rax            # imm = 0x4B0
movl $0xa, (%rax)
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x6748(%rip), %rsi      # 0x16458
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
movb $0x1, 0xe5f7(%rip)      # 0x1e326
jmp 0xfdc6
cmpl $0x0, 0xe5a9(%rip)      # 0x1e2e4
je 0xf70e
leaq 0x188(%rsp), %rbx
movq %rbx, %rdi
leaq 0x65f4(%rip), %rsi      # 0x16347
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
andl $0x0, 0xe572(%rip)      # 0x1e2e4
jmp 0xfdc6
xorb $0x1, 0xe565(%rip)      # 0x1e2e0
callq 0xbd86
jmp 0xf70e
cmpl $0x1, 0xe558(%rip)      # 0x1e2e4
je 0xf70e
leaq 0x168(%rsp), %rbx
movq %rbx, %rdi
leaq 0x65ba(%rip), %rsi      # 0x1635e
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
movl $0x1, 0xe51e(%rip)      # 0x1e2e4
movl $0x0, 0x4(%rsp)
jmp 0xf70e
movl $0x2, 0xe53b(%rip)      # 0x1e318
xorl %edi, %edi
callq 0xcc13
callq 0xf63e
movq %rax, 0x20(%rsp)
movq 0x5b6cb(%rip), %rax     # 0x6b4c0
movl 0x20(%rax), %r15d
movl 0x24(%rax), %ebx
callq 0xf5bf
movq %rax, 0x8(%rsp)
callq 0xefad
cmpq $0x0, 0x8(%rsp)
je 0xf70e
movl %eax, 0x1c(%rsp)
cmpl $0x2, 0xe4f6(%rip)      # 0x1e318
jne 0xf70e
xorl %edi, %edi
callq 0xcc13
movl %r15d, %edi
movl %ebx, %esi
callq 0xc391
movq 0x5b6a0(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r15d, %edx
movl %ebx, %ecx
pushq $0x2a
popq %r8
callq 0xc941
xorl %edi, %edi
xorl %esi, %esi
pushq $0x31
popq %rdx
movl %r12d, %ecx
callq 0x6a9c
movq 0xe16e(%rip), %r12      # 0x1dfd8
movq (%r12), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x5150
movq (%r12), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5260
cmpl $-0x1, %eax
je 0xfe9f
movq (%r12), %rdi
leaq 0x657e(%rip), %rsi      # 0x16415
pushq $-0x1
popq %rdx
callq 0x50d0
callq 0x11424
movl %eax, %r12d
movq 0x5b632(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r15d, %edx
movl %ebx, %ecx
callq 0xcae9
callq 0xc65b
leal -0x62(%r12), %eax
cmpl $0x17, %eax
jbe 0xff22
leal -0x31(%r12), %eax
cmpl $0x8, %eax
jbe 0xff6f
leal -0x102(%r12), %eax
cmpl $0x3, %eax
jbe 0xffaf
leal -0x15c(%r12), %eax
cmpl $0x4, %eax
jbe 0xff83
leal -0x1c2(%r12), %eax
cmpl $0x6, %eax
ja 0x10058
leaq 0x448b(%rip), %rcx      # 0x143a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
leaq 0x43f3(%rip), %rcx      # 0x1431c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
movl %r15d, %edi
movl %ebx, %esi
callq 0xce29
movl $0x2, 0xe3ce(%rip)      # 0x1e318
callq 0xbd86
movq 0x5b58a(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r15d, %edx
movl %ebx, %ecx
pushq $0x2a
popq %r8
callq 0xc941
jmp 0xfe1b
leaq 0x4382(%rip), %rcx      # 0x142f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
leaq 0x4402(%rip), %rcx      # 0x1438c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
decl %r15d
movl 0x5b240(%rip), %eax     # 0x6b1e0
addl $-0x18, %eax
cmpl %eax, %r15d
cmovlel %eax, %r15d
jmp 0x10043
leaq 0x43c6(%rip), %rcx      # 0x1437c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
pushq $0x1
popq %r12
jmpq *%rax
decl %r15d
movl 0x5b214(%rip), %eax     # 0x6b1e0
addl $-0x18, %eax
cmpl %eax, %r15d
cmovlel %eax, %r15d
jmp 0xfe1b
incl %r15d
movl 0x5b1fc(%rip), %eax     # 0x6b1e0
addl $0x18, %eax
cmpl %r15d, %eax
cmovll %eax, %r15d
jmp 0xfe1b
incl %r15d
movl 0x5b1e4(%rip), %eax     # 0x6b1e0
addl $0x18, %eax
cmpl %r15d, %eax
cmovll %eax, %r15d
jmp 0x1001b
decl %r15d
movl 0x5b1cf(%rip), %eax     # 0x6b1e0
addl $-0x18, %eax
cmpl %eax, %r15d
cmovlel %eax, %r15d
incl %ebx
movl 0x5b1c1(%rip), %eax     # 0x6b1e4
addl $0xa, %eax
cmpl %ebx, %eax
cmovll %eax, %ebx
jmp 0xfe1b
incl %r15d
movl 0x5b1a7(%rip), %eax     # 0x6b1e0
addl $0x18, %eax
cmpl %r15d, %eax
cmovll %eax, %r15d
decl %ebx
movl 0x5b199(%rip), %eax     # 0x6b1e4
addl $-0x8, %eax
cmpl %eax, %ebx
cmovlel %eax, %ebx
jmp 0xfe1b
cmpl $0x1b, %r12d
je 0x1011a
cmpl $0x9, %r12d
pushq $0x1
popq %r12
jne 0xfe1b
movq 0x5b459(%rip), %rsi     # 0x6b4d0
movq 0x5b44a(%rip), %rcx     # 0x6b4c8
subq %rcx, %rsi
je 0xfe1b
sarq $0x3, %rsi
movq 0x20(%rsp), %rax
incl %eax
cltq
xorl %edx, %edx
divq %rsi
movq %rdx, 0x20(%rsp)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
movl 0x20(%rax), %r15d
movl 0x24(%rax), %ebx
jmp 0xfe1b
movq 0x5b428(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r15d, %edx
movl %ebx, %ecx
leaq -0x54c3(%rip), %r8      # 0xac07
callq 0xc165
testb %al, %al
je 0x10131
movq 0x8(%rsp), %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x958f
movq 0x8(%rsp), %rdi
callq 0x9569
movq 0x8(%rsp), %rdi
movl 0x1c(%rsp), %esi
callq 0xf1f3
andl $0x0, 0xe217(%rip)      # 0x1e318
movq 0x8(%rsp), %rax
movb $0x0, 0x98(%rax)
movl $0x0, 0x4(%rsp)
jmp 0xfe1b
andl $0x0, 0xe1f7(%rip)      # 0x1e318
xorl %edi, %edi
callq 0xcc13
pushq $0x1
popq %r12
jmp 0xfe1b
leaq 0x68(%rsp), %rdi
leaq 0x62fe(%rip), %rsi      # 0x1643b
movq %r13, %rdx
callq 0x5110
leaq 0x68(%rsp), %rdi
callq 0x5c6e
leaq 0x68(%rsp), %rdi
callq 0x5418
callq 0x6b38
jmp 0xfe1b
pushq $0x5
popq %rdi
callq 0x9479
testl %eax, %eax
jle 0xf70e
leaq 0x108(%rsp), %rbx
movq %rbx, %rdi
leaq 0x6219(%rip), %rsi      # 0x1639e
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
callq 0x6b38
jmp 0xf70e
movslq %ebx, %rax
movslq %r15d, %rcx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq 0x5b335(%rip), %rdx     # 0x6b4f0
addq %rdx, %rax
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0x101ce
movq %rax, 0x5b2f2(%rip)     # 0x6b4c0
movq 0x5b30b(%rip), %rax     # 0x6b4e0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebx, %edx
movl %r15d, %ecx
callq 0xcae9
callq 0xc65b
jmp 0xf70e
movq 0x5b04a(%rip), %rax     # 0x6b240
subq 0x5b03b(%rip), %rax     # 0x6b238
shrq $0x5, %rax
movq 0x5b050(%rip), %rcx     # 0x6b258
subq 0x5b041(%rip), %rcx     # 0x6b250
movl %eax, 0x5b053(%rip)     # 0x6b268
shrq $0x5, %rcx
decl %ecx
movl %ecx, 0x5b04b(%rip)     # 0x6b26c
callq 0x6b38
jmp 0xf70e
leaq 0x88(%rsp), %rbx
movq %rbx, %rdi
leaq 0x626b(%rip), %rsi      # 0x164a8
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
jmp 0x10271
leaq 0xa8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x6221(%rip), %rsi      # 0x16482
movq %r13, %rdx
callq 0x5110
movq %rbx, %rdi
callq 0x5c6e
movq %rbx, %rdi
callq 0x5418
jmp 0xf70e
leaq 0x4033(%rip), %rcx      # 0x142b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%rsp), %rdi
xorl %esi, %esi
jmp 0x102c8
movq 0x10(%rsp), %rdi
xorl %esi, %esi
jmp 0x102d5
movq 0x10(%rsp), %rdi
movl %r12d, %esi
jmp 0x102b2
movq 0x10(%rsp), %rdi
pushq $-0x1
popq %rsi
xorl %edx, %edx
jmp 0x102e4
movq 0x10(%rsp), %rdi
movl %r12d, %esi
jmp 0x102c8
movq 0x10(%rsp), %rdi
pushq $-0x1
popq %rsi
movl %r12d, %edx
jmp 0x102e4
movq 0x10(%rsp), %rdi
movl %r12d, %esi
pushq $-0x1
popq %rdx
jmp 0x102e4
movq 0x10(%rsp), %rdi
pushq $-0x1
popq %rdx
movl %edx, %esi
callq 0xccdb
jmp 0xf70a
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x52b0
xorl %edi, %edi
callq 0x52d0
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x10417
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
jmp 0x1041e
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
jmp 0x10417
jmp 0x1041e
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
jmp 0x10417
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
callq 0x5418
jmp 0x10421
movq %rax, %rbx
movq %rbx, %rdi
callq 0x53c0