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

	d = de_malloc(c, sizeof(lctx));
	if(de_getbyte(3)==0x00)
		d->is_appledouble = 0;
	else
		d->is_appledouble = 1;
	// AppleDouble default = decode resource fork
	// AppleSingle default = extract resource fork
	d->extract_rsrc = de_get_ext_option_bool(c, "applesd:extractrsrc", d->is_appledouble?0:1);
	de_run_sd_internal(c, d);
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
pushq $0x28
popq %rsi
callq 0xdecaf
movq %rax, %r15
movq 0x18(%rbx), %rdi
pushq $0x3
popq %rsi
callq 0xe3eb4
xorl %edx, %edx
testb %al, %al
sete %dl
setne 0x4(%r15)
leaq 0xdbd06(%rip), %rsi     # 0x1099a6
movq %rbx, %rdi
callq 0xdfae5
movl %eax, 0xc(%r15)
cmpb $0x0, 0x4(%r15)
leaq 0xdbd1a(%rip), %rax     # 0x1099d2
leaq 0xdbcfb(%rip), %rsi     # 0x1099ba
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0xe07f7
xorl %r14d, %r14d
pushq $0x11
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe08d2
movl %eax, 0x8(%r15)
movq %rbx, %rdi
callq 0xf07cc
movq %rax, 0x10(%r15)
movq %r15, 0x8(%rax)
leaq 0x27d(%rip), %rcx       # 0x2df73
movq %rcx, 0x60(%rax)
movq 0x68(%rax), %rdi
leaq 0xfa7d8(%rip), %rsi     # 0x1284dd
pushq $0x5
popq %rdx
callq 0xeae42
leaq 0x20(%rsp), %r12
movq $0x4, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xe4071
movq %r15, (%rsp)
movl %eax, (%r15)
leaq 0xdbcaa(%rip), %rsi     # 0x1099de
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
addq $0x10, (%r12)
movq 0x18(%rbx), %rdi
movq %r12, %rsi
callq 0xe3f6e
movq %rax, %r15
leaq 0xdbc93(%rip), %rsi     # 0x1099ee
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xde896
movq (%r12), %rax
movq %rax, 0x10(%rsp)
testq %r15, %r15
cmovleq %r14, %r15
movq %r15, 0x18(%rsp)
leaq 0x8(%rsp), %r14
xorl %r12d, %r12d
cmpq 0x18(%rsp), %r12
je 0x2def1
movq 0x20(%rsp), %rax
addq $0xc, %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jg 0x2def1
movq %rbx, %rdi
leaq 0xdbc53(%rip), %rsi     # 0x109a04
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0xdeba7
imulq $0xc, %r12, %rax
addq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movl %r12d, 0x28(%rsp)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe4071
movl %eax, 0x2c(%rsp)
pushq $0xf
popq %r15
leaq 0x154674(%rip), %rcx    # 0x182468
decq %r15
je 0x2de0b
leaq 0x18(%rcx), %r13
cmpl %eax, 0x18(%rcx)
movq %r13, %rcx
jne 0x2ddf4
movq 0x8(%r13), %rcx
jmp 0x2de15
xorl %r13d, %r13d
leaq 0xf10cc(%rip), %rcx     # 0x11eee1
movq %rbx, %rdi
leaq 0xf5d26(%rip), %rsi     # 0x123b45
movl %eax, %edx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe4071
movq %rax, %rbp
movq %rax, 0x30(%rsp)
movq %rbx, %rdi
leaq 0x101a07(%rip), %rsi    # 0x12f84d
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xe4071
movq %rax, %r14
movq %rax, 0x38(%rsp)
movq %rbx, %rdi
leaq 0xdbd7d(%rip), %rsi     # 0x109beb
movq %rax, %rdx
xorl %eax, %eax
callq 0xde896
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
movq %rax, %r8
subq %rbp, %r8
jl 0x2ded9
leaq (%r14,%rbp), %rcx
cmpq %rax, %rcx
jle 0x2deb8
movq %rbx, %rdi
leaq 0xdbb73(%rip), %rsi     # 0x109a0e
movl %r12d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0xdf05a
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
subq %rbp, %rax
movq %rax, 0x38(%rsp)
testq %r15, %r15
je 0x2ded9
movq 0x10(%r13), %rax
testq %rax, %rax
je 0x2ded9
movq %r13, 0x40(%rsp)
movq %rbx, %rdi
movq (%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq *%rax
movq %rbx, %rdi
pushq $-0x1
popq %rsi
callq 0xdeba7
incq %r12
leaq 0x8(%rsp), %r14
jmp 0x2dd85
movq (%rsp), %r14
movb 0x4(%r14), %al
movq 0x10(%r14), %rdi
movb %al, 0x7a(%rdi)
callq 0xf08e8
movq 0x10(%r14), %rdi
callq 0xf0812
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq