// File: /workspace/github_c_makefile_star2_O0/Astor-Bizard[P]ProjetS5_Groupe2/src/lectureSH.c
// Function: readSectionsHeadersFromFile
SectionsHeadersList readSectionsHeadersFromFile(FILE *f, Elf32_Ehdr elfHeader, int silent) {
	int i;
	SectionsHeadersList shList;
	shList.size = elfHeader.e_shnum;

	// Allocation de la table des en-têtes de section
	shList.headers = (Elf32_Shdr*) malloc(sizeof(Elf32_Shdr)*shList.size);
	if (shList.headers==NULL) {
		printf("\nErreur lors de l'allocation initiale de shList.headers.\n");
		shList.names = NULL;
		shList.headers = NULL;
		shList.size = 0;
		return shList;
	}

	fseek(f, elfHeader.e_shoff, 0);
	for(i=0; i<shList.size; i++) {
		shList.headers[i].sh_name = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_type = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_flags = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_addr = (Elf32_Addr) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_offset = (Elf32_Off) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_size = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_link = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_info = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_addralign = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
		shList.headers[i].sh_entsize = (uint32_t) lire_octets(elfHeader.e_ident[EI_DATA], f, 4);
	}

	shList.names = fetchSectionNames(f, elfHeader, shList);

	if (!silent) {
		displaySectionsHeaders(elfHeader, shList);
	}

	return shList;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x18(%rbp)
movq %rdi, %rax
movq %rax, -0x28(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq %rsi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movzwl 0x30(%rax), %eax
movl %eax, 0x10(%rdi)
movslq 0x10(%rdi), %rax
imulq $0x28, %rax, %rdi
callq 0x10c0
movq -0x18(%rbp), %rdi
movq %rax, (%rdi)
cmpq $0x0, (%rdi)
jne 0x29b3
leaq 0x326e(%rip), %rdi      # 0x5bfb
movb $0x0, %al
callq 0x1070
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq $0x0, (%rax)
movl $0x0, 0x10(%rax)
jmp 0x2c58
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rdi
movl 0x20(%rax), %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x10d0
movl $0x0, -0x10(%rbp)
movq -0x18(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x2bcb
movq -0x20(%rbp), %rax
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, (%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x4(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x8(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0xc(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x10(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x14(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x18(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x1c(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq -0x18(%rbp), %rcx
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq (%rcx), %rcx
movslq -0x10(%rbp), %rsi
imulq $0x28, %rsi, %rsi
addq %rsi, %rcx
movl %edx, 0x20(%rcx)
movb 0x5(%rax), %al
movq -0x8(%rbp), %rsi
movl $0x4, %edx
movsbl %al, %edi
callq 0x1880
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x10(%rbp), %rdx
imulq $0x28, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x24(%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x29ce
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rdi
movq 0x10(%rdx), %rsi
movq %rsp, %rax
movq %rsi, 0x48(%rax)
movups (%rdx), %xmm0
movups %xmm0, 0x38(%rax)
movl 0x30(%rcx), %edx
movl %edx, 0x30(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x2340
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpl $0x0, -0xc(%rbp)
jne 0x2c56
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rdx
movq 0x10(%rdx), %rsi
movq %rsp, %rax
movq %rsi, 0x48(%rax)
movups (%rdx), %xmm0
movups %xmm0, 0x38(%rax)
movl 0x30(%rcx), %edx
movl %edx, 0x30(%rax)
movups (%rcx), %xmm0
movups 0x10(%rcx), %xmm1
movups 0x20(%rcx), %xmm2
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x2740
jmp 0x2c58
movq -0x28(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop