// File: /workspace/github_c_makefile_star2_O3/j4r0g[P]Projet_Labyrinthe/fonctions/labyrinthe.c
// Function: afficher_lab
void afficher_lab(t_lab lab[X][Y], t_fourmi fourmi[]){
	int char_unseen = '?';
	int indice;
	t_etat etat_tmp;
	t_discover decouvert_tmp;
	int i,j;

	printf("\n\n");
	for(i =-1; i<(X+1); i++){					//*Toute la partie qui suit gère l'affichage des bordures (avec les espacements	*//
		for(j =-1; j<(Y+1); j++){					//*particuliers pour que tout soit aligné)
			if(i == -1 && j != -1 ){							//*nombres de l'axe horizontal du haut
				if(j==0){										//*affichage du "Y" sur l'axe horizontal
					printf("\033[1;33;40m Y\033[00m");
				}
				else if(j == 58){
					printf("\033[1;33;40m Y\033[00m");
				}
				if((j%2)!=0){
					if(j == 9){
						printf("%i ", j);
					}
					else if(j < 10 ){
						printf("%i ", j);
					}
					else if(j == (Y-1) && i == -1){
					printf(" ");
					}
					else{
						printf("%i", j);
					}
				}
				else{
					printf("  ");
				}
			}
			else if(i == (X) && j!= -1 ){						//*nombres de l'axe horizontal du bas
				if((j%2)==0){
					if(j == 0){
						printf("\033[1;33;40m  Y  \033[00m");
					}
					else if( j == 60){
						printf(" ");
					}
					else if(j < 10 ){
						printf(" %i  ", j);
					}
					else if(j == (Y-1) && i == -1){
						printf(" ");
					}
					else{
						printf(" %i ", j);
					}
				}

				else if(j == 59){
					printf("\033[1;33;40mY \033[00m");
				}
			}
			else if(j == -1 && i != -1 && i != X){				//*nombres de l'axe vertical, a gauche
				if(i == 0){									//*affichage du "X" sur l'axe vertical
					printf("\033[1;33;40m X \033[00m");
				}
				else if(i == 29){									//*affichage du "X" sur l'axe vertical
					printf("\033[1;33;40m X \033[00m");
				}
				else if(i < 10 ){
					printf(" %i ", i);
				}
				else if(j == -1 && i == (X-1)){
				printf("   ");
				}
				else{
					printf("%i ", i);
				}
			}
			else if(j == Y && i != -1 && i != X){				//*nombres de l'axe vertical, a droite
				if(i == 0){
					printf("\033[1;33;40m X \033[00m");
				}
				else if(i ==29){
					printf("\033[1;33;40m X \033[00m");
				}
				else if(i < 10 ){
					printf(" %i ", i);
				}
				else if(j == -1 && i == (X-1) && i == (X)){
				printf("  ");
				}
				else{
					printf(" %i ", i);
				}
			}
			else if(j == -1 && i == -1){						//*coin supérieur gauche
				printf("  ");
			}
			else if(j == -1 && i == (X)){						//*pas de nombre en bas a gauche
				printf(" ");
			}
			else if(j == -1 && i == (X)){						//*pas de nombre en bas a gauche
				printf(" ");
			}
			else{									//*le else gère tout ce qui est a l'intérieur des bordures (insectes, nourriture)
				etat_tmp = lab[i][j].etat;
				decouvert_tmp = lab[i][j].decouvert;

				if(decouvert_tmp == 0){
				printf("\033[0;30;40m%c \033[00m", char_unseen);
				}
				else{
					if(etat_tmp == vide){
						printf("\033[0;33;43m%c \033[00m", etat_tmp);
					}
					else if(etat_tmp == mur){
						printf("\033[0;37;47m%c \033[00m", etat_tmp);
					}
					else if(etat_tmp == insecte){
						indice = lab[i][j].insecte;
						if(fourmi[indice].age <= 1 || fourmi[indice].nourriture <= 1){
							printf("\033[1;30;43m%c \033[00m", etat_tmp);
						}
						else if(fourmi[indice].age < 5 ){
							printf("\033[1;31;43m%c \033[00m", etat_tmp);
						}
						else if(fourmi[indice].nourriture < 5){
							printf("\033[1;32;43m%c \033[00m", etat_tmp);
						}
						else{
							printf("\033[1;36;43m%c \033[00m", etat_tmp);
						}
					}
					else if(etat_tmp == food){
						printf("\033[1;34;43m%c \033[00m", etat_tmp);
					}
					else{
						printf("%c ", etat_tmp);
					}
				}
			}


		}
		printf("\n");
	}
	printf("\n\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %rbx
leaq 0x4aff(%rip), %rdi      # 0x62a7
callq 0x1070
addq $-0x2d4, %rbx           # imm = 0xFD2C
movq $-0x1, %r15
leaq 0x4925(%rip), %r12      # 0x60e7
leaq 0x4948(%rip), %r13      # 0x6111
movq %rbx, %r14
xorl %ebp, %ebp
cmpq $-0x1, %r15
setne %al
leaq -0x1(%rbp), %rsi
testq %rbp, %rbp
sete %cl
orb %al, %cl
jne 0x1805
testl %esi, %esi
je 0x17ec
cmpl $0x3a, %esi
jne 0x185e
movq %r12, %rdi
xorl %eax, %eax
callq 0x10a0
movq %r13, %rdi
xorl %eax, %eax
callq 0x10a0
jmp 0x1a00
testq %rbp, %rbp
sete %al
cmpq $0x1e, %r15
setne %cl
orb %al, %cl
jne 0x1836
testb $0x1, %sil
jne 0x187b
cmpl $0x3c, %esi
je 0x191f
testl %esi, %esi
jne 0x18ce
leaq 0x48c5(%rip), %rdi      # 0x60f9
jmp 0x17f9
testq %rbp, %rbp
je 0x1891
cmpq $0x3d, %rbp
jne 0x1904
cmpl $0x1c, %r15d
jg 0x18fa
cmpl $-0x1, %r15d
je 0x1904
jmp 0x1a38
testb $0x1, %sil
je 0x17f6
cmpq $0xa, %rbp
jne 0x18e4
leaq 0x48a4(%rip), %rdi      # 0x6115
movl $0x9, %esi
jmp 0x19f9
cmpq $0x3c, %rbp
jne 0x1a00
leaq 0x488d(%rip), %rdi      # 0x6119
jmp 0x17f9
cmpl $0x1c, %r15d
jg 0x18a8
cmpl $-0x1, %r15d
je 0x1904
testl %r15d, %r15d
je 0x1959
jmp 0x18b8
cmpl $0x1d, %r15d
je 0x1959
cmpl $0x1e, %r15d
je 0x1904
cmpq $0x9, %r15
jg 0x19a6
leaq 0x484b(%rip), %rdi      # 0x6114
jmp 0x19ad
cmpq $0x9, %rsi
jg 0x1976
leaq 0x482f(%rip), %rdi      # 0x610e
jmp 0x198c
cmpq $0x9, %rsi
jg 0x197f
leaq 0x4820(%rip), %rdi      # 0x6115
jmp 0x198c
cmpl $0x1e, %r15d
jne 0x1a4d
leal -0x1(%rbp), %eax
andl %r15d, %eax
cmpl $-0x1, %eax
je 0x17f6
movq %r15, %rax
xorq $0x1e, %rax
orq %rbp, %rax
jne 0x192e
movl $0x20, %edi
callq 0x1040
jmp 0x1a00
cmpl $0x0, -0x8(%r14)
je 0x1965
movl -0x4(%r14), %esi
cmpl $0x24, %esi
jg 0x198e
cmpl $0x20, %esi
je 0x19bb
cmpl $0x23, %esi
jne 0x19b2
leaq 0x4815(%rip), %rdi      # 0x6164
movl $0x23, %esi
jmp 0x19f9
leaq 0x47cb(%rip), %rdi      # 0x612b
jmp 0x17f9
leaq 0x47d2(%rip), %rdi      # 0x613e
movl $0x3f, %esi
jmp 0x19f9
leaq 0x4797(%rip), %rdi      # 0x6114
jmp 0x198c
cmpq $0x3c, %rbp
je 0x191f
leaq 0x4c33(%rip), %rdi      # 0x65bf
jmp 0x19f9
cmpl $0x25, %esi
je 0x19c9
cmpl $0x2a, %esi
jne 0x19b2
leaq 0x4824(%rip), %rdi      # 0x61c3
movl $0x2a, %esi
jmp 0x19f9
leaq 0x4768(%rip), %rdi      # 0x6115
movl %r15d, %esi
jmp 0x19f9
leaq 0x481d(%rip), %rdi      # 0x61d6
jmp 0x19f9
leaq 0x478f(%rip), %rdi      # 0x6151
movl $0x20, %esi
jmp 0x19f9
movslq (%r14), %rax
leaq (%rax,%rax,4), %rcx
movq (%rsp), %rax
movl 0x8(%rax,%rcx,4), %eax
cmpl $0x2, %eax
jl 0x19ed
movq (%rsp), %rdx
leaq (%rdx,%rcx,4), %rcx
movl 0x4(%rcx), %ecx
cmpl $0x1, %ecx
jg 0x1a13
leaq 0x4783(%rip), %rdi      # 0x6177
movl $0x25, %esi
xorl %eax, %eax
callq 0x10a0
incq %rbp
addq $0xc, %r14
cmpq $0x3e, %rbp
jne 0x17ce
jmp 0x1a64
cmpl $0x4, %eax
ja 0x1a21
leaq 0x476b(%rip), %rdi      # 0x618a
jmp 0x19f4
cmpl $0x4, %ecx
ja 0x1a2f
leaq 0x4770(%rip), %rdi      # 0x619d
jmp 0x19f4
leaq 0x477a(%rip), %rdi      # 0x61b0
jmp 0x19f4
testl %r15d, %r15d
jne 0x1a53
leaq 0x46e7(%rip), %rdi      # 0x612b
xorl %eax, %eax
callq 0x10a0
jmp 0x1a64
cmpl $0x1d, %r15d
je 0x1a3d
leaq 0x46ba(%rip), %rdi      # 0x6114
movl %r15d, %esi
xorl %eax, %eax
callq 0x10a0
movl $0xa, %edi
callq 0x1040
incq %r15
addq $0x2d0, %rbx            # imm = 0x2D0
cmpq $0x1f, %r15
jne 0x17c9
leaq 0x481e(%rip), %rdi      # 0x62a7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1070