// File: /workspace/github_cpp_makefile_star2_O3/Nallantli[P]Rossa/main/rossa/util/util.cpp
// Function: util::format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
const std::string util::format(const std::string &fmt, const std::vector<std::string> &args)
{
    std::string in(fmt), out;        // unformatted and formatted strings
    std::regex re_arg("\\{\\d+\\}"); // search for {0}, {1}, ...
    std::regex re_idx("\\d+");       // search for 0, 1, ...
    std::smatch m_arg, m_idx;        // store matches
    size_t idx = 0;                  // index of argument inside {...}

    // Replace all {x} with vbuf[x]
    while (std::regex_search(in, m_arg, re_arg))
    {
        out += m_arg.prefix();
        auto text = m_arg[0].str();
        if (std::regex_search(text, m_idx, re_idx))
        {
            idx = std::stoi(m_idx[0].str());
        }
        if (idx < args.size())
        {
            out += std::regex_replace(text, re_arg, args[idx]);
        }
        in = m_arg.suffix();
    }
    out += in;
    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %r14
movq %rdi, %r15
leaq 0x70(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x1ded4
leaq 0x10(%r15), %r12
movq %r12, (%r15)
movq $0x0, 0x8(%r15)
movb $0x0, 0x10(%r15)
leaq 0x3cc92(%rip), %rsi     # 0x84a98
leaq 0xc8(%rsp), %rdi
movl $0x10, %edx
callq 0x48498
movq %r12, 0x30(%rsp)
leaq 0x3cc7c(%rip), %rsi     # 0x84aa0
leaq 0xe8(%rsp), %rdi
movl $0x10, %edx
callq 0x48498
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %rax
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0xa0(%rsp), %rax
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x48(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0x20(%rsp), %rbx
xorl %r12d, %r12d
movq %r15, 0x58(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
addq %rdi, %rsi
leaq 0x80(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
xorl %r8d, %r8d
callq 0x5340d
testb %al, %al
je 0x481fe
movq 0x88(%rsp), %rax
movq %rax, %rcx
subq 0x80(%rsp), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq $0x4, %rcx
movq $-0x30, %rcx
movq $-0x48, %rdx
cmovbq %rdx, %rcx
cmpb $0x1, 0x10(%rax,%rcx)
jne 0x47f06
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
leaq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x55456
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
jmp 0x47f20
leaq 0x48(%rsp), %rsi
movq %rsi, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
xorl %edx, %edx
movq %r15, %rdi
callq 0x10120
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x47f44
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x80(%rsp), %rcx
movq 0x88(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
leaq -0x48(%rdx), %rsi
cmpq $0x48, %rax
movq %rcx, %rax
cmoveq %rsi, %rax
cmpq %rcx, %rdx
cmoveq %rsi, %rax
cmpb $0x1, 0x10(%rax)
jne 0x47f98
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %r13, 0x38(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x55456
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
jmp 0x47fb0
movq %r13, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
xorl %esi, %esi
movq %r13, %rdi
addq %rdi, %rsi
leaq 0xa0(%rsp), %rdx
leaq 0xe8(%rsp), %rcx
xorl %r8d, %r8d
callq 0x5340d
testb %al, %al
leaq 0x10(%rsp), %r10
je 0x480c0
movq 0xa0(%rsp), %rcx
movq 0xa8(%rsp), %rdx
movq %rdx, %rax
subq %rcx, %rax
leaq -0x48(%rdx), %rsi
cmpq $0x48, %rax
movq %rcx, %rax
cmoveq %rsi, %rax
cmpq %rcx, %rdx
cmoveq %rsi, %rax
cmpb $0x1, 0x10(%rax)
jne 0x48025
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbp, 0x10(%rsp)
movq %r10, %rdi
callq 0x55456
movq 0x10(%rsp), %r13
jmp 0x4803b
movq %rbp, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %rbp, %r13
callq 0x10050
movq %rax, %r15
movl (%rax), %ebp
movl $0x0, (%rax)
movq %r13, %rdi
leaq 0xc0(%rsp), %rsi
movl $0xa, %edx
callq 0x10570
cmpq %r13, 0xc0(%rsp)
je 0x48295
movq %rax, %r12
movslq %r12d, %rax
cmpq %r12, %rax
jne 0x482a1
movl (%r15), %eax
cmpl $0x22, %eax
je 0x482a1
testl %eax, %eax
leaq 0x10(%rsp), %r10
jne 0x48095
movl %ebp, (%r15)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rbp
cmpq %rbp, %rdi
je 0x480b6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x10(%rsp), %r10
movq 0x58(%rsp), %r15
leaq 0x48(%rsp), %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rcx, %r12
jae 0x48148
movq %r12, %rcx
shlq $0x5, %rcx
movq %rbx, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
addq %rsi, %rdx
movq (%rax,%rcx), %r8
movq 0x8(%rax,%rcx), %r9
movl $0x0, (%rsp)
movq %r10, %rdi
leaq 0xc8(%rsp), %rcx
callq 0x554cf
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x10120
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48143
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x10(%rsp), %r10
movq 0x88(%rsp), %rax
movq %rax, %rcx
subq 0x80(%rsp), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq $0x4, %rcx
movq $-0x18, %rcx
movq $-0x48, %rdx
cmovbq %rdx, %rcx
cmpb $0x1, 0x10(%rax,%rcx)
jne 0x481a7
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbx, 0x10(%rsp)
movq %r10, %rdi
callq 0x55456
leaq 0x10(%rsp), %r10
jmp 0x481ba
movq %rbx, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
leaq 0x60(%rsp), %rdi
movq %r10, %rsi
callq 0x104f0
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x481de
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x47e6e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x47e6e
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r15, %rdi
callq 0x10120
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
leaq 0x70(%rsp), %rbx
je 0x48232
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4824f
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
leaq 0xe8(%rsp), %rdi
callq 0x48500
leaq 0xc8(%rsp), %rdi
callq 0x48500
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48280
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %r15, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c817(%rip), %rdi     # 0x84ab3
callq 0x10240
leaq 0x3c80b(%rip), %rdi     # 0x84ab3
callq 0x105a0
jmp 0x48357
movq %rax, %r14
leaq 0x70(%rsp), %rbx
movq 0x30(%rsp), %r12
jmp 0x483ab
movq %rax, %r14
jmp 0x483b8
movq %rax, %r14
jmp 0x482f4
jmp 0x48357
jmp 0x482da
jmp 0x48331
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x482f4
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x48(%rsp), %r13
jmp 0x48334
movq %rax, %r14
jmp 0x4834b
movq %rax, %r14
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
jne 0x4833e
jmp 0x4834b
movq %rax, %r14
cmpl $0x0, (%r15)
jne 0x48320
movl %ebp, (%r15)
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0x482e7
jmp 0x482f4
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0x4834b
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x70(%rsp), %rbx
movq 0x58(%rsp), %r15
jmp 0x4835f
movq %rax, %r14
leaq 0x70(%rsp), %rbx
movq 0x30(%rsp), %r12
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x48381
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x4839e
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
leaq 0xe8(%rsp), %rdi
callq 0x48500
leaq 0xc8(%rsp), %rdi
callq 0x48500
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x483cc
movq (%r12), %rsi
incq %rsi
callq 0x103d0
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x483e3
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %r14, %rdi
callq 0x106f0