// File: /workspace/github_cpp_makefile_star2_O1/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 $0xa8, %rsp
movq %rdx, 0x18(%rsp)
movl %esi, %r13d
movq %rdi, %rbp
callq 0x5070
movslq %eax, %rbx
imulq $0x66666667, %rbx, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
sarl %eax
addl %ecx, %eax
leal (%rax,%rax,4), %r14d
movl %ebx, %r15d
subl %r14d, %r15d
leal 0x3(%r15), %r12d
callq 0x5070
movslq %eax, %rcx
imulq $0x66666667, %rcx, %rax # imm = 0x66666667
movq %rax, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rax
sarl %eax
addl %edx, %eax
leal (%rax,%rax,4), %edx
movl %ecx, %esi
subl %edx, %esi
movq %rbp, %rax
shrq $0x20, %rax
movl %r12d, 0x2c(%rsp)
movl %r12d, %edi
shrl $0x1f, %edi
addl %r15d, %edi
addl $0x3, %edi
movq 0x18(%rsp), %r15
sarl %edi
subl %edi, %ebp
movl %esi, %edi
addl $0x3, %edi
movq %rdi, 0x50(%rsp)
shrl $0x1f, %edi
addl %edi, %esi
addl $0x3, %esi
sarl %esi
subl %esi, %eax
leal 0x11(%r13), %esi
movl %esi, 0x40(%rsp)
addl $-0x11, %r13d
movq %r13, 0x98(%rsp)
leal 0x11(%r15), %esi
movl %esi, 0x44(%rsp)
addl $-0x11, %r15d
negl %r14d
leal (%rbx,%r14), %r10d
addl $0x4, %r10d
negl %edx
addl %ecx, %edx
addl $0x4, %edx
xorl %r11d, %r11d
testl %edx, %edx
movl $0x0, %ecx
movq %rdx, 0x20(%rsp)
cmovgl %edx, %ecx
movq %rcx, 0xa0(%rsp)
testl %r10d, %r10d
movl %r10d, %ecx
cmovlel %r11d, %ecx
incl %ecx
movq %rcx, 0x88(%rsp)
movslq %eax, %rdx
leaq 0x14f33(%rip), %rcx     # 0x21350
leaq (%rcx,%rdx,4), %rcx
movq %rcx, 0x68(%rsp)
leal 0x1(%rbp), %r8d
leal -0x1(%rbp), %r14d
leaq 0x5c5bb(%rip), %rsi     # 0x689f0
addq %rdx, %rsi
movq %rsi, 0x60(%rsp)
decl %edx
movq %rdx, 0x58(%rsp)
movb $0x1, 0xb(%rsp)
movq %rbp, 0x90(%rsp)
movl %ebp, %edx
xorl %ebx, %ebx
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r15, 0x18(%rsp)
movq %r10, 0x48(%rsp)
movq 0x90(%rsp), %rsi
leal (%rsi,%r11), %r9d
cmpl 0x40(%rsp), %r9d
setg %r12b
cmpl 0x98(%rsp), %r9d
setl %dil
testq %r11, %r11
movq %rax, %rsi
setne %al
cmpq %r10, %r11
setne %r10b
cmpl $0x95, %esi
jg 0xc68d
movq %rsi, %rcx
orl %r9d, %esi
js 0xc678
cmpl $0x95, %r9d
jg 0xc678
movslq %r8d, %rsi
imulq $0x258, %rsi, %rsi      # imm = 0x258
movl %ebx, %r15d
movl %r8d, 0x3c(%rsp)
movl %ebp, %r8d
movq 0x68(%rsp), %rbp
addq %rbp, %rsi
movq %rsi, 0x80(%rsp)
movslq %r14d, %rsi
imulq $0x258, %rsi, %rsi      # imm = 0x258
addq %rbp, %rsi
movq %rsi, 0x78(%rsp)
movslq %edx, %rbx
imulq $0x258, %rbx, %rsi      # imm = 0x258
addq %rbp, %rsi
imulq $0x96, %rbx, %rbp
addq 0x60(%rsp), %rbp
orb %dil, %r12b
andb %r10b, %al
movslq %r9d, %rdi
imulq $0x258, %rdi, %r10      # imm = 0x258
leaq 0x14e2f(%rip), %rdi     # 0x21350
addq %rdi, %r10
movq %r10, 0x70(%rsp)
movl %r13d, 0x30(%rsp)
movl %r13d, 0x10(%rsp)
movl %eax, %r13d
movl %r8d, 0x34(%rsp)
movl %r8d, 0x14(%rsp)
movl 0x3c(%rsp), %r8d
movl %r15d, 0x38(%rsp)
movl %r15d, 0xc(%rsp)
movq 0x18(%rsp), %r15
movb $0x1, %r10b
xorl %edi, %edi
movq %rcx, %rax
testb %r12b, %r12b
jne 0xc6a2
leaq (%rax,%rdi), %rbx
cmpl 0x44(%rsp), %ebx
jg 0xc6bd
cmpl %r15d, %ebx
jl 0xc6bd
cmpb $0x0, (%rbp,%rdi)
jne 0xc6bd
testq %r11, %r11
je 0xc5b0
cmpq 0x48(%rsp), %r11
sete %r10b
testq %rdi, %rdi
sete %bl
orb %r10b, %bl
cmpq %rdi, 0x20(%rsp)
sete %r10b
orb %bl, %r10b
cmpb $0x1, %r10b
jne 0xc5da
cmpl $0x2, (%rsi,%rdi,4)
ja 0xc641
testq %rdi, %rdi
setne %r10b
cmpq %rdi, 0x20(%rsp)
setne %bl
andb %r10b, %bl
orb %r13b, %bl
movzbl %bl, %r10d
addl %r10d, 0x14(%rsp)
jmp 0xc641
movl (%rsi,%rdi,4), %r10d
andl $-0x2, %r10d
cmpl $0x4, %r10d
jne 0xc63d
movq 0x58(%rsp), %r10
addl %edi, %r10d
movslq %r10d, %r10
movq 0x70(%rsp), %rcx
cmpl $0x4, (%rcx,%r10,4)
movq 0x80(%rsp), %rcx
movl (%rcx,%rdi,4), %r10d
movq 0x78(%rsp), %rcx
movl (%rcx,%rdi,4), %ebx
jne 0xc620
movl $0x1, %r15d
cmpl $0x4, 0x4(%rsi,%rdi,4)
je 0xc631
xorl $0x4, %ebx
xorl $0x4, %r10d
xorl %r15d, %r15d
orl %ebx, %r10d
sete %r15b
addl %r15d, 0x10(%rsp)
movq 0x18(%rsp), %r15
jmp 0xc641
incl 0xc(%rsp)
cmpq 0x20(%rsp), %rdi
setb %r10b
cmpq %rdi, 0xa0(%rsp)
je 0xc6bd
leal (%rax,%rdi), %ebx
incl %ebx
cmpl $0x95, %ebx
jg 0xc6bd
orl %r9d, %ebx
js 0xc6bd
incq %rdi
cmpl $0x95, %r9d
jle 0xc55c
jmp 0xc6bd
movl %r13d, 0x10(%rsp)
movl %ebp, 0x14(%rsp)
movl %ebx, 0xc(%rsp)
movb $0x1, %r10b
movq %rcx, %rax
jmp 0xc6bd
movl %r13d, 0x10(%rsp)
movl %ebp, 0x14(%rsp)
movl %ebx, 0xc(%rsp)
movb $0x1, %r10b
movq %rsi, %rax
jmp 0xc6bd
movl 0x30(%rsp), %esi
movl %esi, 0x10(%rsp)
movl 0x34(%rsp), %esi
movl %esi, 0x14(%rsp)
movl 0x38(%rsp), %esi
movl %esi, 0xc(%rsp)
movb $0x1, %r10b
testb $0x1, %r10b
movq 0x48(%rsp), %r10
jne 0xc6fa
cmpq %r10, %r11
leaq 0x1(%r11), %rsi
setb 0xb(%rsp)
incl %r8d
incl %r14d
incl %edx
movq %rsi, %r11
movl 0xc(%rsp), %ebx
movl 0x14(%rsp), %ebp
movl 0x10(%rsp), %r13d
cmpq 0x88(%rsp), %rsi
jne 0xc464
testb $0x1, 0xb(%rsp)
jne 0xc733
cmpl $0x0, 0x10(%rsp)
setg %al
cmpl $0x0, 0x14(%rsp)
setg %cl
andb %al, %cl
cmpl $0x4, 0xc(%rsp)
setge %al
andb %cl, %al
cmpb $0x1, %al
jne 0xc733
movq 0x50(%rsp), %rcx
shlq $0x20, %rcx
movl 0x2c(%rsp), %eax
orq %rcx, %rax
jmp 0xc735
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq