// File: /workspace/github_cpp_makefile_star2_O1/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 0xd1d2(%rip), %r15      # 0x1710f
decl %eax
cmpl $0x5, %eax
ja 0x9fc1
leaq 0xc76d(%rip), %rcx      # 0x166b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x30(%rbp), %rax
movq (%rax), %r15
jmp 0x9fc1
movq -0x30(%rbp), %rax
movss (%rax), %xmm0
callq 0x4d63
movq %rax, %r15
jmp 0x9fc1
movq -0x30(%rbp), %rax
movl (%rax), %edx
movl 0x14819(%rip), %eax     # 0x1e794
incl %eax
andl $0x3, %eax
movl %eax, 0x1480e(%rip)     # 0x1e794
movl %eax, %ecx
shll $0x8, %ecx
leal (%rcx,%rax,4), %eax
leaq 0x1480b(%rip), %r15     # 0x1e7a0
addq %r15, %rax
leaq -0x38(%rbp), %rdi
movq %rax, (%rdi)
leaq 0xcd9b(%rip), %rsi      # 0x16d41
xorl %eax, %eax
callq 0x128d0
movl 0x147e1(%rip), %eax     # 0x1e794
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,4), %rax
addq %rax, %r15
movb (%r15), %al
testb %al, %al
je 0xa0e3
leaq 0xd13c(%rip), %r14      # 0x1710f
leaq -0x38(%rbp), %r13
leaq -0x50(%rbp), %r12
cmpb $0x25, %al
jne 0xa03c
movb 0x1(%r15), %al
addq $0x2, %r15
leal -0x31(%rax), %ecx
cmpb $0x8, %cl
ja 0xa04f
movzbl %al, %eax
addl $-0x30, %eax
movq %r14, %rsi
cmpl -0x54(%rbp), %eax
jge 0xa0cd
movl %eax, %eax
shlq $0x4, %rax
movq -0x30(%rbp), %rcx
movl 0x8(%rcx,%rax), %ecx
decl %ecx
movq %r14, %rsi
cmpl $0x5, %ecx
ja 0xa0cd
addq -0x30(%rbp), %rax
leaq 0xc6a8(%rip), %rdx      # 0x166d0
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
movq %r14, %rsi
jmpq *%rcx
movq (%rax), %rsi
jmp 0xa0cd
movb %al, -0x38(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x12760
incq %r15
jmp 0xa05d
movb %al, -0x38(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x12760
movb (%r15), %al
testb %al, %al
jne 0x9fdb
jmp 0xa0e3
movss (%rax), %xmm0
callq 0x4d63
movq %rax, %rsi
jmp 0xa0cd
movl (%rax), %edx
movl 0x14714(%rip), %eax     # 0x1e794
incl %eax
andl $0x3, %eax
movl %eax, 0x14709(%rip)     # 0x1e794
movl %eax, %ecx
shll $0x8, %ecx
leal (%rcx,%rax,4), %eax
leaq 0x14706(%rip), %rcx     # 0x1e7a0
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq %r13, %rdi
leaq 0xcc96(%rip), %rsi      # 0x16d41
xorl %eax, %eax
callq 0x128d0
movl 0x146dc(%rip), %eax     # 0x1e794
movq %rax, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rax,4), %rsi
leaq 0x146d6(%rip), %rax     # 0x1e7a0
addq %rax, %rsi
cmpb $0x0, (%rsi)
je 0xa05d
leaq 0x1(%rsi), %rbx
movq %r12, %rdi
callq 0x12760
movq %rbx, %rsi
jmp 0xa0cd
leaq -0x38(%rbp), %rsi
movb $0x0, (%rsi)
leaq -0x50(%rbp), %rdi
callq 0x12760
movq -0x50(%rbp), %rbx
movq 0x1410a(%rip), %r12     # 0x1e208
movq %rbx, %rdi
callq 0x2080
movq %rax, %r14
incq %r14
movq %r14, %rdi
callq 0x152b1
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 0xa147
callq 0x152d7
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa160
jmp 0xa160
jmp 0xa160
jmp 0xa160
jmp 0xa160
movq %rax, %rbx
movl $0x0, -0x44(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xa178
callq 0x152d7
movq %rbx, %rdi
callq 0x23a0