// File: 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
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x180(%rbp)
movq %rdi, %rax
movq %rax, -0x188(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x11250
movq -0x180(%rbp), %rdi
movb $0x0, -0x39(%rbp)
callq 0x117c0
leaq 0xb41d4(%rip), %rsi     # 0x152470
leaq -0x60(%rbp), %rdi
movl $0x10, %edx
callq 0x9e7e0
jmp 0x9e2ac
leaq 0xb41c5(%rip), %rsi     # 0x152478
leaq -0x90(%rbp), %rdi
movl $0x10, %edx
callq 0x9e7e0
jmp 0x9e2c6
leaq -0xb0(%rbp), %rdi
callq 0x9e880
jmp 0x9e2d4
leaq -0xd0(%rbp), %rdi
callq 0x9e880
jmp 0x9e2e2
movq $0x0, -0xd8(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x60(%rbp), %rdx
xorl %ecx, %ecx
callq 0x9e8c0
movb %al, -0x189(%rbp)
jmp 0x9e30b
movb -0x189(%rbp), %al
testb $0x1, %al
jne 0x9e31a
jmp 0x9e5c8
leaq -0xb0(%rbp), %rdi
callq 0x9e920
movq %rax, -0x198(%rbp)
jmp 0x9e32f
movq -0x198(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
callq 0x9e970
jmp 0x9e344
movq -0x180(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x11750
jmp 0x9e359
leaq -0xf8(%rbp), %rdi
callq 0x11360
xorl %eax, %eax
movl %eax, %esi
leaq -0xb0(%rbp), %rdi
callq 0x9e9a0
movq %rax, -0x1a0(%rbp)
jmp 0x9e37e
movq -0x1a0(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x9ea10
jmp 0x9e393
leaq -0x118(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x90(%rbp), %rdx
xorl %ecx, %ecx
callq 0x9e8c0
movb %al, -0x1a1(%rbp)
jmp 0x9e3b7
movb -0x1a1(%rbp), %al
testb $0x1, %al
jne 0x9e3c6
jmp 0x9e4d1
xorl %eax, %eax
movl %eax, %esi
leaq -0xd0(%rbp), %rdi
callq 0x9e9a0
movq %rax, -0x1b0(%rbp)
jmp 0x9e3df
movq -0x1b0(%rbp), %rsi
leaq -0x138(%rbp), %rdi
callq 0x9ea10
jmp 0x9e3f4
xorl %eax, %eax
movl %eax, %esi
leaq -0x138(%rbp), %rdi
movl $0xa, %edx
callq 0x9ead0
movl %eax, -0x1b4(%rbp)
jmp 0x9e411
movl -0x1b4(%rbp), %eax
cltq
movq %rax, -0xd8(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x11360
jmp 0x9e4d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x9e667
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x9e637
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x9e62b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x9e61f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x9e613
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x11360
jmp 0x9e613
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x9e5ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x11360
jmp 0x9e5ba
movq -0xd8(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x18(%rbp), %rdi
callq 0x273d0
movq %rax, %rcx
movq -0x1c0(%rbp), %rax
cmpq %rcx, %rax
jae 0x9e563
movq -0x18(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x2ebf0
movq %rax, %rcx
leaq -0x158(%rbp), %rdi
leaq -0x118(%rbp), %rsi
leaq -0x60(%rbp), %rdx
xorl %r8d, %r8d
callq 0x9eb10
jmp 0x9e526
movq -0x180(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x11750
jmp 0x9e53b
leaq -0x158(%rbp), %rdi
callq 0x11360
jmp 0x9e563
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x11360
jmp 0x9e5ba
leaq -0xb0(%rbp), %rdi
callq 0x9ebf0
movq %rax, -0x1c8(%rbp)
jmp 0x9e578
movq -0x1c8(%rbp), %rsi
leaq -0x178(%rbp), %rdi
callq 0x9e970
jmp 0x9e58d
leaq -0x38(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x11700
leaq -0x178(%rbp), %rdi
callq 0x11360
leaq -0x118(%rbp), %rdi
callq 0x11360
jmp 0x9e2ed
leaq -0x118(%rbp), %rdi
callq 0x11360
jmp 0x9e613
movq -0x180(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x11750
jmp 0x9e5da
movb $0x1, -0x39(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x9ec40
leaq -0xb0(%rbp), %rdi
callq 0x9ec40
leaq -0x90(%rbp), %rdi
callq 0x9ec60
leaq -0x60(%rbp), %rdi
callq 0x9ec60
testb $0x1, -0x39(%rbp)
jne 0x9e64e
jmp 0x9e642
leaq -0xd0(%rbp), %rdi
callq 0x9ec40
leaq -0xb0(%rbp), %rdi
callq 0x9ec40
leaq -0x90(%rbp), %rdi
callq 0x9ec60
leaq -0x60(%rbp), %rdi
callq 0x9ec60
jmp 0x9e667
movq -0x180(%rbp), %rdi
callq 0x11360
leaq -0x38(%rbp), %rdi
callq 0x11360
movq -0x188(%rbp), %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq -0x180(%rbp), %rdi
callq 0x11360
leaq -0x38(%rbp), %rdi
callq 0x11360
movq -0x68(%rbp), %rdi
callq 0x119c0
nopw %cs:(%rax,%rax)