// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x10(%rax), %eax
cmpl $0x0, %eax
jne 0x17b7ca
cmpl $0x0, -0x14(%rbp)
je 0x17b8ce
movq -0x10(%rbp), %rax
cmpb $0x0, 0x10(%rax)
jne 0x17b7e0
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x8(%rbp), %rdi
movl $0x10, %esi
callq 0x15b780
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdx
movq -0x10(%rbp), %rax
movl 0x70(%rax), %ecx
callq 0x15d2c0
movq -0x10(%rbp), %rax
movb 0x79(%rax), %cl
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movb %cl, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
movl 0x74(%rax), %ecx
xorl %eax, %eax
movl %eax, %esi
callq 0x166c60
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x78(%rax)
je 0x17b86c
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x167b90
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdx
callq 0x169280
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x17b8b5
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jle 0x17b8b5
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq *%rax
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1676a0
movq -0x20(%rbp), %rax
movq $0x0, 0x8(%rax)
cmpl $0x0, -0x14(%rbp)
jne 0x17b9b2
movq -0x10(%rbp), %rax
movzbl 0x38(%rax), %eax
cmpl $0x0, %eax
je 0x17b9b2
movq -0x10(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jle 0x17b9b2
movq -0x8(%rbp), %rdi
movl $0x10, %esi
callq 0x15b780
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x17bfc0
movq -0x28(%rbp), %rax
movl $0x2, (%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
movq -0x10(%rbp), %rax
movl 0x74(%rax), %ecx
xorl %eax, %eax
movl %eax, %esi
callq 0x166c60
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpb $0x0, 0x78(%rax)
je 0x17b95b
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x167b90
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdx
callq 0x169280
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x17b999
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq *%rax
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x1676a0
movq -0x28(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x15b820
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x15b820
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)