// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/mscompress.c
// Function: do_header_SZDD
static int do_header_SZDD(deark *c, lctx *d, i64 pos1)
{
	u8 cmpr_mode;
	u8 fnchar;
	i64 pos = pos1;
	char tmps[80];
	int retval = 0;

	de_dbg(c, "header at %d", (int)pos);
	de_dbg_indent(c, 1);

	d->cmpr_data_pos = 14;
	d->cmpr_data_len = d->inf->len - d->cmpr_data_pos;

	pos += 8; // signature

	cmpr_mode = dbuf_getbyte_p(d->inf, &pos);
	de_dbg(c, "compression mode: 0x%02x ('%c')", (unsigned int)cmpr_mode,
		de_byte_to_printable_char(cmpr_mode));
	if(cmpr_mode != 0x41) {
		de_err(c, "Unsupported compression mode");
		goto done;
	}
	d->cmpr_meth = CMPR_LZSS16;

	fnchar = dbuf_getbyte_p(d->inf, &pos);
	if(fnchar>=32 && fnchar<=126) {
		de_snprintf(tmps, sizeof(tmps), " ('%c')", fnchar);
	}
	else if(fnchar==0) {
		de_snprintf(tmps, sizeof(tmps), " (unknown)");
	}
	else {
		de_strlcpy(tmps, "", sizeof(tmps));
	}
	de_dbg(c, "missing filename char: 0x%02x%s", (unsigned int)fnchar, tmps);

	d->uncmpr_len = dbuf_getu32le_p(d->inf, &pos);
	d->uncmpr_len_known = 1;
	de_dbg(c, "uncompressed len: %"I64_FMT, d->uncmpr_len);

	retval = 1;
done:
	de_dbg_indent(c, -1);
	return retval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x84(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl %eax, %edx
leaq 0xe2e54(%rip), %rsi     # 0x1c4f8e
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x10(%rbp), %rax
movq $0xe, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
subq 0x10(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movb %al, -0x19(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movzbl -0x19(%rbp), %eax
movl %eax, -0x88(%rbp)
movzbl -0x19(%rbp), %edi
callq 0x161a80
movq -0x90(%rbp), %rdi
movl -0x88(%rbp), %edx
movsbl %al, %ecx
leaq 0xdaad3(%rip), %rsi     # 0x1bcc9f
movb $0x0, %al
callq 0x15b0d0
movzbl -0x19(%rbp), %eax
cmpl $0x41, %eax
je 0xe21f3
movq -0x8(%rbp), %rdi
leaq 0xdaad8(%rip), %rsi     # 0x1bccbf
movb $0x0, %al
callq 0x15bfb0
jmp 0xe22dc
movq -0x10(%rbp), %rax
movl $0x10000, 0xc(%rax)     # imm = 0x10000
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165170
movb %al, -0x1a(%rbp)
movzbl -0x1a(%rbp), %eax
cmpl $0x20, %eax
jl 0xe2241
movzbl -0x1a(%rbp), %eax
cmpl $0x7e, %eax
jg 0xe2241
leaq -0x80(%rbp), %rdi
movzbl -0x1a(%rbp), %ecx
movl $0x50, %esi
leaq 0xdaa7f(%rip), %rdx     # 0x1bccb7
movb $0x0, %al
callq 0x15a980
jmp 0xe227a
movzbl -0x1a(%rbp), %eax
cmpl $0x0, %eax
jne 0xe2263
leaq -0x80(%rbp), %rdi
movl $0x50, %esi
leaq 0xd1683(%rip), %rdx     # 0x1b38dd
movb $0x0, %al
callq 0x15a980
jmp 0xe2278
leaq -0x80(%rbp), %rdi
leaq 0xee962(%rip), %rsi     # 0x1d0bd0
movl $0x50, %edx
callq 0x15aa30
jmp 0xe227a
movq -0x8(%rbp), %rdi
movzbl -0x1a(%rbp), %edx
leaq -0x80(%rbp), %rcx
leaq 0xdaa4f(%rip), %rsi     # 0x1bccdc
movb $0x0, %al
callq 0x15b0d0
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
leaq -0x28(%rbp), %rsi
callq 0x165580
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movb $0x1, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0xc7557(%rip), %rsi     # 0x1a9822
movb $0x0, %al
callq 0x15b0d0
movl $0x1, -0x84(%rbp)
movq -0x8(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15b560
movl -0x84(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)