// File: /workspace/github_cpp_makefile_star2_O1/sokolcom[P]tp-blockchain-task06/uint256_t/uint256_t.cpp
// Function: uint256_t::str[abi:cxx11](unsigned char, unsigned int const&) const
std::string uint256_t::str(uint8_t base, const unsigned int & len) const{
    if ((base < 2) || (base > 36)){
        throw std::invalid_argument("Base must be in the range 2-36");
    }
    std::string out = "";
    if (!(*this)){
        out = "0";
    }
    else{
        std::pair <uint256_t, uint256_t> qr(*this, uint256_0);
        do{
            qr = divmod(qr.first, base);
            out = "0123456789abcdefghijklmnopqrstuvwxyz"[(uint8_t) qr.second] + out;
        } while (qr.first);
    }
    if (out.size() < len){
        out = std::string(len - out.size(), '0') + out;
    }
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %edx, %r14d
leal -0x25(%r14), %eax
cmpb $-0x24, %al
jbe 0x55f3
movq %rcx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rsp)
movq %rax, (%rdi)
leaq 0x2dc7(%rip), %rdx      # 0x817e
movq %rdx, %rsi
callq 0x34fa
leaq 0x10(%r15), %rdi
movq %r15, %rsi
callq 0x25e4
leaq 0x50(%rsp), %rdi
movq %rax, (%rdi)
movq %rdx, 0x8(%rdi)
callq 0x25a6
testb %al, %al
je 0x5509
movq %r12, 0x8(%rsp)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
leaq 0x60(%rsp), %rax
movaps %xmm1, (%rax)
movaps %xmm0, -0x10(%rax)
leaq 0x70(%rsp), %r12
movups 0x7d8e(%rip), %xmm0     # 0xd198
movaps %xmm0, (%r12)
movups 0x7d92(%rip), %xmm0     # 0xd1a8
movaps %xmm0, 0x10(%r12)
movzbl %r14b, %r15d
leaq 0x30(%rsp), %r14
leaq 0x10(%rsp), %r13
leaq 0x50(%rsp), %rbp
movq %r15, 0x98(%rsp)
movq $0x0, 0xa0(%rsp)
leaq 0x2bbe(%rip), %rax      # 0x8008
movups (%rax), %xmm0
leaq 0xa8(%rsp), %rax
movups %xmm0, (%rax)
movq %r13, %rdi
movq %rbp, %rdx
leaq 0x98(%rsp), %rcx
callq 0x4ac8
movups 0x10(%rsp), %xmm0
movups 0x20(%rsp), %xmm1
movaps %xmm1, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq %r12, %rdi
callq 0x25b2
movzbl %al, %eax
leaq 0x2c39(%rip), %rcx      # 0x80de
movsbl (%rax,%rcx), %esi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x335b
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2180
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x54db
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2150
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x25e4
movq %rax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %r13, %rdi
callq 0x25a6
testb %al, %al
jne 0x542f
movq 0x8(%rsp), %r12
jmp 0x5524
movq 0x8(%rbx), %rdx
leaq 0x2b32(%rip), %rcx      # 0x8046
movl $0x1, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2200
movl (%r12), %esi
subq 0x8(%rbx), %rsi
jbe 0x55de
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x10(%rsp), %rdi
movl $0x30, %edx
callq 0x2170
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x10(%rsp), %rdi
callq 0x2060
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5583
movq %rdx, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x558b
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x50(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2180
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x55c7
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x2150
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x55de
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20b0
movq %rax, %rbx
leaq 0x2ab8(%rip), %rsi      # 0x80bf
movq %rax, %rdi
callq 0x2280
movq 0x79ba(%rip), %rsi      # 0xcfd0
movq 0x79a3(%rip), %rdx      # 0xcfc0
movq %rbx, %rdi
callq 0x2240
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x5659
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2150
jmp 0x5659
jmp 0x5656
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
jmp 0x5671
jmp 0x5656
jmp 0x5656
jmp 0x5656
movq %rax, %r14
movq (%rbx), %rdi
cmpq (%rsp), %rdi
je 0x5671
movq (%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x2150
movq %r14, %rdi
callq 0x2250