// File: essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: move_actor(actor*, int, int)
int move_actor(actor* a, int dx, int dy)
{

	if (dx==0 && dy==0)
		return 1;
	int ox = a->x; int oy = a->y;
	int x = ox+dx; int y = oy+dy;
	if(!on_map(x,y)) return 1;
	if (terrain_immovable(a,x,y))
	{

		return 1;
	}
	if(a->is_player)
	{
		for(unsigned int i=0;i<devices.size();i++)
		{
			if(devices[i]->player_has)
			{
				devices[i]->x = p_ptr->x; devices[i]->y = p_ptr->y;
			}
		}
	}
	map_occupants[ox][oy] = NULL;
	map_occupants[x][y] = a;
	if(a->ai_x == a->x && a->ai_y == a->y)
	{
		a->ai_x = x; a->ai_y = y;
	}
	a->x = x; a->y = y;
	if(a->running)
	{
		make_noise(x,y,&run_noise[a->sspecies->id][map_terrain[x][y]]);
	}
	else
	{
		make_noise(x,y,&walk_noise[a->sspecies->id][map_terrain[x][y]]);
	}
	return 0;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl %edx, 0x40(%rsp)
cmpl $0x0, 0x44(%rsp)
jne 0x1787c
cmpl $0x0, 0x40(%rsp)
jne 0x1787c
movl $0x1, 0x54(%rsp)
jmp 0x17b24
movq 0x48(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x3c(%rsp)
movq 0x48(%rsp), %rax
movl 0x24(%rax), %eax
movl %eax, 0x38(%rsp)
movl 0x3c(%rsp), %eax
addl 0x44(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x38(%rsp), %eax
addl 0x40(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x34(%rsp), %edi
movl 0x30(%rsp), %esi
callq 0x20770
testb $0x1, %al
jne 0x178ca
movl $0x1, 0x54(%rsp)
jmp 0x17b24
movq 0x48(%rsp), %rdi
movl 0x34(%rsp), %esi
movl 0x30(%rsp), %edx
callq 0xef90
testb $0x1, %al
jne 0x178e2
jmp 0x178ef
movl $0x1, 0x54(%rsp)
jmp 0x17b24
movq 0x48(%rsp), %rax
testb $0x1, 0x8(%rax)
je 0x179b8
movl $0x0, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq %rax, 0x20(%rsp)
leaq 0xc8b82(%rip), %rdi     # 0xe0498
callq 0x20b10
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jae 0x179b6
movl 0x2c(%rsp), %eax
movl %eax, %esi
leaq 0xc8b5f(%rip), %rdi     # 0xe0498
callq 0x21440
movq (%rax), %rax
testb $0x1, 0x98(%rax)
je 0x179a4
movq 0x70bff(%rip), %rax     # 0x88550
movl 0x20(%rax), %eax
movl %eax, 0x18(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, %esi
leaq 0xc8b33(%rip), %rdi     # 0xe0498
callq 0x21440
movl 0x18(%rsp), %ecx
movq (%rax), %rax
movl %ecx, 0x90(%rax)
movq 0x70bd2(%rip), %rax     # 0x88550
movl 0x24(%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x2c(%rsp), %eax
movl %eax, %esi
leaq 0xc8b06(%rip), %rdi     # 0xe0498
callq 0x21440
movl 0x1c(%rsp), %ecx
movq (%rax), %rax
movl %ecx, 0x94(%rax)
jmp 0x179a6
movl 0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
jmp 0x17906
jmp 0x179b8
movslq 0x3c(%rsp), %rcx
leaq 0x70b9c(%rip), %rax     # 0x88560
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq 0x38(%rsp), %rcx
movq $0x0, (%rax,%rcx,8)
movq 0x48(%rsp), %rdx
movslq 0x34(%rsp), %rcx
leaq 0x70b74(%rip), %rax     # 0x88560
imulq $0x4b0, %rcx, %rcx      # imm = 0x4B0
addq %rcx, %rax
movslq 0x30(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x48(%rsp), %rax
movl 0x28(%rax), %eax
movq 0x48(%rsp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x17a3b
movq 0x48(%rsp), %rax
movl 0x2c(%rax), %eax
movq 0x48(%rsp), %rcx
cmpl 0x24(%rcx), %eax
jne 0x17a3b
movl 0x34(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x28(%rax)
movl 0x30(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x2c(%rax)
movl 0x34(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x20(%rax)
movl 0x30(%rsp), %ecx
movq 0x48(%rsp), %rax
movl %ecx, 0x24(%rax)
movq 0x48(%rsp), %rax
testb $0x1, 0x14(%rax)
je 0x17abe
movl 0x34(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0x14(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movslq (%rax), %rsi
leaq 0x70908(%rip), %rdi     # 0x88388
callq 0x205d0
movq %rax, %rdi
movslq 0x34(%rsp), %rcx
leaq 0x2391c(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movslq 0x30(%rsp), %rcx
movslq (%rax,%rcx,4), %rsi
callq 0x20630
movl 0x10(%rsp), %edi
movl 0x14(%rsp), %esi
movq %rax, %rdx
callq 0xf520
jmp 0x17b1c
movl 0x34(%rsp), %eax
movl %eax, 0x8(%rsp)
movl 0x30(%rsp), %eax
movl %eax, 0xc(%rsp)
movq 0x48(%rsp), %rax
movq (%rax), %rax
movslq (%rax), %rsi
leaq 0x70890(%rip), %rdi     # 0x88370
callq 0x205d0
movq %rax, %rdi
movslq 0x34(%rsp), %rcx
leaq 0x238bc(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movslq 0x30(%rsp), %rcx
movslq (%rax,%rcx,4), %rsi
callq 0x20630
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
movq %rax, %rdx
callq 0xf520
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)