// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/picladmin.c
// Function: cmdHelp
int _cmdHelp( char *arg, char *arg2, char *passThru ) 
{ 
    int i = 0, notFound = 1;
    char outStr[1024], originID[256];

    // if has parameter then look for a specific help for that command
    //
    if ( 0 != strlen( arg ) ) {
        while ( 1 == 1 ) {
            if ( ( 0 == strcmp( arg, cmdTable[i].cmdShort )) || ( 0 == strcmp( arg, cmdTable[i].cmdLong )) ) {
                apiSaySys("'%s' or %s", cmdTable[i].cmdShort, cmdTable[i].cmdHelp);
                notFound = 0;
                break;
            }
            i++;
            if ( 0 == strcmp( "*", cmdTable[i].cmdShort )) break; 
        }
    }

    // if above search was invalid command, or no arg was specified, display list of commands
    // 
    if ( notFound ) {
        strlcpy( originID, _getOriginID(), 256 );   // get requester ID

        strlcpy( outStr, "help [cmd], avail: ", 1024);
        i = 0;           
        while ( 1 == 1 ) {
            if ( apiAuthIsAllowedCommand( originID, cmdTable[i].cmdLong ) ) {
                strlcat( outStr, cmdTable[i].cmdLong, 1024 );
                strlcat( outStr, " ", 1024 );
                if ( strlen(outStr) > 40 ) {
                    apiSaySys( outStr );
                    strclr( outStr );
                }
            }
            i++;
            if ( 0 == strcmp( "*", cmdTable[i].cmdShort )) break; 
        }
        if (0 != strlen( outStr ))  apiSaySys( outStr );
    }
   
    return 0; 
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x500, %rsp            # imm = 0x500
cmpb $0x0, (%rdi)
je 0x9b8e
movq %rdi, %r14
leaq 0x1e710(%rip), %rbx     # 0x2825c
leaq -0x3c(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0x9c55
leaq -0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x8220
testl %eax, %eax
je 0x9c55
movzbl 0x34(%rbx), %eax
subl $0x2a, %eax
jne 0x9b84
movzbl 0x35(%rbx), %eax
negl %eax
addq $0x70, %rbx
testl %eax, %eax
jne 0x9b4c
leaq 0x541db(%rip), %rsi     # 0x5dd70
movq %rsp, %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
callq 0xe97a
movups 0x10b8e(%rip), %xmm0    # 0x1a73a
leaq 0x100(%rsp), %r14
movaps %xmm0, (%r14)
movl $0x203a6c, 0x10(%r14)   # imm = 0x203A6C
leaq 0x1e6ca(%rip), %r13     # 0x28291
leaq 0x11580(%rip), %r15     # 0x1b14e
leaq -0x5d(%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x12cba
testl %eax, %eax
je 0x9c21
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %r12, %rsi
callq 0xe918
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %r15, %rsi
callq 0xe918
movq %r14, %rdi
callq 0x8120
cmpq $0x29, %rax
jb 0x9c21
movq %r14, %rdi
xorl %eax, %eax
callq 0x12753
movq %r14, %rdi
callq 0xed98
movzbl -0x1(%r13), %eax
subl $0x2a, %eax
jne 0x9c30
movzbl (%r13), %eax
negl %eax
addq $0x70, %r13
testl %eax, %eax
jne 0x9bce
cmpb $0x0, 0x100(%rsp)
je 0x9c69
leaq 0x100(%rsp), %rdi
xorl %eax, %eax
callq 0x12753
jmp 0x9c69
leaq 0x10ad3(%rip), %rdi     # 0x1a72f
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x12753
xorl %eax, %eax
addq $0x500, %rsp            # imm = 0x500
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq