// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq %rdi, -0x8(%rbp)
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0xc(%rbp)
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
addl $0x1, %edx
movl %edx, -0x18(%rbp)
movl -0xc(%rbp), %eax
subl $0x5, %eax
cmpl $0x0, %eax
jg 0xf9b2
movl -0xc(%rbp), %eax
addl $0x5, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %eax
subl $0x5, %eax
cmpl $0x0, %eax
jg 0xf9c6
movl -0x10(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
addl $0x5, %eax
cmpl $0x27, %eax
jl 0xf9da
movl -0xc(%rbp), %eax
subl $0x5, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %eax
addl $0x5, %eax
cmpl $0x82, %eax
jg 0xf9f0
movl -0x10(%rbp), %eax
subl $0x5, %eax
movl %eax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x5, (%rax)
jl 0xfa34
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x9, (%rax)
jle 0xfa50
movq -0x20(%rbp), %rcx
movl -0xc(%rbp), %eax
cmpl 0x14(%rcx), %eax
jne 0xfac4
movq -0x20(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0x18(%rcx), %eax
jne 0xfac4
callq 0x21e0
movl $0x27, %ecx
cltd
idivl %ecx
movl %edx, -0xc(%rbp)
callq 0x21e0
movl $0x82, %ecx
cltd
idivl %ecx
movl %edx, -0x10(%rbp)
movl -0xc(%rbp), %eax
subl $0x5, %eax
cmpl $0x0, %eax
jg 0xfa84
movl -0xc(%rbp), %eax
addl $0x5, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %eax
subl $0x5, %eax
cmpl $0x0, %eax
jg 0xfa98
movl -0x10(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
addl $0x5, %eax
cmpl $0x27, %eax
jl 0xfaac
movl -0xc(%rbp), %eax
subl $0x5, %eax
movl %eax, -0xc(%rbp)
movl -0x10(%rbp), %eax
addl $0x5, %eax
cmpl $0x82, %eax
jg 0xfac2
movl -0x10(%rbp), %eax
subl $0x5, %eax
movl %eax, -0x10(%rbp)
jmp 0xfac4
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0xfb5e
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x3, (%rax)
je 0xfb1c
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movslq -0x10(%rbp), %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl $0x0, (%rax)
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
movl $0x1, %eax
subl %edx, %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
callq 0x21e0
movl $0x3, %ecx
cltd
idivl %ecx
movl $0x1, %eax
subl %edx, %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xfacb
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop