// File: /workspace/github_cpp_makefile_star2_O1/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: play_turn()
int play_turn()
{
		if(turn_count%100 == 50)
		{
			current_advice = rand()%vadvice.size();
		}
		for(std::vector<actor*>::iterator a = actors.begin(); a != actors.end(); ++a)
		{
			actor* act = (*a);
			if (act->sspecies->name == "human" && !act->is_player && !act->is_hologram)
			{
				map_human_scent[act->x][(*a)->y] += 0.7f; //non-player humans get an easier time >:)
			}
			if(!act->dead)
			{
				act->energy += act->sspecies->walk_energy;
				if(act->running)
				{
					if(act == p_ptr) ran = true;
					int stamina_consumed = (act->stamina * (act->sspecies->run_energy - act->sspecies->walk_energy))/act->sspecies->stamina;
					act->energy += std::min(stamina_consumed,act->stamina);
					act->stamina -=  std::min(stamina_consumed,act->stamina);
					if (stamina_consumed == 0)
					{
						if(act->is_player)
						{
							add_message("You are too exhausted to continue running.");
						}
						act->running = false;
					}
				}
				else if(act->energy > 100)
				{
					act->stamina += act->sspecies->stamina/70;
					act->stamina = std::min(act->stamina,act->sspecies->stamina);
				}
				if (act->is_player)
				{
					if(act->energy > 100)
					{
						if(win_condition())
						{
							win();
							
						}
						if(door_closable() && !door_closable_told)
						{
							add_message("Press 'C' to tell the computer to close the door (you can't take off with aliens in the ship, though).");
							door_closable_told = true;
						}
						act->energy -= 100;
						player_turn(act);
						check_achievements();

						act->most_noticeable_sound = 0.0;
						sound_this_turn = "";
						dir_this_turn = "";
						act->sound_threshold = std::max(act->sound_threshold-act->sspecies->hearing_adapt,act->sspecies->hearing_thres);

						visible_actors.clear();
					}
					if(!debug && !(turn_count %5))
					{
						map_human_scent[act->x][act->y] += 1000.0;
						diffuse_scent_human();
					}
					for(std::vector<item*>::iterator dev = timer_devices.begin(); dev != timer_devices.end();)
					{
						if((*dev)->time_remaining > 0)
						{
							(*dev)->time_remaining -= 1;
							++dev;
							//next_timer_devices.push_back(*dev);
						}
						else
						{
							if((*dev)->device_type == LOW_EXPLOSIVE || (*dev)->device_type == HIGH_EXPLOSIVE)
							{
								explode_this_turn.push_back(*dev);
							}
							else
							{
								active_devices.push_back(*dev);
								(*dev)->current_action = (*dev)->next_action;
							}
							dev = timer_devices.erase(dev);
						}
					}
					for(std::vector<item*>::iterator dev = active_devices.begin(); dev != active_devices.end(); ++dev)
					{
						if((*dev)->device_type == SCENT_GENERATOR)
						{
							map_human_scent[(*dev)->x][(*dev)->y] += ((*dev)->power_remaining*1200)/100;
							if(rand()%7 < 2) (*dev)->power_remaining -= 1;
							(*dev)->power_remaining = std::max(0,(*dev)->power_remaining);
						}
						else if((*dev)->device_type == HOLOGRAM_PROJECTOR)
						{
							actor* pr = (*dev)->projection;
							if(pr->x != -500)
							{
								map_occupants[pr->x][pr->y] = NULL;
							}
							int x = rand()%9;
							int y = rand()%9;
							while(terrain_immovable(pr,(*dev)->x+x-4,(*dev)->y+y-4))
							{
								x = rand()%9;
								y = rand()%9;
							}
							map_occupants[(*dev)->x+x-4][(*dev)->y+y-4] = pr;
							pr->x = (*dev)->x+x-4;
							pr->y = (*dev)->y+y-4;
							

						}
						else if((*dev)->device_type == NOISE_GENERATOR)
						{
							if((*dev)->current_action == HUMAN_STIMULUS)
							{
							make_noise((*dev)->x,(*dev)->y,&fake_human_noise[rand()%2]);
							}
							else if((*dev)->current_action == LOUD_STIMULUS)
							{
								make_noise((*dev)->x,(*dev)->y,&generator_loud[rand()%2]);
							}
						}
						else if((*dev)->device_type == BRAIN_SLICE)
						{
							(*dev)->current_action = HUMAN_STIMULUS;
						}
					}
					for(std::vector<item*>::iterator dev = explode_this_turn.begin(); dev != explode_this_turn.end(); ++dev)
					{
						set_unconfigured(*dev);
						//remove(timer_devices.begin(),timer_devices.end(),*dev);
						activate_device(*dev);
					}
					explode_this_turn.erase(explode_this_turn.begin(),explode_this_turn.end());
					for(std::vector<explosion>::iterator ex = explosions_this_turn.begin(); ex != explosions_this_turn.end(); ex++)
					{
						do_explosion(*ex);
					}
					explosions_this_turn.erase(explosions_this_turn.begin(),explosions_this_turn.end());
				}
				else if (act->is_hologram)
				{
					if(act->energy > 100)
					{
						act->energy -= 100;
						if(on_map(act->x,act->y))
							hologram_turn(act);
					}
				}
				else
				{
					if(act->energy > 100)
					{
						act->energy -= 100;
						if(!debug)
						{
						ai_turn(act);
						}
						act->most_noticeable_sound = 0.0;
						act->sound_threshold = std::max(act->sound_threshold-act->sspecies->hearing_adapt,act->sspecies->hearing_thres);
					}
				}
			}
		}
		if(rand()%4000+150+turn_count >4000 && rand()%(45-6*(difficulty-5)) == 0)
		{
			std::pair<int,int> loc = random_occupiable_square_away_from_player();

			add_actor(zoo[rand()%ZOO_SIZE+1],false,loc.first,loc.second);
		}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movslq 0xbdf7(%rip), %rax      # 0x21324
imulq $0x51eb851f, %rax, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x64, %ecx, %ecx
subl %ecx, %eax
cmpl $0x32, %eax
jne 0x1556f
callq 0x5070
cltq
movq 0xbde7(%rip), %rcx      # 0x21340
subq 0xbdd8(%rip), %rcx      # 0x21338
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
movl %edx, 0xbdbd(%rip)      # 0x2132c
movq 0xb0e7a(%rip), %r15     # 0xc63f0
cmpq 0xb0e7b(%rip), %r15     # 0xc63f8
je 0x15c46
leaq 0x38(%rsp), %r14
leaq 0x18(%rsp), %r12
leaq 0x2f40(%rip), %r13      # 0x184d4
movq (%r15), %rbp
movq (%rbp), %rdi
movl $0xf0, %eax
addq %rax, %rdi
leaq 0x3199(%rip), %rsi      # 0x18743
callq 0x5090
testl %eax, %eax
jne 0x155ed
cmpb $0x0, 0x8(%rbp)
jne 0x155ed
cmpb $0x0, 0x9(%rbp)
jne 0x155ed
movslq 0x20(%rbp), %rax
movq (%r15), %rcx
movslq 0x24(%rcx), %rcx
imulq $0x258, %rax, %rax      # imm = 0x258
leaq 0x21d08(%rip), %rdx     # 0x372e0
addq %rdx, %rax
movss (%rax,%rcx,4), %xmm0
addss 0x2a54(%rip), %xmm0     # 0x1803c
movss %xmm0, (%rax,%rcx,4)
cmpb $0x0, 0x1c(%rbp)
je 0x15605
addq $0x8, %r15
cmpq 0xb0dfa(%rip), %r15     # 0xc63f8
jne 0x15594
jmp 0x15c46
movq (%rbp), %rcx
movl 0x2c(%rcx), %edx
movl 0x10(%rbp), %esi
addl %edx, %esi
movl %esi, 0x10(%rbp)
cmpb $0x1, 0x14(%rbp)
jne 0x15691
cmpq 0x58ecf(%rip), %rbp     # 0x6e4f0
jne 0x1562a
movb $0x1, 0xbd08(%rip)      # 0x21332
movl 0x18(%rbp), %edi
movl 0x30(%rcx), %eax
subl %edx, %eax
imull %edi, %eax
cltd
idivl 0x34(%rcx)
cmpl %eax, %edi
movl %eax, %ecx
cmovll %edi, %ecx
addl %ecx, %esi
movl %esi, 0x10(%rbp)
subl %ecx, %edi
movl %edi, 0x18(%rbp)
testl %eax, %eax
jne 0x156c2
cmpb $0x1, 0x8(%rbp)
jne 0x1568b
movq %r14, 0x28(%rsp)
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
leaq 0x4ecf(%rip), %rsi      # 0x1a537
leaq 0x4ef2(%rip), %rdx      # 0x1a561
callq 0x16274
movq %rbx, %rdi
callq 0x5eae
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x1568b
callq 0x5230
movb $0x0, 0x14(%rbp)
jmp 0x156c2
cmpl $0x65, %esi
jl 0x156c2
movslq 0x34(%rcx), %rax
imulq $-0x15f15f15, %rax, %rdx # imm = 0xEA0EA0EB
shrq $0x20, %rdx
addl %eax, %edx
movl %edx, %eax
shrl $0x1f, %eax
sarl $0x6, %edx
addl %eax, %edx
addl 0x18(%rbp), %edx
movl %edx, 0x18(%rbp)
movl 0x34(%rcx), %eax
cmpl %edx, %eax
cmovll %eax, %edx
movl %edx, 0x18(%rbp)
cmpb $0x1, 0x8(%rbp)
jne 0x158d3
cmpl $0x65, 0x10(%rbp)
jl 0x157bb
callq 0xca42
testb %al, %al
jne 0x15d02
callq 0xca08
testb %al, %al
je 0x15733
cmpb $0x0, 0xbc2e(%rip)      # 0x21321
jne 0x15733
movq %r12, 0x8(%rsp)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x4e59(%rip), %rsi      # 0x1a562
leaq 0x4eb8(%rip), %rdx      # 0x1a5c8
callq 0x16274
movq %rbx, %rdi
callq 0x5eae
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1572c
callq 0x5230
movb $0x1, 0xbbee(%rip)      # 0x21321
addl $-0x64, 0x10(%rbp)
movq %rbp, %rdi
callq 0x14469
callq 0xc9a6
movl $0x0, 0x40(%rbp)
movq 0xb0d1e(%rip), %rdx     # 0xc6470
leaq 0xb0d0f(%rip), %rdi     # 0xc6468
xorl %esi, %esi
leaq 0x4991(%rip), %rbx      # 0x1a0f3
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x5380
movq 0xb0d1c(%rip), %rdx     # 0xc6490
leaq 0xb0d0d(%rip), %rdi     # 0xc6488
xorl %esi, %esi
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x5380
movss 0x3c(%rbp), %xmm0
movq (%rbp), %rax
subss 0x1c(%rax), %xmm0
movss 0x18(%rax), %xmm1
maxss %xmm0, %xmm1
movss %xmm1, 0x3c(%rbp)
movq 0x58d2d(%rip), %rax     # 0x6e4d8
cmpq %rax, 0x58d2e(%rip)     # 0x6e4e0
je 0x157bb
movq %rax, 0x58d25(%rip)     # 0x6e4e0
cmpb $0x0, 0xbb60(%rip)      # 0x21322
jne 0x1580a
imull $0xcccccccd, 0xbb56(%rip), %eax # imm = 0xCCCCCCCD
addl $0x19999999, %eax       # imm = 0x19999999
cmpl $0x33333332, %eax       # imm = 0x33333332
ja 0x1580a
movslq 0x20(%rbp), %rax
movslq 0x24(%rbp), %rcx
imulq $0x258, %rax, %rax      # imm = 0x258
leaq 0x21af0(%rip), %rdx     # 0x372e0
addq %rdx, %rax
movss (%rax,%rcx,4), %xmm0
addss 0x28a0(%rip), %xmm0     # 0x180a0
movss %xmm0, (%rax,%rcx,4)
callq 0x153f9
movq %r15, (%rsp)
movq 0x84c83(%rip), %rbp     # 0x9a498
cmpq 0x84c84(%rip), %rbp     # 0x9a4a0
je 0x158f4
movq (%rbp), %rax
movl 0x7c(%rax), %ecx
testl %ecx, %ecx
jle 0x15838
decl %ecx
movl %ecx, 0x7c(%rax)
addq $0x8, %rbp
jmp 0x15815
cmpl $0x1, 0x70(%rax)
ja 0x1585b
movq 0x84bfb(%rip), %rsi     # 0x9a440
cmpq 0x84bfc(%rip), %rsi     # 0x9a448
je 0x15878
movq %rax, (%rsi)
addq $0x8, 0x84be7(%rip)     # 0x9a440
jmp 0x158a8
movq 0x84bf6(%rip), %rsi     # 0x9a458
cmpq 0x84bf7(%rip), %rsi     # 0x9a460
je 0x15889
movq %rax, (%rsi)
addq $0x8, 0x84be2(%rip)     # 0x9a458
jmp 0x15898
leaq 0x84bb9(%rip), %rdi     # 0x9a438
movq %rbp, %rdx
callq 0x16d04
jmp 0x158a8
leaq 0x84bc0(%rip), %rdi     # 0x9a450
movq %rbp, %rdx
callq 0x16d04
movq (%rbp), %rax
movl 0x88(%rax), %ecx
movl %ecx, 0x84(%rax)
movq %rbp, %rsi
addq $0x8, %rsi
movq 0x84bea(%rip), %rdx     # 0x9a4a0
cmpq %rdx, %rsi
je 0x158c6
subq %rsi, %rdx
movq %rbp, %rdi
callq 0x53b0
addq $-0x8, 0x84bd2(%rip)    # 0x9a4a0
jmp 0x15815
movl 0x10(%rbp), %eax
cmpb $0x1, 0x9(%rbp)
jne 0x15bfe
cmpl $0x65, %eax
jl 0x155f3
addl $-0x64, %eax
movl %eax, 0x10(%rbp)
jmp 0x155f3
movq 0x84b55(%rip), %r12     # 0x9a450
cmpq 0x84b56(%rip), %r12     # 0x9a458
je 0x15b27
movq (%r12), %rax
movl 0x70(%rax), %ecx
addl $-0x2, %ecx
cmpl $0x3, %ecx
ja 0x15b1e
movslq (%r13,%rcx,4), %rcx
addq %r13, %rcx
jmpq *%rcx
movq (%rax), %rbp
movslq 0x20(%rbp), %rax
cmpq $-0x1f4, %rax           # imm = 0xFE0C
je 0x15951
movslq 0x24(%rbp), %rcx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq 0x58bba(%rip), %rdx     # 0x6e500
addq %rdx, %rax
movq $0x0, (%rax,%rcx,8)
callq 0x5070
movl %eax, %r14d
callq 0x5070
movslq %r14d, %rbx
imulq $0x38e38e39, %rbx, %rcx # imm = 0x38E38E39
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,8), %ecx
subl %ecx, %ebx
movslq %eax, %r13
imulq $0x38e38e39, %r13, %rax # imm = 0x38E38E39
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x21, %rax
addl %ecx, %eax
leal (%rax,%rax,8), %eax
subl %eax, %r13d
movq (%r12), %rax
movl 0x90(%rax), %ecx
movl 0x94(%rax), %eax
leal (%rcx,%rbx), %r15d
addl $-0x4, %r15d
leal -0x4(%rax,%r13), %r14d
movq %rbp, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0xb382
testb %al, %al
jne 0x15951
movslq %r15d, %rax
movslq %r14d, %rcx
imulq $0x4b0, %rax, %rax      # imm = 0x4B0
leaq 0x58b26(%rip), %rdx     # 0x6e500
addq %rdx, %rax
movq %rbp, (%rax,%rcx,8)
movq (%r12), %rax
movl 0x90(%rax), %ecx
addl %ebx, %ecx
addl $-0x4, %ecx
movl %ecx, 0x20(%rbp)
movl 0x94(%rax), %eax
addl %r13d, %eax
addl $-0x4, %eax
movl %eax, 0x24(%rbp)
leaq 0x2acb(%rip), %r13      # 0x184d4
jmp 0x15b1e
movl 0x78(%rax), %ecx
shll $0x2, %ecx
leal (%rcx,%rcx,2), %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movslq 0x90(%rax), %rcx
movslq 0x94(%rax), %rax
imulq $0x258, %rcx, %rcx      # imm = 0x258
leaq 0x218a6(%rip), %rdx     # 0x372e0
addq %rdx, %rcx
addss (%rcx,%rax,4), %xmm0
movss %xmm0, (%rcx,%rax,4)
callq 0x5070
cltq
imulq $-0x6db6db6d, %rax, %rcx # imm = 0x92492493
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x2, %ecx
addl %edx, %ecx
leal (,%rcx,8), %edx
subl %edx, %ecx
addl %eax, %ecx
cmpl $0x1, %ecx
jg 0x15a7c
movq (%r12), %rax
decl 0x78(%rax)
movq (%r12), %rax
movl 0x78(%rax), %ecx
testl %ecx, %ecx
movl $0x0, %edx
cmovlel %edx, %ecx
movl %ecx, 0x78(%rax)
jmp 0x15b1e
movl $0x1, 0x84(%rax)
jmp 0x15b1e
movl 0x84(%rax), %ecx
cmpl $0x2, %ecx
je 0x15ae2
cmpl $0x1, %ecx
jne 0x15b1e
movl 0x90(%rax), %ebp
movl 0x94(%rax), %r14d
callq 0x5070
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
subl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
leaq 0x58860(%rip), %rax     # 0x6e340
jmp 0x15b11
movl 0x90(%rax), %ebp
movl 0x94(%rax), %r14d
callq 0x5070
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
subl %ecx, %eax
cltq
leaq (%rax,%rax,2), %rdx
shlq $0x4, %rdx
leaq 0x5888f(%rip), %rax     # 0x6e3a0
addq %rax, %rdx
movl %ebp, %edi
movl %r14d, %esi
callq 0xb650
addq $0x8, %r12
jmp 0x158fb
movq 0x8490a(%rip), %rbx     # 0x9a438
movq 0x8490b(%rip), %rax     # 0x9a440
cmpq %rax, %rbx
leaq 0x38(%rsp), %r14
movq (%rsp), %r15
leaq 0x18(%rsp), %r12
je 0x15b7c
movq (%rbx), %rdi
callq 0x13c16
movq (%rbx), %rdi
movl 0x70(%rdi), %eax
movl 0x88(%rdi), %ecx
movl %ecx, 0x84(%rdi)
cmpl $0x1, %eax
ja 0x15b6c
callq 0xdf46
addq $0x8, %rbx
movq 0x848c9(%rip), %rax     # 0x9a440
cmpq %rax, %rbx
jne 0x15b48
movq 0x848b5(%rip), %rcx     # 0x9a438
cmpq %rax, %rcx
je 0x15ba4
movq 0x848b1(%rip), %rdx     # 0x9a440
movq %rdx, %rsi
subq %rax, %rsi
addq %rsi, %rcx
cmpq %rcx, %rdx
je 0x15ba4
movq %rcx, 0x8489c(%rip)     # 0x9a440
movq 0x84875(%rip), %rbx     # 0x9a420
movq 0x84876(%rip), %rax     # 0x9a428
cmpq %rax, %rbx
je 0x15bc9
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x1159e
addq $0x10, %rbx
jmp 0x15bab
movq 0x84850(%rip), %rcx     # 0x9a420
cmpq %rax, %rcx
je 0x155f3
movq 0x84848(%rip), %rdx     # 0x9a428
movq %rdx, %rsi
subq %rax, %rsi
addq %rsi, %rcx
cmpq %rcx, %rdx
je 0x155f3
movq %rcx, 0x8482f(%rip)     # 0x9a428
jmp 0x155f3
cmpl $0x65, %eax
jl 0x155f3
addl $-0x64, %eax
movl %eax, 0x10(%rbp)
cmpb $0x0, 0xb70e(%rip)      # 0x21322
jne 0x15c1e
movq %rbp, %rdi
callq 0x12404
movl $0x0, 0x40(%rbp)
movss 0x3c(%rbp), %xmm0
movq (%rbp), %rax
subss 0x1c(%rax), %xmm0
movss 0x18(%rax), %xmm1
maxss %xmm0, %xmm1
movss %xmm1, 0x3c(%rbp)
jmp 0x155f3
callq 0x5070
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x28, %rcx
addl %edx, %ecx
imull $0xfa0, %ecx, %ecx      # imm = 0xFA0
subl %ecx, %eax
movl 0xb6b5(%rip), %ecx      # 0x21324
addl %ecx, %eax
addl $0x96, %eax
cmpl $0xfa0, %eax            # imm = 0xFA0
jle 0x15cf1
callq 0x5070
movl 0xb694(%rip), %ecx      # 0x2131c
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
movl $0x4b, %esi
subl %ecx, %esi
cltd
idivl %esi
testl %edx, %edx
jne 0x15cf1
callq 0xb3f2
movq %rax, %rbx
movq %rax, %r14
shrq $0x20, %r14
callq 0x5070
cltq
imulq $-0x6db6db6d, %rax, %rcx # imm = 0x92492493
shrq $0x20, %rcx
addl %eax, %ecx
movl %ecx, %edx
shrl $0x1f, %edx
sarl $0x2, %ecx
addl %edx, %ecx
leal (,%rcx,8), %edx
subl %edx, %ecx
addl %eax, %ecx
movq 0x58726(%rip), %rax     # 0x6e400
movslq %ecx, %rcx
movq 0x8(%rax,%rcx,8), %rdi
xorl %esi, %esi
movl %ebx, %edx
movl %r14d, %ecx
xorl %r8d, %r8d
callq 0xbc6a
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11458
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
jne 0x15d23
jmp 0x15d28
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x15d28
callq 0x5230
movq %rbx, %rdi
callq 0x53d0