// File: /workspace/github_c_makefile_star2_O2/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 $0x88, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0xf8d7(%rip), %rdi      # 0x1b118
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xb883
leaq 0xf8ec(%rip), %rdi      # 0x1b140
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xb8b3
leaq 0xf914(%rip), %rdi      # 0x1b17b
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xb933
leaq 0xf961(%rip), %rdi      # 0x1b1df
jmp 0xb9bc
callq 0x13431
leaq 0xf88f(%rip), %rdi      # 0x1b11e
xorl %eax, %eax
callq 0x12753
leaq 0xf3e2(%rip), %rsi      # 0x1ac7f
leaq 0xf88c(%rip), %rdx      # 0x1b130
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x1920b
jmp 0xb9c3
movb $0x1, %r13b
xorl %ebx, %ebx
movq %rsp, %r14
pushq $0x7f
popq %r15
leaq 0xf88a(%rip), %rbp      # 0x1b150
pushq $0x2
popq %r12
movl %ebx, %edi
callq 0x1345a
testq %rax, %rax
je 0xb91d
movq %r14, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0xe97a
cmpb $0x0, (%rsp)
je 0xb91d
xorl %r13d, %r13d
leaq 0xf851(%rip), %rdi      # 0x1b145
movl %ebx, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x12753
movl %r12d, %edi
leaq 0xf375(%rip), %rsi      # 0x1ac7f
movq %rbp, %rdx
movl %ebx, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x1920b
incl %ebx
jmp 0xb8ca
testb $0x1, %r13b
je 0xb9c3
leaq 0xf83a(%rip), %rdi      # 0x1b168
jmp 0xb9bc
cmpb $0x0, (%r14)
je 0xb9b5
pushq $0x2
popq %rbp
leaq 0xf80b(%rip), %r14      # 0x1b14e
movq %rsp, %r15
pushq $0x7f
popq %r12
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0xed9c
testq %rax, %rax
je 0xb976
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0xe97a
movq %r15, %rdi
callq 0x1344e
incl %ebp
jmp 0xb94a
leaq 0xf302(%rip), %rsi      # 0x1ac7f
leaq 0xf7fb(%rip), %rdx      # 0x1b17f
pushq $0x2
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1920b
leaq 0xede6(%rip), %rdi      # 0x1a77e
pushq $0x3
popq %rsi
callq 0x17049
addl $-0x2, %ebp
leaq 0xf7e8(%rip), %rdi      # 0x1b192
movl %ebp, %esi
xorl %eax, %eax
callq 0x12753
jmp 0xb9c3
leaq 0xf7ff(%rip), %rdi      # 0x1b1bb
xorl %eax, %eax
callq 0x12753
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq