// File: /workspace/github_c_makefile_star2_O2/j4r0g[P]Projet_Labyrinthe/fonctions/deplacement.c
// Function: decouvrir
void decouvrir(t_lab lab[X][Y]) {
	int i, j;
  for(i=0;i<X;i++) {
    for(j=0;j<Y;j++){
      if(lab[i][j].etat==insecte) {
          lab[i][j].decouvert=seen;
          /* Découverte suivant l'axe des x*/
          if(i+1<X)
            lab[i+1][j].decouvert=seen;
          if(i+2<X)
            lab[i+2][j].decouvert=seen;
          if(i-1>0)
            lab[i-1][j].decouvert=seen;
          if(i-2>0)
            lab[i-2][j].decouvert=seen;

          /*Découverte suivant l'axe des y*/
          if(j+1<Y)
            lab[i][j+1].decouvert=seen;
          if(j+2<Y)
            lab[i][j+2].decouvert=seen;
          if(i-1>0)
            lab[i][j-1].decouvert=seen;
          if(j-2>0)
            lab[i][j-2].decouvert=seen;

          /* Découverte dans les diagonales */
          if(i+1<X && j+1<Y)
            lab[i+1][j+1].decouvert=seen;
          if(i-1>0 && j-1>0)
            lab[i-1][j-1].decouvert=seen;
          if(i+1<X && j-1>0)
            lab[i+1][j-1].decouvert=seen;
          if(i-1>0 && j+1<Y)
            lab[i-1][j+1].decouvert=seen;
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x5a0(%rdi), %rax
movq %rax, -0x10(%rsp)
leaq -0x5a0(%rdi), %rax
movq %rax, -0x20(%rsp)
xorl %edx, %edx
cmpq $0x1e, %rdx
je 0x253c
leaq 0x1(%rdx), %rcx
cmpq $0x1d, %rdx
setne %r9b
leaq -0x1(%rdx), %rax
leal -0x1(%rdx), %r11d
imulq $0x2d0, %rdx, %rsi      # imm = 0x2D0
leaq (%rdi,%rsi), %r14
movq %rax, -0x28(%rsp)
imulq $0x2d0, %rax, %r15      # imm = 0x2D0
addq %rdi, %r15
movq -0x20(%rsp), %rax
movq %rsi, -0x8(%rsp)
leaq (%rax,%rsi), %r12
xorb $0x1, %r9b
movq %rcx, -0x18(%rsp)
imulq $0x2d0, %rcx, %r13      # imm = 0x2D0
addq %rdi, %r13
xorl %ebp, %ebp
cmpq $0x3c, %rbp
je 0x2532
imulq $0xc, %rbp, %rsi
cmpl $0x25, 0x4(%rsi,%r14)
jne 0x243c
leaq (%r14,%rsi), %rax
movl $0x1, (%rax)
cmpq $0x1d, %rdx
je 0x2441
movl $0x1, (%rsi,%r13)
cmpq $0x1c, %rdx
jae 0x2441
movq -0x10(%rsp), %rax
movq -0x8(%rsp), %rcx
addq %rcx, %rax
movl $0x1, (%rsi,%rax)
cmpq $0x2, %rdx
jb 0x2526
movl $0x1, (%rsi,%r15)
movb $0x1, %cl
movq -0x28(%rsp), %rax
movl %eax, %r8d
movl $0x1, %eax
jne 0x244c
jmp 0x2459
incq %rbp
jmp 0x23cf
movl $0x1, (%rsi,%r15)
movl %r11d, %r8d
movl $0x1, (%rsi,%r12)
movb $0x1, %cl
movl %r8d, %eax
leaq 0x1(%rbp), %r8
cmpq $0x3b, %rbp
je 0x247e
imulq $0xc, %r8, %r10
movl $0x1, (%r10,%r14)
cmpq $0x39, %rbp
ja 0x247e
movl $0x1, 0x18(%rsi,%r14)
testb %cl, %cl
je 0x248b
movl $0x1, -0xc(%rsi,%r14)
cmpq $0x3, %rbp
jb 0x249a
movl $0x1, -0x18(%rsi,%r14)
cmpq $0x3b, %rbp
sete %r10b
cmpq $0x1d, %rdx
sete %bl
orb %r10b, %bl
jne 0x24ba
imulq $0xc, %r8, %r10
movl $0x1, (%r10,%r13)
cmpq $0x2, %rbp
setb %r10b
xorb $0x1, %cl
orb %cl, %r10b
movl %eax, %eax
jne 0x24df
imulq $0x2d0, %rax, %r10      # imm = 0x2D0
addq %rdi, %r10
movl $0x1, -0xc(%rsi,%r10)
cmpq $0x2, %rbp
setb %r10b
orb %r9b, %r10b
jne 0x24f5
movl $0x1, -0xc(%rsi,%r13)
cmpq $0x3b, %rbp
sete %sil
orb %cl, %sil
movq %r8, %rbp
jne 0x23cf
imulq $0x2d0, %rax, %rax      # imm = 0x2D0
addq %rdi, %rax
imulq $0xc, %r8, %rcx
movl $0x1, (%rcx,%rax)
movq %r8, %rbp
jmp 0x23cf
xorl %ecx, %ecx
movq -0x28(%rsp), %rax
jmp 0x2459
movq -0x18(%rsp), %rdx
jmp 0x2374
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq