// File: /workspace/github_cpp_makefile_star2_O2/essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: draw_ship(int, int)
void draw_ship(int x,int y)
{
	ship_x = x;
	ship_y = y;
	map_terrain[x-4][y] = NOSE;
	map_terrain[x-3][y] = CPANEL;
	map_terrain[x-3][y-1] = SW_NE;
	map_terrain[x-3][y+1] = NW_SE;
	map_terrain[x-2][y-2] = SW_NE;
	map_terrain[x-2][y+2] = NW_SE;
	map_terrain[x-2][y-1] = CPANEL;
	map_terrain[x-2][y] = FLOOR;
	map_terrain[x-2][y+2] = NW_SE;
	map_terrain[x-2][y+1] = CPANEL;
	map_terrain[x-1][y-2] = WE;
	map_terrain[x-1][y+2] = WE;
	map_terrain[x][y-2] = WE;
	map_terrain[x][y+2] = WE;
	map_terrain[x+1][y-2] = WE;
	map_terrain[x+1][y+2] = WE;
	map_terrain[x+2][y-2] = NW_SE;
	map_terrain[x+2][y+2] = SW_NE;
	map_terrain[x+2][y-1] = NS;
	map_terrain[x+2][y+1] = NS;
	map_terrain[x+2][y] = DOOR;
	for(int i=x-1;i<x+2;i++)
	{
		for(int j=y-1;j<y+2;j++)
		{
				map_terrain[i][j] = FLOOR;
		}

	}
	if(map_terrain[x+3][y] == WALL)
	{
		map_terrain[x+3][y] = DOOR;
	}
	if(map_terrain[x+3][y] == FLOOR || map_terrain[x+3][y] == DOOR)
	{
		int i = x+3;
		while(map_terrain[i][y] == FLOOR || map_terrain[i][y] == DOOR) {i++;}
		if(map_terrain[i][y] != STREE && map_terrain[i][y] != BTREE && map_terrain[i][y] != DIRT)
		{
			map_terrain[i][y] = DOOR;
		}
	}

}

// Assembly:
movl %edi, 0x611f2(%rip)     # 0x6b1fc
movl %esi, 0x611f0(%rip)     # 0x6b200
leal -0x4(%rdi), %eax
cltq
movslq %esi, %rcx
imulq $0x258, %rax, %rdx      # imm = 0x258
leaq 0x1431a(%rip), %rax     # 0x1e340
addq %rax, %rdx
movl $0x8, (%rdx,%rcx,4)
leal -0x3(%rdi), %edx
movslq %edx, %rdx
imulq $0x258, %rdx, %rdx      # imm = 0x258
addq %rax, %rdx
movabsq $0x900000006, %rsi      # imm = 0x900000006
movq %rsi, -0x4(%rdx,%rcx,4)
pushq $0x7
popq %rsi
movl %esi, 0x4(%rdx,%rcx,4)
leal -0x2(%rdi), %edx
movslq %edx, %rdx
imulq $0x258, %rdx, %rdx      # imm = 0x258
addq %rax, %rdx
movl %esi, 0x8(%rdx,%rcx,4)
movaps 0xa0cf(%rip), %xmm0     # 0x14140
movups %xmm0, -0x8(%rdx,%rcx,4)
leal -0x1(%rdi), %edx
movslq %edx, %rdx
imulq $0x258, %rdx, %rsi      # imm = 0x258
addq %rax, %rsi
pushq $0xb
popq %r8
movl %r8d, -0x8(%rsi,%rcx,4)
movl %r8d, 0x8(%rsi,%rcx,4)
movslq %edi, %rsi
imulq $0x258, %rsi, %r9       # imm = 0x258
leaq (%rax,%r9), %r10
movl %r8d, -0x8(%r10,%rcx,4)
movl %r8d, 0x8(%r10,%rcx,4)
leal 0x1(%rsi), %r10d
movslq %r10d, %r10
imulq $0x258, %r10, %r10      # imm = 0x258
addq %rax, %r10
movl %r8d, -0x8(%r10,%rcx,4)
movl %r8d, 0x8(%r10,%rcx,4)
addl $0x2, %esi
movslq %esi, %rsi
imulq $0x258, %rsi, %r8       # imm = 0x258
addq %rax, %r8
movl $0x6, 0x8(%r8,%rcx,4)
movaps 0xa069(%rip), %xmm0     # 0x14150
movups %xmm0, -0x8(%r8,%rcx,4)
leaq (%r9,%rcx,4), %r8
addq %rax, %r8
addq $-0x25c, %r8            # imm = 0xFDA4
cmpq %rsi, %rdx
jge 0xa122
xorl %r9d, %r9d
cmpq $0x3, %r9
je 0xa116
movl $0x3, (%r8,%r9,4)
incq %r9
jmp 0xa103
incq %rdx
addq $0x258, %r8             # imm = 0x258
jmp 0xa0fb
addl $0x3, %edi
movslq %edi, %rdx
imulq $0x258, %rdx, %rsi      # imm = 0x258
leaq (%rax,%rsi), %rdi
movl (%rdi,%rcx,4), %edx
cmpl $0x3, %edx
je 0xa153
cmpl $0x4, %edx
je 0xa146
cmpl $0x5, %edx
je 0xa153
retq
leaq (%rdi,%rcx,4), %rdx
movl $0x5, (%rdx)
pushq $0x5
popq %rdx
leaq (%rsi,%rcx,4), %rcx
addq %rcx, %rax
cmpl $0x3, %edx
je 0xa164
cmpl $0x5, %edx
jne 0xa172
movl 0x258(%rax), %edx
addq $0x258, %rax            # imm = 0x258
jmp 0xa15a
cmpl $0x3, %edx
jb 0xa145
movl $0x5, (%rax)
retq