// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x58
popq %rsi
callq 0xdecaf
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0x67af7(%rip), %rdx     # 0x134ca1
pushq $0x4
popq %rcx
xorl %esi, %esi
callq 0xe4d48
testl %eax, %eax
je 0xcd1f0
movq 0x18(%rbx), %rdi
leaq 0x67ae3(%rip), %rdx     # 0x134ca6
pushq $0x8
popq %rcx
xorl %esi, %esi
callq 0xe4d48
testl %eax, %eax
je 0xcd1f8
leaq 0x67ad7(%rip), %rsi     # 0x134caf
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
testq %r14, %r14
jne 0xcdb92
jmp 0xcdbd2
pushq $0x11
popq %rdx
pushq $0x1
popq %rax
jmp 0xcd1fd
pushq $0x2
popq %rax
movl %eax, %edx
movl %eax, (%r14)
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x4(%r14)
pushq $0x2a
popq %rsi
movq %rbx, %rdi
callq 0xeb95d
movq %rax, 0x20(%r14)
pushq $0x21
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xe0ae9
movq %rax, 0x28(%r14)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xe0ae9
movq %rax, 0x30(%r14)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xe0ae9
movq %rax, 0x38(%r14)
movl (%r14), %eax
cmpl $0x2, %eax
je 0xcda2b
cmpl $0x1, %eax
jne 0xcdb62
leaq 0x67a71(%rip), %rsi     # 0x134cd7
movq %rbx, %rdi
callq 0xe07f7
leaq 0x67aba(%rip), %rsi     # 0x134d2f
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq %r14, 0x10(%rsp)
leaq 0x40(%rsp), %r14
movq $0x4, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe3f6e
movq 0x10(%rsp), %rcx
movl %eax, 0x8(%rcx)
leaq 0x4be36(%rip), %rsi     # 0x1190ee
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe4071
movq 0x10(%rsp), %rcx
movq %rax, 0x18(%rcx)
leaq 0x67a63(%rip), %rsi     # 0x134d43
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq $0x4, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq 0x10(%rsp), %r14
callq 0xe3f2a
movb %al, 0x10(%r14)
movzbl %al, %edx
leaq 0x5c774(%rip), %rsi     # 0x129a84
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
pushq $0x16
popq %r13
movb $0x1, %bpl
xorl %ecx, %ecx
leaq 0x70(%r13), %rsi
movq 0x18(%rbx), %rax
movl 0xc(%r14), %edx
cmpq 0x18(%rax), %rsi
jg 0xcdb75
movq %rsi, 0x38(%rsp)
movl %edx, 0x28(%rsp)
movl %ecx, 0x2c(%rsp)
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0xdebae
movl $0x140, %esi            # imm = 0x140
movq %rbx, %rdi
callq 0xdecaf
movq %rax, %r15
addq $0xa0, %rax
movq %rax, 0x18(%rsp)
movb %bpl, 0xa0(%r15)
leaq 0x5fcaa(%rip), %rax     # 0x12d031
movq %rax, 0x108(%r15)
leaq 0x562d8(%rip), %rax     # 0x12366d
movq %rax, 0xc8(%r15)
movq %rbx, %rdi
leaq 0x614c7(%rip), %rsi     # 0x12e86d
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movb $0x1, %r12b
pushq $0x1
popq %rbp
movl %ebp, %esi
callq 0xdeba7
movq %rbx, %rdi
callq 0xf07cc
movq %rax, 0x8(%r15)
movb %r12b, 0x78(%rax)
movq %r13, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x34(%rsp), %rsi
callq 0xdebae
movq %rbx, %rdi
leaq 0x6a336(%rip), %rsi     # 0x137722
movq %r13, 0x20(%rsp)
movq %r13, %rdx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
movl %ebp, %esi
callq 0xdeba7
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %r13
movq %r13, %rsi
callq 0xe3f2a
movb %al, 0xa1(%r15)
movq %rbx, %rdi
callq 0xeac74
movq %rax, %rbp
movq %r14, %rdi
movq 0x18(%rsp), %rsi
movq %rax, %rdx
callq 0xcde3e
movzbl 0xa1(%r15), %r12d
movq %rbp, %rdi
callq 0xeb7e4
movq %rbx, %rdi
leaq 0x67966(%rip), %rsi     # 0x134db8
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe3f2a
leaq 0xe0(%r15), %r12
movb %al, 0xe1(%r15)
movq %rbp, %rdi
callq 0xeac85
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rdx
callq 0xcde3e
movzbl 0xe1(%r15), %r12d
movq %rbp, 0x18(%rsp)
movq %rbp, %rdi
callq 0xeb7e4
movq %rbx, %rdi
leaq 0x67929(%rip), %rsi     # 0x134dd7
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe3f2a
movzbl %al, %eax
cmpb $0x3f, %al
pushq $0x3f
popq %rcx
cmovael %ecx, %eax
movzbl %al, %ecx
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movl 0x4(%r14), %r9d
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0xe495c
movq %rax, 0x10(%r15)
movq 0x18(%rax), %rdi
callq 0xeb7e4
movq %rbx, %rdi
leaq 0x6155a(%rip), %rsi     # 0x12ea5e
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x8(%rsp), %rax
leaq 0x3f(%rax), %rsi
movq %rsi, 0x8(%rsp)
cmpb $0x0, 0xe2(%r15)
jne 0xcd534
cmpb $0x0, 0xa2(%r15)
je 0xcd97d
movq 0x18(%rbx), %rdi
leaq 0x20(%r15), %rdx
pushq $0x4
popq %rbp
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0xe657c
leaq 0x30(%r15), %rdx
movq %rbx, %rdi
leaq 0x3a359(%rip), %rsi     # 0x1078b0
xorl %eax, %eax
callq 0xde896
movq 0x8(%r15), %rax
movl 0x20(%r15), %ecx
movl %ecx, 0x90(%rax)
movq 0x8(%r15), %rax
movb $0x1, %r14b
movb %r14b, 0x7b(%rax)
movq 0x8(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x50(%r15), %rdx
movl %ebp, %ecx
xorl %r8d, %r8d
callq 0xe657c
leaq 0x60(%r15), %rdx
movq %rbx, %rdi
leaq 0x59a6e(%rip), %rsi     # 0x127013
xorl %eax, %eax
callq 0xde896
movq 0x8(%r15), %rax
movl 0x50(%r15), %ecx
movl %ecx, 0x94(%rax)
movq 0x8(%r15), %rax
movb %r14b, 0x7c(%rax)
addq $0x4, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe3f6e
movl %eax, 0x4(%r15)
movq %rbx, %rdi
leaq 0x3a2dd(%rip), %rsi     # 0x1078bf
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movzwl 0x4(%r15), %eax
movq 0x8(%r15), %rcx
movw %ax, 0x7e(%rcx)
movb %r14b, 0x7d(%rcx)
movq %r13, %rbp
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xe4071
movq %rax, %r12
leaq 0x90(%r15), %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0xe0102
movq %r13, %rdi
leaq 0x40(%rsp), %r14
movq %r14, %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movq %rbx, %rdi
leaq 0x5da82(%rip), %rsi     # 0x12b0c1
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xde896
movq 0x8(%r15), %rax
movq 0x20(%rax), %rax
movups 0x90(%r15), %xmm0
movups %xmm0, 0x28(%rax)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe4071
movq %rax, %r12
movq %r15, %r13
subq $-0x80, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0xe0102
movq %r13, %rdi
movq %r14, %rsi
pushq $0x40
popq %rdx
xorl %ecx, %ecx
callq 0xe0644
movq %rbx, %rdi
leaq 0x37951(%rip), %rsi     # 0x104fec
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xde896
movq 0x8(%r15), %rax
movq 0x20(%rax), %rax
movups 0x80(%r15), %xmm0
movups %xmm0, 0x18(%rax)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe4071
movq %rax, 0xb0(%r15)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe4071
movq %rax, 0xf0(%r15)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe4071
movq %rax, 0xc0(%r15)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe4071
movq %rax, 0x100(%r15)
movq 0xb0(%r15), %rdx
movq %rbx, %rdi
leaq 0x676dd(%rip), %rsi     # 0x134df6
xorl %eax, %eax
callq 0xde896
movq 0xc0(%r15), %rdx
movq %rbx, %rdi
leaq 0x676da(%rip), %rsi     # 0x134e0b
xorl %eax, %eax
callq 0xde896
movq 0xf0(%r15), %rdx
movq %rbx, %rdi
leaq 0x676d5(%rip), %rsi     # 0x134e1e
xorl %eax, %eax
callq 0xde896
movq 0x100(%r15), %rdx
movq %rbx, %rdi
leaq 0x676d2(%rip), %rsi     # 0x134e33
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe3f6e
movl %eax, 0xa8(%r15)
movq %rbx, %rdi
leaq 0x676c1(%rip), %rsi     # 0x134e46
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe3f6e
movl %eax, 0xe8(%r15)
movq %rbx, %rdi
leaq 0x6a22c(%rip), %rsi     # 0x1379d7
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
addq $0x6, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
callq 0xe3f6e
movq %rax, %r12
movq %rbx, %rdi
leaq 0x51c1a(%rip), %rsi     # 0x11f3ed
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
movq 0x10(%rsp), %r14
movq 0x38(%r14), %rdi
callq 0xe0e44
movq 0x38(%r14), %rdi
movq 0x18(%rbx), %rsi
movq 0x20(%rsp), %rdx
pushq $0x6e
popq %rcx
callq 0xe0f33
movq 0x38(%r14), %rdi
callq 0xe0e95
movl %eax, %r13d
movq %rbx, %rdi
leaq 0x54ad7(%rip), %rsi     # 0x1222ed
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
cmpl %r12d, %r13d
je 0xcd83b
movq %rbx, %rdi
leaq 0x5d8a9(%rip), %rsi     # 0x12b0d7
movl %r12d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0xdf05a
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
movl 0x34(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
movq 0x18(%rsp), %rdi
callq 0xeaf3c
movb 0xa1(%r15), %al
cmpb $0x20, %al
je 0xcd877
movb 0xe1(%r15), %cl
cmpb $0x20, %cl
jne 0xcd94c
movb $0x1, (%r15)
andq $0x0, 0xc0(%r15)
andq $0x0, 0x100(%r15)
pushq $0x70
popq %r12
movq 0x20(%rsp), %r13
movq %rbx, %rdi
callq 0xeac74
movq %rax, 0x18(%r15)
movq 0x20(%r14), %rdi
movq 0x10(%r15), %rax
movq 0x18(%rax), %rsi
callq 0xeb9f5
movq 0x20(%r14), %rdi
movq 0x18(%r15), %rsi
pushq $0x1
popq %rdx
callq 0xeba55
movq 0x18(%r15), %rdi
callq 0xeb877
movq %rbx, %rdi
leaq 0x57d83(%rip), %rsi     # 0x125657
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
cmpb $0x0, (%r15)
setne %bpl
je 0xcd904
movl 0xc(%r14), %eax
cmpl $0x20, %eax
jl 0xcd937
movq %rbx, %rdi
leaq 0x397f1(%rip), %rsi     # 0x1070ec
xorl %eax, %eax
callq 0xdf2a5
jmp 0xcd92c
movq 0x38(%rsp), %rax
movq %rax, 0xb8(%r15)
addq 0xc0(%r15), %rax
movq %rax, 0xf8(%r15)
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xcdccf
movq 0x20(%r14), %rdi
callq 0xeb9bd
jmp 0xcd9b2
incl %eax
movl %eax, 0xc(%r14)
movq %rbx, %rdi
movq %r15, %rsi
callq 0xcdc48
xorl %ebp, %ebp
jmp 0xcd9b2
cmpb $0x21, %al
setne %dl
cmpb $0x21, %cl
setne %sil
testb %sil, %dl
movq 0x20(%rsp), %r13
jne 0xcd98b
movl 0xc(%r14), %eax
testl %eax, %eax
jle 0xcd970
decl %eax
movl %eax, 0xc(%r14)
movq 0x20(%r14), %rdi
callq 0xeb9bd
xorl %ebp, %ebp
jmp 0xcd9ae
addq $0x49, %rax
movq %rax, 0x8(%rsp)
jmp 0xcd5fc
cmpb $0x22, %al
setae %al
cmpb $0x22, %cl
setae %cl
orb %al, %cl
je 0xcda10
movq %rbx, %rdi
leaq 0x673ee(%rip), %rsi     # 0x134d92
xorl %eax, %eax
callq 0xdf2a5
movb $0x1, %bpl
pushq $0x70
popq %r12
movq 0x10(%r15), %rsi
movq %rbx, %rdi
callq 0xe4b94
movq 0x18(%r15), %rdi
callq 0xeaf3c
movq 0x8(%r15), %rdi
callq 0xf0812
movq %rbx, %rdi
movq %r15, %rsi
callq 0xded32
movl 0x30(%rsp), %esi
movq %rbx, %rdi
callq 0xdebb7
testb %bpl, %bpl
movl 0x2c(%rsp), %ecx
jne 0xcdb92
testq %r12, %r12
jle 0xcdb92
addq %r12, %r13
cmpl $0x1, 0x28(%rsp)
adcl $0x0, %ecx
movb $0x1, %bpl
jmp 0xcd32e
movq 0xc0(%r15), %rax
movq 0x100(%r15), %rcx
leaq (%rax,%rcx), %r12
addq $0x70, %r12
jmp 0xcd894
leaq 0x672b9(%rip), %rsi     # 0x134ceb
movq %rbx, %rdi
callq 0xe07f7
movq %rbx, %rdi
callq 0xe0955
movq %rax, 0x50(%r14)
leaq 0x48405(%rip), %rsi     # 0x115e52
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xde896
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
leaq 0x40(%rsp), %r15
movq $0x52, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f2a
movzbl %al, %edx
leaq 0x67604(%rip), %rsi     # 0x13508a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f2a
movb %al, 0x40(%r14)
movzbl %al, %edx
leaq 0x675f4(%rip), %rsi     # 0x13509e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe4071
movq %rax, 0x18(%r14)
leaq 0x67278(%rip), %rsi     # 0x134d43
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f6e
movl %eax, 0x8(%r14)
leaq 0x675c1(%rip), %rsi     # 0x1350b4
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe4071
movq %rax, 0x48(%r14)
leaq 0x675b9(%rip), %rsi     # 0x1350cf
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xe3f6e
leaq 0x675b7(%rip), %rsi     # 0x1350ed
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0xdeba7
movq 0x48(%r14), %rdx
movslq 0x8(%r14), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xce8a8
jmp 0xcdb92
leaq 0x67195(%rip), %rsi     # 0x134cfe
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xcdb92
testl %edx, %edx
jne 0xcdb92
movl 0x8(%r14), %edx
cmpl %edx, %ecx
je 0xcdb92
leaq 0x671db(%rip), %rsi     # 0x134d63
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf05a
movq 0x28(%r14), %rdi
callq 0xe0e8d
movq 0x30(%r14), %rdi
callq 0xe0e8d
movq 0x38(%r14), %rdi
callq 0xe0e8d
movq 0x20(%r14), %rdi
callq 0xeb97e
movq 0x50(%r14), %rsi
testq %rsi, %rsi
je 0xcdbc7
movq %rbx, %rdi
callq 0xe095f
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq