// File: /workspace/github_c_makefile_star2_O3/jsummers[P]deark/modules/xfer.c
// Function: de_run_ascii85
static void de_run_ascii85(deark *c, de_module_params *mparams)
{
	lctx *d = NULL;
	dbuf *f = NULL;

	d = de_malloc(c, sizeof(lctx));

	d->ascii85_fmt = ascii85_detect_fmt(c);
	if(d->ascii85_fmt==0) {
		// TODO: Scan the file to try to detect the format.
		de_err(c, "Unknown Ascii85 format");
		goto done;
	}

	f = dbuf_create_output_file(c, "bin", NULL, 0);

	if(d->ascii85_fmt==ASCII85_FMT_BTOA_OLD ||
		d->ascii85_fmt==ASCII85_FMT_BTOA_NEW)
	{
		do_ascii85_btoa(c, d, f);
	}
	else if(d->ascii85_fmt==ASCII85_FMT_STANDARD) {
		do_ascii85_standard(c, d, f, 2);
	}

done:
	dbuf_close(f);
	de_free(c, d);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rdi, %rbx
movl $0x38, %esi
callq 0xe8b2b
movq %rax, %r14
movq %rbx, %rdi
callq 0xdb2ac
movl %eax, 0x10(%r14)
testl %eax, %eax
je 0xda9f7
leaq 0x5af68(%rip), %rsi     # 0x1357bd
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xefda1
movq %rax, %r15
movl 0x10(%r14), %eax
leal -0x15(%rax), %ecx
cmpl $0x2, %ecx
jae 0xdaa0d
movl $0x0, (%r14)
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
xorl %esi, %esi
callq 0xf166d
testl %eax, %eax
je 0xda9ee
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rbx, (%rsp)
incq %r12
movq 0x8(%rsp), %rcx
cmpq $0x400, %rcx            # imm = 0x400
jge 0xdaa5e
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movq %rbp, %rdx
callq 0xee8d4
movq 0x8(%rsp), %r13
movb $0x0, 0x20(%rsp,%r13)
addq 0x10(%rsp), %rbp
testq %r13, %r13
jle 0xda9cc
cmpb $0x78, 0x20(%rsp)
jne 0xda958
cmpq $0x7, %r13
jb 0xda9cc
movl 0x20(%rsp), %eax
movl $0x6f746278, %ecx       # imm = 0x6F746278
xorl %ecx, %eax
movl 0x23(%rsp), %ecx
movl $0x2035616f, %edx       # imm = 0x2035616F
xorl %edx, %ecx
orl %eax, %ecx
je 0xda983
cmpq $0xb, %r13
jb 0xda9a2
movq 0x20(%rsp), %rax
movabsq $0x654220616f746278, %rcx # imm = 0x654220616F746278
xorq %rcx, %rax
movq 0x23(%rsp), %rcx
movabsq $0x6e6967654220616f, %rdx # imm = 0x6E6967654220616F
xorq %rdx, %rcx
orq %rax, %rcx
jne 0xda9a8
movq (%rsp), %rdi
leaq 0x688ab(%rip), %rsi     # 0x1431f7
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
jmp 0xda9cc
xorl %eax, %eax
cmpl $0x16, 0x10(%r14)
sete %al
subq %rax, %r13
je 0xda9cc
xorl %ebx, %ebx
movzbl 0x20(%rsp,%rbx), %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdb429
incq %rbx
cmpq %rbx, %r13
jne 0xda969
jmp 0xda9cc
movq (%rsp), %rdi
leaq 0x68847(%rip), %rsi     # 0x1431d5
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
movl $0x16, 0x10(%r14)
jmp 0xda9cc
cmpq $0x9, %r13
jb 0xda9cc
movq 0x20(%rsp), %rax
movabsq $0x6e4520616f746278, %rcx # imm = 0x6E4520616F746278
xorq %rcx, %rax
movzbl 0x28(%rsp), %ecx
xorq $0x64, %rcx
orq %rax, %rcx
je 0xdaa97
movq (%rsp), %rbx
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xf166d
testl %eax, %eax
jne 0xda8a4
leaq 0x687b1(%rip), %rsi     # 0x1431a6
jmp 0xdaa65
leaq 0x6877a(%rip), %rsi     # 0x143178
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xdaa72
cmpl $0x17, %eax
jne 0xdaa72
movl $0x0, (%r14)
movq 0x18(%rbx), %rdi
cmpq $0x3, 0x18(%rdi)
jl 0xdaa51
movl $0x2, %r12d
movq %r12, %rsi
callq 0xeead3
cmpb $0x7e, %al
je 0xdaa51
incq %r12
movzbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdb429
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r12
jl 0xdaa2a
movq %r14, %rdi
movq %r15, %rsi
callq 0xdb344
jmp 0xdaa72
leaq 0x6875f(%rip), %rsi     # 0x1431c4
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9295
movq %r15, %rdi
callq 0xf052b
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe8be2
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %r13
movq $0x0, (%r13)
leaq 0x687a5(%rip), %rsi     # 0x143250
movq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe8617
leaq 0x687a4(%rip), %rsi     # 0x143267
leaq 0x20(%rsp), %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x18220
cmpl $0x1, %eax
jne 0xdab36
movq 0x18(%rsp), %rdx
movq %rdx, 0x20(%r14)
movl $0x1, 0x28(%r14)
leaq 0x458db(%rip), %rsi     # 0x1203ca
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe8617
movq %r14, %rdi
movq %r15, %rsi
callq 0xdb344
cmpl $0x0, 0x28(%r14)
je 0xdaa72
movq 0x18(%r14), %rcx
movq 0x20(%r14), %rdx
cmpq %rdx, %rcx
je 0xdaa72
leaq 0x686fc(%rip), %rsi     # 0x143223
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9295
jmp 0xdaa72
leaq 0x6873b(%rip), %rsi     # 0x143278
jmp 0xdaa01