// File: /workspace/github_cpp_makefile_star2_O1/Fohlen[P]cubescript-standalone/command.cpp
// Function: addcommand(char const*, void (*)(), char const*)
bool addcommand(const char *name, identfun fun, const char *args)
{
    uint argmask = 0;
    int numargs = 0;
    bool limit = true;
    for(const char *fmt = args; *fmt; fmt++) switch(*fmt)
    {
        case 'i': case 'b': case 'f': case 't': case 'N': case 'D': if(numargs < MAXARGS) numargs++; break;
        case 's': case 'e': case 'r': case '$': if(numargs < MAXARGS) { argmask |= 1<<numargs; numargs++; } break;
        case '1': case '2': case '3': case '4': if(numargs < MAXARGS) fmt -= *fmt-'0'+1; break;
        case 'C': case 'V': limit = false; break;
        default: fatal("builtin %s declared with illegal type: %s", name, args); break;
    }
    if(limit && numargs > MAXCOMARGS) fatal("builtin %s declared with too many args: %d", name, numargs);
    addident(ident(ID_COMMAND, name, args, argmask, (void *)fun));
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movq %rsi, -0x40(%rbp)
movq %rdi, -0x30(%rbp)
movb $0x1, %r15b
leaq 0x125f5(%rip), %r13     # 0x16060
xorl %ebx, %ebx
xorl %r12d, %r12d
movq %rdx, -0x38(%rbp)
movzbl (%r14), %eax
cmpl $0x55, %eax
jg 0x3aa1
cmpl $0x42, %eax
jg 0x3ab8
leal -0x31(%rax), %ecx
cmpl $0x4, %ecx
jae 0x3ae4
cmpl $0x18, %r12d
jg 0x3b1c
movsbq %al, %rax
subq %rax, %r14
addq $0x2f, %r14
jmp 0x3b1c
cmpl $0x71, %eax
jg 0x3ac9
leal -0x62(%rax), %ecx
cmpl $0x7, %ecx
ja 0x3af8
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
cmpl $0x43, %eax
je 0x3afd
cmpl $0x44, %eax
je 0x3ad6
cmpl $0x4e, %eax
je 0x3ad6
jmp 0x3b06
leal -0x72(%rax), %ecx
cmpl $0x2, %ecx
jb 0x3ae9
cmpl $0x74, %eax
jne 0x3b06
xorl %eax, %eax
cmpl $0x19, %r12d
setl %al
addl %eax, %r12d
jmp 0x3b1c
cmpl $0x24, %eax
jne 0x3b02
cmpl $0x18, %r12d
jg 0x3b1c
btsl %r12d, %ebx
incl %r12d
jmp 0x3b1c
cmpl $0x56, %eax
jne 0x3b06
xorl %r15d, %r15d
jmp 0x3b1c
testl %eax, %eax
je 0x3b24
leaq 0x131e2(%rip), %rdi     # 0x16cef
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
xorl %eax, %eax
callq 0x35dd
incq %r14
jmp 0x3a74
testb $0x1, %r15b
je 0x3b45
cmpl $0xc, %r12d
jle 0x3b45
leaq 0x131e2(%rip), %rdi     # 0x16d19
movq -0x30(%rbp), %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x35dd
movl $0x3, -0x80(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movl %ebx, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x48(%rbp)
cmpb $0x0, 0x1b0be(%rip)     # 0x1ec33
je 0x3bac
leaq -0x78(%rbp), %rsi
leaq 0x1aade(%rip), %rdi     # 0x1e660
leaq -0x80(%rbp), %rdx
callq 0x129c8
leaq 0x1aaee(%rip), %rdi     # 0x1e680
movl 0x1aaf4(%rip), %ecx     # 0x1e68c
movl %ecx, 0x3c(%rax)
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
callq 0x12a76
jmp 0x3bdd
cmpq $0x0, 0x1b084(%rip)     # 0x1ec38
jne 0x3bcd
movl $0x10, %edi
callq 0x1529c
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x1b06b(%rip)     # 0x1ec38
movq 0x1b064(%rip), %rdi     # 0x1ec38
leaq -0x80(%rbp), %rsi
callq 0x12962
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq