// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %rbp
leaq 0x4b5c(%rip), %rdi      # 0x628b
callq 0x1070
addq $-0x2d4, %rbp           # imm = 0xFD2C
movq $-0x1, %r15
leaq 0x4982(%rip), %r12      # 0x60cb
movq %r15, %rax
notq %rax
movq %rax, 0x10(%rsp)
movq %rbp, %r14
xorl %ebx, %ebx
cmpq $-0x1, %r15
setne %al
leaq -0x1(%rbx), %r13
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x17a5
leal -0x1(%rbx), %eax
cmpl $0x3a, %eax
je 0x177a
testl %eax, %eax
jne 0x1784
movq %r12, %rdi
xorl %eax, %eax
callq 0x10a0
testb $0x1, %r13b
je 0x187d
cmpq $0xa, %rbx
jne 0x1805
leaq 0x495e(%rip), %rdi      # 0x60f9
movl $0x9, %esi
jmp 0x196b
testq %rbx, %rbx
sete %al
cmpq $0x1e, %r15
setne %cl
orb %al, %cl
jne 0x17dc
testb $0x1, %r13b
jne 0x181a
leal -0x1(%rbx), %eax
cmpl $0x3c, %eax
je 0x1923
testl %eax, %eax
jne 0x1903
leaq 0x4906(%rip), %rdi      # 0x60dd
jmp 0x1884
testq %rbx, %rbx
je 0x182d
cmpq $0x3d, %rbx
jne 0x1874
cmpl $0x1c, %r15d
jg 0x1864
cmpl $-0x1, %r15d
je 0x1874
testl %r15d, %r15d
je 0x18fa
jmp 0x18f1
cmpq $0x9, %r13
jg 0x184b
leal -0x1(%rbx), %esi
leaq 0x48e4(%rip), %rdi      # 0x60f9
jmp 0x196b
cmpq $0x3c, %rbx
jne 0x1972
leaq 0x48d2(%rip), %rdi      # 0x60fd
jmp 0x1884
cmpl $0x1c, %r15d
jg 0x18db
cmpl $-0x1, %r15d
je 0x17e1
testl %r15d, %r15d
je 0x18fa
jmp 0x18eb
cmpq $0x3c, %rbx
je 0x1923
leal -0x1(%rbx), %esi
leaq 0x4d44(%rip), %rdi      # 0x65a3
jmp 0x196b
cmpl $0x1d, %r15d
je 0x18fa
cmpl $0x1e, %r15d
jne 0x18f1
andl %r15d, %r13d
cmpl $-0x1, %r13d
jne 0x1890
leaq 0x4871(%rip), %rdi      # 0x60f5
xorl %eax, %eax
callq 0x10a0
jmp 0x1972
movq %r15, %rax
xorq $0x1e, %rax
orq %rbx, %rax
je 0x1923
cmpl $0x0, -0x8(%r14)
je 0x192f
movl -0x4(%r14), %esi
cmpl $0x24, %esi
jg 0x193d
cmpl $0x20, %esi
je 0x198e
cmpl $0x23, %esi
jne 0x1985
leaq 0x4877(%rip), %rdi      # 0x6148
movl $0x23, %esi
jmp 0x196b
cmpl $0x1d, %r15d
je 0x18fa
cmpl $0x1e, %r15d
je 0x17e1
cmpq $0x9, %r15
jg 0x1961
leaq 0x4800(%rip), %rdi      # 0x60f8
jmp 0x1968
leaq 0x480e(%rip), %rdi      # 0x610f
jmp 0x1884
cmpq $0x9, %r13
jg 0x1915
leal -0x1(%rbx), %esi
leaq 0x47df(%rip), %rdi      # 0x60f2
jmp 0x196b
movq %rbx, %rax
xorq $0x3c, %rax
orq 0x10(%rsp), %rax
jne 0x1955
movl $0x20, %edi
callq 0x1040
jmp 0x1972
leaq 0x47ec(%rip), %rdi      # 0x6122
movl $0x3f, %esi
jmp 0x196b
cmpl $0x25, %esi
je 0x199c
cmpl $0x2a, %esi
jne 0x1985
leaq 0x4859(%rip), %rdi      # 0x61a7
movl $0x2a, %esi
jmp 0x196b
leal -0x1(%rbx), %esi
leaq 0x4799(%rip), %rdi      # 0x60f8
jmp 0x196b
leaq 0x4791(%rip), %rdi      # 0x60f9
movl %r15d, %esi
xorl %eax, %eax
callq 0x10a0
incq %rbx
addq $0xc, %r14
cmpq $0x3e, %rbx
jne 0x1759
jmp 0x19f5
leaq 0x482e(%rip), %rdi      # 0x61ba
jmp 0x196b
leaq 0x47a0(%rip), %rdi      # 0x6135
movl $0x20, %esi
jmp 0x196b
movslq (%r14), %rax
leaq (%rax,%rax,4), %rcx
movq 0x8(%rsp), %rax
movl 0x8(%rax,%rcx,4), %eax
cmpl $0x2, %eax
jl 0x19c2
movq 0x8(%rsp), %rdx
leaq (%rdx,%rcx,4), %rcx
movl 0x4(%rcx), %ecx
cmpl $0x1, %ecx
jg 0x19d0
leaq 0x4792(%rip), %rdi      # 0x615b
movl $0x25, %esi
jmp 0x196b
cmpl $0x4, %eax
jg 0x19de
leaq 0x4792(%rip), %rdi      # 0x616e
jmp 0x19c9
cmpl $0x4, %ecx
jg 0x19ec
leaq 0x4797(%rip), %rdi      # 0x6181
jmp 0x19c9
leaq 0x47a1(%rip), %rdi      # 0x6194
jmp 0x19c9
movl $0xa, %edi
callq 0x1040
incq %r15
addq $0x2d0, %rbp            # imm = 0x2D0
cmpq $0x1f, %r15
jne 0x1749
leaq 0x4871(%rip), %rdi      # 0x628b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1070