// File: /workspace/github_c_makefile_star2_O3/schroeder-lvb[P]sissm/src/picladmin.c
// Function: cmdClan
int _cmdClan( char *arg, char *arg2, char *passThru ) 
{ 
    int j, errCode = 0, found = 0, count;
    char *w, clanID[127];

    // === Case: "Clear"
    //
    if (0 == strcmp( "clear", arg )) {
        apiClanClear();
        apiSaySys( "Clan list cleared" );
        logPrintf( LOG_LEVEL_INFO, "picladmin", "cmdClan cleared list" );
    } 

    // === Case: "List"
    //
    else if (0 == strcmp( "list", arg )) {
        for (j = 0;; j++ ) {
            if ( NULL != (w = apiClanGet( j )) )  {
                strlcpy( clanID, w, 127 );
                if ( 0 == strlen( clanID ) ) break;
                found = 1;
                apiSaySys( "%03d '%s' ", j, clanID );
                logPrintf( LOG_LEVEL_INFO, "picladmin", "cmdClan list ::%d::%s::", j, clanID );
            }
            else {
                break;
            }
        }        
        if (found == 0) {
            apiSaySys( "Clan list is empty" );
        } 
    } 

    // === Case: "Add"
    //
    else if (0 == strcmp( "add", arg )) {
        if (0 != strlen( arg2 )) {
            for (count = 0, j = 2;; j++ ) {
                if (NULL != (w = getWord( passThru, j, " " ))) {
                    strlcpy( clanID, w, 127 );
                    apiClanAdd( clanID );
                    count++;
                }
                else {
                    break;
                }
            }
            // apiClanAdd( arg2 );
            logPrintf( LOG_LEVEL_INFO, "picladmin", "cmdClan add ::%s::", passThru );
            p2pSetL( "pigateway.p2p.lockOut", 3L );   // clan-lock the server
            apiSaySys( "Added %d elements, Server is Clan-locked", count );
        }
        else {
            apiSaySys( "You must specify partial name or ID" );
        }
    } 
    else {
        apiSaySys( "Missing or incorrect option: clear|add|list" );
    }
    return( errCode );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1013c(%rip), %rdi     # 0x1c118
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xc01e
leaq 0x10151(%rip), %rdi     # 0x1c140
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xc050
leaq 0x10179(%rip), %rdi     # 0x1c17b
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xc100
leaq 0x101c6(%rip), %rdi     # 0x1c1df
jmp 0xc16e
callq 0x142c5
leaq 0x100f4(%rip), %rdi     # 0x1c11e
xorl %eax, %eax
callq 0x134e5
leaq 0xfc47(%rip), %rsi      # 0x1bc7f
leaq 0x100f1(%rip), %rdx     # 0x1c130
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a3e3
jmp 0xc175
xorl %edi, %edi
callq 0x14355
testq %rax, %rax
je 0xc0f7
leaq 0x10(%rsp), %rbx
movl $0x7f, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xf384
movb (%rbx), %al
movb %al, 0xf(%rsp)
testb %al, %al
je 0xc0f7
movl $0x1, %ebx
leaq 0x100ba(%rip), %r14     # 0x1c145
leaq 0x10(%rsp), %r15
leaq 0xfbe8(%rip), %r12      # 0x1bc7f
leaq 0x100b2(%rip), %r13     # 0x1c150
leal -0x1(%rbx), %ebp
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x134e5
movl $0x2, %edi
movq %r12, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x1a3e3
movl %ebx, %edi
callq 0x14355
testq %rax, %rax
je 0xc175
movl $0x7f, %edx
movq %r15, %rdi
movq %rax, %rsi
callq 0xf384
incl %ebx
cmpb $0x0, 0x10(%rsp)
jne 0xc09e
cmpb $0x0, 0xf(%rsp)
jne 0xc175
leaq 0x1006a(%rip), %rdi     # 0x1c168
jmp 0xc16e
cmpb $0x0, (%r14)
je 0xc167
leaq 0x10041(%rip), %rdx     # 0x1c14e
movq %rbx, %rdi
movl $0x2, %esi
callq 0xf82d
testq %rax, %rax
je 0xc189
xorl %r12d, %r12d
leaq 0x10(%rsp), %r14
leaq 0x10020(%rip), %r15     # 0x1c14e
movl $0x7f, %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0xf384
movq %r14, %rdi
callq 0x14349
leal 0x1(%r12), %ebp
addl $0x3, %r12d
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0xf82d
movl %ebp, %r12d
testq %rax, %rax
jne 0xc12e
jmp 0xc18b
leaq 0x1004d(%rip), %rdi     # 0x1c1bb
xorl %eax, %eax
callq 0x134e5
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0xfaed(%rip), %rsi      # 0x1bc7f
leaq 0xffe6(%rip), %rdx      # 0x1c17f
movl $0x2, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1a3e3
leaq 0xf5cf(%rip), %rdi      # 0x1b77e
movl $0x3, %esi
callq 0x180a5
leaq 0xffd2(%rip), %rdi      # 0x1c192
movl %ebp, %esi
xorl %eax, %eax
callq 0x134e5
jmp 0xc175