// File: /workspace/github_c_makefile_star2_O0/orestesleal[P]base64/base64.c
// Function: b32_enc
void b32_enc(unsigned char *s, unsigned char *b, unsigned int len)
{
	unsigned long long x;	/* c99 only */
	unsigned int i,w,z;
	unsigned char ap[5] = {0,6,4,3,1};

	w = x = 0;
	/* 	in base32 per 5 bytes of input we get 40 bits that must
		be treated as eight 5 bits groups, each 5 bit number
		will be used as an index into the base32 alphabet  */
	for (i = 0; i < len; i++) {
		for (z = 0; z < 5 && i < len; z++, i++) {
			x |= s[i];
			x <<= 8;
		}
		/* compute the number of shifts needed to align all bytes
			to the most significant part of x, this avoids several
			iterations of one 'test, shift, and increment' loop */
		x <<= (7 - z) << 3; /* mul by 8 */ 

		/* 	this block could be optimized for size within a loop, but that
			will involve a and additional 'test and increment' step on a 
			loop, which will make the code a tiny fraction more slower,
			this is coded for speed, not size */
		b[w++] = b32_alp[x >> 59];
		b[w++] = b32_alp[(x << 5) >> 59];
		b[w++] = b32_alp[(x << 10) >> 59];
		b[w++] = b32_alp[(x << 15) >> 59];
		b[w++] = b32_alp[(x << 20) >> 59];
		b[w++] = b32_alp[(x << 25) >> 59];
		b[w++] = b32_alp[(x << 30) >> 59];
		b[w++] = b32_alp[(x << 35) >> 59];
		--i;
	}
	b[w] = '\0';
	for (i = ap[len % 5]; i; i--) {
		b[--w] = PAD; 
	}		
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl 0xffc(%rip), %eax       # 0x3271
movl %eax, -0x31(%rbp)
movb 0xff7(%rip), %al        # 0x3275
movb %al, -0x2d(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x2478
movl $0x0, -0x2c(%rbp)
xorl %eax, %eax
cmpl $0x5, -0x2c(%rbp)
movb %al, -0x32(%rbp)
jae 0x22c1
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
setb %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x22ca
jmp 0x22fd
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movzbl (%rax,%rcx), %eax
orq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
shlq $0x8, %rax
movq %rax, -0x20(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x22aa
movl $0x7, %ecx
subl -0x2c(%rbp), %ecx
shll $0x3, %ecx
movq -0x20(%rbp), %rax
movl %ecx, %ecx
shlq %cl, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
shrq $0x3b, %rcx
leaq 0x2ddc(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0x5, %rcx
shrq $0x3b, %rcx
leaq 0x2db2(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0xa, %rcx
shrq $0x3b, %rcx
leaq 0x2d88(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0xf, %rcx
shrq $0x3b, %rcx
leaq 0x2d5e(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0x14, %rcx
shrq $0x3b, %rcx
leaq 0x2d34(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0x19, %rcx
shrq $0x3b, %rcx
leaq 0x2d0a(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0x1e, %rcx
shrq $0x3b, %rcx
leaq 0x2ce0(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rcx
shlq $0x23, %rcx
shrq $0x3b, %rcx
leaq 0x2cb6(%rip), %rax      # 0x5100
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x28(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2297
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x14(%rbp), %eax
movl $0x5, %ecx
xorl %edx, %edx
divl %ecx
movl %edx, %eax
movzbl -0x31(%rbp,%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x24bd
movq -0x10(%rbp), %rax
movl -0x28(%rbp), %ecx
addl $-0x1, %ecx
movl %ecx, -0x28(%rbp)
movl %ecx, %ecx
movb $0x3d, (%rax,%rcx)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2499
popq %rbp
retq
nop