// File: /workspace/github_cpp_makefile_star2_O1/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, -0x68(%rbp)
movq %rdi, -0x38(%rbp)
movl (%rdx), %r12d
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $0x4, (%r8)
jl 0xbba0
movl (%rcx), %eax
xorl %r15d, %r15d
testl %eax, %eax
cmovgl %eax, %r15d
movq %rdi, -0x60(%rbp)
movq %rdi, -0x58(%rbp)
testl %r12d, %r12d
jle 0xbbe1
decl %r12d
leaq -0x78(%rbp), %r13
leaq -0x70(%rbp), %rbx
leaq -0x58(%rbp), %r14
leaq -0x38(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %r14, %r8
callq 0xa23b
addl $-0x1, %r12d
setb %cl
testb %al, %al
je 0xbbe1
testb %cl, %cl
jne 0xbbbc
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rsi
cmpq %rsi, %rdx
movq -0x68(%rbp), %rbx
jbe 0xbc04
subl %esi, %edx
leaq -0x50(%rbp), %rdi
callq 0x1279e
cmpb $0x0, (%rbx)
je 0xbc35
cmpl $0x0, -0x44(%rbp)
je 0xbc1f
leaq -0x29(%rbp), %rsi
movb $0x20, (%rsi)
leaq -0x50(%rbp), %rdi
callq 0x12760
movq %rbx, %rdi
callq 0x2080
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x1279e
incl %r15d
leaq 0x12f99(%rip), %r14     # 0x1ebd8
leaq 0x12f7a(%rip), %rbx     # 0x1ebc0
leaq 0x12f7b(%rip), %r12     # 0x1ebc8
leaq -0x38(%rbp), %r13
decl %r15d
testl %r15d, %r15d
jle 0xbc75
movq %r13, %rdi
leaq 0x12f6d(%rip), %rsi     # 0x1ebd0
movq %r14, %rdx
movq %rbx, %rcx
movq %r12, %r8
callq 0xa23b
testb %al, %al
jne 0xbc51
movq -0x38(%rbp), %rbx
leaq 0xb48b(%rip), %rsi      # 0x1710b
movq %rbx, %rdi
callq 0x2070
leaq (%rbx,%rax), %r15
movq %r15, -0x38(%rbp)
cmpb $0x2f, (%rbx,%rax)
jne 0xbcda
leaq 0xae3c(%rip), %rbx      # 0x16ad9
leaq 0xb467(%rip), %r14      # 0x1710b
cmpb $0x2f, 0x1(%r15)
jne 0xbcda
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2030
movq %rax, %r12
addq %r15, %r12
movq %r12, -0x38(%rbp)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2070
leaq (%r12,%rax), %r15
movq %r15, -0x38(%rbp)
cmpb $0x2f, (%rax,%r12)
je 0xbca4
movq -0x38(%rbp), %rbx
movzbl (%rbx), %eax
testl %eax, %eax
je 0xbd1b
cmpl $0x29, %eax
je 0xbd1b
cmpl $0x5d, %eax
je 0xbd1b
cmpl $0x0, -0x44(%rbp)
je 0xbd05
leaq -0x29(%rbp), %rsi
movb $0x20, (%rsi)
leaq -0x50(%rbp), %rdi
callq 0x12760
movq %rbx, %rdi
callq 0x2080
leaq -0x50(%rbp), %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x1279e
leaq -0x29(%rbp), %rsi
movb $0x0, (%rsi)
leaq -0x50(%rbp), %rdi
callq 0x12760
movq 0x124d6(%rip), %r13     # 0x1e208
movq -0x50(%rbp), %rbx
movslq -0x44(%rbp), %r15
movq %r15, %rdi
callq 0x152b1
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, -0x44(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xbd8f
callq 0x152d7
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xbda4
jmp 0xbda4
jmp 0xbda4
movq %rax, %rbx
movl $0x0, -0x44(%rbp)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0xbdbc
callq 0x152d7
movq %rbx, %rdi
callq 0x23a0