// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/lzexe.c
// Function: read_special_hdr
static void read_special_hdr(deark *c, lctx *d, i64 pos1)
{
	i64 pos = pos1;

	de_dbg(c, "LZEXE private info at %"I64_FMT, pos1);
	de_dbg_indent(c, 1);

	d->ephdr.regIP = de_getu16le_p(&pos);
	de_dbg(c, "ip: %u", (UI)d->ephdr.regIP);
	d->ephdr.regCS = de_geti16le_p(&pos);
	de_dbg(c, "cs: %d", (int)d->ephdr.regCS);
	d->ephdr.regSP = de_getu16le_p(&pos);
	de_dbg(c, "sp: %u", (UI)d->ephdr.regSP);
	d->ephdr.regSS = de_geti16le_p(&pos);
	de_dbg(c, "ss: %d", (int)d->ephdr.regSS);
	d->ephdr.cmpr_len_para = de_getu16le_p(&pos);
	de_dbg(c, "cmpr len: %u ("DE_CHAR_TIMES"16=%"I64_FMT")", (int)d->ephdr.cmpr_len_para,
		(i64)(d->ephdr.cmpr_len_para*16));

	// TODO: These fields could be named better
	d->ephdr.field5 = de_getu16le_p(&pos);
	de_dbg(c, "field5: %u", (UI)d->ephdr.field5);
	d->ephdr.field6 = de_getu16le_p(&pos);
	de_dbg(c, "field6: %u", (UI)d->ephdr.field6);
	if(d->ver==LZEXE_VER_090) {
		d->ephdr.field7 = de_getu16le_p(&pos);
		de_dbg(c, "field7: %u", (UI)d->ephdr.field7);
		d->ephdr.field8 = de_getu16le_p(&pos);
		de_dbg(c, "field8: %u", (UI)d->ephdr.field8);
	}

	de_dbg_indent(c, -1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0xe5b6a(%rip), %rsi     # 0x1bad05
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movl %eax, %edx
leaq 0x101cc2(%rip), %rsi    # 0x1d6ea3
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1653f0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movl %eax, %edx
leaq 0xf033f(%rip), %rsi     # 0x1c5558
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movl %eax, %edx
leaq 0xd448c(%rip), %rsi     # 0x1a96dd
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1653f0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movl %eax, %edx
leaq 0xd445b(%rip), %rsi     # 0x1a96e4
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
shlq $0x4, %rcx
leaq 0xe5a52(%rip), %rsi     # 0x1bad1f
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x60(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movl %eax, %edx
leaq 0xe5a32(%rip), %rsi     # 0x1bad37
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
movl %eax, %edx
leaq 0xe5a05(%rip), %rsi     # 0x1bad42
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0xd53bd
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movl %eax, %edx
leaq 0xe59cf(%rip), %rsi     # 0x1bad4d
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1652c0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
movl %eax, %edx
leaq 0xe59a2(%rip), %rsi     # 0x1bad58
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)