// File: /workspace/github_c_makefile_star2_O0/aerospike[P]aerospike-common/src/main/citrusleaf/cf_b64.c
// Function: cf_b64_encode
void
cf_b64_encode(const uint8_t* in, uint32_t in_size, char* out)
{
	int i = 0;
	int j = 0;

	while (in_size >= 3) {
		uint8_t i0 = in[i];
		uint8_t i1 = in[i + 1];
		uint8_t i2 = in[i + 2];

		out[j]     = EA[ (i0 & 0xfc) >> 2];
		out[j + 1] = EA[((i0 & 0x03) << 4) + ((i1 & 0xf0) >> 4)];
		out[j + 2] = EA[((i1 & 0x0f) << 2) + ((i2 & 0xc0) >> 6)];
		out[j + 3] = EA[  i2 & 0x3f];

		i += 3;
		j += 4;

		in_size -= 3;
	}

	if (in_size == 1) {
		uint8_t i0 = in[i];

		out[j]     = EA[(i0 & 0xfc) >> 2];
		out[j + 1] = EA[(i0 & 0x03) << 4];
		out[j + 2] = '=';
		out[j + 3] = '=';
	}
	else if (in_size == 2) {
		uint8_t i0 = in[i];
		uint8_t i1 = in[i + 1];

		out[j]     = EA[ (i0 & 0xfc) >> 2];
		out[j + 1] = EA[((i0 & 0x03) << 4) + ((i1 & 0xf0) >> 4)];
		out[j + 2] = EA[ (i1 & 0x0f) << 2];
		out[j + 3] = '=';
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x3, -0xc(%rbp)
jb 0x1ff2f
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x22(%rbp)
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x23(%rbp)
movzbl -0x21(%rbp), %eax
andl $0xfc, %eax
sarl $0x2, %eax
movslq %eax, %rcx
leaq 0x772f(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb %dl, (%rax,%rcx)
movzbl -0x21(%rbp), %eax
andl $0x3, %eax
shll $0x4, %eax
movzbl -0x22(%rbp), %ecx
andl $0xf0, %ecx
sarl $0x4, %ecx
addl %ecx, %eax
movslq %eax, %rcx
leaq 0x76fe(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movzbl -0x22(%rbp), %eax
andl $0xf, %eax
shll $0x2, %eax
movzbl -0x23(%rbp), %ecx
andl $0xc0, %ecx
sarl $0x6, %ecx
addl %ecx, %eax
movslq %eax, %rcx
leaq 0x76c8(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movzbl -0x23(%rbp), %eax
andl $0x3f, %eax
movslq %eax, %rcx
leaq 0x76a4(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x20(%rbp)
movl -0xc(%rbp), %eax
subl $0x3, %eax
movl %eax, -0xc(%rbp)
jmp 0x1fe1d
cmpl $0x1, -0xc(%rbp)
jne 0x1ffb9
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x24(%rbp)
movzbl -0x24(%rbp), %eax
andl $0xfc, %eax
sarl $0x2, %eax
movslq %eax, %rcx
leaq 0x7643(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb %dl, (%rax,%rcx)
movzbl -0x24(%rbp), %eax
andl $0x3, %eax
shll $0x4, %eax
movslq %eax, %rcx
leaq 0x7621(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb $0x3d, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb $0x3d, (%rax,%rcx)
jmp 0x20078
cmpl $0x2, -0xc(%rbp)
jne 0x20076
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x25(%rbp)
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
movb %al, -0x26(%rbp)
movzbl -0x25(%rbp), %eax
andl $0xfc, %eax
sarl $0x2, %eax
movslq %eax, %rcx
leaq 0x75a6(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movslq -0x20(%rbp), %rcx
movb %dl, (%rax,%rcx)
movzbl -0x25(%rbp), %eax
andl $0x3, %eax
shll $0x4, %eax
movzbl -0x26(%rbp), %ecx
andl $0xf0, %ecx
sarl $0x4, %ecx
addl %ecx, %eax
movslq %eax, %rcx
leaq 0x7575(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movzbl -0x26(%rbp), %eax
andl $0xf, %eax
shll $0x2, %eax
movslq %eax, %rcx
leaq 0x754e(%rip), %rax      # 0x275a0
movb (%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x18(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movb $0x3d, (%rax,%rcx)
jmp 0x20078
popq %rbp
retq
nopw (%rax,%rax)