// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
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 0x1e014
leaq 0x10(%r12), %r15
movq %r15, (%r12)
movq $0x0, 0x8(%r12)
movb $0x0, 0x10(%r12)
leaq 0x3d38e(%rip), %rsi     # 0x85a78
leaq 0xc8(%rsp), %rdi
movl $0x10, %edx
callq 0x48d42
movq %r15, 0x10(%rsp)
leaq 0x3d378(%rip), %rsi     # 0x85a80
leaq 0xe8(%rsp), %rdi
movl $0x10, %edx
callq 0x48d42
xorps %xmm0, %xmm0
leaq 0x80(%rsp), %r13
movaps %xmm0, 0x10(%r13)
movaps %xmm0, (%r13)
leaq 0xa0(%rsp), %rax
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
leaq 0x48(%rsp), %rbx
leaq 0x28(%rsp), %rbp
xorl %r15d, %r15d
movq %r12, 0x58(%rsp)
movq 0x60(%rsp), %rdi
movq 0x68(%rsp), %rsi
addq %rdi, %rsi
movq %r13, %rdx
leaq 0xc8(%rsp), %rcx
xorl %r8d, %r8d
callq 0x53c6e
testb %al, %al
je 0x48aca
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 0x487d4
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbx, 0x38(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x55ca8
jmp 0x487e7
movq %rbx, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x10120
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48810
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 0x4885a
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbx, 0x38(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x55ca8
jmp 0x4886d
movq %rbx, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
addq %rdi, %rsi
leaq 0xa0(%rsp), %rdx
leaq 0xe8(%rsp), %rcx
xorl %r8d, %r8d
callq 0x53c6e
testb %al, %al
leaq 0x18(%rsp), %r10
je 0x4898c
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 0x488e7
movq (%rax), %rsi
movq 0x8(%rax), %rdx
movq %rbp, 0x18(%rsp)
movq %r10, %rdi
callq 0x55ca8
jmp 0x488fa
movq %rbp, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq 0x18(%rsp), %r13
callq 0x10050
movq %rax, %r12
movl (%rax), %ebx
movl $0x0, (%rax)
movq %r13, %rdi
leaq 0xc0(%rsp), %rsi
movl $0xa, %edx
callq 0x10570
cmpq %r13, 0xc0(%rsp)
je 0x48b61
movq %rax, %r15
movslq %r15d, %rax
cmpq %r15, %rax
leaq 0x18(%rsp), %r10
jne 0x48b6d
movl (%r12), %eax
cmpl $0x22, %eax
je 0x48b6d
testl %eax, %eax
leaq 0x80(%rsp), %r13
jne 0x48963
movl %ebx, (%r12)
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x4897f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x18(%rsp), %r10
movslq %r15d, %r15
movq 0x58(%rsp), %r12
leaq 0x48(%rsp), %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rcx, %r15
jae 0x48a14
movq %r15, %rcx
shlq $0x5, %rcx
movq %rbp, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%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 0x55d1c
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r12, %rdi
callq 0x10120
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x48a0f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x18(%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 0x48a73
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbp, 0x18(%rsp)
movq %r10, %rdi
callq 0x55ca8
leaq 0x18(%rsp), %r10
jmp 0x48a86
movq %rbp, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
leaq 0x60(%rsp), %rdi
movq %r10, %rsi
callq 0x104f0
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x48aaa
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48750
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x48750
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %r12, %rdi
callq 0x10120
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
leaq 0x70(%rsp), %rbx
je 0x48afe
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x48b1b
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
leaq 0xe8(%rsp), %rdi
callq 0x48daa
leaq 0xc8(%rsp), %rdi
callq 0x48daa
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48b4c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %r12, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3cf2b(%rip), %rdi     # 0x85a93
callq 0x10240
leaq 0x3cf1f(%rip), %rdi     # 0x85a93
callq 0x105a0
jmp 0x48c01
movq %rax, %r14
leaq 0x70(%rsp), %rbx
movq 0x10(%rsp), %r15
jmp 0x48c55
movq %rax, %r14
jmp 0x48c62
movq %rax, %r14
jmp 0x48bd4
jmp 0x48c01
jmp 0x48ba3
jmp 0x48bdb
movq %rax, %r14
jmp 0x48bbd
movq %rax, %r14
jmp 0x48bf5
jmp 0x48bdb
movq %rax, %r14
cmpl $0x0, (%r12)
jne 0x48bbd
movl %ebx, (%r12)
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x48bd4
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x48(%rsp), %rbx
jmp 0x48bde
movq %rax, %r14
movq 0x38(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48bf5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0x70(%rsp), %rbx
movq 0x58(%rsp), %r12
jmp 0x48c09
movq %rax, %r14
leaq 0x70(%rsp), %rbx
movq 0x10(%rsp), %r15
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x48c2b
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x48c48
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x103d0
leaq 0xe8(%rsp), %rdi
callq 0x48daa
leaq 0xc8(%rsp), %rdi
callq 0x48daa
movq (%r12), %rdi
cmpq %r15, %rdi
je 0x48c76
movq (%r15), %rsi
incq %rsi
callq 0x103d0
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x48c8d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x103d0
movq %r14, %rdi
callq 0x106f0