// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x16f52(%rip), %rdi     # 0x24122
callq 0x8200
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xd20f
callq 0x18ff0
leaq 0x16f3f(%rip), %rdi     # 0x24128
movb $0x0, %al
callq 0x17af0
movl $0x2, %edi
leaq 0x16a8b(%rip), %rsi     # 0x23c87
leaq 0x16f37(%rip), %rdx     # 0x2413a
movb $0x0, %al
callq 0x21bf0
jmp 0xd3e6
movq -0x8(%rbp), %rsi
leaq 0x16f30(%rip), %rdi     # 0x2414a
callq 0x8200
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xd2e5
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x19070
movq %rax, %rcx
movq %rcx, -0x30(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0xd2ba
leaq -0xb0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x7f, %edx
callq 0x11bc0
leaq -0xb0(%rbp), %rdi
callq 0x8110
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jne 0xd275
jmp 0xd2cc
movl $0x1, -0x24(%rbp)
movl -0x1c(%rbp), %esi
leaq -0xb0(%rbp), %rdx
leaq 0x16ec2(%rip), %rdi     # 0x2414f
movb $0x0, %al
callq 0x17af0
movl -0x1c(%rbp), %ecx
leaq -0xb0(%rbp), %r8
movl $0x2, %edi
leaq 0x169dd(%rip), %rsi     # 0x23c87
leaq 0x16ea9(%rip), %rdx     # 0x2415a
movb $0x0, %al
callq 0x21bf0
jmp 0xd2bc
jmp 0xd2cc
jmp 0xd2be
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xd232
cmpl $0x0, -0x24(%rbp)
jne 0xd2e0
leaq 0x16e99(%rip), %rdi     # 0x24172
movb $0x0, %al
callq 0x17af0
jmp 0xd3e4
movq -0x8(%rbp), %rsi
leaq 0x16e95(%rip), %rdi     # 0x24185
callq 0x8200
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0xd3d4
movq -0x10(%rbp), %rdi
callq 0x8110
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0xd3c4
movl $0x0, -0x28(%rbp)
movl $0x2, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
leaq 0x16e24(%rip), %rdx     # 0x24158
callq 0x122d0
movq %rax, %rcx
movq %rcx, -0x30(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0xd373
leaq -0xb0(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x7f, %edx
callq 0x11bc0
leaq -0xb0(%rbp), %rdi
callq 0x19040
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0xd375
jmp 0xd382
jmp 0xd377
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xd326
movq -0x18(%rbp), %rcx
movl $0x2, %edi
leaq 0x168f5(%rip), %rsi     # 0x23c87
leaq 0x16df0(%rip), %rdx     # 0x24189
movb $0x0, %al
callq 0x21bf0
leaq 0x163df(%rip), %rdi     # 0x23786
movl $0x3, %esi
callq 0x1ebf0
movl -0x28(%rbp), %esi
leaq 0x16de1(%rip), %rdi     # 0x2419c
movb $0x0, %al
callq 0x17af0
jmp 0xd3d2
leaq 0x16dfa(%rip), %rdi     # 0x241c5
movb $0x0, %al
callq 0x17af0
jmp 0xd3e2
leaq 0x16e0e(%rip), %rdi     # 0x241e9
movb $0x0, %al
callq 0x17af0
jmp 0xd3e4
jmp 0xd3e6
movl -0x20(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)