// File: /workspace/github_c_makefile_star2_O0/S01den[P]Lost_CavernRL/player.c
// Function: hit
int hit(char dirChar, int dirX, int dirY, WINDOW *win_map, Player *player, Weapons *weaponHold, Weapons listWeapons[], Map map[LONGUEUR][LARGEUR], int *gem, Ennemy ennemies[], int nbrEnnemyInFloor, int *component, int *exoticBlood, int *compBefore, int *indiceEnnemy, int *retHit, Pnj pnj[], int nbrPnjInFloor, int *indicePnj)
{
	int ret = 0;

	if(weaponHold->type == 0)
	{
		if(rand()%100 <= weaponHold->efficiency)
		{
			if(map[player->x+dirX][player->y+dirY].content == WALL)
			{
				if(weaponHold->indice == 3) // if we use our fists
				{
					player->life-=2;
				}
				destroyWall(map,player->x+dirX,player->y+dirY,weaponHold, gem);
			}

			*indiceEnnemy = testEnnemyOnPos(ennemies,player->x+dirX,player->y+dirY,nbrEnnemyInFloor);
			if(*indiceEnnemy >= 0)
			{
				*compBefore = *component;
				*retHit = hitEnnemy(*player, &ennemies[*indiceEnnemy], *weaponHold, component, exoticBlood);
				ret = *retHit;
			}
		}
	}
	else if(weaponHold->indice == 1 || weaponHold->indice == 2 || weaponHold->indice == 4 || weaponHold->indice == 5 || weaponHold->indice == 9)
	{
		*retHit = shotLine(map,weaponHold,ennemies,dirChar,*player,nbrEnnemyInFloor,component);
		ret = *retHit;
	}
	else if(listWeapons[weaponHold->indice].type == 2)
	{
		*retHit = burn(map,weaponHold,ennemies,dirChar,*player,nbrEnnemyInFloor,component,win_map);
		ret = *retHit;
	}
	else if(listWeapons[weaponHold->indice].type == 3 && (*gem)-1 >= 0) // crystal canon
	{
		(*gem)--;
		flashBomb(win_map);
		crystalCanon(map,*player,dirChar);
	}

	*indicePnj = testPnjOnPos(pnj,player->x+dirX,player->y+dirY,nbrPnjInFloor);	

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movb %dil, %al
movq 0x70(%rbp), %rdi
movl 0x68(%rbp), %edi
movq 0x60(%rbp), %rdi
movq 0x58(%rbp), %rdi
movq 0x50(%rbp), %rdi
movq 0x48(%rbp), %rdi
movq 0x40(%rbp), %rdi
movq 0x38(%rbp), %rdi
movl 0x30(%rbp), %edi
movq 0x28(%rbp), %rdi
movq 0x20(%rbp), %rdi
movq 0x18(%rbp), %rdi
movq 0x10(%rbp), %rdi
movb %al, -0x1(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jne 0x12c02
callq 0x21e0
movl $0x64, %ecx
cltd
idivl %ecx
movq -0x28(%rbp), %rax
cmpl 0x14(%rax), %edx
jg 0x12bfd
movq 0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movl 0x14(%rcx), %ecx
addl -0x8(%rbp), %ecx
movslq %ecx, %rcx
imulq $0xe38, %rcx, %rcx      # imm = 0xE38
addq %rcx, %rax
movq -0x20(%rbp), %rcx
movl 0x18(%rcx), %ecx
addl -0xc(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0x12af4
movq -0x28(%rbp), %rax
cmpl $0x3, 0x2c(%rax)
jne 0x12acf
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
subl $0x2, %ecx
movl %ecx, 0x10(%rax)
movq 0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %esi
addl -0x8(%rbp), %esi
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edx
addl -0xc(%rbp), %edx
movq -0x28(%rbp), %rcx
movq 0x20(%rbp), %r8
callq 0xf750
movq 0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %esi
addl -0x8(%rbp), %esi
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edx
addl -0xc(%rbp), %edx
movl 0x30(%rbp), %ecx
callq 0x8a10
movl %eax, %ecx
movq 0x50(%rbp), %rax
movl %ecx, (%rax)
movq 0x50(%rbp), %rax
cmpl $0x0, (%rax)
jl 0x12bfb
movq 0x38(%rbp), %rax
movl (%rax), %ecx
movq 0x48(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rsi
movq 0x28(%rbp), %rax
movq 0x50(%rbp), %rcx
movslq (%rcx), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x158(%rbp)
movq 0x38(%rbp), %rax
movq %rax, -0x148(%rbp)
movq 0x40(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x70(%rbp), %rdi
movl $0x40, %edx
callq 0x2200
movq -0x158(%rbp), %rax
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdx
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movq %rsp, %rax
movq %rax, -0x138(%rbp)
movups %xmm3, 0x70(%rax)
movups %xmm2, 0x60(%rax)
movups %xmm1, 0x50(%rax)
movups %xmm0, 0x40(%rax)
movups -0x70(%rbp), %xmm0
movups -0x60(%rbp), %xmm1
movups -0x50(%rbp), %xmm2
movups -0x40(%rbp), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x12ef0
movl %eax, %ecx
movq 0x58(%rbp), %rax
movl %ecx, (%rax)
movq 0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
jmp 0x12bfd
jmp 0x12ead
movq -0x28(%rbp), %rax
cmpl $0x1, 0x2c(%rax)
je 0x12c38
movq -0x28(%rbp), %rax
cmpl $0x2, 0x2c(%rax)
je 0x12c38
movq -0x28(%rbp), %rax
cmpl $0x4, 0x2c(%rax)
je 0x12c38
movq -0x28(%rbp), %rax
cmpl $0x5, 0x2c(%rax)
je 0x12c38
movq -0x28(%rbp), %rax
cmpl $0x9, 0x2c(%rax)
jne 0x12cfd
movq 0x18(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x178(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x170(%rbp)
movb -0x1(%rbp), %al
movb %al, -0x181(%rbp)
movq -0x20(%rbp), %rsi
movl 0x30(%rbp), %eax
movl %eax, -0x164(%rbp)
movq 0x38(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq -0xb0(%rbp), %rdi
movl $0x40, %edx
callq 0x2200
movb -0x181(%rbp), %al
movq -0x180(%rbp), %rdi
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
movl -0x164(%rbp), %r8d
movq -0x160(%rbp), %r9
movups -0xb0(%rbp), %xmm0
movups -0xa0(%rbp), %xmm1
movups -0x90(%rbp), %xmm2
movups -0x80(%rbp), %xmm3
movq %rsp, %rcx
movups %xmm3, 0x30(%rcx)
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movsbl %al, %ecx
callq 0x13050
movl %eax, %ecx
movq 0x58(%rbp), %rax
movl %ecx, (%rax)
movq 0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
jmp 0x12eab
movq 0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x2c(%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x2, 0x24(%rax)
jne 0x12df8
movq 0x18(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movb -0x1(%rbp), %al
movb %al, -0x1b1(%rbp)
movq -0x20(%rbp), %rsi
movl 0x30(%rbp), %eax
movl %eax, -0x194(%rbp)
movq 0x38(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x1c0(%rbp)
leaq -0xf0(%rbp), %rdi
movl $0x40, %edx
callq 0x2200
movq -0x1c0(%rbp), %r10
movb -0x1b1(%rbp), %al
movq -0x1b0(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
movq -0x1a0(%rbp), %rdx
movl -0x194(%rbp), %r8d
movq -0x190(%rbp), %r9
movups -0xf0(%rbp), %xmm0
movups -0xe0(%rbp), %xmm1
movups -0xd0(%rbp), %xmm2
movups -0xc0(%rbp), %xmm3
movq %rsp, %rcx
movups %xmm3, 0x30(%rcx)
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movq %r10, 0x40(%rcx)
movsbl %al, %ecx
callq 0x13380
movl %eax, %ecx
movq 0x58(%rbp), %rax
movl %ecx, (%rax)
movq 0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
jmp 0x12ea9
movq 0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq 0x2c(%rcx), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x3, 0x24(%rax)
jne 0x12ea7
movq 0x20(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
cmpl $0x0, %eax
jl 0x12ea7
movq 0x20(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rdi
callq 0x16220
movq 0x18(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movq -0x20(%rbp), %rsi
movb -0x1(%rbp), %al
movb %al, -0x1c9(%rbp)
leaq -0x130(%rbp), %rdi
movl $0x40, %edx
callq 0x2200
movb -0x1c9(%rbp), %al
movq -0x1c8(%rbp), %rdi
movups -0x130(%rbp), %xmm0
movups -0x120(%rbp), %xmm1
movups -0x110(%rbp), %xmm2
movups -0x100(%rbp), %xmm3
movq %rsp, %rcx
movups %xmm3, 0x30(%rcx)
movups %xmm2, 0x20(%rcx)
movups %xmm1, 0x10(%rcx)
movups %xmm0, (%rcx)
movsbl %al, %esi
callq 0x13740
jmp 0x12ea9
jmp 0x12eab
jmp 0x12ead
movq 0x60(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %esi
addl -0x8(%rbp), %esi
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edx
addl -0xc(%rbp), %edx
movl 0x68(%rbp), %ecx
callq 0x13950
movl %eax, %ecx
movq 0x70(%rbp), %rax
movl %ecx, (%rax)
movl -0x2c(%rbp), %eax
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
nopw %cs:(%rax,%rax)