// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/hlp.c
// Function: de_run_hlp
static void de_run_hlp(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	i64 pos;

	d = de_malloc(c, sizeof(lctx));

	d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_WINDOWS1252);
	d->extract_text = de_get_ext_option_bool(c, "hlp:extracttext",
		((c->extract_level>=2)?1:0));
	d->extract_raw_streams = (u8)de_get_ext_option_bool(c, "hlp:extractstreams", 0);
	d->tmpdbuf1 = dbuf_create_membuf(c, 0, 0);
	d->unc_linkdata2_dbuf = dbuf_create_membuf(c, 0, 0);
	d->tmpucstring1 = ucstring_create(c);
	d->phrases_data = dbuf_create_membuf(c, 0, 0);

	pos = 0;
	do_header(c, d, pos);

	do_file(c, d, d->internal_dir_FILEHEADER_offs, FILETYPE_INTERNALDIR, 0, NULL);

	de_dbg(c, "summary: v%d.%d %s%s%s blksize=%d levels=%d%s%s%s",
		d->ver_major, d->ver_minor,
		d->is_lz77_compressed?"lz77":"no_lz77",
		d->uses_old_phrase_compression?" phrase_compression":"",
		d->uses_hall_compression?" Hall_compression":"",
		(int)d->topic_block_size,
		(int)d->internal_dir_num_levels,
		d->has_shg?" has-shg":"",
		d->has_ico?" has-ico":"",
		d->has_bmp?" has-bmp":"");

	if(d) {
		dbuf_close(d->tmpdbuf1);
		dbuf_close(d->unc_linkdata2_dbuf);
		dbuf_close(d->phrases_data);
		ucstring_destroy(d->tmpucstring1);
		ucstring_destroy(d->help_file_title);
		ucstring_destroy(d->help_file_copyright);
		dbuf_close(d->outf_text);
		de_free(c, d->phrase_info);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movl $0x130, %esi            # imm = 0x130
callq 0x15b780
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x9, %edx
callq 0x15e4a0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x90(%rax), %ecx
xorl %edx, %edx
movl $0x1, %eax
cmpl $0x2, %ecx
cmovgel %eax, %edx
leaq 0x131a50(%rip), %rsi    # 0x1acc6d
callq 0x15cbc0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rdi
leaq 0x131a47(%rip), %rsi    # 0x1acc7d
xorl %edx, %edx
callq 0x15cbc0
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x168020
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x168020
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x28(%rbp), %rdi
callq 0x1711d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x108(%rax)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x168020
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0xf0(%rax)
movq $0x0, -0x40(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x7b550
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdx
movl $0x3, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
movl %eax, %r9d
callq 0x7b630
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x88(%rax), %edx
movq -0x38(%rbp), %rax
movl 0x8c(%rax), %ecx
movq -0x38(%rbp), %rax
movl 0x98(%rax), %esi
leaq 0x1319aa(%rip), %r8     # 0x1accc2
leaq 0x12ea00(%rip), %rax    # 0x1a9d1f
cmpl $0x0, %esi
cmovneq %rax, %r8
movq -0x38(%rbp), %rax
movl 0x9c(%rax), %esi
leaq 0x155899(%rip), %r9     # 0x1d0bd0
leaq 0x13198c(%rip), %rax    # 0x1accca
cmpl $0x0, %esi
cmovneq %rax, %r9
movq -0x38(%rbp), %rax
movl 0xa0(%rax), %esi
leaq 0x15587a(%rip), %r15    # 0x1d0bd0
leaq 0x131981(%rip), %rax    # 0x1accde
cmpl $0x0, %esi
cmovneq %rax, %r15
movq -0x38(%rbp), %rax
movq 0x90(%rax), %rax
movl %eax, %r14d
movq -0x38(%rbp), %rax
movq 0xb8(%rax), %rax
movl %eax, %ebx
movq -0x38(%rbp), %rax
movl 0xa8(%rax), %esi
leaq 0x155840(%rip), %r11    # 0x1d0bd0
leaq 0x131959(%rip), %rax    # 0x1accf0
cmpl $0x0, %esi
cmovneq %rax, %r11
movq -0x38(%rbp), %rax
movl 0xac(%rax), %esi
leaq 0x155821(%rip), %r10    # 0x1d0bd0
leaq 0x131943(%rip), %rax    # 0x1accf9
cmpl $0x0, %esi
cmovneq %rax, %r10
movq -0x38(%rbp), %rax
movl 0xb0(%rax), %r12d
leaq 0x155801(%rip), %rax    # 0x1d0bd0
leaq 0x13192c(%rip), %rsi    # 0x1acd02
cmpl $0x0, %r12d
cmovneq %rsi, %rax
leaq 0x1318ab(%rip), %rsi    # 0x1acc90
movq %r15, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movq %r11, 0x18(%rsp)
movq %r10, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movb $0x0, %al
callq 0x15b0d0
cmpq $0x0, -0x38(%rbp)
je 0x7b4a4
movq -0x38(%rbp), %rax
movq 0xd0(%rax), %rdi
callq 0x1676a0
movq -0x38(%rbp), %rax
movq 0xd8(%rax), %rdi
callq 0x1676a0
movq -0x38(%rbp), %rax
movq 0xf0(%rax), %rdi
callq 0x1676a0
movq -0x38(%rbp), %rax
movq 0x108(%rax), %rdi
callq 0x171750
movq -0x38(%rbp), %rax
movq 0x110(%rax), %rdi
callq 0x171750
movq -0x38(%rbp), %rax
movq 0x118(%rax), %rdi
callq 0x171750
movq -0x38(%rbp), %rax
movq 0xc0(%rax), %rdi
callq 0x1676a0
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x100(%rax), %rsi
callq 0x15b820
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x15b820
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)