// File: /workspace/github_cpp_makefile_star2_O3/Fohlen[P]cubescript-standalone/command.cpp
// Function: listsplice(char const*, char const*, int*, int*, int*)
void listsplice(const char *s, const char *vals, int *skip, int *count, int *numargs)
{
    int offset = max(*skip, 0), len = *numargs >= 4 ? max(*count, 0) : -1;
    const char *list = s, *start, *end, *qstart, *qend = s;
    loopi(offset) if(!parselist(s, start, end, qstart, qend)) break;
    vector<char> p;
    if(qend > list) p.put(list, qend-list);
    if(*vals)
    {
        if(!p.empty()) p.add(' ');
        p.put(vals, strlen(vals));
    }
    while(len-- > 0) if(!parselist(s)) break;
    skiplist(s);
    switch(*s)
    {
        case '\0': case ')': case ']': break;
        default:
            if(!p.empty()) p.add(' ');
            p.put(s, strlen(s));
            break;
    }
    p.add('\0');
    commandret->setstr(newstring(p.getbuf(), p.length()-1));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, -0x48(%rbp)
movl (%rdx), %r12d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $0x4, (%r8)
jl 0xc1d7
movl (%rcx), %eax
xorl %r15d, %r15d
testl %eax, %eax
cmovgl %eax, %r15d
movq %rdi, -0x50(%rbp)
testl %r12d, %r12d
jle 0xc241
movq %rdi, -0x58(%rbp)
movq %rbx, -0x60(%rbp)
decl %r12d
leaq -0x70(%rbp), %r13
leaq -0x68(%rbp), %rbx
leaq -0x50(%rbp), %r14
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %r14, %r8
callq 0xa8fd
addl $-0x1, %r12d
setb %cl
testb %al, %al
je 0xc21c
testb %cl, %cl
jne 0xc1f7
movq -0x50(%rbp), %rdx
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq -0x58(%rbp), %rsi
cmpq %rsi, %rdx
movq -0x60(%rbp), %rbx
jbe 0xc248
subl %esi, %edx
leaq -0x40(%rbp), %rdi
callq 0x12ce0
jmp 0xc248
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
cmpb $0x0, (%rbx)
je 0xc279
cmpl $0x0, -0x34(%rbp)
je 0xc263
leaq -0x29(%rbp), %rsi
movb $0x20, (%rsi)
leaq -0x40(%rbp), %rdi
callq 0x12ca0
movq %rbx, %rdi
callq 0x2080
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x12ce0
incl %r15d
leaq 0x13955(%rip), %r14     # 0x1fbd8
leaq 0x13936(%rip), %rbx     # 0x1fbc0
leaq 0x13937(%rip), %r12     # 0x1fbc8
leaq -0x48(%rbp), %r13
decl %r15d
testl %r15d, %r15d
jle 0xc2b9
movq %r13, %rdi
leaq 0x13929(%rip), %rsi     # 0x1fbd0
movq %r14, %rdx
movq %rbx, %rcx
movq %r12, %r8
callq 0xa8fd
testb %al, %al
jne 0xc295
movq -0x48(%rbp), %r14
leaq 0xbfa7(%rip), %rsi      # 0x1826b
movq %r14, %rdi
callq 0x2070
leaq (%r14,%rax), %rbx
movq %rbx, -0x48(%rbp)
movb (%r14,%rax), %al
cmpb $0x2f, %al
jne 0xc320
leaq 0xb956(%rip), %r14      # 0x17c39
leaq 0xbf81(%rip), %r15      # 0x1826b
cmpb $0x2f, 0x1(%rbx)
jne 0xc331
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2030
movq %rax, %r12
addq %rbx, %r12
movq %r12, -0x48(%rbp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x2070
leaq (%r12,%rax), %rbx
movq %rbx, -0x48(%rbp)
movb (%rax,%r12), %al
cmpb $0x2f, %al
je 0xc2ea
testb %al, %al
je 0xc35d
movzbl %al, %eax
cmpl $0x29, %eax
je 0xc35d
cmpl $0x5d, %eax
je 0xc35d
cmpl $0x0, -0x34(%rbp)
je 0xc347
leaq -0x29(%rbp), %rsi
movb $0x20, (%rsi)
leaq -0x40(%rbp), %rdi
callq 0x12ca0
movq %rbx, %rdi
callq 0x2080
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x12ce0
leaq -0x29(%rbp), %rsi
movb $0x0, (%rsi)
leaq -0x40(%rbp), %rdi
callq 0x12ca0
movq 0x12e94(%rip), %r13     # 0x1f208
movq -0x40(%rbp), %rbx
movslq -0x34(%rbp), %r15
movq %r15, %rdi
callq 0x15705
movq %rax, %r14
movq %rbx, %rdi
callq 0x2080
movq %rax, %r12
incq %r12
cmpq %r15, %r12
cmovaeq %r15, %r12
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2130
movb $0x0, -0x1(%r14,%r12)
movl $0x3, 0x8(%r13)
movq %r14, (%r13)
movl $0x0, -0x34(%rbp)
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xc3d1
callq 0x1572b
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xc3e6
jmp 0xc3e6
jmp 0xc3e6
movq %rax, %rbx
movl $0x0, -0x34(%rbp)
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0xc3fe
callq 0x1572b
movq %rbx, %rdi
callq 0x23a0