// File: /workspace/github_c_makefile_star2_O0/Astor-Bizard[P]ProjetS5_Groupe2/src/lectureST.c
// Function: afficherTableSymboles
void afficherTableSymboles(ListeSymboles listeSymboles, Elf32_Ehdr elfHeader) {
	char* symbolString;
	unsigned char bind, info;
	int j;

	printf("\nSymbol table '.symtab' contains %d entries:\n", listeSymboles.nbSymboles);
	printf("   Num:    Value  Size Type    Bind   Vis      Ndx Name\n");

	for(j=0; j<listeSymboles.nbSymboles; j++)
	{
		info = 15 & listeSymboles.symboles[j].st_info;
		bind = 15<<4 & listeSymboles.symboles[j].st_info;

		symbolString = getSymbolNameBis(listeSymboles.names, listeSymboles.symboles[j]);

		printf("   %3d: %08x %5d %-7s %-6s %-7s  ", j, listeSymboles.symboles[j].st_value, listeSymboles.symboles[j].st_size, typeSymbole(info), bindSymbole(bind), visionSymbole(listeSymboles.symboles[j].st_other));
		switch(listeSymboles.symboles[j].st_shndx)
		{
			case 0: printf("UND ");
				break;
			case 65521: printf("ABS ");
				break;
			case 65522: printf("COM ");
				break;
			default: printf("%3d ", listeSymboles.symboles[j].st_shndx);
		}
		printf("%s\n", symbolString);
		free(symbolString);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq 0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movl 0x10(%rax), %esi
leaq 0x2471(%rip), %rdi      # 0x5e4b
movb $0x0, %al
callq 0x1070
leaq 0x2491(%rip), %rdi      # 0x5e79
movb $0x0, %al
callq 0x1070
movl $0x0, -0x10(%rbp)
movq -0x18(%rbp), %rcx
movl -0x10(%rbp), %eax
cmpl 0x10(%rcx), %eax
jge 0x3b88
movq -0x18(%rbp), %rcx
movq (%rcx), %rax
movslq -0x10(%rbp), %rdx
shlq $0x4, %rdx
movb 0xc(%rax,%rdx), %al
andb $0xf, %al
movb %al, -0xa(%rbp)
movq (%rcx), %rax
movslq -0x10(%rbp), %rdx
shlq $0x4, %rdx
movb 0xc(%rax,%rdx), %al
andb $-0x10, %al
movb %al, -0x9(%rbp)
movq (%rcx), %rax
movq 0x8(%rcx), %rdi
movslq -0x10(%rbp), %rcx
shlq $0x4, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
callq 0x3b90
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, -0x8(%rbp)
movslq -0x10(%rbp), %rcx
movl %ecx, %edx
movl %edx, -0x3c(%rbp)
movq (%rax), %rax
shlq $0x4, %rcx
movl 0x4(%rax,%rcx), %edx
movl %edx, -0x38(%rbp)
movl 0x8(%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
movzbl -0xa(%rbp), %edi
callq 0x3bc0
movq %rax, -0x30(%rbp)
movzbl -0x9(%rbp), %edi
callq 0x3c60
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq (%rax), %rax
movslq -0x10(%rbp), %rcx
shlq $0x4, %rcx
movzbl 0xd(%rax,%rcx), %edi
callq 0x3cf0
movl -0x3c(%rbp), %esi
movl -0x38(%rbp), %edx
movl -0x34(%rbp), %ecx
movq -0x30(%rbp), %r8
movq -0x28(%rbp), %r9
movq %rax, %rdi
movq %rsp, %rax
movq %rdi, (%rax)
leaq 0x23e3(%rip), %rdi      # 0x5eb2
xorl %eax, %eax
callq 0x1070
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x10(%rbp), %rcx
shlq $0x4, %rcx
movzwl 0xe(%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
testl %eax, %eax
je 0x3b0b
jmp 0x3af3
movl -0x1c(%rbp), %eax
subl $0xfff1, %eax           # imm = 0xFFF1
je 0x3b1b
jmp 0x3aff
movl -0x1c(%rbp), %eax
subl $0xfff2, %eax           # imm = 0xFFF2
je 0x3b2b
jmp 0x3b3b
leaq 0x23c2(%rip), %rdi      # 0x5ed4
movb $0x0, %al
callq 0x1070
jmp 0x3b5f
leaq 0x23b7(%rip), %rdi      # 0x5ed9
movb $0x0, %al
callq 0x1070
jmp 0x3b5f
leaq 0x23ac(%rip), %rdi      # 0x5ede
movb $0x0, %al
callq 0x1070
jmp 0x3b5f
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x10(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0xe(%rax), %esi
leaq 0x238b(%rip), %rdi      # 0x5ee3
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rsi
leaq 0x17c9(%rip), %rdi      # 0x5333
movb $0x0, %al
callq 0x1070
movq -0x8(%rbp), %rdi
callq 0x1030
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x39f6
addq $0x50, %rsp
popq %rbp
retq
nop