// File: /workspace/github_cpp_makefile_star2_O3/sokolcom[P]tp-blockchain-task06/uint256_t/uint128_t.cpp
// Function: uint128_t::str[abi:cxx11](unsigned char, unsigned int const&) const
std::string uint128_t::str(uint8_t base, const unsigned int & len) const{
    if ((base < 2) || (base > 16)){
        throw std::invalid_argument("Base must be in the range [2, 16]");
    }
    std::string out = "";
    if (!(*this)){
        out = "0";
    }
    else{
        std::pair <uint128_t, uint128_t> qr(*this, uint128_0);
        do{
            qr = divmod(qr.first, base);
            out = "0123456789abcdef"[(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 $0x68, %rsp
movl %edx, %r15d
leal -0x11(%r15), %eax
cmpb $-0x10, %al
jbe 0x2f5c
movq %rcx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x28(%rsp)
movq %rax, (%rdi)
leaq 0x53c9(%rip), %rdx      # 0x817e
movq %rdx, %rsi
callq 0x34e8
movq (%r12), %rax
orq 0x8(%r12), %rax
je 0x2e79
movq %r14, 0x50(%rsp)
movups (%r12), %xmm0
leaq 0x10(%rsp), %rax
movaps %xmm0, -0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movzbl %r15b, %r14d
leaq 0x40(%rsp), %rbp
leaq 0x30(%rsp), %r15
leaq 0x58(%rsp), %r13
leaq 0x526b(%rip), %r12      # 0x806a
movq %r14, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq %r15, %rdi
movq %rsp, %rdx
movq %r13, %rcx
callq 0x2a1a
movups 0x30(%rsp), %xmm0
movaps %xmm0, (%rsp)
movups (%rbp), %xmm0
leaq 0x10(%rsp), %rax
movups %xmm0, (%rax)
movzbl 0x10(%rsp), %eax
movsbl (%rax,%r12), %esi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x3341
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2180
movq 0x30(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2e67
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2150
movq (%rsp), %rax
orq 0x8(%rsp), %rax
jne 0x2dff
movq 0x50(%rsp), %r14
jmp 0x2e94
movq 0x8(%rbx), %rdx
leaq 0x51c2(%rip), %rcx      # 0x8046
movl $0x1, %r8d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2200
movl (%r14), %esi
subq 0x8(%rbx), %rsi
jbe 0x2f4a
leaq 0x40(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x30(%rsp), %rdi
movl $0x30, %edx
callq 0x2170
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x30(%rsp), %rdi
callq 0x2060
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2ef1
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x2ef9
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %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 0x2f33
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2150
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x2f4a
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2150
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x20b0
movq %rax, %rbx
leaq 0x50d8(%rip), %rsi      # 0x8048
movq %rax, %rdi
callq 0x2280
movq 0xa051(%rip), %rsi      # 0xcfd0
movq 0xa03a(%rip), %rdx      # 0xcfc0
movq %rbx, %rdi
callq 0x2240
jmp 0x2fbd
movq %rax, %r14
movq 0x30(%rsp), %rdi
cmpq %r15, %rdi
je 0x2fc0
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x2150
jmp 0x2fc0
jmp 0x2fbd
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
jmp 0x2fda
jmp 0x2fbd
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x28(%rsp), %rdi
je 0x2fda
movq 0x28(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x2150
movq %r14, %rdi
callq 0x2250