// File: Fohlen[P]cubescript-standalone/command.cpp
// Function: conc(tagval*, int, bool, char const*, int)
static char *conc(tagval *v, int n, bool space, const char *prefix, int prefixlen)
{
    static int vlen[MAXARGS];
    static char numbuf[3*MAXSTRLEN];
    int len = prefixlen, numlen = 0, i = 0;
    for(; i < n; i++) switch(v[i].type)
    {
        case VAL_MACRO: len += (vlen[i] = v[i].code[-1]>>8); break;
        case VAL_STR: len += (vlen[i] = int(strlen(v[i].s))); break;
        case VAL_INT:
            if(numlen + MAXSTRLEN > int(sizeof(numbuf))) goto overflow;
            intformat(&numbuf[numlen], v[i].i);
            numlen += (vlen[i] = strlen(&numbuf[numlen]));
            break;
        case VAL_FLOAT:
            if(numlen + MAXSTRLEN > int(sizeof(numbuf))) goto overflow;
            floatformat(&numbuf[numlen], v[i].f);
            numlen += (vlen[i] = strlen(&numbuf[numlen]));
            break;
        default: vlen[i] = 0; break;
    }
overflow:
    if(space) len += max(prefix ? i : i-1, 0);
    char *buf = newstring(len + numlen);
    int offset = 0, numoffset = 0;
    if(prefix)
    {
        memcpy(buf, prefix, prefixlen);
        offset += prefixlen;
        if(space && i) buf[offset++] = ' ';
    }
    loopj(i)
    {
        if(v[j].type == VAL_INT || v[j].type == VAL_FLOAT)
        {
            memcpy(&buf[offset], &numbuf[numoffset], vlen[j]);
            numoffset += vlen[j];
        }
        else if(vlen[j]) memcpy(&buf[offset], v[j].s, vlen[j]);
        offset += vlen[j];
        if(j==i-1) break;
        if(space) buf[offset++] = ' ';
    }
    buf[offset] = '\0';
    if(i < n)
    {
        char *morebuf = conc(&v[i], n-i, space, buf, offset);
        delete[] buf;
        return morebuf;
    }
    return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x14e47
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
movl 0x8(%rax,%rcx), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x5, %eax
ja 0x14e25
movq -0x58(%rbp), %rax
leaq 0x907e(%rip), %rcx      # 0x1dd78
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x4(%rax), %eax
shrl $0x8, %eax
movslq -0x30(%rbp), %rdx
leaq 0x130da(%rip), %rcx     # 0x27e00
movl %eax, (%rcx,%rdx,4)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x14e37
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x20b0
movslq -0x30(%rbp), %rdx
leaq 0x130aa(%rip), %rcx     # 0x27e00
movl %eax, (%rcx,%rdx,4)
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x14e37
movl -0x2c(%rbp), %eax
addl $0x104, %eax            # imm = 0x104
cmpl $0x30c, %eax            # imm = 0x30C
jle 0x14d78
jmp 0x14e49
movslq -0x2c(%rbp), %rax
leaq 0x130ed(%rip), %rdi     # 0x27e70
addq %rax, %rdi
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %esi
callq 0xb810
movslq -0x2c(%rbp), %rax
leaq 0x130c9(%rip), %rdi     # 0x27e70
addq %rax, %rdi
callq 0x20b0
movslq -0x30(%rbp), %rdx
leaq 0x13046(%rip), %rcx     # 0x27e00
movl %eax, (%rcx,%rdx,4)
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x14e37
movl -0x2c(%rbp), %eax
addl $0x104, %eax            # imm = 0x104
cmpl $0x30c, %eax            # imm = 0x30C
jle 0x14dd6
jmp 0x14e49
movslq -0x2c(%rbp), %rax
leaq 0x1308f(%rip), %rdi     # 0x27e70
addq %rax, %rdi
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movss (%rax), %xmm0
callq 0xb850
movslq -0x2c(%rbp), %rax
leaq 0x13069(%rip), %rdi     # 0x27e70
addq %rax, %rdi
callq 0x20b0
movslq -0x30(%rbp), %rdx
leaq 0x12fe6(%rip), %rcx     # 0x27e00
movl %eax, (%rcx,%rdx,4)
addl -0x2c(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x14e37
movslq -0x30(%rbp), %rcx
leaq 0x12fd0(%rip), %rax     # 0x27e00
movl $0x0, (%rax,%rcx,4)
jmp 0x14e39
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x14cc2
jmp 0x14e49
testb $0x1, -0x15(%rbp)
je 0x14e77
cmpq $0x0, -0x20(%rbp)
je 0x14e5e
movl -0x30(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0x14e67
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %edi
xorl %esi, %esi
callq 0xca20
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
movslq %eax, %rdi
callq 0x16090
movq %rax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x14edc
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movslq -0x24(%rbp), %rdx
callq 0x2170
movl -0x24(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
testb $0x1, -0x15(%rbp)
je 0x14eda
cmpl $0x0, -0x30(%rbp)
je 0x14eda
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movslq %ecx, %rcx
movb $0x20, (%rax,%rcx)
jmp 0x14edc
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x14fef
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x1, 0x8(%rax)
je 0x14f19
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $0x2, 0x8(%rax)
jne 0x14f5c
movq -0x38(%rbp), %rdi
movslq -0x3c(%rbp), %rax
addq %rax, %rdi
movslq -0x40(%rbp), %rax
leaq 0x12f41(%rip), %rsi     # 0x27e70
addq %rax, %rsi
movslq -0x44(%rbp), %rcx
leaq 0x12ec3(%rip), %rax     # 0x27e00
movslq (%rax,%rcx,4), %rdx
callq 0x2170
movslq -0x44(%rbp), %rcx
leaq 0x12eaf(%rip), %rax     # 0x27e00
movl (%rax,%rcx,4), %eax
addl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
jmp 0x14fa0
movslq -0x44(%rbp), %rcx
leaq 0x12e99(%rip), %rax     # 0x27e00
cmpl $0x0, (%rax,%rcx,4)
je 0x14f9e
movq -0x38(%rbp), %rdi
movslq -0x3c(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movslq -0x44(%rbp), %rcx
leaq 0x12e6b(%rip), %rax     # 0x27e00
movslq (%rax,%rcx,4), %rdx
callq 0x2170
jmp 0x14fa0
movslq -0x44(%rbp), %rcx
leaq 0x12e55(%rip), %rax     # 0x27e00
movl (%rax,%rcx,4), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x44(%rbp), %eax
movl -0x30(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14fc3
jmp 0x14fef
testb $0x1, -0x15(%rbp)
je 0x14fdf
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x3c(%rbp)
movslq %ecx, %rcx
movb $0x20, (%rax,%rcx)
jmp 0x14fe1
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x14ee3
movq -0x38(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x15052
movq -0x10(%rbp), %rdi
movslq -0x30(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
subl -0x30(%rbp), %esi
movb -0x15(%rbp), %al
movq -0x38(%rbp), %rcx
movl -0x3c(%rbp), %r8d
andb $0x1, %al
movzbl %al, %edx
callq 0x14c90
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x15048
movq -0x68(%rbp), %rdi
callq 0x1b110
movq -0x50(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1505a
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)