// File: /workspace/github_c_makefile_star2_O1/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
movl $0x28, %esi
callq 0xe969b
movq %rax, %r14
movq 0x18(%rbx), %rdi
movl $0x3, %esi
callq 0xef0d5
xorl %edx, %edx
testb %al, %al
sete %dl
setne 0x4(%r14)
leaq 0xe7cce(%rip), %rsi     # 0x116986
movq %rbx, %rdi
callq 0xea727
movl %eax, 0xc(%r14)
leaq 0x30(%rsp), %r15
movq $0x0, (%r15)
cmpb $0x0, 0x4(%r14)
leaq 0xe7cd6(%rip), %rax     # 0x1169b2
leaq 0xe7cb7(%rip), %rsi     # 0x11699a
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0xeb6d6
movq %rbx, %rdi
xorl %esi, %esi
movl $0x11, %edx
callq 0xeb7d1
movl %eax, 0x8(%r14)
movq %rbx, %rdi
callq 0xfca54
movq %rax, 0x10(%r14)
movq %r14, 0x8(%rax)
leaq 0x287(%rip), %rcx       # 0x2efa0
movq %rcx, 0x60(%rax)
movq 0x68(%rax), %rdi
leaq 0x106709(%rip), %rsi    # 0x135431
movl $0x5, %edx
callq 0xf6a40
addq $0x4, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef34e
movq %r14, 0x28(%rsp)
movl %eax, (%r14)
leaq 0xe7c6d(%rip), %rsi     # 0x1169be
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
addq $0x10, (%r15)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xef193
movq %rax, %r15
leaq 0xe7c57(%rip), %rsi     # 0x1169ce
movq %rbx, %rdi
movl %r15d, %edx
xorl %eax, %eax
callq 0xe9226
testq %r15, %r15
jle 0x2ef1b
movq 0x30(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %r13
leaq 0x1505fd(%rip), %r14    # 0x17f3a0
xorl %r12d, %r12d
movq 0x30(%rsp), %rax
addq $0xc, %rax
movq 0x18(%rbx), %rcx
cmpq 0x18(%rcx), %rax
jg 0x2ef1b
movq %rbx, %rdi
leaq 0xe7c1d(%rip), %rsi     # 0x1169e4
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq %rbx, %rdi
movl $0x1, %esi
callq 0xe9585
leaq (%r12,%r12,2), %rax
movq 0x38(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movl %r12d, (%rsp)
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef34e
movl %eax, 0x4(%rsp)
xorl %ebp, %ebp
cmpl %eax, (%rbp,%r14)
je 0x2ee2a
addq $0x18, %rbp
cmpq $0x150, %rbp            # imm = 0x150
jne 0x2ee12
xorl %ebp, %ebp
jmp 0x2ee2d
addq %r14, %rbp
leaq 0xfd035(%rip), %rcx     # 0x12be69
testq %rbp, %rbp
je 0x2ee3d
movq 0x8(%rbp), %rcx
movq %rbx, %rdi
leaq 0x101ca6(%rip), %rsi    # 0x130aed
movl %eax, %edx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef34e
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x10d912(%rip), %rsi    # 0x13c77d
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x18(%rbx), %rdi
movq %r13, %rsi
callq 0xef34e
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
leaq 0xe7d3b(%rip), %rsi     # 0x116bcb
movq %rax, %rdx
xorl %eax, %eax
callq 0xe9226
movq 0x8(%rsp), %rax
movq 0x18(%rbx), %rcx
movq 0x18(%rcx), %rdx
movq %rdx, %r8
subq %rax, %r8
jl 0x2ef02
movq 0x10(%rsp), %rcx
addq %rcx, %rax
cmpq %rdx, %rax
jle 0x2eee2
movl (%rsp), %edx
movq %rbx, %rdi
leaq 0xe7b25(%rip), %rsi     # 0x1169ee
xorl %eax, %eax
callq 0xe9b27
movq 0x18(%rbx), %rax
movq 0x18(%rax), %rax
subq 0x8(%rsp), %rax
movq %rax, 0x10(%rsp)
testq %rbp, %rbp
je 0x2ef02
movq 0x10(%rbp), %rax
testq %rax, %rax
je 0x2ef02
movq %rbp, 0x18(%rsp)
movq %rbx, %rdi
movq 0x28(%rsp), %rsi
movq %rsp, %rdx
callq *%rax
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe9585
incq %r12
cmpq %r15, %r12
jne 0x2eda6
movq 0x28(%rsp), %r14
movb 0x4(%r14), %al
movq 0x10(%r14), %rdi
movb %al, 0x7a(%rdi)
callq 0xfcb73
movq 0x10(%r14), %rdi
callq 0xfca9a
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq