// File: /workspace/github_c_makefile_star2_O3/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 $0x58, %rsp
movq %rdi, %rbx
movl $0x28, %esi
callq 0xe8b2b
movq %rax, %r15
movq 0x18(%rbx), %rdi
movl $0x3, %esi
callq 0xeead3
xorl %edx, %edx
testb %al, %al
sete %dl
setne 0x4(%r15)
leaq 0xe7eae(%rip), %rsi     # 0x116a36
movq %rbx, %rdi
callq 0xe9bd0
movl %eax, 0xc(%r15)
cmpb $0x0, 0x4(%r15)
leaq 0xe7ec2(%rip), %rax     # 0x116a62
leaq 0xe7ea3(%rip), %rsi     # 0x116a4a
cmoveq %rax, %rsi
movq %rbx, %rdi
callq 0xeb125
movq %rbx, %rdi
xorl %esi, %esi
movl $0x11, %edx
callq 0xeb220
movl %eax, 0x8(%r15)
movq %rbx, %rdi
callq 0xfc498
movq %rax, 0x10(%r15)
movq %r15, 0x8(%rax)
leaq 0x2ba(%rip), %rcx       # 0x2ee97
movq %rcx, 0x60(%rax)
movq 0x68(%rax), %rdi
leaq 0x106bd1(%rip), %rsi    # 0x1357bd
movl $0x5, %edx
callq 0xf65e3
leaq 0x18(%rsp), %r14
movq $0x4, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
callq 0xeed31
movq %r15, 0x10(%rsp)
movl %eax, (%r15)
leaq 0xe7e51(%rip), %rsi     # 0x116a6e
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0xe8617
addq $0x10, (%r14)
movq 0x18(%rbx), %rdi
movq %r14, %rsi
movq %rbx, %r14
callq 0xeeb91
movq %rax, %rbx
leaq 0xe7e38(%rip), %rsi     # 0x116a7e
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0xe8617
movq %rbx, 0x30(%rsp)
testq %rbx, %rbx
jle 0x2ee13
movq 0x18(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x20(%rsp), %r15
leaq 0x1507ca(%rip), %r13    # 0x17f440
xorl %r12d, %r12d
movq %r14, 0x8(%rsp)
movq 0x18(%rsp), %rax
addq $0xc, %rax
movq 0x18(%r14), %rcx
cmpq 0x18(%rcx), %rax
jg 0x2ee13
movq %r14, %rdi
leaq 0xe7df5(%rip), %rsi     # 0x116a94
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movl $0x1, %esi
callq 0xe8a15
leaq (%r12,%r12,2), %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq %rax, 0x20(%rsp)
movl %r12d, 0x38(%rsp)
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xeed31
movq %rax, %rbp
movl %ebp, 0x3c(%rsp)
xorl %eax, %eax
movl (%rax,%r13), %ebx
cmpl %ebp, %ebx
je 0x2ed07
addq $0x18, %rax
cmpq $0x150, %rax            # imm = 0x150
jne 0x2ece2
movq $0x0, (%rsp)
leaq 0xfd44c(%rip), %rcx     # 0x12c151
jmp 0x2ed14
leaq (%rax,%r13), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax,%r13), %rcx
movq %r14, %rdi
leaq 0x10210a(%rip), %rsi    # 0x130e28
movl %ebp, %edx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xeed31
movq %rax, %r13
movq %rax, 0x40(%rsp)
movq %r14, %rdi
leaq 0x10de38(%rip), %rsi    # 0x13cb7d
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xeed31
movq %rax, %r15
movq %rax, 0x48(%rsp)
movq %r14, %rdi
leaq 0xe7f0e(%rip), %rsi     # 0x116c7b
movq %rax, %rdx
xorl %eax, %eax
callq 0xe8617
movq 0x18(%r14), %rax
movq 0x18(%rax), %rax
movq %rax, %r8
subq %r13, %r8
jl 0x2ede7
leaq (%r15,%r13), %rcx
cmpq %rax, %rcx
jle 0x2edbc
movq 0x8(%rsp), %r14
movq %r14, %rdi
leaq 0xe7cff(%rip), %rsi     # 0x116a9e
movl %r12d, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0xe8faa
movq 0x18(%r14), %rax
movq 0x18(%rax), %rax
subq %r13, %rax
movq %rax, 0x48(%rsp)
cmpl %ebp, %ebx
jne 0x2ede7
movq (%rsp), %rax
movq 0x10(%rax), %rax
testq %rax, %rax
je 0x2ede7
movq (%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq *%rax
movq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xe8a15
incq %r12
cmpq 0x30(%rsp), %r12
leaq 0x20(%rsp), %r15
leaq 0x150633(%rip), %r13    # 0x17f440
jne 0x2ec7e
movq 0x10(%rsp), %rbx
movb 0x4(%rbx), %al
movq 0x10(%rbx), %rdi
movb %al, 0x7a(%rdi)
callq 0xfc5b7
movq 0x10(%rbx), %rdi
callq 0xfc4de
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe8be2
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq