// File: /workspace/github_c_makefile_star2_O3/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 0x9cdb
movq %rdi, %r14
leaq 0x1e5c3(%rip), %rbx     # 0x2825c
leaq -0x3c(%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0x9da2
leaq -0x28(%rbx), %rsi
movq %r14, %rdi
callq 0x8220
testl %eax, %eax
je 0x9da2
movzbl 0x34(%rbx), %eax
subl $0x2a, %eax
jne 0x9cd1
movzbl 0x35(%rbx), %eax
negl %eax
addq $0x70, %rbx
testl %eax, %eax
jne 0x9c99
leaq 0x5408e(%rip), %rsi     # 0x5dd70
movq %rsp, %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
callq 0xf384
movups 0x11a41(%rip), %xmm0    # 0x1b73a
leaq 0x100(%rsp), %r14
movaps %xmm0, (%r14)
movl $0x203a6c, 0x10(%r14)   # imm = 0x203A6C
leaq 0x1e57d(%rip), %r13     # 0x28291
leaq 0x12433(%rip), %r15     # 0x1c14e
leaq -0x5d(%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13a5b
testl %eax, %eax
je 0x9d6e
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %r12, %rsi
callq 0xf310
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %r15, %rsi
callq 0xf310
movq %r14, %rdi
callq 0x8120
cmpq $0x29, %rax
jb 0x9d6e
movq %r14, %rdi
xorl %eax, %eax
callq 0x134e5
movq %r14, %rdi
callq 0xf829
movzbl -0x1(%r13), %eax
subl $0x2a, %eax
jne 0x9d7d
movzbl (%r13), %eax
negl %eax
addq $0x70, %r13
testl %eax, %eax
jne 0x9d1b
cmpb $0x0, 0x100(%rsp)
je 0x9db6
leaq 0x100(%rsp), %rdi
xorl %eax, %eax
callq 0x134e5
jmp 0x9db6
leaq 0x11986(%rip), %rdi     # 0x1b72f
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x134e5
xorl %eax, %eax
addq $0x500, %rsp            # imm = 0x500
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq