// File: /workspace/github_c_makefile_star2_O3/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 0xe8b2b
movq %rax, %r14
movq 0x18(%rbx), %rdi
leaq 0x6bdcd(%rip), %rdx     # 0x1420f1
movl $0x4, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
je 0xd636e
movq 0x18(%rbx), %rdi
leaq 0x6bdb7(%rip), %rdx     # 0x1420f6
movl $0x8, %ecx
xorl %esi, %esi
callq 0xefc85
testl %eax, %eax
je 0xd637a
leaq 0x6bda9(%rip), %rsi     # 0x1420ff
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
testq %r14, %r14
jne 0xd6634
jmp 0xd6674
movl $0x11, %edx
movl $0x1, %eax
jmp 0xd6384
movl $0x2, %eax
movl $0x2, %edx
movl %eax, (%r14)
movq %rbx, %rdi
xorl %esi, %esi
callq 0xeb220
movl %eax, 0x4(%r14)
movl $0x2a, %esi
movq %rbx, %rdi
callq 0xf7205
movq %rax, 0x20(%r14)
movq %rbx, %rdi
movl $0x21, %esi
callq 0xeb499
movq %rax, 0x28(%r14)
movq %rbx, %rdi
movl $0x21, %esi
callq 0xeb499
movq %rax, 0x30(%r14)
movq %rbx, %rdi
movl $0x21, %esi
callq 0xeb499
movq %rax, 0x38(%r14)
movl (%r14), %eax
cmpl $0x2, %eax
je 0xd64e8
cmpl $0x1, %eax
jne 0xd6623
leaq 0x6bd32(%rip), %rsi     # 0x142127
movq %rbx, %rdi
callq 0xeb125
leaq 0x6bd7b(%rip), %rsi     # 0x14217f
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x40(%rsp), %r15
movq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movl %eax, 0x8(%r14)
leaq 0x4feac(%rip), %rsi     # 0x1262ee
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed31
movq %rax, 0x18(%r14)
leaq 0x6bd2e(%rip), %rsi     # 0x142193
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb4b
movb %al, 0x10(%r14)
movzbl %al, %edx
leaq 0x608f4(%rip), %rsi     # 0x136d84
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x18(%rbx), %rax
cmpq $0x86, 0x18(%rax)
jge 0xd6686
cmpl $0x0, 0xc(%r14)
jne 0xd6634
movl 0x8(%r14), %edx
cmpl %edx, %ebp
je 0xd6634
leaq 0x6bcdc(%rip), %rsi     # 0x1421b3
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0xe8faa
jmp 0xd6634
leaq 0x6bc4c(%rip), %rsi     # 0x14213b
movq %rbx, %rdi
callq 0xeb125
movq %rbx, %rdi
callq 0xeb2a9
movq %rax, 0x50(%r14)
leaq 0x4cb08(%rip), %rsi     # 0x123012
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq 0x40(%rsp), %r15
movq $0x52, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb4b
movzbl %al, %edx
leaq 0x6bf95(%rip), %rsi     # 0x1424da
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb4b
movb %al, 0x40(%r14)
movzbl %al, %edx
leaq 0x6bf85(%rip), %rsi     # 0x1424ee
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed31
movq %rax, 0x18(%r14)
leaq 0x6bc09(%rip), %rsi     # 0x142193
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
movl %eax, 0x8(%r14)
leaq 0x6bf52(%rip), %rsi     # 0x142504
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeed31
movq %rax, 0x48(%r14)
leaq 0x6bf4a(%rip), %rsi     # 0x14251f
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xeeb91
leaq 0x6bf48(%rip), %rsi     # 0x14253d
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movq 0x48(%r14), %rdx
movslq 0x8(%r14), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd7b34
jmp 0xd6634
leaq 0x6bb24(%rip), %rsi     # 0x14214e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
movq 0x28(%r14), %rdi
callq 0xeb858
movq 0x30(%r14), %rdi
callq 0xeb858
movq 0x38(%r14), %rdi
callq 0xeb858
movq 0x20(%r14), %rdi
callq 0xf7228
movq 0x50(%r14), %rsi
testq %rsi, %rsi
je 0xd6669
movq %rbx, %rdi
callq 0xeb2b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x16, %eax
movl $0x86, %edx
movb $0x1, %r13b
xorl %ebp, %ebp
movq %r14, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movl %ebp, 0x14(%rsp)
movl 0xc(%r14), %ecx
movl %ecx, 0x10(%rsp)
movq %rbx, %rdi
leaq 0x18(%rsp), %rsi
movq %rax, %rbp
callq 0xe8a1c
movl $0x140, %esi            # imm = 0x140
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r12
leaq 0xa0(%rax), %r15
movb %r13b, 0xa0(%rax)
leaq 0x63c45(%rip), %rax     # 0x13a325
movq %rax, 0x108(%r12)
leaq 0x5a261(%rip), %rax     # 0x130950
movq %rax, 0xc8(%r12)
movq %rbx, %rdi
leaq 0x6545c(%rip), %rsi     # 0x13bb5d
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq %rbx, %rdi
callq 0xfc498
movq %rax, 0x8(%r12)
movb %r13b, 0x78(%rax)
movq %rbp, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xe8a1c
movq %rbx, %rdi
leaq 0x6e42d(%rip), %rsi     # 0x144b72
movq %rbp, 0x20(%rsp)
movq %rbp, %rdx
xorl %eax, %eax
callq 0xe8617
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe8a15
movq 0x18(%rbx), %rdi
movq %r14, %r13
leaq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0xeeb4b
movb %al, 0xa1(%r12)
movq %rbx, %rdi
callq 0xf6410
movq %rax, %rbp
movq %r13, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xd705c
movzbl 0xa1(%r12), %r15d
movq %rbp, %rdi
callq 0xf705c
movq %rbx, %rdi
leaq 0x6ba57(%rip), %rsi     # 0x142208
movl %r15d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
leaq 0xe0(%r12), %r15
movb %al, 0xe1(%r12)
movq %rbp, %rdi
callq 0xf6423
movq %r13, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0xd705c
movzbl 0xe1(%r12), %r15d
movq %rbp, 0x38(%rsp)
movq %rbp, %rdi
callq 0xf705c
movq %rbx, %rdi
leaq 0x6ba17(%rip), %rsi     # 0x142227
movl %r15d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb4b
movzbl %al, %eax
cmpb $0x3f, %al
movl $0x3f, %ecx
cmovael %ecx, %eax
movzbl %al, %ecx
movq 0x18(%rbx), %rdi
movq 0x8(%rsp), %rsi
movl 0x4(%r13), %r9d
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0xef87c
movq %rax, 0x10(%r12)
movq 0x18(%rax), %rdi
callq 0xf705c
movq %rbx, %rdi
leaq 0x654e5(%rip), %rsi     # 0x13bd4e
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%rsp), %rax
leaq 0x3f(%rax), %rsi
movq %rsi, 0x8(%rsp)
cmpb $0x0, 0xe2(%r12)
jne 0xd689b
cmpb $0x0, 0xa2(%r12)
je 0xd6d94
movq 0x18(%rbx), %rdi
leaq 0x20(%r12), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1762
leaq 0x30(%r12), %rdx
movq %rbx, %rdi
leaq 0x3e07b(%rip), %rsi     # 0x11493b
xorl %eax, %eax
callq 0xe8617
movq 0x8(%r12), %rax
movl 0x20(%r12), %ecx
movl %ecx, 0x90(%rax)
movq 0x8(%r12), %rax
movb $0x1, %bpl
movb %bpl, 0x7b(%rax)
movq 0x8(%rsp), %rsi
addq $0x4, %rsi
movq %rsi, 0x8(%rsp)
movq 0x18(%rbx), %rdi
leaq 0x50(%r12), %rdx
movl $0x4, %ecx
xorl %r8d, %r8d
callq 0xf1762
leaq 0x60(%r12), %rdx
movq %rbx, %rdi
leaq 0x5d9d5(%rip), %rsi     # 0x1342eb
xorl %eax, %eax
callq 0xe8617
movq 0x8(%r12), %rax
movl 0x50(%r12), %ecx
movl %ecx, 0x94(%rax)
movq 0x8(%r12), %rax
movb %bpl, 0x7c(%rax)
addq $0x4, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb91
movl %eax, 0x4(%r12)
movq %rbx, %rdi
leaq 0x3dff3(%rip), %rsi     # 0x11494a
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movzwl 0x4(%r12), %eax
movq 0x8(%r12), %rcx
movw %ax, 0x7e(%rcx)
movb %bpl, 0x7d(%rcx)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, %r15
leaq 0x90(%r12), %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0xea8ff
movl $0x40, %edx
movq %r13, %rdi
leaq 0x40(%rsp), %rbp
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0xeaf46
movq %rbx, %rdi
leaq 0x61a0b(%rip), %rsi     # 0x1383c1
movq %r15, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%r12), %rax
movq 0x20(%rax), %rax
movups 0x90(%r12), %xmm0
movups %xmm0, 0x28(%rax)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, %r15
movq %r12, %r13
subq $-0x80, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0xea8ff
movl $0x40, %edx
movq %r13, %rdi
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0xeaf46
movq %rbx, %rdi
leaq 0x3b5f6(%rip), %rsi     # 0x11200c
movq %r15, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0xe8617
movq 0x8(%r12), %rax
movq 0x20(%rax), %rax
movups 0x80(%r12), %xmm0
movups %xmm0, 0x18(%rax)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, 0xb0(%r12)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, 0xf0(%r12)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, 0xc0(%r12)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %rax, 0x100(%r12)
movq 0xb0(%r12), %rdx
movq %rbx, %rdi
leaq 0x6b7ab(%rip), %rsi     # 0x142246
xorl %eax, %eax
callq 0xe8617
movq 0xc0(%r12), %rdx
movq %rbx, %rdi
leaq 0x6b7a7(%rip), %rsi     # 0x14225b
xorl %eax, %eax
callq 0xe8617
movq 0xf0(%r12), %rdx
movq %rbx, %rdi
leaq 0x6b7a1(%rip), %rsi     # 0x14226e
xorl %eax, %eax
callq 0xe8617
movq 0x100(%r12), %rdx
movq %rbx, %rdi
leaq 0x6b79d(%rip), %rsi     # 0x142283
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb91
movl %eax, 0xa8(%r12)
movq %rbx, %rdi
leaq 0x6b78b(%rip), %rsi     # 0x142296
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb91
movl %eax, 0xe8(%r12)
movq %rbx, %rdi
leaq 0x6e2f5(%rip), %rsi     # 0x144e27
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x6, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeeb91
movq %rax, %r15
movq %rbx, %rdi
leaq 0x55b03(%rip), %rsi     # 0x12c65d
movl %r15d, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x28(%rsp), %r14
movq 0x38(%r14), %rdi
callq 0xeb7fe
movq 0x38(%r14), %rdi
movq 0x18(%rbx), %rsi
movl $0x6e, %ecx
movq 0x20(%rsp), %rdx
callq 0xeb944
movq 0x38(%r14), %rdi
callq 0xeb865
movl %eax, %r13d
movq %rbx, %rdi
leaq 0x589d6(%rip), %rsi     # 0x12f575
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
cmpl %r15d, %r13d
je 0xd6bc4
movq %rbx, %rdi
leaq 0x61820(%rip), %rsi     # 0x1383d7
movl %r15d, %edx
movl %r13d, %ecx
xorl %eax, %eax
callq 0xe8faa
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
movl 0x1c(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
movq 0x38(%rsp), %rdi
callq 0xf6753
movb 0xa1(%r12), %al
cmpb $0x20, %al
je 0xd6c04
movb 0xe1(%r12), %cl
cmpb $0x20, %cl
jne 0xd6ce4
movb $0x1, (%r12)
xorl %eax, %eax
movq %rax, 0xc0(%r12)
movq %rax, 0x100(%r12)
movl $0x70, %r15d
movb $0x1, %r13b
movq %rbx, %rdi
callq 0xf6410
movq %rax, 0x18(%r12)
movq 0x20(%r14), %rdi
movq 0x10(%r12), %rax
movq 0x18(%rax), %rsi
callq 0xf72a4
movq 0x20(%r14), %rdi
movq 0x18(%r12), %rsi
movl $0x1, %edx
callq 0xf730d
movq 0x18(%r12), %rdi
callq 0xf70f6
movq %rbx, %rdi
leaq 0x5bced(%rip), %rsi     # 0x132957
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
cmpb $0x0, (%r12)
setne %bpl
je 0xd6c9b
movl 0xc(%r14), %eax
cmpl $0x20, %eax
jl 0xd6cd1
movq %rbx, %rdi
leaq 0x3d4ba(%rip), %rsi     # 0x11414c
xorl %eax, %eax
callq 0xe9295
jmp 0xd6cc6
movq 0x30(%rsp), %rax
movq %rax, 0xb8(%r12)
addq 0xc0(%r12), %rax
movq %rax, 0xf8(%r12)
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xd6ee5
movq 0x20(%r14), %rdi
callq 0xf7267
jmp 0xd6d1b
incl %eax
movl %eax, 0xc(%r14)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xd6e5c
jmp 0xd6d19
cmpb $0x21, %al
setne %dl
cmpb $0x21, %cl
setne %sil
testb %sil, %dl
movb $0x1, %r13b
jne 0xd6da2
movl 0xc(%r14), %eax
testl %eax, %eax
jle 0xd6d0a
decl %eax
movl %eax, 0xc(%r14)
movq 0x20(%r14), %rdi
callq 0xf7267
movl $0x70, %r15d
xorl %ebp, %ebp
movq 0x10(%r12), %rsi
movq %rbx, %rdi
callq 0xefaca
movq 0x18(%r12), %rdi
callq 0xf6753
movq 0x8(%r12), %rdi
callq 0xfc4de
movq %rbx, %rdi
movq %r12, %rsi
callq 0xe8be2
movl 0x18(%rsp), %esi
movq %rbx, %rdi
callq 0xe8a25
testb %bpl, %bpl
movl 0x14(%rsp), %ebp
jne 0xd6634
testq %r15, %r15
jle 0xd6634
movq 0x20(%rsp), %rax
leaq (%r15,%rax), %rdx
addq $0x70, %rdx
addq %r15, %rax
cmpl $0x1, 0x10(%rsp)
adcl $0x0, %ebp
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rdx
jle 0xd669a
jmp 0xd64b9
addq $0x49, %rax
movq %rax, 0x8(%rsp)
jmp 0xd6973
cmpb $0x22, %al
setae %al
cmpb $0x22, %cl
setae %cl
orb %al, %cl
je 0xd6dd0
movq %rbx, %rdi
leaq 0x6b427(%rip), %rsi     # 0x1421e2
xorl %eax, %eax
callq 0xe9295
movb $0x1, %bpl
movl $0x70, %r15d
jmp 0xd6d1b
movq 0xc0(%r12), %rax
movq 0x100(%r12), %rcx
leaq (%rax,%rcx), %r15
addq $0x70, %r15
jmp 0xd6c24