// File: /workspace/github_c_makefile_star2_O0/Astor-Bizard[P]ProjetS5_Groupe2/src/afficher_section.c
// Function: index_Shdr
int index_Shdr(char str[], SectionsHeadersList shList) {
	int i,num_sh;
	char *name;
	int different;
	if(str[0]!='\0'){
		// Cas nombre : on traduit le nombre (string) en int
		i=0;
		num_sh=0;
		while(is_digit(str[i])){
			num_sh = num_sh*10 + str[i]-ASCII_0;
			i++;
		}
		if(str[i]=='\0'){
			if(num_sh<shList.size){
				name=getSectionNameBis(shList.names, shList.headers[num_sh]);
				strcpy(str, name);
				free(name);
			}
			else num_sh=-1;
		}
		// Cas nom : on le cherche dans la table shstrtab
		else{
			num_sh=-1;
			different=1;
			while(num_sh<shList.size-1 && different){
				num_sh++;
				name=getSectionNameBis(shList.names, shList.headers[num_sh]);
				different=strcmp(str, name);
				free(name);
			}
			if(different) num_sh=-1;
		}
		return num_sh;
	}
	else return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x308b
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x2c70
cmpl $0x0, %eax
je 0x2f1e
imull $0xa, -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
movslq -0x14(%rbp), %rdx
movsbl (%rcx,%rdx), %ecx
addl %ecx, %eax
subl $0x30, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2ee5
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x2fb8
movq -0x80(%rbp), %rcx
movl -0x18(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x2fac
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x88(%rbp)
movq (%rax), %rsi
movslq -0x18(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0x50(%rbp), %rdi
movl $0x28, %edx
callq 0x10b0
movq -0x88(%rbp), %rdi
movq -0x30(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x50(%rbp), %xmm0
movups -0x40(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x24f0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1040
movq -0x20(%rbp), %rdi
callq 0x1030
jmp 0x2fb3
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
jmp 0x3083
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x24(%rbp)
movq -0x80(%rbp), %rax
movl -0x18(%rbp), %ecx
movl 0x10(%rax), %edx
subl $0x1, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x89(%rbp)
jge 0x2fec
cmpl $0x0, -0x24(%rbp)
setne %al
movb %al, -0x89(%rbp)
movb -0x89(%rbp), %al
testb $0x1, %al
jne 0x2ff8
jmp 0x3074
movq -0x80(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x18(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x98(%rbp)
movq (%rax), %rsi
movslq -0x18(%rbp), %rax
imulq $0x28, %rax, %rax
addq %rax, %rsi
leaq -0x78(%rbp), %rdi
movl $0x28, %edx
callq 0x10b0
movq -0x98(%rbp), %rdi
movq -0x58(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x20(%rax)
movups -0x78(%rbp), %xmm0
movups -0x68(%rbp), %xmm1
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x24f0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1090
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1030
jmp 0x2fc6
cmpl $0x0, -0x24(%rbp)
je 0x3081
movl $0xffffffff, -0x18(%rbp) # imm = 0xFFFFFFFF
jmp 0x3083
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3092
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nop