// File: /workspace/github_cpp_makefile_star2_O3/Fohlen[P]cubescript-standalone/command.cpp
// Function: format(tagval*, int)
void format(tagval *args, int numargs)
{
    vector<char> s;
    const char *f = args[0].getstr();
    while(*f)
    {
        int c = *f++;
        if(c == '%')
        {
            int i = *f++;
            if(i >= '1' && i <= '9')
            {
                i -= '0';
                const char *sub = i < numargs ? args[i].getstr() : "";
                while(*sub) s.add(*sub++);
            }
            else s.add(i);
        }
        else s.add(c);
    }
    s.add('\0');
    result(s.getbuf());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, -0x54(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq %rdi, -0x30(%rbp)
movl 0x8(%rdi), %eax
leaq 0xdc70(%rip), %r15      # 0x1826f
decl %eax
cmpl $0x5, %eax
ja 0xa683
leaq 0xd20b(%rip), %rcx      # 0x17818
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movq (%rax), %r15
jmp 0xa683
movq -0x30(%rbp), %rax
movss (%rax), %xmm0
callq 0x4d4c
movq %rax, %r15
jmp 0xa683
movq -0x30(%rbp), %rax
movl (%rax), %edx
movl 0x15157(%rip), %eax     # 0x1f794
incl %eax
andl $0x3, %eax
movl %eax, 0x1514c(%rip)     # 0x1f794
movl %eax, %ecx
shll $0x8, %ecx
leal (%rcx,%rax,4), %eax
leaq 0x15149(%rip), %r15     # 0x1f7a0
addq %r15, %rax
leaq -0x38(%rbp), %rdi
movq %rax, (%rdi)
leaq 0xd839(%rip), %rsi      # 0x17ea1
xorl %eax, %eax
callq 0x12e1e
movl 0x1511f(%rip), %eax     # 0x1f794
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,4), %rax
addq %rax, %r15
movb (%r15), %al
testb %al, %al
je 0xa7a5
leaq 0xdbda(%rip), %r14      # 0x1826f
leaq -0x38(%rbp), %r13
leaq -0x50(%rbp), %r12
cmpb $0x25, %al
jne 0xa6fe
movb 0x1(%r15), %al
addq $0x2, %r15
leal -0x31(%rax), %ecx
cmpb $0x8, %cl
ja 0xa711
movzbl %al, %eax
addl $-0x30, %eax
movq %r14, %rsi
cmpl -0x54(%rbp), %eax
jge 0xa78f
movl %eax, %eax
shlq $0x4, %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx,%rax), %ecx
decl %ecx
movq %r14, %rsi
cmpl $0x5, %ecx
ja 0xa78f
addq -0x30(%rbp), %rax
leaq 0xd146(%rip), %rdx      # 0x17830
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movq %r14, %rsi
jmpq *%rcx
movq (%rax), %rsi
jmp 0xa78f
movb %al, -0x38(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x12ca0
incq %r15
jmp 0xa71f
movb %al, -0x38(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x12ca0
movb (%r15), %al
testb %al, %al
jne 0xa69d
jmp 0xa7a5
movss (%rax), %xmm0
callq 0x4d4c
movq %rax, %rsi
jmp 0xa78f
movl (%rax), %edx
movl 0x15052(%rip), %eax     # 0x1f794
incl %eax
andl $0x3, %eax
movl %eax, 0x15047(%rip)     # 0x1f794
movl %eax, %ecx
shll $0x8, %ecx
leal (%rcx,%rax,4), %eax
leaq 0x15044(%rip), %rcx     # 0x1f7a0
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq %r13, %rdi
leaq 0xd734(%rip), %rsi      # 0x17ea1
xorl %eax, %eax
callq 0x12e1e
movl 0x1501a(%rip), %eax     # 0x1f794
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,4), %rsi
leaq 0x15014(%rip), %rax     # 0x1f7a0
addq %rax, %rsi
cmpb $0x0, (%rsi)
je 0xa71f
leaq 0x1(%rsi), %rbx
movq %r12, %rdi
callq 0x12ca0
movq %rbx, %rsi
jmp 0xa78f
leaq -0x38(%rbp), %rsi
movb $0x0, (%rsi)
leaq -0x50(%rbp), %rdi
callq 0x12ca0
movq -0x50(%rbp), %rbx
movq 0x14a48(%rip), %r12     # 0x1f208
movq %rbx, %rdi
callq 0x2080
movq %rax, %r14
incq %r14
movq %r14, %rdi
callq 0x15705
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2130
movl $0x3, 0x8(%r12)
movq %r15, (%r12)
movl $0x0, -0x44(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xa809
callq 0x1572b
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa822
jmp 0xa822
jmp 0xa822
jmp 0xa822
jmp 0xa822
movq %rax, %rbx
movl $0x0, -0x44(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xa83a
callq 0x1572b
movq %rbx, %rdi
callq 0x23a0