// File: /workspace/github_cpp_makefile_star2_O1/jorbs[P]stellar-keypair-tool/./lib/basen.h
// Function: void bn::impl::encode<bn::impl::b32_conversion_traits, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, std::back_insert_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>(__gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, __gnu_cxx::__normal_iterator<unsigned char const*, std::vector<unsigned char, std::allocator<unsigned char>>>, std::back_insert_iterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>)
void encode(Iter1 start, Iter1 end, Iter2 out)
{
    Iter1 iter = start;
    int start_bit = 0;
    bool has_backlog = false;
    char backlog = 0;

    while (has_backlog || iter != end) {
        if (!has_backlog) {
            if (start_bit + ConversionTraits::group_length() < 8) {
                // the value fits within single byte, so we can extract it
                // directly
                char v = extract_partial_bits(*iter, start_bit, ConversionTraits::group_length());
                *out++ = ConversionTraits::encode(v);
                // since we know that start_bit + ConversionTraits::group_length() < 8 we don't need to go
                // to the next byte
                start_bit += ConversionTraits::group_length();
            }
            else {
                // our bits are spanning across byte border; we need to keep the
                // starting point and move over to next byte.
                backlog = *iter++;
                has_backlog = true;
            }
        }
        else {
            // encode value which is made from bits spanning across byte
            // boundary
            char v = extract_overlapping_bits(backlog, (iter != end) ? *iter : 0, start_bit, ConversionTraits::group_length());
            *out++ = ConversionTraits::encode(v);
            has_backlog = false;
            start_bit = (start_bit + ConversionTraits::group_length()) % 8;
        }
    }
    while (start_bit != 0)
    {
        *out++ = '=';
        start_bit = (start_bit + ConversionTraits::group_length()) % 8;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
xorl %r13d, %r13d
xorl %r12d, %r12d
movzbl %al, %eax
movl %eax, 0x4(%rsp)
movl $0x3, %ebp
subl %r12d, %ebp
testb $0x1, %r13b
jne 0x3409
cmpq %r14, %r15
je 0x3473
cmpl $0x2, %r12d
jg 0x3465
addl $0x5, %r12d
cmpl $0x8, %r12d
jae 0x34af
movsbl (%r15), %eax
movl %ebp, %ecx
sarl %cl, %eax
andl $0x1f, %eax
leaq 0xe88(%rip), %rcx       # 0x4280
movsbl (%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x2130
addl $-0x5, %ebp
jmp 0x33bf
cmpq %r14, %r15
je 0x3414
movsbl (%r15), %eax
jmp 0x3416
xorl %eax, %eax
movb $0xb, %cl
subb %r12b, %cl
sarl %cl, %eax
leal 0x5(%r12), %ebp
addb $-0x3, %r12b
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %r12d, %ecx
shll %cl, %edx
notl %edx
movl 0x4(%rsp), %ecx
movl %ecx, %esi
movl %r12d, %ecx
shll %cl, %esi
andl %eax, %edx
orl %edx, %esi
andl $0x1f, %esi
leaq 0xe35(%rip), %rax       # 0x4280
movsbl (%rsi,%rax), %esi
movq %rbx, %rdi
callq 0x2130
andl $0x7, %ebp
xorl %r13d, %r13d
movl %ebp, %r12d
jmp 0x33b7
movb (%r15), %al
incq %r15
movb $0x1, %r13b
jmp 0x33b0
testl %r12d, %r12d
je 0x34a0
movq %rbx, %rdi
movl $0x3d, %esi
callq 0x2130
leal 0x5(%r12), %eax
addl $0xc, %r12d
testl %eax, %eax
cmovnsl %eax, %r12d
andl $-0x8, %r12d
subl %r12d, %eax
movl %eax, %r12d
jne 0x3478
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd29(%rip), %rdi       # 0x41df
leaq 0xd3d(%rip), %rsi       # 0x41fa
leaq 0xd44(%rip), %rcx       # 0x4208
movl $0xff, %edx
callq 0x20d0