// File: /workspace/github_c_makefile_star2_O1/jsummers[P]deark/modules/stuffit.c
// Function: de_run_stuffit
static void de_run_stuffit(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;

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

	if(!dbuf_memcmp(c->infile, 0, "SIT!", 4)) {
		d->file_fmt = 1;
	}
	else if(!dbuf_memcmp(c->infile, 0, "StuffIt ", 8)) {
		d->file_fmt = 2;
	}
	else {
		de_err(c, "Not a StuffIt file, or unknown version.");
		goto done;
	}

	if(d->file_fmt==2) {
		d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_UTF8);
	}
	else {
		d->input_encoding = de_get_input_encoding(c, NULL, DE_ENCODING_MACROMAN);
	}

	d->curpath = de_strarray_create(c, MAX_NESTING_LEVEL+10);
	d->crco_rfork = de_crcobj_create(c, DE_CRCOBJ_CRC16_ARC);
	d->crco_dfork = de_crcobj_create(c, DE_CRCOBJ_CRC16_ARC);
	d->crco_hdr = de_crcobj_create(c, DE_CRCOBJ_CRC16_ARC);

	if(d->file_fmt==1) {
		de_declare_fmt(c, "StuffIt, old format");
		do_oldfmt(c, d);
	}
	else if(d->file_fmt==2) {
		de_declare_fmt(c, "StuffIt, v5 format");
		do_v5(c, d);
	}
	else {
		de_err(c, "This version of StuffIt format is not supported.");
	}

