// File: essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: can_make_room(std::pair<int, int>, int, int)
std::pair<int,int> can_make_room(std::pair<int,int> xy,int xcentre,int ycentre)
{
	int x=xy.first; int y = xy.second;
	int xsize = rand()%5 + 3;
	int ysize = rand()%5 + 3;
	int inner_walls=0;
	int outer_walls=0;
	int floors=0;

	for(int i=0;i<xsize+2;i++)
	{
		for(int j=0;j<ysize+2;j++)
		{
			if (!on_map(i+x-xsize/2,j+y-ysize/2)) {return std::make_pair(0,0);}
			if (i+x-xsize/2 > xcentre+BUILDING_SIZE || i+x-xsize/2 < xcentre - BUILDING_SIZE) {return std::make_pair(0,0);}
			if (j+y-ysize/2 > ycentre+BUILDING_SIZE || j+y-ysize/2 < ycentre - BUILDING_SIZE) {return std::make_pair(0,0);}
			if(map_access[i+x-xsize/2][j+y-ysize/2]) {return std::make_pair(0,0);}
			if(i==0 || i == xsize+1 || j==0 || j==ysize+1)
			{
				if (map_terrain[i+x-xsize/2][j+y-ysize/2] == DIRT || map_terrain[i+x-xsize/2][j+y-ysize/2] == STREE || map_terrain[i+x-xsize/2][j+y-ysize/2] == BTREE)
				{
					if(!is_corner_a(i,j,xsize+1,ysize+1))
					{ outer_walls++; }
				}
			}
			else
			{
				if(map_terrain[i+x-xsize/2][j+y-ysize/2] != WALL && map_terrain[i+x-xsize/2][j+y-ysize/2] != DOOR)
				{
					floors++;
				}
				else if(!is_corner_b(i+x-xsize/2,j+y-ysize/2))
				{
					inner_walls++;
				}
			}
		}
	}
	if(inner_walls>0 && outer_walls > 0 && floors > 3)
	{
		return std::make_pair(xsize,ysize);
	}
	return std::make_pair(0,0);
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movl %esi, 0xc4(%rsp)
movl %edx, 0xc0(%rsp)
movl 0xc8(%rsp), %eax
movl %eax, 0xbc(%rsp)
movl 0xcc(%rsp), %eax
movl %eax, 0xb8(%rsp)
callq 0x50b0
movl $0x5, %ecx
cltd
idivl %ecx
addl $0x3, %edx
movl %edx, 0xb4(%rsp)
callq 0x50b0
movl $0x5, %ecx
cltd
idivl %ecx
addl $0x3, %edx
movl %edx, 0xb0(%rsp)
movl $0x0, 0xac(%rsp)
movl $0x0, 0xa8(%rsp)
movl $0x0, 0xa4(%rsp)
movl $0x0, 0xa0(%rsp)
movl 0xa0(%rsp), %eax
movl 0xb4(%rsp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0x1149f
movl $0x0, 0x9c(%rsp)
movl 0x9c(%rsp), %eax
movl 0xb0(%rsp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0x11487
movl 0xa0(%rsp), %edi
addl 0xbc(%rsp), %edi
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %edi
movl 0x9c(%rsp), %esi
addl 0xb8(%rsp), %esi
movl 0xb0(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %esi
callq 0x20770
testb $0x1, %al
jne 0x10f4f
movl $0x0, 0x98(%rsp)
movl $0x0, 0x94(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x94(%rsp), %rsi
callq 0x20b30
movq %rax, 0xd0(%rsp)
jmp 0x11503
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x70(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x70(%rsp), %eax
subl %ecx, %eax
movl 0xc4(%rsp), %ecx
addl $0x11, %ecx
cmpl %ecx, %eax
jg 0x10fbd
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x6c(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x6c(%rsp), %eax
subl %ecx, %eax
movl 0xc4(%rsp), %ecx
subl $0x11, %ecx
cmpl %ecx, %eax
jge 0x10ff5
movl $0x0, 0x90(%rsp)
movl $0x0, 0x8c(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x8c(%rsp), %rsi
callq 0x20b30
movq %rax, 0xd0(%rsp)
jmp 0x11503
movl 0x9c(%rsp), %eax
addl 0xb8(%rsp), %eax
movl %eax, 0x68(%rsp)
movl 0xb0(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x68(%rsp), %eax
subl %ecx, %eax
movl 0xc0(%rsp), %ecx
addl $0x11, %ecx
cmpl %ecx, %eax
jg 0x11063
movl 0x9c(%rsp), %eax
addl 0xb8(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0xb0(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x64(%rsp), %eax
subl %ecx, %eax
movl 0xc0(%rsp), %ecx
subl $0x11, %ecx
cmpl %ecx, %eax
jge 0x1109b
movl $0x0, 0x88(%rsp)
movl $0x0, 0x84(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x84(%rsp), %rsi
callq 0x20b30
movq %rax, 0xd0(%rsp)
jmp 0x11503
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x54(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x71982(%rip), %rax     # 0x82a50
imulq $0x96, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x58(%rsp)
movl 0x9c(%rsp), %ecx
addl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq 0x58(%rsp), %rax
subl %edx, %ecx
movslq %ecx, %rcx
testb $0x1, (%rax,%rcx)
je 0x1113e
movl $0x0, 0x80(%rsp)
movl $0x0, 0x7c(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x7c(%rsp), %rsi
callq 0x20b30
movq %rax, 0xd0(%rsp)
jmp 0x11503
cmpl $0x0, 0xa0(%rsp)
je 0x11180
movl 0xa0(%rsp), %eax
movl 0xb4(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
je 0x11180
cmpl $0x0, 0x9c(%rsp)
je 0x11180
movl 0x9c(%rsp), %eax
movl 0xb0(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1131a
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x44(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x2a1fd(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq %rax, 0x48(%rsp)
movl 0x9c(%rsp), %ecx
addl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq 0x48(%rsp), %rax
subl %edx, %ecx
movslq %ecx, %rcx
cmpl $0x0, (%rax,%rcx,4)
je 0x112d7
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x34(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x2a188(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movl 0x9c(%rsp), %ecx
addl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq 0x38(%rsp), %rax
subl %edx, %ecx
movslq %ecx, %rcx
cmpl $0x1, (%rax,%rcx,4)
je 0x112d7
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x24(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x2a117(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq %rax, 0x28(%rsp)
movl 0x9c(%rsp), %ecx
addl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq 0x28(%rsp), %rax
subl %edx, %ecx
movslq %ecx, %rcx
cmpl $0x2, (%rax,%rcx,4)
jne 0x11315
movl 0xa0(%rsp), %edi
movl 0x9c(%rsp), %esi
movl 0xb4(%rsp), %edx
addl $0x1, %edx
movl 0xb0(%rsp), %ecx
addl $0x1, %ecx
callq 0x20d60
testb $0x1, %al
jne 0x11313
movl 0xa8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa8(%rsp)
jmp 0x11315
jmp 0x1146f
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x2a063(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movl 0x9c(%rsp), %ecx
addl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq 0x18(%rsp), %rax
subl %edx, %ecx
movslq %ecx, %rcx
cmpl $0x4, (%rax,%rcx,4)
je 0x11413
movl 0xa0(%rsp), %eax
addl 0xbc(%rsp), %eax
movl %eax, 0x4(%rsp)
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x4(%rsp), %eax
subl %ecx, %eax
movslq %eax, %rcx
leaq 0x29fee(%rip), %rax     # 0x3b3b0
imulq $0x258, %rcx, %rcx      # imm = 0x258
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movl 0x9c(%rsp), %ecx
addl 0xb8(%rsp), %ecx
movl 0xb0(%rsp), %eax
movl $0x2, %esi
cltd
idivl %esi
movl %eax, %edx
movq 0x8(%rsp), %rax
subl %edx, %ecx
movslq %ecx, %rcx
cmpl $0x5, (%rax,%rcx,4)
je 0x11413
movl 0xa4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa4(%rsp)
jmp 0x1146d
movl 0xa0(%rsp), %edi
addl 0xbc(%rsp), %edi
movl 0xb4(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %edi
movl 0x9c(%rsp), %esi
addl 0xb8(%rsp), %esi
movl 0xb0(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %esi
callq 0x20df0
testb $0x1, %al
jne 0x1146b
movl 0xac(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xac(%rsp)
jmp 0x1146d
jmp 0x1146f
jmp 0x11471
movl 0x9c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0x10eb7
jmp 0x11489
movl 0xa0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0x10e93
cmpl $0x0, 0xac(%rsp)
jle 0x114dc
cmpl $0x0, 0xa8(%rsp)
jle 0x114dc
cmpl $0x3, 0xa4(%rsp)
jle 0x114dc
leaq 0xb4(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x207c0
movq %rax, 0xd0(%rsp)
jmp 0x11503
movl $0x0, 0x78(%rsp)
movl $0x0, 0x74(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x74(%rsp), %rsi
callq 0x20b30
movq %rax, 0xd0(%rsp)
movq 0xd0(%rsp), %rax
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)