// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../libcperciva/util/b64encode.c
// Function: b64decode
int
b64decode(const char * in, size_t inlen, uint8_t * out, size_t * outlen)
{
	uint32_t t;
	ptrdiff_t pos;
	size_t deadbytes = 0;
	size_t i;

	/* We must have a multiple of 4 input bytes. */
	if (inlen % 4 != 0)
		goto bad;

	/* Check that we have valid input and count trailing '='s. */
	for (i = 0; i < inlen; i++) {
		/* Must be characters from our b64 character set. */
		if ((in[i] == '\0') || (strchr(b64chars, in[i]) == NULL))
			goto bad;

		/* Is this a '=' character? */
		if (in[i] == '=')
			deadbytes += 1;

		/* No non-'=' bytes after a '=' byte. */
		if ((in[i] != '=') && (deadbytes > 0))
			goto bad;
	}

	/* Can't have more than 2 trailing '=' bytes. */
	if (deadbytes > 2)
		goto bad;

	/* We have no output yet. */
	*outlen = 0;

	/* Loop until we run out of data. */
	while (inlen) {
		/* Parse 4 bytes. */
		for (t = 0, i = 0; i < 4; i++) {
			t <<= 6;
			pos = strchr(b64chars, in[i]) - b64chars;
			t += (uint32_t)(pos & 0x3f);
		}

		/* Output 3 bytes. */
		for (i = 0; i < 3; i++) {
			out[i] = (t >> 16) & 0xff;
			t <<= 8;
		}

		/* Adjust pointers and lengths for the completed block. */
		in += 4;
		inlen -= 4;
		out += 3;
		*outlen += 3;
	}

	/* Ignore dead bytes. */
	*outlen -= deadbytes;

	/* Success! */
	return (0);

bad:
	/* The input is not valid base-64 encoded text. */
	return (1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x18(%rbp), %rax
andq $0x3, %rax
cmpq $0x0, %rax
je 0x102e3
jmp 0x1048c
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x1037a
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x10328
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %esi
leaq 0x16353(%rip), %rdi     # 0x26670
callq 0x3170
cmpq $0x0, %rax
jne 0x1032d
jmp 0x1048c
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x1034a
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
je 0x10367
cmpq $0x0, -0x40(%rbp)
jbe 0x10367
jmp 0x1048c
jmp 0x10369
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x102eb
cmpq $0x2, -0x40(%rbp)
jbe 0x10386
jmp 0x1048c
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0x18(%rbp)
je 0x10472
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x48(%rbp)
cmpq $0x4, -0x48(%rbp)
jae 0x103fd
movl -0x2c(%rbp), %eax
shll $0x6, %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %esi
leaq 0x162a2(%rip), %rdi     # 0x26670
callq 0x3170
leaq 0x16296(%rip), %rcx     # 0x26670
subq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
andq $0x3f, %rax
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x103ab
movq $0x0, -0x48(%rbp)
cmpq $0x3, -0x48(%rbp)
jae 0x1043b
movl -0x2c(%rbp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %dl
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x2c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x2c(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x10405
movq -0x10(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
subq $0x4, %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
addq $0x3, %rcx
movq %rcx, (%rax)
jmp 0x10391
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rax
movq (%rax), %rcx
subq %rdx, %rcx
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x10493
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)