done:
	if(d) {
		de_crcobj_destroy(d->crco_rfork);
		de_crcobj_destroy(d->crco_dfork);
		de_crcobj_destroy(d->crco_hdr);
		de_strarray_destroy(d->curpath);
		if(d->v5_offsets_seen) de_inthashtable_destroy(c, d->v5_offsets_seen);
		de_free(c, d);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbx
movl $0x58, %esi
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0x6ae8d(%rip), %rdx     # 0x141c11
movl $0x4, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
je 0xd6dbb
movq 0x18(%rbx), %rdi
leaq 0x6ae77(%rip), %rdx     # 0x141c16
movl $0x8, %ecx
xorl %esi, %esi
callq 0xf025e
testl %eax, %eax
je 0xd6dc7
leaq 0x6ae69(%rip), %rsi     # 0x141c1f
jmp 0xd77bf
movl $0x11, %edx
movl $0x1, %eax
jmp 0xd6dd1
movl $0x2, %eax
movl $0x2, %edx
movl %eax, (%r14)
movq %rbx, %rdi
xorl %esi, %esi
callq 0xeb7d1
movl %eax, 0x4(%r14)
movl $0x2a, %esi
movq %rbx, %rdi
callq 0xf7666
movq %rax, 0x20(%r14)
movq %rbx, %rdi
movl $0x21, %esi
callq 0xeba56
movq %rax, 0x28(%r14)
movq %rbx, %rdi
movl $0x21, %esi
callq 0xeba56
movq %rax, 0x30(%r14)
movq %rbx, %rdi
movl $0x21, %esi
callq 0xeba56
movq %rax, 0x38(%r14)
movl (%r14), %eax
cmpl $0x2, %eax
je 0xd7679
cmpl $0x1, %eax
jne 0xd77b8
leaq 0x6ae05(%rip), %rsi     # 0x141c47
movq %rbx, %rdi
callq 0xeb6d6
movq %r14, 0x10(%rsp)
leaq 0x40(%rsp), %r14
movq $0x0, (%r14)
leaq 0x6ae3d(%rip), %rsi     # 0x141c9f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
addq $0x4, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef193
movq 0x10(%rsp), %rcx
movl %eax, 0x8(%rcx)
leaq 0x4f224(%rip), %rsi     # 0x1260be
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xef34e
movq 0x10(%rsp), %rcx
movq %rax, 0x18(%rcx)
leaq 0x6adf1(%rip), %rsi     # 0x141cb3
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq 0x10(%rsp), %r14
callq 0xef14d
movb %al, 0x10(%r14)
movzbl %al, %edx
leaq 0x5fac8(%rip), %rsi     # 0x1369ba
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movl $0x16, %r15d
movb $0x1, %r12b
xorl %r13d, %r13d
leaq 0x70(%r15), %rdx
movq 0x18(%rbx), %rax
movl 0xc(%r14), %ecx
cmpq 0x18(%rax), %rdx
jle 0xd6f3f
testl %ecx, %ecx
jne 0xd6f38
movl 0x8(%r14), %edx
cmpl %edx, %r13d
jne 0xd7613
xorl %ebp, %ebp
jmp 0xd7629
movq %rdx, 0x30(%rsp)
movl %ecx, 0x24(%rsp)
movl %r13d, 0xc(%rsp)
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
callq 0xe958c
movl $0x140, %esi            # imm = 0x140
movq %rbx, %rdi
callq 0xe969b
movq %rax, %r13
leaq 0xa0(%rax), %rbp
movb %r12b, 0xa0(%rax)
leaq 0x63022(%rip), %rax     # 0x139fa1
movq %rax, 0x108(%r13)
leaq 0x59688(%rip), %rax     # 0x130615
movq %rax, 0xc8(%r13)
movq %rbx, %rdi
leaq 0x64845(%rip), %rsi     # 0x13b7e3
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq %rbx, %rdi
callq 0xfca54
movq %rax, 0x8(%r13)
movb %r12b, 0x78(%rax)
movq %r15, (%rsp)
movq %rbx, %rdi
leaq 0x2c(%rsp), %rsi
callq 0xe958c
movq %rbx, %rdi
leaq 0x6d6b2(%rip), %rsi     # 0x144692
movq %r15, 0x18(%rsp)
movq %r15, %rdx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
movq 0x18(%rbx), %rdi
movq %rsp, %rsi
movq %rsi, %r12
callq 0xef14d
movb %al, 0xa1(%r13)
movq %rbx, %rdi
callq 0xf6870
movq %r14, %r15
movq %rax, %r14
movq %r15, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xd7a8f
movzbl 0xa1(%r13), %ebp
movq %r14, %rdi
callq 0xf74bd
movq %rbx, %rdi
leaq 0x6ace0(%rip), %rsi     # 0x141d28
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rbp
movq %r12, %rsi
callq 0xef14d
leaq 0xe0(%r13), %r12
movb %al, 0xe1(%r13)
movq %r14, %rdi
callq 0xf6883
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %r12
movq %r14, %rdx
callq 0xd7a8f
movzbl 0xe1(%r13), %ebp
movq %r14, 0x38(%rsp)
movq %r14, %rdi
callq 0xf74bd
movq %rbx, %rdi
leaq 0x6ac9e(%rip), %rsi     # 0x141d47
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef14d
movzbl %al, %eax
cmpb $0x3f, %al
movl $0x3f, %ecx
cmovael %ecx, %eax
movzbl %al, %ecx
movq 0x18(%rbx), %rdi
movq (%rsp), %rsi
movl 0x4(%r15), %r9d
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0xefe67
movq %rax, 0x10(%r13)
movq 0x18(%rax), %rdi
callq 0xf74bd
movq %rbx, %rdi
leaq 0x648d5(%rip), %rsi     # 0x13b9d4
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq (%rsp), %rax
leaq 0x3f(%rax), %rsi
movq %rsi, (%rsp)
cmpb $0x0, 0xe2(%r13)
jne 0xd712d
cmpb $0x0, 0xa2(%r13)
je 0xd7637
movq 0x18(%rbx), %rdi
leaq 0x20(%r13), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
leaq 0x30(%r13), %rdx
movq %rbx, %rdi
leaq 0x3d710(%rip), %rsi     # 0x114860
xorl %eax, %eax
callq 0xe9226
movq 0x8(%r13), %rax
movl 0x20(%r13), %ecx
movl %ecx, 0x90(%rax)
movq 0x8(%r13), %rax
movb $0x1, %bpl
movb %bpl, 0x7b(%rax)
movq (%rsp), %rsi
addq $0x4, %rsi
movq %rsi, (%rsp)
movq 0x18(%rbx), %rdi
leaq 0x50(%r13), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1d74
leaq 0x60(%r13), %rdx
movq %rbx, %rdi
leaq 0x5cd54(%rip), %rsi     # 0x133ef3
xorl %eax, %eax
callq 0xe9226
movq 0x8(%r13), %rax
movl 0x50(%r13), %ecx
movl %ecx, 0x94(%rax)
movq 0x8(%r13), %rax
movb %bpl, 0x7c(%rax)
addq $0x4, (%rsp)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef193
movl %eax, 0x4(%r13)
movq %rbx, %rdi
leaq 0x3d694(%rip), %rsi     # 0x11486f
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movzwl 0x4(%r13), %eax
movq 0x8(%r13), %rcx
movw %ax, 0x7e(%rcx)
movb %bpl, 0x7d(%rcx)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xef34e
movq %r12, %r15
movq %rax, %r12
leaq 0x90(%r13), %rbp
movq %rax, %rdi
movq %rbp, %rsi
callq 0xeae04
movl $0x40, %edx
movq %rbp, %rdi
leaq 0x40(%rsp), %r14
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xeb4f8
movq %rbx, %rdi
leaq 0x60dfb(%rip), %rsi     # 0x138035
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%r13), %rax
movq 0x20(%rax), %rax
movups 0x90(%r13), %xmm0
movups %xmm0, 0x28(%rax)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, %r12
leaq 0x80(%r13), %rbp
movq %rax, %rdi
movq %rbp, %rsi
callq 0xeae04
movl $0x40, %edx
movq %rbp, %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq 0xeb4f8
movq %rbx, %rdi
leaq 0x3ad64(%rip), %rsi     # 0x111ffc
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%r13), %rax
movq 0x20(%rax), %rax
movups 0x80(%r13), %xmm0
movups %xmm0, 0x18(%rax)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, 0xb0(%r13)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, 0xf0(%r13)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, 0xc0(%r13)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, 0x100(%r13)
movq 0xb0(%r13), %rdx
movq %rbx, %rdi
leaq 0x6aa50(%rip), %rsi     # 0x141d66
xorl %eax, %eax
callq 0xe9226
movq 0xc0(%r13), %rdx
movq %rbx, %rdi
leaq 0x6aa4d(%rip), %rsi     # 0x141d7b
xorl %eax, %eax
callq 0xe9226
movq 0xf0(%r13), %rdx
movq %rbx, %rdi
leaq 0x6aa48(%rip), %rsi     # 0x141d8e
xorl %eax, %eax
callq 0xe9226
movq 0x100(%r13), %rdx
movq %rbx, %rdi
leaq 0x6aa45(%rip), %rsi     # 0x141da3
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef193
movl %eax, 0xa8(%r13)
movq %rbx, %rdi
leaq 0x6aa34(%rip), %rsi     # 0x141db6
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef193
movl %eax, 0xe8(%r13)
movq %rbx, %rdi
leaq 0x6d59f(%rip), %rsi     # 0x144947
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x6, (%rsp)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef193
movq %rax, %rbp
movq %rbx, %rdi
leaq 0x54fa6(%rip), %rsi     # 0x12c375
movl %ebp, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x10(%rsp), %r14
movq 0x38(%r14), %rdi
callq 0xebdc3
movq 0x38(%r14), %rdi
movq 0x18(%rbx), %rsi
movl $0x6e, %ecx
movq 0x18(%rsp), %rdx
callq 0xebf09
movq 0x38(%r14), %rdi
callq 0xebe2a
movl %eax, %r12d
movq %rbx, %rdi
leaq 0x57e7f(%rip), %rsi     # 0x12f292
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
cmpl %ebp, %r12d
je 0xd7437
movq %rbx, %rdi
leaq 0x60c20(%rip), %rsi     # 0x13804b
movl %ebp, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0xe9b27
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movl 0x2c(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
movq 0x38(%rsp), %rdi
callq 0xf6bb0
movb 0xa1(%r13), %al
cmpb $0x20, %al
je 0xd7475
movb 0xe1(%r13), %cl
cmpb $0x20, %cl
jne 0xd755a
movb $0x1, (%r13)
xorl %eax, %eax
movq %rax, 0xc0(%r13)
movq %rax, 0x100(%r13)
movq 0xc0(%r13), %rax
movq 0x100(%r13), %rcx
leaq (%rax,%rcx), %r15
addq $0x70, %r15
movq %rbx, %rdi
callq 0xf6870
movq %rax, 0x18(%r13)
movq 0x20(%r14), %rdi
movq 0x10(%r13), %rax
movq 0x18(%rax), %rsi
callq 0xf7705
movq 0x20(%r14), %rdi
movq 0x18(%r13), %rsi
movl $0x1, %edx
callq 0xf776e
movq 0x18(%r13), %rdi
callq 0xf7557
movq %rbx, %rdi
leaq 0x5b0dd(%rip), %rsi     # 0x1325bf
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
cmpb $0x0, (%r13)
je 0xd7515
movl 0xc(%r14), %eax
cmpl $0x20, %eax
jl 0xd7544
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x3cb93(%rip), %rsi     # 0x11409c
xorl %eax, %eax
callq 0xe9df7
movb $0x1, %bpl
jmp 0xd7591
movq 0x30(%rsp), %rax
movq %rax, 0xb8(%r13)
addq 0xc0(%r13), %rax
movq %rax, 0xf8(%r13)
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xd7918
xorl %ebp, %ebp
xorl %r12d, %r12d
jmp 0xd7591
incl %eax
movl %eax, 0xc(%r14)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xd788f
movb $0x1, %r12b
jmp 0xd758f
cmpb $0x21, %al
setne %dl
cmpb $0x21, %cl
setne %sil
testb %sil, %dl
jne 0xd7644
movl 0xc(%r14), %eax
testl %eax, %eax
jle 0xd757d
decl %eax
movl %eax, 0xc(%r14)
movq 0x20(%r14), %rdi
callq 0xf76c8
movb $0x1, %r12b
movl $0x70, %r15d
xorl %ebp, %ebp
testb %r12b, %r12b
jne 0xd759f
movq 0x20(%r14), %rdi
callq 0xf76c8
testq %r13, %r13
movb $0x1, %r12b
je 0xd75d0
movq 0x10(%r13), %rsi
movq %rbx, %rdi
callq 0xf00aa
movq 0x18(%r13), %rdi
callq 0xf6bb0
movq 0x8(%r13), %rdi
callq 0xfca9a
movq %rbx, %rdi
movq %r13, %rsi
callq 0xe9752
movl 0x28(%rsp), %esi
movq %rbx, %rdi
callq 0xe9595
testq %r15, %r15
setle %al
orb %al, %bpl
je 0xd75f5
xorl %ebp, %ebp
movq 0x18(%rsp), %r15
movl 0xc(%rsp), %r13d
jmp 0xd7629
movq 0x18(%rsp), %rax
addq %r15, %rax
movq %rax, %r15
cmpl $0x1, 0x24(%rsp)
movl 0xc(%rsp), %r13d
adcl $0x0, %r13d
movb $0x1, %bpl
jmp 0xd7629
xorl %ebp, %ebp
movq %rbx, %rdi
leaq 0x6a6b4(%rip), %rsi     # 0x141cd3
movl %r13d, %ecx
xorl %eax, %eax
callq 0xe9b27
testb %bpl, %bpl
jne 0xd6f15
jmp 0xd77c9
addq $0x49, %rax
movq %rax, (%rsp)
jmp 0xd71f5
cmpb $0x22, %al
setb %al
cmpb $0x22, %cl
setb %cl
testb %cl, %al
jne 0xd748a
movq %rbx, %rdi
leaq 0x6a6a1(%rip), %rsi     # 0x141d02
xorl %eax, %eax
callq 0xe9df7
movb $0x1, %bpl
movl $0x70, %r15d
movb $0x1, %r12b
jmp 0xd7591
leaq 0x6a5db(%rip), %rsi     # 0x141c5b
movq %rbx, %rdi
callq 0xeb6d6
movq %rbx, %rdi
callq 0xeb85a
movq %rax, 0x50(%r14)
leaq 0x40(%rsp), %r15
movq $0x0, (%r15)
leaq 0x4b77e(%rip), %rsi     # 0x122e25
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
addq $0x52, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movzbl %al, %edx
leaq 0x6a920(%rip), %rsi     # 0x141ffa
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef14d
movb %al, 0x40(%r14)
movzbl %al, %edx
leaq 0x6a910(%rip), %rsi     # 0x14200e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, 0x18(%r14)
leaq 0x6a594(%rip), %rsi     # 0x141cb3
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef193
movl %eax, 0x8(%r14)
leaq 0x6a8dd(%rip), %rsi     # 0x142024
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %rax, 0x48(%r14)
leaq 0x6a8d5(%rip), %rsi     # 0x14203f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef193
leaq 0x6a8d3(%rip), %rsi     # 0x14205d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
movq 0x48(%r14), %rdx
movslq 0x8(%r14), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd8588
jmp 0xd77c9
leaq 0x6a4af(%rip), %rsi     # 0x141c6e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
testq %r14, %r14
je 0xd780e
movq 0x28(%r14), %rdi
callq 0xebe1d
movq 0x30(%r14), %rdi
callq 0xebe1d
movq 0x38(%r14), %rdi
callq 0xebe1d
movq 0x20(%r14), %rdi
callq 0xf7689
movq 0x50(%r14), %rsi
testq %rsi, %rsi
je 0xd7803
movq %rbx, %rdi
callq 0xeb864
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq