// File: /workspace/github_cpp_makefile_star2_O3/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 $0x58, %rsp
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5070
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rax # imm = 0x66666667
movq %rcx, %r13
movq %rcx, 0x8(%rsp)
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
sarl %eax
addl %ecx, %eax
leal (%rax,%rax,4), %ebp
subl %ebp, %r13d
leal 0x3(%r13), %r12d
callq 0x5070
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
sarl %ecx
addl %edx, %ecx
leal (%rcx,%rcx,4), %esi
movl %eax, %edx
subl %esi, %edx
leal 0x3(%rdx), %r8d
movq %r15, %rcx
shrq $0x20, %rcx
movl %r12d, %edi
shrb $0x7, %dil
movl %r12d, 0x14(%rsp)
addb %r12b, %dil
sarb %dil
negb %dil
movsbl %dil, %r9d
addl %r15d, %r9d
movq %r13, %r15
movl %r8d, %edi
shrb $0x7, %dil
movq %r8, 0x20(%rsp)
addb %r8b, %dil
sarb %dil
negb %dil
movsbl %dil, %r10d
leal 0x11(%r14), %edi
movl %edi, 0x1c(%rsp)
addl $-0x11, %r14d
leal 0x11(%rbx), %r8d
movl %r8d, 0x18(%rsp)
addl $-0x11, %ebx
movq %rbx, 0x50(%rsp)
addl $0x4, %r15d
addl $0x4, %edx
negl %esi
addl %esi, %eax
addl $0x5, %eax
movq %rax, 0x48(%rsp)
negl %ebp
movq 0x8(%rsp), %rax
addl %ebp, %eax
addl $0x5, %eax
movq %rax, 0x28(%rsp)
leal (%r10,%rcx), %r11d
leal (%r10,%rcx), %eax
decl %eax
movq %rax, 0x30(%rsp)
xorl %r10d, %r10d
leaq 0x152e2(%rip), %r8      # 0x21340
movl $0x0, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
leal (%r9,%r10), %r13d
movslq %r13d, %rbp
testq %r10, %r10
sete %al
cmpq %r15, %r10
sete %dil
leal 0x1(%r9,%r10), %ecx
movslq %ecx, %rcx
leal (%r9,%r10), %esi
decl %esi
movslq %esi, %rsi
orb %al, %dil
movb %dil, 0x3(%rsp)
imulq $0x258, %rcx, %rax      # imm = 0x258
addq %r8, %rax
movq %rax, 0x40(%rsp)
imulq $0x258, %rsi, %rax      # imm = 0x258
addq %r8, %rax
movq %rax, 0x38(%rsp)
xorl %esi, %esi
leaq (%r11,%rsi), %rcx
movl %ecx, %eax
orl %r13d, %eax
js 0xc274
cmpl $0x95, %ebp
jg 0xc274
cmpl $0x95, %ecx
jg 0xc274
cmpl 0x1c(%rsp), %ebp
jg 0xc274
movl $0x0, %eax
cmpl %r14d, %ebp
jl 0xc276
cmpl 0x18(%rsp), %ecx
jg 0xc274
movl $0x0, %eax
cmpl 0x50(%rsp), %ecx
jl 0xc276
movslq %ecx, %rax
imulq $0x96, %rbp, %rcx
leaq 0x5c8b4(%rip), %rbx     # 0x689e0
addq %rbx, %rcx
cmpb $0x0, (%rax,%rcx)
jne 0xc274
testq %r10, %r10
je 0xc198
movq %r9, %rbx
movq %r15, %r9
cmpq %r15, %r10
sete %cl
testq %rsi, %rsi
sete %r15b
orb %cl, %r15b
cmpq %rsi, %rdx
sete %r12b
orb %r15b, %r12b
imulq $0x258, %rbp, %rcx      # imm = 0x258
movq %r8, %rdi
addq %r8, %rcx
movl (%rcx,%rax,4), %r15d
cmpb $0x1, %r12b
jne 0xc1bf
cmpl $0x3, %r15d
jae 0xc21d
cmpb $0x0, 0x3(%rsp)
movq %r9, %r15
movq %rbx, %r9
movq %rdi, %r8
jne 0xc1a8
incl 0x8(%rsp)
jmp 0xc226
imulq $0x258, %rbp, %rcx      # imm = 0x258
addq %r8, %rcx
cmpl $0x3, (%rcx,%rax,4)
jae 0xc226
testq %rsi, %rsi
setne %al
cmpq %rsi, %rdx
setne %cl
andb %al, %cl
movzbl %cl, %eax
addl %eax, 0x8(%rsp)
jmp 0xc226
andl $-0x2, %r15d
cmpl $0x4, %r15d
jne 0xc204
movq 0x30(%rsp), %r15
addl %esi, %r15d
movslq %r15d, %r15
cmpl $0x4, (%rcx,%r15,4)
movq 0x40(%rsp), %r8
movl (%r8,%rax,4), %r15d
movq 0x38(%rsp), %r8
movl (%r8,%rax,4), %eax
jne 0xc20a
leal (%r11,%rsi), %r12d
incl %r12d
movslq %r12d, %r12
cmpl $0x4, (%rcx,%r12,4)
jne 0xc20a
incl 0x4(%rsp)
jmp 0xc21d
incl 0x10(%rsp)
jmp 0xc21d
xorl $0x4, %eax
xorl $0x4, %r15d
xorl %ecx, %ecx
orl %eax, %r15d
sete %cl
addl %ecx, 0x4(%rsp)
movq %r9, %r15
movq %rbx, %r9
movq %rdi, %r8
incq %rsi
cmpq %rsi, 0x48(%rsp)
jne 0xc0c3
incq %r10
cmpq 0x28(%rsp), %r10
jne 0xc076
cmpl $0x0, 0x4(%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 0xc274
movq 0x20(%rsp), %rcx
shlq $0x20, %rcx
movl 0x14(%rsp), %eax
orq %rcx, %rax
jmp 0xc276
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq