// File: /workspace/github_c_makefile_star2_O3/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, -0x18(%rsp)
leaq -0x5a0(%rdi), %rax
movq %rax, -0x20(%rsp)
xorl %edx, %edx
leaq 0x1(%rdx), %rcx
cmpq $0x1d, %rdx
setne %r8b
leaq -0x1(%rdx), %r9
leal -0x1(%rdx), %eax
movl %eax, -0x24(%rsp)
imulq $0x2d0, %rdx, %rsi      # imm = 0x2D0
leaq (%rdi,%rsi), %rbx
imulq $0x2d0, %r9, %r14       # imm = 0x2D0
addq %rdi, %r14
movq -0x20(%rsp), %rax
leaq (%rax,%rsi), %r15
xorb $0x1, %r8b
movq %rcx, -0x10(%rsp)
imulq $0x2d0, %rcx, %r12      # imm = 0x2D0
addq %rdi, %r12
addq -0x18(%rsp), %rsi
movq %rsi, -0x8(%rsp)
xorl %r13d, %r13d
leaq (,%r13,2), %rbp
addq %r13, %rbp
cmpl $0x25, 0x4(%rbx,%rbp,4)
jne 0x2568
leaq (%rbx,%rbp,4), %rax
movl $0x1, (%rax)
cmpq $0x1d, %rdx
je 0x2573
movl $0x1, (%r12,%rbp,4)
cmpq $0x1c, %rdx
jae 0x2573
movq -0x8(%rsp), %rax
movl $0x1, (%rax,%rbp,4)
cmpq $0x2, %rdx
jb 0x2652
movl $0x1, (%r14,%rbp,4)
movl -0x24(%rsp), %r10d
jne 0x257e
movb $0x1, %cl
movl $0x1, %r10d
jmp 0x2588
incq %r13
movq %r13, %rax
jmp 0x2643
movl $0x1, (%r14,%rbp,4)
movl %r9d, %r10d
movl $0x1, (%r15,%rbp,4)
movb $0x1, %cl
leaq 0x1(%r13), %rax
cmpq $0x3b, %r13
je 0x25ab
leaq (%rax,%rax,2), %rsi
movl $0x1, (%rbx,%rsi,4)
cmpq $0x39, %r13
ja 0x25ab
movl $0x1, 0x18(%rbx,%rbp,4)
testb %cl, %cl
je 0x25b7
movl $0x1, -0xc(%rbx,%rbp,4)
cmpq $0x3, %r13
jb 0x25c5
movl $0x1, -0x18(%rbx,%rbp,4)
cmpq $0x3b, %r13
sete %sil
cmpq $0x1d, %rdx
sete %r11b
orb %sil, %r11b
jne 0x25e6
leaq (%rax,%rax,2), %rsi
movl $0x1, (%r12,%rsi,4)
cmpq $0x2, %r13
setb %sil
xorb $0x1, %cl
orb %cl, %sil
movl %r10d, %r10d
jne 0x260b
imulq $0x2d0, %r10, %rsi      # imm = 0x2D0
addq %rdi, %rsi
movl $0x1, -0xc(%rsi,%rbp,4)
cmpq $0x2, %r13
setb %sil
orb %r8b, %sil
jne 0x2621
movl $0x1, -0xc(%r12,%rbp,4)
cmpq $0x3b, %r13
sete %sil
orb %cl, %sil
jne 0x2643
imulq $0x2d0, %r10, %rcx      # imm = 0x2D0
addq %rdi, %rcx
leaq (%rax,%rax,2), %rsi
movl $0x1, (%rcx,%rsi,4)
movq %rax, %r13
cmpq $0x3c, %rax
jne 0x2509
jmp 0x265c
xorl %ecx, %ecx
movl %r9d, %r10d
jmp 0x2588
movq -0x10(%rsp), %rax
movq %rax, %rdx
cmpq $0x1e, %rax
jne 0x24b4
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq