// File: /workspace/github_c_makefile_star2_O0/jsummers[P]deark/modules/xfer.c
// Function: do_base64_internal
static void do_base64_internal(deark *c, lctx *d, i64 pos, dbuf *outf)
{
	u8 b;
	int found_terminator = 0;
	int bad_warned = 0;

	d->cbuf_count = 0;
	while(pos<c->infile->len) {
		b = de_getbyte(pos++);
		if(b>='A' && b<='Z') {
			d->cbuf[d->cbuf_count++] = b-65;
		}
		else if(b>='a' && b<='z') {
			d->cbuf[d->cbuf_count++] = b-71;
		}
		else if(b>='0' && b<='9') {
			d->cbuf[d->cbuf_count++] = b+4;
		}
		else if(b=='+') {
			d->cbuf[d->cbuf_count++] = 62;
		}
		else if(b=='/') {
			d->cbuf[d->cbuf_count++] = 63;
		}
		else if(b=='=') {
			found_terminator = 1;
			break;
		}
		else if(b==9 || b==10 || b==13 || b==32) {
			; // ignore whitespace
		}
		else {
			if(!bad_warned) {
				de_warn(c, "Bad Base64 character(s) found (offset %d)", (int)pos);
				bad_warned = 1;
			}
		}

		if(d->cbuf_count>=4) {
			do_base64_flush(c, d, outf, 3);
		}
	}

	if(d->cbuf_count>0) {
		if(!found_terminator || d->cbuf_count==1) {
			de_warn(c, "Unexpected end of Base64 data");
		}
		do_base64_flush(c, d, outf, 3);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
cmpq 0x18(%rcx), %rax
jge 0x145fa2
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
movq %rsi, %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
callq 0x165060
movb %al, -0x21(%rbp)
movzbl -0x21(%rbp), %eax
cmpl $0x41, %eax
jl 0x145e5c
movzbl -0x21(%rbp), %eax
cmpl $0x5a, %eax
jg 0x145e5c
movzbl -0x21(%rbp), %eax
subl $0x41, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movl %ecx, %ecx
movb %dl, 0x4(%rax,%rcx)
jmp 0x145f7e
movzbl -0x21(%rbp), %eax
cmpl $0x61, %eax
jl 0x145e93
movzbl -0x21(%rbp), %eax
cmpl $0x7a, %eax
jg 0x145e93
movzbl -0x21(%rbp), %eax
subl $0x47, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movl %ecx, %ecx
movb %dl, 0x4(%rax,%rcx)
jmp 0x145f7c
movzbl -0x21(%rbp), %eax
cmpl $0x30, %eax
jl 0x145eca
movzbl -0x21(%rbp), %eax
cmpl $0x39, %eax
jg 0x145eca
movzbl -0x21(%rbp), %eax
addl $0x4, %eax
movb %al, %dl
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rsi
movl (%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, (%rsi)
movl %ecx, %ecx
movb %dl, 0x4(%rax,%rcx)
jmp 0x145f7a
movzbl -0x21(%rbp), %eax
cmpl $0x2b, %eax
jne 0x145ef0
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movl (%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, (%rdx)
movl %ecx, %ecx
movb $0x3e, 0x4(%rax,%rcx)
jmp 0x145f78
movzbl -0x21(%rbp), %eax
cmpl $0x2f, %eax
jne 0x145f13
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rdx
movl (%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, (%rdx)
movl %ecx, %ecx
movb $0x3f, 0x4(%rax,%rcx)
jmp 0x145f76
movzbl -0x21(%rbp), %eax
cmpl $0x3d, %eax
jne 0x145f25
movl $0x1, -0x28(%rbp)
jmp 0x145fa2
movzbl -0x21(%rbp), %eax
cmpl $0x9, %eax
je 0x145f49
movzbl -0x21(%rbp), %eax
cmpl $0xa, %eax
je 0x145f49
movzbl -0x21(%rbp), %eax
cmpl $0xd, %eax
je 0x145f49
movzbl -0x21(%rbp), %eax
cmpl $0x20, %eax
jne 0x145f4b
jmp 0x145f72
cmpl $0x0, -0x2c(%rbp)
jne 0x145f70
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl %eax, %edx
leaq 0x88c5e(%rip), %rsi     # 0x1cebc0
movb $0x0, %al
callq 0x15bc10
movl $0x1, -0x2c(%rbp)
jmp 0x145f72
jmp 0x145f74
jmp 0x145f76
jmp 0x145f78
jmp 0x145f7a
jmp 0x145f7c
jmp 0x145f7e
movq -0x10(%rbp), %rax
cmpl $0x4, (%rax)
jb 0x145f9d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x3, %ecx
callq 0x145ff0
jmp 0x145df0
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jbe 0x145fe2
cmpl $0x0, -0x28(%rbp)
je 0x145fba
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x145fcc
movq -0x8(%rbp), %rdi
leaq 0x88c25(%rip), %rsi     # 0x1cebea
movb $0x0, %al
callq 0x15bc10
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x3, %ecx
callq 0x145ff0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)