// File: /workspace/github_cpp_makefile_star2_O1/Fohlen[P]cubescript-standalone/command.cpp
// Function: listfind(ident*, char const*, unsigned int const*)
void listfind(ident *id, const char *list, const uint *body)
{
    if(id->type!=ID_ALIAS) { intret(-1); return; }
    identstack stack;
    int n = -1;
    for(const char *s = list, *start, *end; parselist(s, start, end);)
    {
        ++n;
        char *val = newstring(start, end-start);
        setiter(*id, val, stack);
        if(executebool(body)) { intret(n); goto found; }
    }
    intret(-1);
found:
    if(n >= 0) poparg(*id);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, -0x38(%rbp)
cmpl $0x4, (%rdi)
jne 0xaeec
movq %rdi, %rbx
leaq -0x50(%rbp), %rax
movq %rsi, (%rax)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
leaq -0x50(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq 0x13e85(%rip), %rcx     # 0x1ebc0
leaq 0x13e86(%rip), %r8      # 0x1ebc8
callq 0xa23b
testb %al, %al
je 0xae72
movb %al, -0x29(%rbp)
movl %r14d, -0x30(%rbp)
movq -0x48(%rbp), %r15
movq -0x40(%rbp), %r14
subq %r15, %r14
incq %r14
movq %r14, %rdi
callq 0x152b1
movq %rax, %r13
movq %r15, %rdi
callq 0x2080
movq %rax, %r12
incq %r12
cmpq %r14, %r12
jb 0xad85
movq %r14, %r12
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2130
movb $0x0, -0x1(%r13,%r12)
movq 0x28(%rbx), %rax
leaq -0x68(%rbp), %rdx
cmpq %rdx, %rax
je 0xadf9
movq 0x20(%rbx), %rcx
movq %rcx, -0x68(%rbp)
movl 0x10(%rbx), %ecx
movl %ecx, -0x60(%rbp)
movq %rax, -0x58(%rbp)
movq %rdx, 0x28(%rbx)
movl $0x3, 0x10(%rbx)
movq %r13, 0x20(%rbx)
movq 0x18(%rbx), %rax
testq %rax, %rax
movl -0x30(%rbp), %r14d
je 0xadf3
addl $0xffffff00, (%rax)     # imm = 0xFFFFFF00
movq 0x18(%rbx), %rdi
cmpl $0xff, (%rdi)
jg 0xadeb
callq 0x152d7
movq $0x0, 0x18(%rbx)
andb $-0x21, 0x38(%rbx)
jmp 0xae4a
cmpl $0x3, 0x10(%rbx)
jne 0xae13
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
movl -0x30(%rbp), %r14d
je 0xae1e
callq 0x152d7
jmp 0xae1e
movl $0x3, 0x10(%rbx)
movl -0x30(%rbp), %r14d
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xae46
addl $0xffffff00, (%rax)     # imm = 0xFFFFFF00
movq 0x18(%rbx), %rdi
cmpl $0xff, (%rdi)
jg 0xae3e
callq 0x152d7
movq $0x0, 0x18(%rbx)
movq %r13, 0x20(%rbx)
movq -0x38(%rbp), %rdi
callq 0x8f8b
incl %r14d
testb %al, %al
je 0xad28
movq 0x133a3(%rip), %rax     # 0x1e208
movl $0x1, 0x8(%rax)
movl %r14d, (%rax)
movb -0x29(%rbp), %al
testb %al, %al
jne 0xae8a
movq 0x1338b(%rip), %rax     # 0x1e208
movl $0x1, 0x8(%rax)
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
testl %r14d, %r14d
js 0xaf00
movq 0x28(%rbx), %r14
testq %r14, %r14
je 0xaf00
cmpl $0x3, 0x10(%rbx)
jne 0xaeac
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xaeac
callq 0x152d7
movl 0x8(%r14), %eax
movl %eax, 0x10(%rbx)
movq (%r14), %rax
movq %rax, 0x20(%rbx)
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xaee2
addl $0xffffff00, (%rax)     # imm = 0xFFFFFF00
movq 0x18(%rbx), %rdi
cmpl $0xff, (%rdi)
jg 0xaeda
callq 0x152d7
movq $0x0, 0x18(%rbx)
movq 0x10(%r14), %rax
movq %rax, 0x28(%rbx)
jmp 0xaf00
movq 0x13315(%rip), %rax     # 0x1e208
movl $0x1, 0x8(%rax)
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq