// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/exe.c
// Function: do_pe_section_header
static void do_pe_section_header(deark *c, lctx *d, i64 section_index, i64 pos)
{
	i64 section_data_size;
	struct de_stringreaderdata *srd = NULL;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg(c, "section[%d] header at %"I64_FMT, (int)section_index, pos);
	de_dbg_indent(c, 1);

	// Section name: "An 8-byte, null-padded UTF-8 encoded string"
	srd = dbuf_read_string(c->infile, pos, 8, 8, DE_CONVFLAG_STOP_AT_NUL, DE_ENCODING_UTF8);
	de_dbg(c, "section name: \"%s\"", ucstring_getpsz(srd->str));

	d->pe_cur_section_virt_addr = de_getu32le(pos+12);
	section_data_size = de_getu32le(pos+16);
	d->pe_cur_section_data_offset = de_getu32le(pos+20);

	de_dbg(c, "section virt. addr=%"I64_FMT" (0x%08x)", d->pe_cur_section_virt_addr, (UI)d->pe_cur_section_virt_addr);
	de_dbg(c, "section data offset=%"I64_FMT", size=%"I64_FMT, d->pe_cur_section_data_offset, section_data_size);

	if(!de_strcmp(srd->sz, ".rsrc")) {
		do_pe_resource_section(c, d, d->pe_cur_section_data_offset, section_data_size);
	}

	de_destroy_stringreaderdata(c, srd);
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
movq -0x20(%rbp), %rcx
leaq 0x1470af(%rip), %rsi    # 0x1a8d01
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
movl $0x8, %ecx
movl $0x1, %r8d
movl $0x2, %r9d
movq %rcx, %rdx
callq 0x1664c0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x172500
movq -0x40(%rbp), %rdi
movq %rax, %rdx
leaq 0x147068(%rip), %rsi    # 0x1a8d1b
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0xc, %rsi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x10, %rsi
callq 0x165540
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x14, %rsi
callq 0x165540
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0xf8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0xf0(%rax), %rax
movl %eax, %ecx
leaq 0x146ff2(%rip), %rsi    # 0x1a8d2e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0xf8(%rax), %rdx
movq -0x28(%rbp), %rcx
leaq 0x146ff1(%rip), %rsi    # 0x1a8d4e
movb $0x0, %al
callq 0x15b0d0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x146ffd(%rip), %rsi    # 0x1a8d70
callq 0x191a0
cmpl $0x0, %eax
jne 0x61d99
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0xf8(%rax), %rdx
movq -0x28(%rbp), %rcx
callq 0x61dc0
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x166830
movq -0x8(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x15b5a0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)