// File: /workspace/github_c_makefile_star2_O1/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 0x104e1(%rip), %rdi     # 0x1c120
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xbc81
leaq 0x104f6(%rip), %rdi     # 0x1c148
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xbcb3
leaq 0x1051e(%rip), %rdi     # 0x1c183
movq %r15, %rsi
callq 0x8220
testl %eax, %eax
je 0xbd63
leaq 0x1056b(%rip), %rdi     # 0x1c1e7
jmp 0xbdd1
callq 0x13f89
leaq 0x10499(%rip), %rdi     # 0x1c126
xorl %eax, %eax
callq 0x1316b
leaq 0xffec(%rip), %rsi      # 0x1bc87
leaq 0x10496(%rip), %rdx     # 0x1c138
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a227
jmp 0xbdd8
xorl %edi, %edi
callq 0x14019
testq %rax, %rax
je 0xbd5a
leaq 0x10(%rsp), %rbx
movl $0x7f, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xf038
movb (%rbx), %al
movb %al, 0xf(%rsp)
testb %al, %al
je 0xbd5a
movl $0x1, %ebx
leaq 0x1045f(%rip), %r14     # 0x1c14d
leaq 0x10(%rsp), %r15
leaq 0xff8d(%rip), %r12      # 0x1bc87
leaq 0x10457(%rip), %r13     # 0x1c158
leal -0x1(%rbx), %ebp
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1316b
movl $0x2, %edi
movq %r12, %rsi
movq %r13, %rdx
movl %ebp, %ecx
movq %r15, %r8
xorl %eax, %eax
callq 0x1a227
movl %ebx, %edi
callq 0x14019
testq %rax, %rax
je 0xbdd8
movl $0x7f, %edx
movq %r15, %rdi
movq %rax, %rsi
callq 0xf038
incl %ebx
cmpb $0x0, 0x10(%rsp)
jne 0xbd01
cmpb $0x0, 0xf(%rsp)
jne 0xbdd8
leaq 0x1040f(%rip), %rdi     # 0x1c170
jmp 0xbdd1
cmpb $0x0, (%r14)
je 0xbdca
leaq 0x103e6(%rip), %rdx     # 0x1c156
movq %rbx, %rdi
movl $0x2, %esi
callq 0xf4e1
testq %rax, %rax
je 0xbdec
xorl %r12d, %r12d
leaq 0x10(%rsp), %r14
leaq 0x103c5(%rip), %r15     # 0x1c156
movl $0x7f, %edx
movq %r14, %rdi
movq %rax, %rsi
callq 0xf038
movq %r14, %rdi
callq 0x1400d
leal 0x1(%r12), %ebp
addl $0x3, %r12d
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0xf4e1
movl %ebp, %r12d
testq %rax, %rax
jne 0xbd91
jmp 0xbdee
leaq 0x103f2(%rip), %rdi     # 0x1c1c3
xorl %eax, %eax
callq 0x1316b
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
leaq 0xfe92(%rip), %rsi      # 0x1bc87
leaq 0x1038b(%rip), %rdx     # 0x1c187
movl $0x2, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1a227
leaq 0xf974(%rip), %rdi      # 0x1b786
movl $0x3, %esi
callq 0x17ea8
leaq 0x10377(%rip), %rdi     # 0x1c19a
movl %ebp, %esi
xorl %eax, %eax
callq 0x1316b
jmp 0xbdd8