// File: /workspace/github_c_makefile_star2_O1/S01den[P]Lost_CavernRL/map.c
// Function: destroyMap
void destroyMap(Map map[LONGUEUR][LARGEUR], Player player)
{
	int x = rand()%LONGUEUR;
	int y = rand()%LARGEUR;
	int i = 0;
	int nbrDestroyed = rand()%3+1;

	if(x-5 <= 0)
		x+=5;
	if(y-5 <= 0)
		y+=5;
	if(x+5 >= LONGUEUR)
		x-=5;
	if(y+5 <= LARGEUR)
		y-=5;
	
	if((map[x][y].content >= 5 && map[x][y].content <= 9) || (x == player.x && y == player.y))
	{
		x = rand()%LONGUEUR;
		y = rand()%LARGEUR;

		if(x-5 <= 0)
			x+=5;
		if(y-5 <= 0)
			y+=5;
		if(x+5 >= LONGUEUR)
			x-=5;
		if(y+5 <= LARGEUR)
			y-=5;	
	}

	for(i = 0; i < nbrDestroyed; i++)
	{
		if(map[x][y].content != STAIRS)
			map[x][y].content = HOLE;
		x += 1-rand()%3;
		y += 1-rand()%3;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x11d0
movslq %eax, %rcx
imulq $-0x2df2df2d, %rcx, %rax # imm = 0xD20D20D3
shrq $0x20, %rax
addl %ecx, %eax
movq %rcx, %rdx
movq %rcx, 0x10(%rsp)
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x5, %eax
addl %ecx, %eax
imull $0x27, %eax, %r13d
movl %edx, %ebp
subl %r13d, %ebp
callq 0x11d0
movslq %eax, %rcx
imulq $0x7e07e07f, %rcx, %rax # imm = 0x7E07E07F
movq %rcx, %rdx
movq %rcx, 0x8(%rsp)
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
sarl $0x6, %eax
addl %ecx, %eax
movl %eax, %ecx
shll $0x7, %ecx
leal (%rcx,%rax,2), %r15d
movl %edx, %r12d
subl %r15d, %r12d
callq 0x11d0
movslq %eax, %r14
imulq $0x55555556, %r14, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
leal (%rax,%rax,2), %eax
subl %eax, %r14d
negl %r13d
cmpl $0x6, %ebp
movq 0x10(%rsp), %rax
leal 0x5(%rax,%r13), %eax
cmovgel %ebp, %eax
negl %r15d
cmpl $0x6, %r12d
movq 0x8(%rsp), %rcx
leal 0x5(%rcx,%r15), %ecx
cmovgel %r12d, %ecx
leal -0x5(%rax), %r15d
cmpl $0x22, %eax
cmovll %eax, %r15d
leal -0x5(%rcx), %r12d
cmpl $0x7e, %ecx
cmovgel %ecx, %r12d
movslq %r15d, %rax
movslq %r12d, %rcx
leaq (%rcx,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %rdx
addq %rcx, %rdx
imulq $0xe38, %rax, %rax      # imm = 0xE38
addq %rbx, %rax
movl (%rax,%rdx), %eax
addl $-0x5, %eax
cmpl $0x5, %eax
jb 0x93be
leaq 0x50(%rsp), %rax
cmpl 0x14(%rax), %r15d
jne 0x943f
cmpl 0x18(%rax), %r12d
jne 0x943f
callq 0x11d0
movslq %eax, %r15
imulq $-0x2df2df2d, %r15, %rax # imm = 0xD20D20D3
shrq $0x20, %rax
addl %r15d, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x5, %eax
addl %ecx, %eax
imull $0x27, %eax, %r12d
movl %r15d, %ebp
subl %r12d, %ebp
callq 0x11d0
cltq
imulq $0x7e07e07f, %rax, %rcx # imm = 0x7E07E07F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rcx
addl %edx, %ecx
movl %ecx, %edx
shll $0x7, %edx
leal (%rdx,%rcx,2), %ecx
movl %eax, %edx
subl %ecx, %edx
negl %r12d
cmpl $0x6, %ebp
leal 0x5(%r15,%r12), %esi
cmovgel %ebp, %esi
negl %ecx
cmpl $0x6, %edx
leal 0x5(%rax,%rcx), %eax
cmovgel %edx, %eax
leal -0x5(%rsi), %r15d
cmpl $0x22, %esi
cmovll %esi, %r15d
leal -0x5(%rax), %r12d
cmpl $0x7e, %eax
cmovgel %eax, %r12d
testl %r14d, %r14d
js 0x94c2
incl %r14d
movslq %r15d, %rax
movslq %r12d, %rdx
imulq $0xe38, %rax, %rax      # imm = 0xE38
addq %rbx, %rax
leaq (%rdx,%rdx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rdx, %rcx
cmpl $0x3, (%rax,%rcx)
je 0x9471
addq %rcx, %rax
movl $0x0, (%rax)
callq 0x11d0
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %eax, %ecx
addl %ecx, %r15d
incl %r15d
callq 0x11d0
cltq
imulq $0x55555556, %rax, %rcx # imm = 0x55555556
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %eax, %ecx
addl %ecx, %r12d
incl %r12d
decl %r14d
jne 0x9447
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)