// File: /workspace/github_c_makefile_star2_O0/S01den[P]Lost_CavernRL/map.c
// Function: destroyWall
void destroyWall(Map map[LONGUEUR][LARGEUR], int x, int y, Weapons *weaponHold, int *gem)
{	
	if(x != 0 && x != LONGUEUR && y != 0 && y != LARGEUR)
	{
		if(map[x][y].resistance-weaponHold->degat > 0)
		{
			map[x][y].resistance -= weaponHold->degat;
			if(weaponHold->type == 0)
				weaponHold->state -= map[x][y].resistance/5+3;
			else
				weaponHold->state--;
		}
		else
		{
			map[x][y].resistance = 0;
			if(map[x][y].effect == 4) // if the player breaks a gem
			{
				(*gem)++;
				map[x][y].content = FLOOR;
			}
			else
			{
				if(rand()%100 <= 90)
					map[x][y].content = FLOOR;
				else
				{
					map[x][y].content = MINES;
					map[x][y].trap = 2;
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0xf946
cmpl $0x27, -0xc(%rbp)
je 0xf946
cmpl $0x0, -0x10(%rbp)
je 0xf946
cmpl $0x82, -0x10(%rbp)
je 0xf946
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 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
subl 0x10(%rcx), %eax
cmpl $0x0, %eax
jle 0xf848
movq -0x18(%rbp), %rax
movl 0x10(%rax), %edx
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 0x14(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x14(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jne 0xf836
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 0x14(%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movl %eax, %edx
addl $0x3, %edx
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x1c(%rax)
jmp 0xf843
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x1c(%rax)
jmp 0xf944
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, 0x14(%rax)
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 $0x4, 0x4(%rax)
jne 0xf8c2
movq -0x20(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
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 $0x1, (%rax)
jmp 0xf942
callq 0x21e0
movl $0x64, %ecx
cltd
idivl %ecx
cmpl $0x5a, %edx
jg 0xf8f9
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 $0x1, (%rax)
jmp 0xf940
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 $0x4, (%rax)
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 $0x2, 0x18(%rax)
jmp 0xf942
jmp 0xf944
jmp 0xf946
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)