// File: /workspace/github_c_makefile_star2_O2/rpeepz[P]ft_ssl/srcs/encode/base64.c
// Function: base64_nstr_fd
void			base64_nstr_fd(uint8_t *in, int len, int fd, int *count)
{
	int			i;
	uint8_t		enc[4];

	i = 0;
	while (count ? in[i] : i < len)
	{
		DEBUG ? ft_printf("%02x %02x %02x\n", in[i], in[i + 1], in[i + 2]) : 0;
		ft_bzero(enc, 4);
		enc[0] |= in[i] >> 2;
		enc[1] |= ((in[i] & 0x03) << 4);
		enc[1] |= (in[i + 1] >> 4);
		enc[2] |= ((in[i + 1] & 0x0F) << 2);
		enc[2] |= (in[i + 2] >> 6);
		enc[3] |= (in[i + 2] & 0x3F);
		ft_putchar_fd(g_base64[enc[0]], fd);
		ft_putchar_fd(g_base64[enc[1]], fd);
		ft_putchar_fd((!enc[2] && len - i < 2) ? '=' : g_base64[enc[2]], fd);
		ft_putchar_fd((!enc[3] && len - i < 3) ? '=' : g_base64[enc[3]], fd);
		i += 3;
		count ? (*count) += 4 : 0;
		count && *count % 64 == 0 ? ft_putchar_fd('\n', fd) : 0;
		!count && (i % 48) == 0 ? ft_putchar_fd('\n', fd) : 0;
	}
	!count && (i % 48) ? ft_putchar_fd('\n', fd) : 0;
	count && len < 63 ? ft_putchar_fd('\n', fd) : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movl %edx, %ebx
movq %rdi, %r15
movl %esi, 0xc(%rsp)
movslq %esi, %rbp
xorl %r12d, %r12d
pushq $0x3
popq %rax
movq %rbp, 0x20(%rsp)
xorl %r13d, %r13d
movl %eax, 0x14(%rsp)
xorl %edx, %edx
pushq $0x30
popq %rcx
divl %ecx
testq %r14, %r14
je 0x188a
movzbl (%r15,%r13), %ecx
jmp 0x1894
xorl %ecx, %ecx
cmpq 0x20(%rsp), %r13
setl %cl
testl %ecx, %ecx
je 0x19d4
movl %eax, 0x10(%rsp)
movq %r12, 0x18(%rsp)
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rsi
callq 0x6720
movzbl (%r15,%r13), %ecx
movl %ecx, %edx
shrl $0x2, %edx
movzbl 0x8(%rsp), %eax
orq %rdx, %rax
movb %al, 0x8(%rsp)
shlb $0x4, %cl
andb $0x30, %cl
orb 0x9(%rsp), %cl
movb 0x1(%r15,%r13), %dl
movl %edx, %esi
shrb $0x4, %sil
orb %cl, %sil
movb %sil, 0x9(%rsp)
shlb $0x2, %dl
andb $0x3c, %dl
orb 0xa(%rsp), %dl
movb 0x2(%r15,%r13), %cl
movl %ecx, %esi
shrb $0x6, %sil
orb %dl, %sil
movb %sil, 0xa(%rsp)
andb $0x3f, %cl
orb %cl, 0xb(%rsp)
leaq 0x10780(%rip), %r12     # 0x12090
movsbl (%rax,%r12), %edi
movl %ebx, %esi
callq 0x6cf0
movzbl 0x9(%rsp), %eax
movsbl (%rax,%r12), %edi
movl %ebx, %esi
callq 0x6cf0
movzbl 0xa(%rsp), %eax
testq %rax, %rax
sete %dl
cmpq $0x2, %rbp
setl %sil
movb $0x3d, %r12b
movb $0x3d, %cl
testb %sil, %dl
jne 0x1954
leaq 0x1073f(%rip), %rcx     # 0x12090
movb (%rax,%rcx), %cl
movsbl %cl, %edi
movl %ebx, %esi
callq 0x6cf0
movzbl 0xb(%rsp), %eax
testq %rax, %rax
sete %cl
cmpq $0x3, %rbp
setl %dl
testb %dl, %cl
jne 0x197f
leaq 0x10715(%rip), %rcx     # 0x12090
movb (%rax,%rcx), %r12b
movsbl %r12b, %edi
movl %ebx, %esi
callq 0x6cf0
testq %r14, %r14
je 0x199c
movl (%r14), %eax
addl $0x4, %eax
movl %eax, (%r14)
testb $0x3f, %al
jmp 0x19ab
imull $0x30, 0x10(%rsp), %eax
addl $-0x10, %eax
orq $0xd, %rax
cmpl %r13d, %eax
movq 0x18(%rsp), %r12
jne 0x19bc
pushq $0xa
popq %rdi
movl %ebx, %esi
callq 0x6cf0
addl $-0x3, %r12d
addq $0x3, %r13
addq $-0x3, %rbp
movl 0x14(%rsp), %eax
addl $0x3, %eax
jmp 0x1873
testq %r14, %r14
setne %cl
sete %sil
movl %r13d, %eax
xorl %edx, %edx
pushq $0x30
popq %rdi
divl %edi
imull $0x30, %eax, %eax
addl %eax, %r12d
setne %al
andb %sil, %al
cmpl $0x3f, 0xc(%rsp)
setl %dl
andb %cl, %dl
orb %al, %dl
cmpb $0x1, %dl
jne 0x1a0f
pushq $0xa
popq %rdi
movl %ebx, %esi
callq 0x6cf0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq