// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x38
popq %rsi
callq 0xdecaf
movq %rax, %r14
movq %rbx, %rdi
callq 0xd1de3
movl %eax, 0x10(%r14)
testl %eax, %eax
je 0xd1634
leaq 0x5709e(%rip), %rsi     # 0x1284dd
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xe4e62
movq %rax, %r15
movl 0x10(%r14), %eax
leal -0x15(%rax), %ecx
cmpl $0x2, %ecx
jae 0xd164a
andl $0x0, (%r14)
xorl %ebp, %ebp
xorl %r12d, %r12d
movq %rbx, 0x8(%rsp)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movq %rsp, %rdx
leaq 0x10(%rsp), %rcx
callq 0xe6482
testl %eax, %eax
je 0xd168d
incq %r12
movq (%rsp), %rcx
cmpq $0x400, %rcx            # imm = 0x400
jge 0xd1696
movq 0x18(%rbx), %rdi
leaq 0x20(%rsp), %rsi
movq %rbp, %rdx
callq 0xe3cb7
movq (%rsp), %r13
movb $0x0, 0x20(%rsp,%r13)
addq 0x10(%rsp), %rbp
testq %r13, %r13
jle 0xd146c
cmpb $0x78, 0x20(%rsp)
jne 0xd1521
cmpq $0x7, %r13
jb 0xd146c
leaq 0x20(%rsp), %rdi
leaq 0x64871(%rip), %rsi     # 0x135d4b
pushq $0x7
popq %rdx
callq 0x18230
testl %eax, %eax
je 0xd1554
cmpq $0xb, %r13
jb 0xd1575
leaq 0x20(%rsp), %rdi
leaq 0x64843(%rip), %rsi     # 0x135d3f
pushq $0xb
popq %rdx
callq 0x18230
testl %eax, %eax
jne 0xd157f
movq %rbx, %rdi
leaq 0x64895(%rip), %rsi     # 0x135da7
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
jmp 0xd146c
xorl %eax, %eax
cmpl $0x16, 0x10(%r14)
sete %al
subq %rax, %r13
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0xd154a
movzbl 0x20(%rsp,%rbx), %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xd1f4e
incq %rbx
jmp 0xd1530
movq 0x8(%rsp), %rbx
jmp 0xd146c
movq %rbx, %rdi
leaq 0x64827(%rip), %rsi     # 0x135d85
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
movl $0x16, 0x10(%r14)
jmp 0xd146c
cmpq $0x9, %r13
jb 0xd146c
leaq 0x20(%rsp), %rdi
leaq 0x6483e(%rip), %rsi     # 0x135dc9
pushq $0x9
popq %rdx
callq 0x18230
testl %eax, %eax
jne 0xd146c
leaq 0x18(%rsp), %r13
andq $0x0, (%r13)
leaq 0x64854(%rip), %rsi     # 0x135e00
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xde896
leaq 0x64857(%rip), %rsi     # 0x135e17
leaq 0x20(%rsp), %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x18220
cmpl $0x1, %eax
jne 0xd16cf
movq 0x18(%rsp), %rdx
movq %rdx, 0x20(%r14)
movl $0x1, 0x28(%r14)
leaq 0x41ce8(%rip), %rsi     # 0x1132d8
movq %rbx, %rdi
xorl %eax, %eax
callq 0xde896
movq %r14, %rdi
movq %r15, %rsi
callq 0xd1e6c
cmpl $0x0, 0x28(%r14)
je 0xd16aa
movq 0x18(%r14), %rcx
movq 0x20(%r14), %rdx
cmpq %rdx, %rcx
je 0xd16aa
leaq 0x647ab(%rip), %rsi     # 0x135dd3
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xd16aa
leaq 0x646ed(%rip), %rsi     # 0x135d28
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xdf2a5
jmp 0xd16aa
cmpl $0x17, %eax
jne 0xd16aa
andl $0x0, (%r14)
pushq $0x2
popq %r12
movq 0x18(%rbx), %rdi
cmpq 0x18(%rdi), %r12
jge 0xd1680
movq %r12, %rsi
callq 0xe3eb4
cmpb $0x7e, %al
je 0xd1680
incq %r12
movzbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0xd1f4e
jmp 0xd1657
movq %r14, %rdi
movq %r15, %rsi
callq 0xd1e6c
jmp 0xd16aa
leaq 0x646c2(%rip), %rsi     # 0x135d56
jmp 0xd169d
leaq 0x646d7(%rip), %rsi     # 0x135d74
movq %rbx, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0xdf2a5
movq %r15, %rdi
callq 0xe5591
movq %rbx, %rdi
movq %r14, %rsi
callq 0xded32
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x64752(%rip), %rsi     # 0x135e28
jmp 0xd163e