// File: /workspace/github_c_makefile_star2_O3/orestesleal[P]base64/base64.c
// Function: b64_dec
unsigned int b64_dec(unsigned char *s, char b[], unsigned int len)
{
	unsigned int x,w,i,rtsize,z;
	unsigned char pad,t,l = 0;
	t = l = pad = 0;

	/* this is non-standard behavior:
		if the input file or stream contains a LINE FEED or CARRIAGE
		RETURN characters  at the end of the file (maybe generated by
		an editor) remove it to allow the padding trimming do his job */
	for (i = len-1; s[i] == '\r' || s[i] == '\n'; i--, --len); 

	/* remove trailing padding and count them, 1 or 2 '='s 
	   for base64 */	
	for (i = len-1; s[i] == PAD; --i) {
		++pad;
		--len;
	}
	w = 0;
	for (i = 0; i < len; i++) {
		for (x = 0, z = 0; z < 4 && i < len; z++, i++) {
			/* if the rfc is modified to include ignoring CRLF or 
			   PAD's in between encoded data the next block of code
			   should be uncommented
		       rfc4648 sec 3.3: */
			/*
			if (s[i] == PAD || 
				s[i] == '\n' || 
				s[i] == '\r') {
				--z;
				--i;
				continue;
			}
			*/

			/*	rfc4648 section 3.3 */ 
			if ((s[i] >= 'A' && s[i] <= 'z') || 
   		   		(s[i] >= '0' && s[i] <= '9') || 
	       		(s[i] == '+' || s[i] == '/') ) {

				/* since the input is in range within the alphabet
				   there is not possibility of failure, loop and 
				   find the position */
				for (t = 0; s[i] != b64_alp[t]; t++);
				x |= t;
				z < 3 && i+1 < len ? x <<= 6 : 0;
			} else {
				fprintf(stderr, "b64_dec: error, non alphabet char found -> %c -> %d\n",
																			s[i], s[i]);
				exit(EXIT_FAILURE);
			}
		}
		for (;z < 4; z++, x <<= 6);
		x <<= 8;
		b[w++] = x >> 24;
		b[w++] = (x << 8) >> 24;
		b[w++] = (x << 16) >> 24;
		--i;
	}
	rtsize = (len >> 2) * 3;
	if (pad) {
		rtsize += pad == 2 ? 1 : 2;
	}
	b[rtsize] = '\0';
	return rtsize; /* number of decoded bytes */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %eax
leal -0x1(%rax), %edx
movzbl (%rdi,%rdx), %ecx
cmpl $0xa, %ecx
je 0x1b1c
cmpl $0xd, %ecx
je 0x1b1c
cmpl $0x3d, %ecx
jne 0x1b48
xorl %ecx, %ecx
incb %cl
leal -0x1(%rax), %edx
addl $-0x2, %eax
cmpb $0x3d, (%rdi,%rax)
movl %edx, %eax
je 0x1b36
jmp 0x1b4c
xorl %ecx, %ecx
movl %eax, %edx
testl %edx, %edx
je 0x1c09
xorl %r8d, %r8d
leaq 0x3532(%rip), %r9       # 0x5090
xorl %r10d, %r10d
xorl %r14d, %r14d
xorl %ebx, %ebx
movl %r14d, %r11d
movl %r8d, %eax
movzbl (%rdi,%rax), %eax
leal -0x41(%rax), %r14d
cmpb $0x3a, %r14b
setb %r14b
leal -0x30(%rax), %r15d
cmpb $0xa, %r15b
setb %r15b
orb %r14b, %r15b
jne 0x1b9e
movl %eax, %r14d
orl $0x4, %r14d
cmpl $0x2f, %r14d
jne 0x1c33
movb $-0x1, %r14b
incb %r14b
movzbl %r14b, %r15d
cmpb (%r15,%r9), %al
jne 0x1ba1
movl %ebx, %eax
orl %r15d, %eax
incl %r8d
cmpl $0x2, %r11d
ja 0x1bca
movl %eax, %ebx
shll $0x6, %ebx
leal 0x1(%r11), %r14d
cmpl %edx, %r8d
jb 0x1b66
cmpl $0x2, %r11d
ja 0x1bdf
movl $0x3, %ebx
subl %r11d, %ebx
shll $0x6, %eax
decl %ebx
jne 0x1bd8
movl %eax, %r11d
shrl $0x10, %r11d
leal 0x1(%r10), %ebx
leal 0x2(%r10), %r14d
movl %r10d, %r15d
addl $0x3, %r10d
movb %r11b, (%rsi,%r15)
movb %ah, (%rsi,%rbx)
movb %al, (%rsi,%r14)
cmpl %edx, %r8d
jb 0x1b61
shrl $0x2, %edx
xorl %edi, %edi
cmpb $0x2, %cl
setne %dil
incl %edi
xorl %eax, %eax
testb %cl, %cl
cmovnel %edi, %eax
leal (%rdx,%rdx,2), %ecx
addq %rcx, %rax
movb $0x0, (%rsi,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %edi
callq 0x117e