// File: /workspace/github_c_makefile_star2_O3/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, 0x14(%rsp)
movslq %esi, %r13
xorl %ebp, %ebp
movl $0x3, 0x10(%rsp)
movq %r13, 0x20(%rsp)
xorl %r12d, %r12d
testq %r14, %r14
je 0x18c3
movzbl (%r15,%r12), %eax
jmp 0x18cd
xorl %eax, %eax
cmpq 0x20(%rsp), %r12
setl %al
testl %eax, %eax
je 0x1a1a
movq %rbp, 0x18(%rsp)
movl $0x4, %esi
leaq 0xc(%rsp), %rdi
callq 0x7370
movzbl (%r15,%r12), %ecx
movl %ecx, %edx
shrl $0x2, %edx
movzbl 0xc(%rsp), %eax
orq %rdx, %rax
movb %al, 0xc(%rsp)
shlb $0x4, %cl
andb $0x30, %cl
orb 0xd(%rsp), %cl
movb 0x1(%r15,%r12), %dl
movl %edx, %esi
shrb $0x4, %sil
orb %cl, %sil
movb %sil, 0xd(%rsp)
shlb $0x2, %dl
andb $0x3c, %dl
orb 0xe(%rsp), %dl
movb 0x2(%r15,%r12), %cl
movl %ecx, %esi
shrb $0x6, %sil
orb %dl, %sil
movb %sil, 0xe(%rsp)
andb $0x3f, %cl
orb %cl, 0xf(%rsp)
leaq 0x10759(%rip), %rbp     # 0x120a0
movsbl (%rax,%rbp), %edi
movl %ebx, %esi
callq 0x7928
movzbl 0xd(%rsp), %eax
movsbl (%rax,%rbp), %edi
movl %ebx, %esi
callq 0x7928
movzbl 0xe(%rsp), %eax
testq %rax, %rax
sete %dl
cmpq $0x2, %r13
setl %sil
movb $0x3d, %bpl
movb $0x3d, %cl
testb %sil, %dl
jne 0x1989
leaq 0x1071a(%rip), %rcx     # 0x120a0
movb (%rax,%rcx), %cl
movsbl %cl, %edi
movl %ebx, %esi
callq 0x7928
movzbl 0xf(%rsp), %eax
testq %rax, %rax
sete %cl
cmpq $0x3, %r13
setl %dl
testb %dl, %cl
jne 0x19b4
leaq 0x106f0(%rip), %rcx     # 0x120a0
movb (%rax,%rcx), %bpl
movsbl %bpl, %edi
movl %ebx, %esi
callq 0x7928
testq %r14, %r14
je 0x19d1
movl (%r14), %eax
addl $0x4, %eax
movl %eax, (%r14)
testb $0x3f, %al
jmp 0x19f2
movl 0x10(%rsp), %eax
movl $0xaaaaaaab, %ecx       # imm = 0xAAAAAAAB
imulq %rcx, %rax
shrq $0x25, %rax
leal (%rax,%rax,2), %eax
shll $0x4, %eax
addl $-0x10, %eax
orq $0xd, %rax
cmpl %r12d, %eax
movq 0x18(%rsp), %rbp
jne 0x1a05
movl $0xa, %edi
movl %ebx, %esi
callq 0x7928
addl $-0x3, %ebp
addq $0x3, %r12
addq $-0x3, %r13
addl $0x3, 0x10(%rsp)
jmp 0x18b7
testq %r14, %r14
setne %al
sete %cl
movl %r12d, %edx
movl $0xaaaaaaab, %esi       # imm = 0xAAAAAAAB
imulq %rdx, %rsi
shrq $0x25, %rsi
leal (%rsi,%rsi,2), %edx
shll $0x4, %edx
addl %edx, %ebp
setne %dl
andb %cl, %dl
cmpl $0x3f, 0x14(%rsp)
setl %cl
andb %al, %cl
orb %dl, %cl
cmpb $0x1, %cl
jne 0x1a5d
movl $0xa, %edi
movl %ebx, %esi
callq 0x7928
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq