// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edx, %r14d
movl %esi, %r12d
movq %rdi, %r13
movq %rdi, %rbx
shrq $0x20, %rbx
callq 0x5080
pushq $0x5
popq %rcx
cltd
idivl %ecx
movl %edx, %ebp
leal 0x3(%rbp), %r15d
callq 0x5080
movq %r14, %rdi
cltd
pushq $0x5
popq %rcx
idivl %ecx
leal 0x3(%rdx), %esi
movl %r15d, 0x14(%rsp)
movsbl %r15b, %eax
movb $-0x2, %cl
idivb %cl
movsbl %al, %r8d
addl %r13d, %r8d
movq %rsi, 0x28(%rsp)
movsbl %sil, %eax
idivb %cl
movsbl %al, %r9d
leal 0x11(%r12), %r10d
addl $-0x11, %r12d
leal 0x11(%r14), %r11d
addl $-0x11, %edi
leal 0x4(%rbp), %r14d
leal 0x4(%rdx), %r15d
addl $0x5, %edx
addl $0x5, %ebp
addl %ebx, %r9d
movslq %r9d, %rax
leaq 0x145a3(%rip), %rcx     # 0x1e340
leaq (%rcx,%rax,4), %rcx
leaq 0x5bc38(%rip), %rsi     # 0x659e0
addq %rax, %rsi
movq %r8, 0x48(%rsp)
movl %r8d, %eax
xorl %r8d, %r8d
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq %rbp, 0x40(%rsp)
movq %r12, 0x68(%rsp)
movq %rdi, 0x60(%rsp)
movq %r14, 0x58(%rsp)
movq %r15, 0x50(%rsp)
movq %rcx, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movl %r10d, 0x1c(%rsp)
cmpq %rbp, %r8
je 0x9f85
movl %eax, 0x18(%rsp)
cltq
imulq $0x258, %rax, %rbx      # imm = 0x258
addq %rcx, %rbx
movq %rbx, 0x20(%rsp)
imulq $0x96, %rax, %rax
addq %rsi, %rax
movq %rax, 0x70(%rsp)
movq 0x48(%rsp), %rax
leal (%rax,%r8), %ebp
testq %r8, %r8
sete %al
cmpq %r14, %r8
sete %cl
orb %al, %cl
movb %cl, 0x7(%rsp)
xorl %r13d, %r13d
cmpq %r13, %rdx
je 0x9f68
leaq (%r9,%r13), %rsi
movl %esi, %eax
orl %ebp, %eax
js 0x9fb7
cmpl $0x95, %ebp
jg 0x9fb7
cmpl $0x95, %esi
jg 0x9fb7
cmpl %r10d, %ebp
jg 0x9fb7
movl $0x0, %eax
cmpl %r12d, %ebp
jl 0x9fb9
cmpl %r11d, %esi
jg 0x9fb7
movl $0x0, %eax
cmpl %edi, %esi
jl 0x9fb9
movq 0x70(%rsp), %rax
cmpb $0x0, (%rax,%r13)
jne 0x9fb7
testq %r8, %r8
je 0x9ef1
movq %r8, %rbx
cmpq %r14, %r8
sete %al
testq %r13, %r13
sete %cl
orb %al, %cl
cmpq %r13, %r15
sete %r8b
orb %cl, %r8b
movq 0x20(%rsp), %rax
movl (%rax,%r13,4), %eax
cmpb $0x1, %r8b
jne 0x9f14
cmpl $0x3, %eax
jae 0x9f5d
cmpb $0x0, 0x7(%rsp)
movq %rbx, %r8
jne 0x9efd
incl 0x8(%rsp)
jmp 0x9f60
movq 0x20(%rsp), %rax
cmpl $0x3, (%rax,%r13,4)
jae 0x9f60
testq %r13, %r13
setne %al
cmpq %r13, %r15
setne %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, 0x8(%rsp)
jmp 0x9f60
andl $-0x2, %eax
cmpl $0x4, %eax
jne 0x9f59
movl %ebp, %edi
movq %rdx, %r14
movq %r9, %r15
movl %r11d, %r12d
callq 0x1113b
movl %r12d, %r11d
movl 0x1c(%rsp), %r10d
movq %r15, %r9
movq 0x50(%rsp), %r15
movq %r14, %rdx
movq 0x58(%rsp), %r14
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %r12
xorb $0x1, %al
movzbl %al, %eax
addl %eax, 0xc(%rsp)
jmp 0x9f5d
incl 0x10(%rsp)
movq %rbx, %r8
incq %r13
jmp 0x9e41
incq %r8
movl 0x18(%rsp), %eax
incl %eax
movq 0x40(%rsp), %rbp
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rsi
jmp 0x9df6
cmpl $0x0, 0xc(%rsp)
setg %al
cmpl $0x0, 0x8(%rsp)
setg %cl
andb %al, %cl
cmpl $0x4, 0x10(%rsp)
setge %al
andb %cl, %al
cmpb $0x1, %al
jne 0x9fb7
movq 0x28(%rsp), %rcx
shlq $0x20, %rcx
movl 0x14(%rsp), %eax
orq %rcx, %rax
jmp 0x9fb9
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq