// File: /workspace/github_c_makefile_star2_O1/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 0xe969b
movq %rax, %r14
movq %rbx, %rdi
callq 0xdbc58
movl %eax, 0x10(%r14)
testl %eax, %eax
je 0xdb3db
leaq 0x5a1fe(%rip), %rsi     # 0x135431
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xf037a
movq %rax, %r15
movl 0x10(%r14), %eax
leal -0x15(%rax), %ecx
cmpl $0x2, %ecx
jae 0xdb3f1
movl $0x0, (%r14)
movq 0x18(%rbx), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
xorl %esi, %esi
callq 0xf1c72
testl %eax, %eax
je 0xdb3d2
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %rbx, (%rsp)
incq %r12
movq 0x8(%rsp), %rcx
cmpq $0x400, %rcx            # imm = 0x400
jge 0xdb442
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movq %rbp, %rdx
callq 0xeeee8
movq 0x8(%rsp), %r13
movb $0x0, 0x20(%rsp,%r13)
addq 0x10(%rsp), %rbp
testq %r13, %r13
jle 0xdb3b0
cmpb $0x78, 0x20(%rsp)
jne 0xdb34e
cmpq $0x7, %r13
jl 0xdb2f0
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 0xdb37c
cmpq $0xb, %r13
jl 0xdb31f
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
je 0xdb39b
cmpq $0x9, %r13
jl 0xdb3b0
movq 0x20(%rsp), %rax
movabsq $0x6e4520616f746278, %rcx # imm = 0x6E4520616F746278
xorq %rcx, %rax
movzbl 0x28(%rsp), %ecx
xorq $0x64, %rcx
orq %rax, %rcx
jne 0xdb3b0
jmp 0xdb47b
xorl %eax, %eax
cmpl $0x16, 0x10(%r14)
sete %al
subq %rax, %r13
testq %r13, %r13
jle 0xdb3b0
xorl %ebx, %ebx
movzbl 0x20(%rsp,%rbx), %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdbdd5
incq %rbx
cmpq %rbx, %r13
jne 0xdb362
jmp 0xdb3b0
movq (%rsp), %rdi
leaq 0x6796e(%rip), %rsi     # 0x142cf5
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movl $0x16, 0x10(%r14)
jmp 0xdb3b0
movq (%rsp), %rdi
leaq 0x67971(%rip), %rsi     # 0x142d17
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
movq (%rsp), %rbx
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0xf1c72
testl %eax, %eax
jne 0xdb282
leaq 0x678ed(%rip), %rsi     # 0x142cc6
jmp 0xdb449
leaq 0x678b6(%rip), %rsi     # 0x142c98
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xdb456
cmpl $0x17, %eax
jne 0xdb456
movl $0x0, (%r14)
movq 0x18(%rbx), %rdi
cmpq $0x3, 0x18(%rdi)
jl 0xdb435
movl $0x2, %r12d
movq %r12, %rsi
callq 0xef0d5
cmpb $0x7e, %al
je 0xdb435
incq %r12
movzbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xdbdd5
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r12
jl 0xdb40e
movq %r14, %rdi
movq %r15, %rsi
callq 0xdbcf0
jmp 0xdb456
leaq 0x6789b(%rip), %rsi     # 0x142ce4
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9df7
movq %r15, %rdi
callq 0xf0b13
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe9752
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 0x678e1(%rip), %rsi     # 0x142d70
movq (%rsp), %rbx
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xe9226
leaq 0x678e0(%rip), %rsi     # 0x142d87
leaq 0x20(%rsp), %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x18220
movl %eax, %ebp
cmpl $0x1, %eax
jne 0xdb4e1
movq 0x18(%rsp), %rdx
movq %rdx, 0x20(%r14)
movl $0x1, 0x28(%r14)
leaq 0x44dcd(%rip), %rsi     # 0x1202a2
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9226
jmp 0xdb4f2
leaq 0x678b0(%rip), %rsi     # 0x142d98
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
cmpl $0x1, %ebp
jne 0xdb456
movq %r14, %rdi
movq %r15, %rsi
callq 0xdbcf0
cmpl $0x0, 0x28(%r14)
je 0xdb456
movq 0x18(%r14), %rcx
movq 0x20(%r14), %rdx
cmpq %rdx, %rcx
je 0xdb456
leaq 0x6781a(%rip), %rsi     # 0x142d43
movq %rbx, %rdi
xorl %eax, %eax
callq 0xe9df7
jmp 0xdb456