// File: /workspace/github_cpp_makefile_star2_O3/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 %ecx, %ecx
xorl %eax, %eax
xorl %r12d, %r12d
movzbl %cl, %ecx
movl %ecx, 0x4(%rsp)
testb $0x1, %al
je 0x3375
cmpq %r14, %r15
je 0x33b9
movsbl (%r15), %eax
jmp 0x33bb
cmpq %r14, %r15
je 0x3422
cmpl $0x2, %r12d
jg 0x3415
leal 0x5(%r12), %ebp
cmpl $0x8, %ebp
jae 0x347d
movsbl (%r15), %eax
movb $0x3, %cl
subb %r12b, %cl
sarl %cl, %eax
andl $0x1f, %eax
leaq 0xf45(%rip), %rcx       # 0x42f0
movsbl (%rax,%rcx), %esi
movq %rbx, %rdi
callq 0x2130
jmp 0x340b
xorl %eax, %eax
leal 0x5(%r12), %r13d
cmpl $0x10, %r13d
jae 0x345e
leal -0x3(%r12), %ebp
movl 0x4(%rsp), %edx
movl %ebp, %ecx
shll %cl, %edx
movb $0xb, %cl
subb %r12b, %cl
sarl %cl, %eax
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movl %ebp, %ecx
shll %cl, %esi
notl %esi
andl %eax, %esi
orl %edx, %esi
andl $0x1f, %esi
leaq 0xef9(%rip), %rax       # 0x42f0
movsbl (%rsi,%rax), %esi
movq %rbx, %rdi
callq 0x2130
cmpl $0x8, %r13d
cmovbl %r13d, %ebp
xorl %eax, %eax
movl %ebp, %r12d
jmp 0x3366
movb (%r15), %cl
incq %r15
movb $0x1, %al
jmp 0x335f
testl %r12d, %r12d
je 0x344f
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 0x3427
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xde9(%rip), %rdi       # 0x424e
leaq 0xd8e(%rip), %rsi       # 0x41fa
leaq 0xdf7(%rip), %rcx       # 0x426a
movl $0x107, %edx            # imm = 0x107
callq 0x20d0
leaq 0xd5b(%rip), %rdi       # 0x41df
leaq 0xd6f(%rip), %rsi       # 0x41fa
leaq 0xd76(%rip), %rcx       # 0x4208
movl $0xff, %edx
callq 0x20d0