// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/arcfs.c
// Function: do_squash_main
static void do_squash_main(deark *c, sqctx *d)
{
	dbuf *outf = NULL;
	de_finfo *fi = NULL;
	de_ucstring *fn = NULL;
	struct de_dfilter_results dres;
	struct de_dfilter_in_params dcmpri;
	struct de_dfilter_out_params dcmpro;
	struct de_lzw_params delzwp;
	int saved_indent_level;

	de_dbg_indent_save(c, &saved_indent_level);
	de_dfilter_init_objects(c, &dcmpri, &dcmpro, &dres);

	dcmpri.f = c->infile;
	dcmpri.pos = 20;
	dcmpri.len = c->infile->len - dcmpri.pos;
	de_dbg(c, "compressed data at %"I64_FMT, dcmpri.pos);
	de_dbg_indent(c, 1);

	fi = de_finfo_create(c);

	fn = ucstring_create(c);

	fi->has_riscos_data = 1;
	fi->riscos_attribs = d->rfa.attribs;
	fi->load_addr = d->rfa.load_addr;
	fi->exec_addr = d->rfa.exec_addr;

	ucstring_append_sz(fn, "bin", DE_ENCODING_LATIN1);
	fmtutil_riscos_append_type_to_filename(c, fi, fn, &d->rfa, 0, 1);
	de_finfo_set_name_from_ucstring(c, fi, fn, 0);

	if(d->rfa.mod_time.is_valid) {
		fi->timestamp[DE_TIMESTAMPIDX_MODIFY] = d->rfa.mod_time;
	}

	outf = dbuf_create_output_file(c, NULL, fi, 0);
	dbuf_enable_wbuffer(outf);
	dcmpro.f = outf;
	dcmpro.len_known = 0;

	de_zeromem(&delzwp, sizeof(struct de_lzw_params));
	delzwp.fmt = DE_LZWFMT_UNIXCOMPRESS;
	delzwp.flags |= DE_LZWFLAG_HAS3BYTEHEADER;

	fmtutil_decompress_lzw(c, &dcmpri, &dcmpro, &dres, &delzwp);
	dbuf_flush(dcmpro.f);

	if(dres.errcode) {
		de_err(c, "%s", de_dfilter_get_errmsg(c, &dres));
		goto done;
	}

	if(outf->len != d->orig_len) {
		de_err(c, "Decompression failed, expected size %"I64_FMT
			", got %"I64_FMT, d->orig_len, outf->len);
		goto done;
	}

done:
	dbuf_close(outf);
	de_finfo_destroy(c, fi);
	ucstring_destroy(fn);
	de_dbg_indent_restore(c, saved_indent_level);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x15b580
movq -0x8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x1773f0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xa8(%rbp)
movq $0x14, -0xa0(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rax
subq -0xa0(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
movq -0xa0(%rbp), %rdx
leaq 0x18fa74(%rip), %rsi    # 0x1bdbe3
movb $0x0, %al
callq 0x15b0d0
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x15b560
movq -0x8(%rbp), %rdi
callq 0x15d230
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1711d0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movb $0x1, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x14(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xa0(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xa4(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0xa8(%rax)
movq -0x28(%rbp), %rdi
leaq 0x193023(%rip), %rsi    # 0x1c1207
movl $0x5, %edx
callq 0x1715e0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rcx
addq $0x8, %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x175820
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
xorl %ecx, %ecx
callq 0x15d2c0
movq -0x10(%rbp), %rax
cmpb $0x0, 0x28(%rax)
je 0x2e245
movq -0x20(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq 0x30(%rcx), %rcx
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
xorl %ecx, %ecx
callq 0x166c60
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x167b90
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movb $0x0, -0xb8(%rbp)
leaq -0xd4(%rbp), %rdi
xorl %esi, %esi
movl $0x14, %edx
callq 0x19140
movl $0x1, -0xd4(%rbp)
movl -0xd0(%rbp), %eax
orl $0x1, %eax
movl %eax, -0xd0(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
leaq -0x88(%rbp), %rcx
leaq -0xd4(%rbp), %r8
callq 0x1843b0
movq -0xc0(%rbp), %rdi
callq 0x167c30
cmpl $0x0, -0x88(%rbp)
je 0x2e312
movq -0x8(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x177360
movq -0xe0(%rbp), %rdi
movq %rax, %rdx
leaq 0x172826(%rip), %rsi    # 0x1a0b2f
movb $0x0, %al
callq 0x15bfb0
jmp 0x2e348
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
je 0x2e346
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x171d4f(%rip), %rsi    # 0x1a008c
movb $0x0, %al
callq 0x15bfb0
jmp 0x2e348
jmp 0x2e348
movq -0x18(%rbp), %rdi
callq 0x1676a0
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15d260
movq -0x28(%rbp), %rdi
callq 0x171750
movq -0x8(%rbp), %rdi
movl -0xd8(%rbp), %esi
callq 0x15b5a0
addq $0xe0, %rsp
popq %rbp
retq
nop