// File: /workspace/github_cpp_makefile_star2_O1/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, 0x8(%rsp)
callq 0x12b6a
leaq 0xf8(%rsp), %r12
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq 0xcb3f(%rip), %rbx      # 0x20fd8
movl $0x1, %edi
callq 0x1093e
movl $0x3f, %r14d
cmpb $0x1, 0xce68(%rip)      # 0x21318
jne 0x144c2
movq (%rbx), %rdi
callq 0x50f0
movl %eax, %r14d
callq 0x5130
cmpl $0x101, %r14d           # imm = 0x101
jg 0x1468c
leal -0x2e(%r14), %eax
cmpl $0x47, %eax
ja 0x1473a
leaq 0x3cf5(%rip), %rcx      # 0x181d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r14d, %r14d
leaq 0x38(%rsp), %rcx
leaq 0x58(%rsp), %rdx
leaq 0x78(%rsp), %rsi
leaq 0x98(%rsp), %rdi
cmpl $0x4, %r14d
ja 0x14614
movl %r14d, %eax
leaq 0x3fa6(%rip), %r8       # 0x184c0
movslq (%r8,%rax,4), %rax
addq %r8, %rax
jmpq *%rax
movq %rdi, 0x88(%rsp)
movq %rdi, %r13
leaq 0x88(%rsp), %r14
movq %r14, %rdi
leaq 0x50f3(%rip), %rsi      # 0x19633
leaq 0x5538(%rip), %rdx      # 0x19a7f
callq 0x16274
movq %r14, %rdi
callq 0x68a8
movq 0x88(%rsp), %rdi
xorl %r14d, %r14d
jmp 0x1460a
movq %rcx, 0x28(%rsp)
movq %rcx, %r13
leaq 0x28(%rsp), %r14
movq %r14, %rdi
leaq 0x5b79(%rip), %rsi      # 0x1a0f4
leaq 0x5dfb(%rip), %rdx      # 0x1a37d
callq 0x16274
movq %r14, %rdi
callq 0x68a8
movq 0x28(%rsp), %rdi
movl $0x3, %r14d
jmp 0x1460a
movq %rsi, 0x68(%rsp)
movq %rsi, %r13
leaq 0x68(%rsp), %r14
movq %r14, %rdi
leaq 0x54cd(%rip), %rsi      # 0x19a80
leaq 0x57b4(%rip), %rdx      # 0x19d6e
callq 0x16274
movq %r14, %rdi
callq 0x68a8
movq 0x68(%rsp), %rdi
movl $0x1, %r14d
jmp 0x1460a
movq %rdx, 0x48(%rsp)
movq %rdx, %r13
leaq 0x48(%rsp), %r14
movq %r14, %rdi
leaq 0x5784(%rip), %rsi      # 0x19d6f
leaq 0x5b01(%rip), %rdx      # 0x1a0f3
callq 0x16274
movq %r14, %rdi
callq 0x68a8
movq 0x48(%rsp), %rdi
movl $0x2, %r14d
cmpq %r13, %rdi
je 0x14614
callq 0x5230
incl %r14d
movq (%rbx), %rdi
callq 0x50f0
movl %eax, %ebp
callq 0x5130
xorl %edi, %edi
callq 0x1093e
cmpl $0x4, %r14d
sete %al
orb 0xccde(%rip), %al       # 0x21318
je 0x14655
leaq 0x38(%rsp), %rcx
leaq 0x58(%rsp), %rdx
leaq 0x78(%rsp), %rsi
leaq 0x98(%rsp), %rdi
jmp 0x1467e
movl $0x3f, %ebp
cmpl $0x3, %r14d
leaq 0x38(%rsp), %rcx
leaq 0x58(%rsp), %rdx
leaq 0x78(%rsp), %rsi
leaq 0x98(%rsp), %rdi
jne 0x1467e
movb $0x1, 0xcc9a(%rip)      # 0x21318
cmpl $0x3f, %ebp
je 0x14506
jmp 0x14761
leal -0x15c(%r14), %eax
cmpl $0x4, %eax
jbe 0x146c5
leal -0x102(%r14), %eax
cmpl $0x3, %eax
jbe 0x146e1
addl $0xfffffe3e, %r14d      # imm = 0xFFFFFE3E
cmpl $0x6, %r14d
ja 0x14761
leaq 0x3c60(%rip), %rcx      # 0x1831c
movslq (%rcx,%r14,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x3c3c(%rip), %rcx      # 0x18308
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rsp), %rdi
movl $0x1, %esi
jmp 0x14754
leaq 0x3c10(%rip), %rcx      # 0x182f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rsp), %rdi
xorl %esi, %esi
jmp 0x14733
movq 0x8(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x14710
movq 0x8(%rsp), %rdi
movl $0x1, %esi
xorl %edx, %edx
jmp 0x14759
movq 0x8(%rsp), %rdi
xorl %esi, %esi
jmp 0x14754
movq 0x8(%rsp), %rdi
movl $0x1, %esi
jmp 0x14733
movq 0x8(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0x1, %edx
jmp 0x14759
cmpl $0x20, %r14d
je 0x15216
cmpl $0x79, %r14d
jne 0x14761
movq 0x8(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x10a55
movl %eax, %r15d
testl %r15d, %r15d
jne 0x14499
jmp 0x152e3
xorb $0x1, 0xcb7a(%rip)      # 0x212f0
jmp 0x14783
movq 0x59d71(%rip), %rax     # 0x6e4f0
xorb $0x1, 0x14(%rax)
callq 0xf5d5
jmp 0x14761
movl $0x2, 0xcb94(%rip)      # 0x21328
xorl %edi, %edi
callq 0x1093e
callq 0x143d2
movq %rax, 0x18(%rsp)
movq 0x59d24(%rip), %rax     # 0x6e4d0
movl 0x20(%rax), %r14d
movl 0x24(%rax), %r13d
callq 0x1432a
movq %rax, %rbp
callq 0x13a32
movq %rbp, 0x20(%rsp)
testq %rbp, %rbp
je 0x14761
cmpl $0x2, 0xcb56(%rip)      # 0x21328
jne 0x14761
movl %eax, 0x14(%rsp)
movq %r12, %rbp
xorl %edi, %edi
callq 0x1093e
movl %r14d, %edi
movl %r13d, %esi
callq 0xfdc1
movq 0x59cfc(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r14d, %edx
movl %r13d, %ecx
movl $0x2a, %r8d
callq 0x1049f
xorl %edi, %edi
xorl %esi, %esi
movl $0x31, %edx
movl $0x1, %ecx
callq 0x743c
movq (%rbx), %rdi
movl $0x700, %esi            # imm = 0x700
xorl %edx, %edx
callq 0x5150
movq (%rbx), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5280
cmpl $-0x1, %eax
je 0x14852
movq (%rbx), %rdi
leaq 0x5c04(%rip), %rsi      # 0x1a44c
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x50d0
movq (%rbx), %rdi
callq 0x50f0
movl %eax, %r12d
callq 0x5130
movq 0x59c87(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r14d, %edx
movl %r13d, %ecx
callq 0x10804
callq 0x100cd
cmpl $0x101, %r12d           # imm = 0x101
jg 0x148ac
cmpl $0x61, %r12d
jg 0x148eb
leal -0x31(%r12), %eax
cmpl $0x8, %eax
ja 0x14a1d
leaq 0x3a95(%rip), %rcx      # 0x18338
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal -0x102(%r12), %eax
cmpl $0x3, %eax
jbe 0x1496b
leal -0x15c(%r12), %eax
cmpl $0x4, %eax
jbe 0x14946
addl $0xfffffe3e, %r12d      # imm = 0xFFFFFE3E
cmpl $0x6, %r12d
ja 0x14a08
leaq 0x3afe(%rip), %rcx      # 0x183e0
movslq (%rcx,%r12,4), %rax
addq %rcx, %rax
jmpq *%rax
addl $-0x62, %r12d
cmpl $0x17, %r12d
ja 0x14a08
leaq 0x3a5c(%rip), %rcx      # 0x1835c
movslq (%rcx,%r12,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r14d, %edi
movl %r13d, %esi
callq 0x10bad
movl $0x2, 0xca0a(%rip)      # 0x21328
callq 0xf5d5
movq 0x59bc6(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r14d, %edx
movl %r13d, %ecx
movl $0x2a, %r8d
callq 0x1049f
jmp 0x14a08
leaq 0x3a7f(%rip), %rcx      # 0x183cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
decl %r14d
movl 0x59891(%rip), %eax     # 0x6e1f0
addl $-0x18, %eax
cmpl %eax, %r14d
cmovlel %eax, %r14d
jmp 0x149b8
leaq 0x3a4a(%rip), %rcx      # 0x183bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
decl %r14d
movl 0x5986c(%rip), %eax     # 0x6e1f0
addl $-0x18, %eax
cmpl %eax, %r14d
cmovlel %eax, %r14d
jmp 0x14a08
incl %r14d
movl 0x59857(%rip), %eax     # 0x6e1f0
addl $0x18, %eax
cmpl %r14d, %eax
cmovll %eax, %r14d
jmp 0x14a08
incl %r14d
movl 0x59842(%rip), %eax     # 0x6e1f0
addl $0x18, %eax
cmpl %r14d, %eax
cmovll %eax, %r14d
decl %r13d
movl 0x59833(%rip), %eax     # 0x6e1f4
addl $-0x8, %eax
cmpl %eax, %r13d
cmovlel %eax, %r13d
jmp 0x14a08
incl %r14d
movl 0x5981a(%rip), %eax     # 0x6e1f0
addl $0x18, %eax
cmpl %r14d, %eax
cmovll %eax, %r14d
jmp 0x149f5
decl %r14d
movl 0x59805(%rip), %eax     # 0x6e1f0
addl $-0x18, %eax
cmpl %eax, %r14d
cmovlel %eax, %r14d
incl %r13d
movl 0x597f6(%rip), %eax     # 0x6e1f4
addl $0xa, %eax
cmpl %r13d, %eax
cmovll %eax, %r13d
movq %rbp, %r12
cmpl $0x2, 0xc916(%rip)      # 0x21328
je 0x147d8
jmp 0x14761
cmpl $0x9, %r12d
je 0x14acd
cmpl $0x1b, %r12d
jne 0x14a08
movl $0x0, 0xc8f1(%rip)      # 0x21328
xorl %edi, %edi
callq 0x1093e
jmp 0x14a08
movq 0x59aa9(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %r14d, %edx
movl %r13d, %ecx
leaq -0x7179(%rip), %r8      # 0xd8e1
callq 0xfb30
testb %al, %al
movq %rbp, %r12
je 0x14b12
movq 0x20(%rsp), %r15
movq %r15, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0xb9a6
movslq 0x70(%r15), %rax
movq 0xb19c8(%rip), %rcx     # 0xc6450
leaq (%rax,%rax,2), %rax
movslq 0x8c(%r15), %rdx
leaq (%rdx,%rdx,2), %rdi
shlq $0x3, %rdi
addq (%rcx,%rax,8), %rdi
movq %r15, %rsi
callq 0x16158
movq %r15, %rdi
movl 0x14(%rsp), %esi
callq 0x13cd9
movl $0x0, 0xc86b(%rip)      # 0x21328
movb $0x0, 0x98(%r15)
xorl %r15d, %r15d
jmp 0x14a0b
movq 0x59a0c(%rip), %rsi     # 0x6e4e0
movq 0x599fd(%rip), %rcx     # 0x6e4d8
subq %rcx, %rsi
movq %rbp, %r12
je 0x14a0b
sarq $0x3, %rsi
movq 0x18(%rsp), %rax
incl %eax
cltq
xorl %edx, %edx
divq %rsi
movq %rdx, 0x18(%rsp)
movslq %edx, %rax
movq (%rcx,%rax,8), %rax
movl 0x20(%rax), %r14d
movl 0x24(%rax), %r13d
jmp 0x14a0b
movq %r12, 0xe8(%rsp)
leaq 0xe8(%rsp), %rbp
movq %rbp, %rdi
leaq 0x5946(%rip), %rsi      # 0x1a472
leaq 0x595b(%rip), %rdx      # 0x1a48e
callq 0x16274
movq %rbp, %rdi
callq 0x5eae
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0x14b52
callq 0x5230
callq 0x74e9
jmp 0x14a0b
movl $0x1, 0xc7c2(%rip)      # 0x21328
xorl %edi, %edi
callq 0x1093e
callq 0x143d2
movl %eax, %r14d
movq 0x59954(%rip), %rax     # 0x6e4d0
movl 0x20(%rax), %ebp
movl 0x24(%rax), %r13d
cmpl $0x1, 0xc79e(%rip)      # 0x21328
jne 0x151c6
movl %ebp, %edi
movl %r13d, %esi
callq 0xfdc1
movq 0x5994f(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebp, %edx
movl %r13d, %ecx
movl $0x2a, %r8d
callq 0x1049f
movq (%rbx), %rdi
callq 0x50f0
movl %eax, %r12d
callq 0x5130
movq 0x59922(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x10804
callq 0x100cd
cmpl $0x101, %r12d           # imm = 0x101
jg 0x14c18
cmpl $0x61, %r12d
leaq 0xd8(%rsp), %rcx
jg 0x14c5b
leal -0x31(%r12), %eax
cmpl $0x8, %eax
ja 0x14db6
leaq 0x37ed(%rip), %rcx      # 0x183fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal -0x102(%r12), %eax
cmpl $0x3, %eax
jbe 0x14d1a
leal -0x15c(%r12), %eax
cmpl $0x4, %eax
jbe 0x14cf8
addl $0xfffffe3e, %r12d      # imm = 0xFFFFFE3E
cmpl $0x6, %r12d
ja 0x14b83
leaq 0x3852(%rip), %rcx      # 0x184a4
movslq (%rcx,%r12,4), %rax
addq %rcx, %rax
jmpq *%rax
addl $-0x62, %r12d
cmpl $0x17, %r12d
ja 0x14b83
leaq 0x37b0(%rip), %rdx      # 0x18420
movslq (%rdx,%r12,4), %rax
addq %rdx, %rax
jmpq *%rax
movslq 0xc674(%rip), %rax      # 0x212f4
leaq 0x59571(%rip), %rdx     # 0x6e1f8
cmpl $0x0, (%rdx,%rax,4)
leaq 0xb8(%rsp), %rdx
je 0x14e5a
movq 0x59850(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
cmpl %edi, %ebp
jne 0x14e33
cmpl 0x24(%rax), %r13d
jne 0x14e33
movq %r14, %r12
movq %rdx, 0xa8(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0x5852(%rip), %rsi      # 0x1a521
movq %rdx, %r14
leaq 0x585d(%rip), %rdx      # 0x1a536
callq 0x16274
leaq 0xa8(%rsp), %rdi
callq 0x5eae
movq 0xa8(%rsp), %rdi
jmp 0x14e98
leaq 0x3791(%rip), %rcx      # 0x18490
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
decl %ebp
movl 0x594e0(%rip), %eax     # 0x6e1f0
addl $-0x18, %eax
cmpl %eax, %ebp
cmovlel %eax, %ebp
jmp 0x14d76
leaq 0x375f(%rip), %rcx      # 0x18480
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
decl %ebp
movl 0x594be(%rip), %eax     # 0x6e1f0
addl $-0x18, %eax
cmpl %eax, %ebp
cmovlel %eax, %ebp
jmp 0x14b83
incl %ebp
movl 0x594a9(%rip), %eax     # 0x6e1f0
addl $0x18, %eax
cmpl %ebp, %eax
cmovll %eax, %ebp
jmp 0x14b83
incl %ebp
movl 0x59494(%rip), %eax     # 0x6e1f0
addl $0x18, %eax
cmpl %ebp, %eax
cmovll %eax, %ebp
jmp 0x14d9e
incl %ebp
movl 0x59482(%rip), %eax     # 0x6e1f0
addl $0x18, %eax
cmpl %ebp, %eax
cmovll %eax, %ebp
decl %r13d
movl 0x59475(%rip), %eax     # 0x6e1f4
addl $-0x8, %eax
cmpl %eax, %r13d
cmovlel %eax, %r13d
jmp 0x14b83
decl %ebp
movl 0x5945a(%rip), %eax     # 0x6e1f0
addl $-0x18, %eax
cmpl %eax, %ebp
cmovlel %eax, %ebp
incl %r13d
movl 0x5944d(%rip), %eax     # 0x6e1f4
addl $0xa, %eax
cmpl %r13d, %eax
cmovll %eax, %r13d
jmp 0x14b83
cmpl $0x9, %r12d
je 0x14e17
cmpl $0x1b, %r12d
jne 0x14b83
movl $0x0, 0xc558(%rip)      # 0x21328
xorl %edi, %edi
callq 0x1093e
jmp 0x14b83
movl %ebp, %edi
movl %r13d, %esi
callq 0x10bad
movl $0x1, 0xc538(%rip)      # 0x21328
callq 0xf5d5
movq 0x596f4(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebp, %edx
movl %r13d, %ecx
movl $0x2a, %r8d
callq 0x1049f
jmp 0x14b83
movq 0x596c2(%rip), %rsi     # 0x6e4e0
movq 0x596b3(%rip), %rcx     # 0x6e4d8
subq %rcx, %rsi
jne 0x14eaf
jmp 0x14b83
movl 0x24(%rax), %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x11a18
testb %al, %al
je 0x14b83
movl $0x0, 0xc4d6(%rip)      # 0x21328
xorl %r15d, %r15d
jmp 0x14b83
movq %r14, %r12
movq %rcx, 0xc8(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0x568c(%rip), %rsi      # 0x1a500
leaq 0x56a5(%rip), %rdx      # 0x1a520
movq %rcx, %r14
callq 0x16274
leaq 0xc8(%rsp), %rdi
callq 0x5eae
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
movq %r12, %r14
je 0x14ea5
callq 0x5230
callq 0x74e9
jmp 0x14b83
sarq $0x3, %rsi
incl %r14d
movslq %r14d, %rax
xorl %edx, %edx
divq %rsi
movq %rdx, %r14
movslq %r14d, %rax
movq (%rcx,%rax,8), %rax
jmp 0x14b7c
movq 0xb157c(%rip), %rax     # 0xc6450
movq 0x78(%rax), %rcx
xorl %eax, %eax
movl $0x8, %edx
movq (%rcx,%rdx), %rsi
subq -0x8(%rcx,%rdx), %rsi
shrq $0x3, %rsi
addl %esi, %eax
addq $0x18, %rdx
cmpq $0x50, %rdx
jne 0x14edf
testl %eax, %eax
leaq 0x198(%rsp), %r14
jle 0x14761
movq %r14, 0x188(%rsp)
leaq 0x188(%rsp), %r13
movq %r13, %rdi
leaq 0x54b3(%rip), %rsi      # 0x1a3d5
leaq 0x54ef(%rip), %rdx      # 0x1a418
callq 0x16274
movq %r13, %rdi
callq 0x5eae
movq 0x188(%rsp), %rdi
cmpq %r14, %rdi
je 0x15248
callq 0x5230
jmp 0x15248
cmpl $0x0, 0xc39c(%rip)      # 0x212f4
je 0x14761
leaq 0x218(%rsp), %r14
movq %r14, 0x208(%rsp)
leaq 0x208(%rsp), %r15
movq %r15, %rdi
leaq 0x53fe(%rip), %rsi      # 0x1a37e
leaq 0x540d(%rip), %rdx      # 0x1a394
callq 0x16274
movq %r15, %rdi
callq 0x5eae
movq 0x208(%rsp), %rdi
cmpq %r14, %rdi
je 0x14fa6
callq 0x5230
movl $0x0, 0xc344(%rip)      # 0x212f4
jmp 0x15159
movq 0x59534(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %esi
movl 0x24(%rax), %edx
leaq 0x1a8(%rsp), %r14
movq %r14, %rdi
callq 0x12c21
movq %r14, %rdi
callq 0x5eae
movq 0x1a8(%rsp), %rdi
xorl %r15d, %r15d
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
jne 0x152d9
jmp 0x14761
cmpl $0x2, 0xc2f2(%rip)      # 0x212f4
je 0x14761
leaq 0x1d8(%rsp), %r14
movq %r14, 0x1c8(%rsp)
leaq 0x1c8(%rsp), %r15
movq %r15, %rdi
leaq 0x538b(%rip), %rsi      # 0x1a3b5
leaq 0x53a3(%rip), %rdx      # 0x1a3d4
callq 0x16274
movq %r15, %rdi
callq 0x5eae
movq 0x1c8(%rsp), %rdi
cmpq %r14, %rdi
je 0x15050
callq 0x5230
movl $0x2, 0xc29a(%rip)      # 0x212f4
jmp 0x15159
callq 0xca08
testb %al, %al
je 0x15252
movslq 0x59199(%rip), %rax     # 0x6e20c
imulq $0x258, %rax, %rax      # imm = 0x258
leaq 0xc2cf(%rip), %rcx      # 0x21350
addq %rcx, %rax
movslq 0x59185(%rip), %rcx     # 0x6e210
cmpl $0x5, 0x4b0(%rax,%rcx,4)
jne 0x15292
leaq (%rax,%rcx,4), %rax
addq $0x4b0, %rax            # imm = 0x4B0
movl $0xa, (%rax)
leaq 0x158(%rsp), %r14
movq %r14, 0x148(%rsp)
leaq 0x148(%rsp), %r15
movq %r15, %rdi
leaq 0x53c4(%rip), %rsi      # 0x1a48f
leaq 0x53e6(%rip), %rdx      # 0x1a4b8
callq 0x16274
movq %r15, %rdi
callq 0x5eae
movq 0x148(%rsp), %rdi
cmpq %r14, %rdi
je 0x150f1
callq 0x5230
movb $0x1, 0xc23e(%rip)      # 0x21336
jmp 0x15159
cmpl $0x1, 0xc1f3(%rip)      # 0x212f4
je 0x14761
leaq 0x1f8(%rsp), %r14
movq %r14, 0x1e8(%rsp)
leaq 0x1e8(%rsp), %r15
movq %r15, %rdi
leaq 0x526c(%rip), %rsi      # 0x1a395
leaq 0x5284(%rip), %rdx      # 0x1a3b4
callq 0x16274
movq %r15, %rdi
callq 0x5eae
movq 0x1e8(%rsp), %rdi
cmpq %r14, %rdi
je 0x1514f
callq 0x5230
movl $0x1, 0xc19b(%rip)      # 0x212f4
xorl %r15d, %r15d
jmp 0x14761
leaq 0x178(%rsp), %r14
movq %r14, 0x168(%rsp)
leaq 0x168(%rsp), %r13
movq %r13, %rdi
leaq 0x5296(%rip), %rsi      # 0x1a419
leaq 0x52c1(%rip), %rdx      # 0x1a44b
callq 0x16274
movq %r13, %rdi
callq 0x68a8
movq 0x168(%rsp), %rdi
cmpq %r14, %rdi
je 0x151a9
callq 0x5230
movq (%rbx), %rdi
callq 0x50f0
movl %eax, %ebp
callq 0x5130
cmpl $0x59, %ebp
jne 0x14761
jmp 0x152f5
movslq %ebp, %rax
movslq %r13d, %rcx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq 0x59326(%rip), %rdx     # 0x6e500
addq %rdx, %rax
movq (%rax,%rcx,8), %rax
testq %rax, %rax
je 0x151ed
movq %rax, 0x592e3(%rip)     # 0x6e4d0
movq 0x592fc(%rip), %rax     # 0x6e4f0
movl 0x20(%rax), %edi
movl 0x24(%rax), %esi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x10804
callq 0x100cd
leaq 0xf8(%rsp), %r12
jmp 0x14761
movq 0x59033(%rip), %rax     # 0x6e250
subq 0x59024(%rip), %rax     # 0x6e248
shrq $0x5, %rax
movq 0x59039(%rip), %rcx     # 0x6e268
subq 0x5902a(%rip), %rcx     # 0x6e260
movl %eax, 0x5903c(%rip)     # 0x6e278
shrq $0x5, %rcx
decl %ecx
movl %ecx, 0x59034(%rip)     # 0x6e27c
callq 0x74e9
jmp 0x14761
leaq 0x118(%rsp), %r14
movq %r14, 0x108(%rsp)
leaq 0x108(%rsp), %r13
movq %r13, %rdi
leaq 0x526b(%rip), %rsi      # 0x1a4df
leaq 0x5284(%rip), %rdx      # 0x1a4ff
callq 0x16274
movq %r13, %rdi
callq 0x5eae
movq 0x108(%rsp), %rdi
jmp 0x152d0
leaq 0x138(%rsp), %r14
movq %r14, 0x128(%rsp)
leaq 0x128(%rsp), %r13
movq %r13, %rdi
leaq 0x5205(%rip), %rsi      # 0x1a4b9
leaq 0x5223(%rip), %rdx      # 0x1a4de
callq 0x16274
movq %r13, %rdi
callq 0x5eae
movq 0x128(%rsp), %rdi
cmpq %r14, %rdi
je 0x14761
callq 0x5230
jmp 0x14761
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x52d0
xorl %edi, %edi
callq 0x52f0
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x153ec
jmp 0x153f1
movq %rax, %rbx
movq 0x148(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x128(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x108(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x1e8(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x1c8(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x208(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x188(%rsp), %rdi
jmp 0x1539d
movq %rax, %rbx
movq 0x168(%rsp), %rdi
cmpq %r14, %rdi
jne 0x153ec
jmp 0x153f1
movq %rax, %rbx
movq 0x1a8(%rsp), %rdi
leaq 0x1b8(%rsp), %rax
cmpq %rax, %rdi
jne 0x153ec
jmp 0x153f1
movq %rax, %rbx
movq 0x68(%rsp), %rdi
jmp 0x153e7
movq %rax, %rbx
movq 0x48(%rsp), %rdi
jmp 0x153e7
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x153e7
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x153f1
callq 0x5230
movq %rbx, %rdi
callq 0x53d0