// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/pkm.c
// Function: pkm_read_postheader
static void pkm_read_postheader(deark *c, struct pkm_ctx *d, i64 pos1)
{
	i64 pos = pos1;
	i64 endpos = pos1 + d->ph_size;
	int saved_indent_level;

	de_dbg(c, "post-header at %"I64_FMT, pos1);

	de_dbg_indent_save(c, &saved_indent_level);
	de_dbg_indent(c, 1);

	while(1) {
		u8 id;
		i64 field_pos;
		i64 field_size;

		field_pos = pos;
		if(field_pos+2 > endpos) goto done;
		id = de_getbyte_p(&pos);
		field_size = (i64)de_getbyte_p(&pos);
		de_dbg(c, "field at %"I64_FMT", type=%u, dlen=%u", field_pos, (UI)id,
			(UI)field_size);
		de_dbg_indent(c, 1);
		switch(id) {
		case 0:
			pkm_read_comment(c, d, pos, field_size);
			break;
		case 1:
			pkm_read_orig_screen_size(c, d, pos, field_size);
			break;
		case 2:
			pkm_read_back_color(c, d, pos, field_size);
			break;
		default:
			de_dbg_hexdump(c, c->infile, pos, field_size, 256, NULL, 0x1);
		}
		de_dbg_indent(c, -1);
		pos += field_size;
	}

done:
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
addq 0x18(%rcx), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xb122d(%rip), %rsi     # 0x1c3da8
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x2, %rax
cmpq -0x28(%rbp), %rax
jle 0x112bb8
jmp 0x112cc4
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
movq %rsi, -0x50(%rbp)
callq 0x165170
movq -0x50(%rbp), %rsi
movb %al, -0x2d(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x165170
movzbl %al, %eax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
movzbl -0x2d(%rbp), %ecx
movl -0x40(%rbp), %r8d
leaq 0xb11bc(%rip), %rsi     # 0x1c3dbb
xorl %eax, %eax
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movzbl -0x2d(%rbp), %eax
movl %eax, -0x44(%rbp)
testl %eax, %eax
je 0x112c35
jmp 0x112c21
movl -0x44(%rbp), %eax
subl $0x1, %eax
je 0x112c4c
jmp 0x112c2b
movl -0x44(%rbp), %eax
subl $0x2, %eax
je 0x112c63
jmp 0x112c7a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x112e80
jmp 0x112ca5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x112f10
jmp 0x112ca5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0x112fa0
jmp 0x112ca5
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %rcx
movl $0x100, %r8d            # imm = 0x100
xorl %eax, %eax
movl %eax, %r9d
movl $0x1, (%rsp)
callq 0x15b840
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movq -0x40(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x112b9d
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0x15b5a0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)