// File: /workspace/github_c_makefile_star2_O2/j4r0g[P]Projet_Labyrinthe/fonctions/utilisateur.c
// Function: action_user
int action_user(t_lab lab[X][Y], int bouffe, int dureevie, t_fourmi fourmi[]){
  int choix, i, j;
  char reponse='\0';
  do {
    printf(" 1 - Ajouter de la nourriture\n");
    printf(" 2 - Ajouter un insecte\n");
    printf(" 3 - Passer\n");
    printf(" 4 - Abandonner la partie\n");
    printf(" 5 - Sauvegarder la partie\n");
    printf(" 6 - Charger la partie\n");
    printf("Votre choix : ");
    scanf("%i%*c", &choix);

    switch(choix) {
		case 1 : ajout_nourriture(lab) ; break;
		case 2 : ajout_insecte(lab, bouffe, dureevie, fourmi) ; break;
		case 3 : break;
		case 4 : {  printf("Souhaitez vous vraiment abandonner la partie ? (y/n) : ");
					scanf("%c%*c", &reponse);
					if(reponse!='y' || reponse!='n') {
						while(reponse!='y' && reponse!='n') {
							printf("Souhaitez vous vraiment abandonner la partie ? (y/n) : ");
							scanf("%c%*c", &reponse);
						}
						if(reponse=='n')
							choix=7;
						}
				 } ; break;
		case 5 :{
					sauver_lab(lab, fourmi);
				}  ; break;
		case 6 :{
					charger_lab(lab, fourmi);
				} ; break;
		case 666 : decouvrir_lab(lab); break;
    default : printf("\nErreur retentez\n\n"); choix=7; break;

    }
  }
  while(choix==7);
  if(choix==4)
    return 0;
  else
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x10(%rsp)
movl %edx, 0xc(%rsp)
movl %esi, 0x8(%rsp)
movq %rdi, %r15
leaq 0x3(%rsp), %r12
movb $0x0, (%r12)
leaq 0x4(%rsp), %r13
leaq 0x3392(%rip), %rbx      # 0x54f4
leaq 0x349f(%rip), %rbp      # 0x5608
leaq 0x34d0(%rip), %r14      # 0x5640
leaq 0x3506(%rip), %rdi      # 0x567d
callq 0x1070
leaq 0x3518(%rip), %rdi      # 0x569b
callq 0x1070
leaq 0x3524(%rip), %rdi      # 0x56b3
callq 0x1070
leaq 0x3524(%rip), %rdi      # 0x56bf
callq 0x1070
leaq 0x3532(%rip), %rdi      # 0x56d9
callq 0x1070
leaq 0x3541(%rip), %rdi      # 0x56f4
callq 0x1070
leaq 0x2fff(%rip), %rdi      # 0x51be
xorl %eax, %eax
callq 0x10a0
leaq 0x3435(%rip), %rdi      # 0x5602
movq %r13, %rsi
xorl %eax, %eax
callq 0x1130
movl 0x4(%rsp), %eax
leal -0x1(%rax), %ecx
cmpl $0x5, %ecx
ja 0x221e
movslq (%rbx,%rcx,4), %rax
addq %rbx, %rax
jmpq *%rax
movq %r15, %rdi
callq 0x1db0
jmp 0x225d
movq %rbp, %rdi
xorl %eax, %eax
callq 0x10a0
movq %r14, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1130
movzbl 0x3(%rsp), %eax
cmpl $0x79, %eax
je 0x225d
cmpl $0x6e, %eax
jne 0x21f6
jmp 0x226f
cmpl $0x29a, %eax            # imm = 0x29A
jne 0x2263
movq %r15, %rdi
callq 0x1a51
jmp 0x225d
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x1f4f
jmp 0x225d
movq %r15, %rdi
callq 0x1eac
jmp 0x225d
movq %r15, %rdi
movl 0x8(%rsp), %esi
movl 0xc(%rsp), %edx
movq 0x10(%rsp), %rcx
callq 0x3050
movl 0x4(%rsp), %eax
jmp 0x227a
leaq 0x34a1(%rip), %rdi      # 0x570b
callq 0x1070
movl $0x7, 0x4(%rsp)
pushq $0x7
popq %rax
cmpl $0x7, %eax
je 0x2170
cmpl $0x4, %eax
pushq $0x1
popq %rax
jne 0x228d
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rax
jmp 0x228d
nopl (%rax)