// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/src/fmtutil-advfile.c
// Function: de_advfile_run_rawfiles
static void de_advfile_run_rawfiles(deark *c, struct de_advfile *advf, int is_appledouble)
{
	struct de_advfile_cbparams *afp_main = NULL;
	struct de_advfile_cbparams *afp_rsrc = NULL;

	if(advf->mainfork.fork_exists || is_appledouble) {
		if(!advf->mainfork.fork_exists) {
			advf->mainfork.fork_len = 0;
		}
		afp_main = de_malloc(c, sizeof(struct de_advfile_cbparams));
		afp_main->whattodo = DE_ADVFILE_WRITEMAIN;
		de_finfo_set_name_from_ucstring(c, advf->mainfork.fi, advf->filename, advf->snflags);
		advf->mainfork.fi->original_filename_flag = advf->original_filename_flag;
		afp_main->outf = dbuf_create_output_file(c, NULL, advf->mainfork.fi, advf->createflags);
		if(advf->enable_wbuffer) dbuf_enable_wbuffer(afp_main->outf);
		dbuf_set_writelistener(afp_main->outf, advf->mainfork.writelistener_cb,
			advf->mainfork.userdata_for_writelistener);
		if(advf->writefork_cbfn && advf->mainfork.fork_len>0) {
			advf->writefork_cbfn(c, advf, afp_main);
		}
		dbuf_close(afp_main->outf);
		afp_main->outf = NULL;
	}
	if(!is_appledouble && advf->rsrcfork.fork_exists && advf->rsrcfork.fork_len>0) {
		afp_rsrc = de_malloc(c, sizeof(struct de_advfile_cbparams));
		setup_rsrc_finfo(advf);
		afp_rsrc->whattodo = DE_ADVFILE_WRITERSRC;
		afp_rsrc->outf = dbuf_create_output_file(c, NULL, advf->rsrcfork.fi, advf->createflags);
		if(advf->enable_wbuffer) dbuf_enable_wbuffer(afp_rsrc->outf);
		dbuf_set_writelistener(afp_rsrc->outf, advf->rsrcfork.writelistener_cb,
			advf->rsrcfork.userdata_for_writelistener);
		if(advf->writefork_cbfn) {
			advf->writefork_cbfn(c, advf, afp_rsrc);
		}
		dbuf_close(afp_rsrc->outf);
		afp_rsrc->outf = NULL;
	}

	de_free(c, afp_main);
	de_free(c, afp_rsrc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movb 0x10(%rsi), %al
testb %al, %al
sete %cl
testl %edx, %edx
sete %dl
testb %cl, %dl
jne 0xfd2cb
testb %al, %al
jne 0xfd22e
movq $0x0, 0x18(%r15)
movl $0x10, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r14
movl $0x1, (%rax)
movq 0x20(%r15), %rsi
movq 0x68(%r15), %rdx
movl 0x70(%r15), %ecx
movq %rbx, %rdi
callq 0xea53f
movb 0x79(%r15), %al
movq 0x20(%r15), %rdx
movb %al, 0x8(%rdx)
movl 0x74(%r15), %ecx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xefda1
movq %rax, %rdi
movq %rax, 0x8(%r14)
cmpb $0x0, 0x78(%r15)
je 0xfd288
callq 0xf0855
movq 0x8(%r14), %rdi
movq 0x28(%r15), %rdx
movq 0x30(%r15), %rsi
callq 0xf1412
movq 0x60(%r15), %rax
testq %rax, %rax
je 0xfd2b0
cmpq $0x0, 0x18(%r15)
jle 0xfd2b0
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq *%rax
movq 0x8(%r14), %rdi
callq 0xf052b
movq $0x0, 0x8(%r14)
testl %ebp, %ebp
jne 0xfd3eb
jmp 0xfd2ce
xorl %r14d, %r14d
cmpb $0x0, 0x38(%r15)
je 0xfd3eb
cmpq $0x0, 0x40(%r15)
jle 0xfd3eb
movl $0x10, %esi
movq %rbx, %rdi
callq 0xe8b2b
movq %rax, %r12
movq (%r15), %r13
movl $0x18, %eax
movq 0x20(%r15), %rcx
movq 0x48(%r15), %rdx
movups (%rcx,%rax), %xmm0
movups %xmm0, (%rdx,%rax)
addq $0x10, %rax
cmpq $0x68, %rax
jne 0xfd2fc
movq %r13, %rdi
callq 0xf6410
movq %rax, %rbp
movq 0x68(%r15), %rsi
movq %rax, %rdi
callq 0xf6509
cmpq $0x0, 0x10(%rbp)
jg 0xfd348
leaq 0x31649(%rip), %rsi     # 0x12e984
movq %rbp, %rdi
movl $0x5, %edx
callq 0xf65e3
leaq 0x1fe70(%rip), %rsi     # 0x11d1bf
movq %rbp, %rdi
movl $0x5, %edx
callq 0xf65e3
movq 0x48(%r15), %rsi
movl 0x70(%r15), %ecx
movq %r13, %rdi
movq %rbp, %rdx
callq 0xea53f
movb 0x79(%r15), %al
movq 0x48(%r15), %rcx
movb %al, 0x8(%rcx)
movq %rbp, %rdi
callq 0xf6753
movl $0x2, (%r12)
movq 0x48(%r15), %rdx
movl 0x74(%r15), %ecx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xefda1
movq %rax, %rdi
movq %rax, 0x8(%r12)
cmpb $0x0, 0x78(%r15)
je 0xfd3b5
callq 0xf0855
movq 0x8(%r12), %rdi
movq 0x50(%r15), %rdx
movq 0x58(%r15), %rsi
callq 0xf1412
movq 0x60(%r15), %rax
testq %rax, %rax
je 0xfd3d6
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq *%rax
movq 0x8(%r12), %rdi
callq 0xf052b
movq $0x0, 0x8(%r12)
jmp 0xfd3ee
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
movq %rbx, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe8be2
nop