// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/pigateway.c
// Function: pigatewayClientSynthAddCB
int pigatewayClientSynthAddCB( char *strIn )
{
    static char playerName[256], playerGUID[256], playerIP[256];
    int alreadyKicked = 0;
    int kickReason, firstAdminSlot;

    rosterParsePlayerSynthConn( strIn, 256, playerName, playerGUID, playerIP );
    logPrintf( LOG_LEVEL_INFO, "pigateway", "Synthetic ADD Callback Name ::%s:: IP ::%s:: GUID ::%s::", 
        playerName, playerIP, playerGUID );

    // copy to local, first admin slot from sissm.cfg
    //
    firstAdminSlot = pigatewayConfig.firstAdminSlotNo;
  
    // server lockout via picladmin "lock off|on|perm|clan" command
    // if "locked" then make all slots "admin" or via the allowin exemption
    //
    if ( 0L != p2pGetL( "pigateway.p2p.lockOut", 0L ))   // default is 0L = unlock
        firstAdminSlot = 1;

    if (apiPlayersGetCount() >= firstAdminSlot ) {         // check if these are admin-only slots

        if ( _allowInExemption( playerName ) ) {
            logPrintf( LOG_LEVEL_CRITICAL, "pigateway", "Special full server join granted by admin ::%s::%s::%s::", 
                    playerName, playerGUID, playerIP );
        }
        // else if ( !_isPriority( playerGUID, playerName ) && (pigatewayConfig.adminPortDisable == 0) ) {     // check if this is an admin
        else if ( !_isPriority( playerGUID, playerName ) ) {     // check if this is an admin

            // this block of code kicks incoming players
            //
            if ( (apiTimeGet() - timeRestarted) > PIGATEWAY_RESTART_LOCKOUT_SEC ) {  // check if we are restarting
                // apiKickOrBan( 0, playerGUID, "Server_full, under maintenance, or hosting a private session." );

                if ( 0L == p2pGetL( "pigateway.p2p.lockOut", 0L ) ) {
                    apiKickOrBan( 0, playerGUID, pigatewayConfig.adminPortKickMsgFull );    // server full
                    apiSay ( "Player %s kicked Server Full", playerName );
                }
                else {
                    apiKickOrBan( 0, playerGUID, pigatewayConfig.adminPortKickMsgLock );    // special events !lock
                    apiSay ( "Player %s kicked Server Reserved", playerName );
                }

                logPrintf( LOG_LEVEL_CRITICAL, "pigateway", "Full Server Kick ::%s::%s::%s::", 
                    playerName, playerGUID, playerIP );
                alreadyKicked = 1;
            }
            else {
                logPrintf( LOG_LEVEL_INFO, "pigateway", 
                    "Exempt Full Server Kick due to Restart ::%s::%s::%s::", playerName, playerGUID, playerIP );
            }
        }
    }

    // process badname auto-kicking
    //
    if ( (0 == alreadyKicked) && (pigatewayConfig.enableBadNameFilter) ) {
        if ( 0 != (kickReason = _isBadName( playerName, playerGUID )) ) {
            apiKickOrBan( 0, playerGUID, "" );
            if ( kickReason == 1 ) {
                apiSay ( "Player %s auto-kicked by server", playerName );
                logPrintf( LOG_LEVEL_INFO, "pigateway", "Bad Name Auto-kick ::%s::%s::%s::", 
                    playerName, playerGUID, playerIP );
            }
            else {
                logPrintf( LOG_LEVEL_INFO, "pigateway", "Suspended User Auto-kick ::%s::%s::%s::", 
                    playerName, playerGUID, playerIP );
            }
            alreadyKicked = 1;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x225f2c(%rip), %rbx    # 0x23f8a0
leaq 0x226025(%rip), %r14    # 0x23f9a0
leaq 0x22611e(%rip), %r15    # 0x23faa0
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0x14fb7
leaq 0x6a54(%rip), %rsi      # 0x203f0
leaq 0x63ab(%rip), %rdx      # 0x1fd4e
movl $0x2, %edi
movq %rbx, %rcx
movq %r15, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x1a227
movl 0x224eb6(%rip), %ebx    # 0x23e874
leaq 0x1dc1(%rip), %rdi      # 0x1b786
xorl %esi, %esi
callq 0x18004
testq %rax, %rax
movl $0x1, %ebp
cmovel %ebx, %ebp
callq 0x134dc
movb $0x1, %r12b
cmpl %ebp, %eax
jl 0x19c10
leaq 0x248b(%rip), %rdi      # 0x1be79
xorl %esi, %esi
callq 0x18004
movq %rax, %r14
leaq 0x245d(%rip), %rdi      # 0x1be5c
leaq 0x1d0b(%rip), %rsi      # 0x1b711
callq 0x1808c
movq %rax, %rbx
callq 0x114b2
subq %r14, %rax
movl 0x225e6c(%rip), %ecx    # 0x23f888
cmpq %rcx, %rax
jae 0x19a72
leaq 0x21d4(%rip), %rsi      # 0x1bbfc
movq %rbx, %rdi
callq 0x8220
testl %eax, %eax
je 0x19a48
leaq 0x225e65(%rip), %rdi    # 0x23f8a0
movq %rbx, %rsi
callq 0x8350
testq %rax, %rax
je 0x19a72
leaq 0x69a1(%rip), %rsi      # 0x203f0
leaq 0x6b64(%rip), %rdx      # 0x205ba
leaq 0x225e43(%rip), %rcx    # 0x23f8a0
leaq 0x225f3c(%rip), %r8     # 0x23f9a0
leaq 0x226035(%rip), %r9     # 0x23faa0
xorl %edi, %edi
jmp 0x19c09
leaq 0x225f27(%rip), %rdi    # 0x23f9a0
leaq 0x6eb2(%rip), %rsi      # 0x20932
callq 0x138da
movl %eax, %ebx
leaq 0x6962(%rip), %rsi      # 0x203f0
leaq 0x6ea5(%rip), %rdx      # 0x2093a
movl $0x2, %edi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1a227
leaq 0x1cdc(%rip), %rdi      # 0x1b786
xorl %esi, %esi
callq 0x18004
cmpq $0x3, %rax
jne 0x19af5
leaq 0x225ee2(%rip), %rdi    # 0x23f9a0
callq 0x13fb9
testl %eax, %eax
je 0x19acb
movl %eax, %ebx
jmp 0x19af5
leaq 0x225dce(%rip), %rdi    # 0x23f8a0
callq 0x13fb9
movl %eax, %ebx
leaq 0x6910(%rip), %rsi      # 0x203f0
leaq 0x6e72(%rip), %rdx      # 0x20959
movl $0x2, %edi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1a227
leaq 0x225ea4(%rip), %rdi    # 0x23f9a0
callq 0x139b5
leaq 0x6e6d(%rip), %rdi      # 0x20975
movq %rax, %rsi
callq 0x8220
testl %eax, %eax
jne 0x19b33
leaq 0x68d5(%rip), %rsi      # 0x203f0
leaq 0x6e58(%rip), %rdx      # 0x2097a
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a227
movl $0x1, %ebx
leaq 0x225d66(%rip), %rdi    # 0x23f8a0
leaq 0x4cf7(%rip), %rsi      # 0x1e838
callq 0x83b0
testl %ebx, %ebx
je 0x19b53
testq %rax, %rax
je 0x19c10
callq 0x114b2
subq 0x226041(%rip), %rax    # 0x23fba0
cmpq $0x3d, %rax
jb 0x19be1
leaq 0x1c1a(%rip), %rdi      # 0x1b786
xorl %r12d, %r12d
xorl %esi, %esi
callq 0x18004
testq %rax, %rax
leaq 0x2250f8(%rip), %rax    # 0x23ec78
leaq 0x224cf1(%rip), %rdx    # 0x23e878
cmoveq %rax, %rdx
leaq 0x6a61(%rip), %rax      # 0x205f3
leaq 0x6a77(%rip), %rbx      # 0x20610
cmoveq %rax, %rbx
leaq 0x225dfc(%rip), %r14    # 0x23f9a0
xorl %edi, %edi
movq %r14, %rsi
callq 0x132ff
leaq 0x225ceb(%rip), %r15    # 0x23f8a0
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x12fba
leaq 0x6827(%rip), %rsi      # 0x203f0
leaq 0x6a61(%rip), %rdx      # 0x20631
leaq 0x225ec9(%rip), %r9     # 0x23faa0
xorl %edi, %edi
movq %r15, %rcx
movq %r14, %r8
jmp 0x19c09
leaq 0x6808(%rip), %rsi      # 0x203f0
leaq 0x6a62(%rip), %rdx      # 0x20651
leaq 0x225caa(%rip), %rcx    # 0x23f8a0
leaq 0x225da3(%rip), %r8     # 0x23f9a0
leaq 0x225e9c(%rip), %r9     # 0x23faa0
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a227
testb %r12b, %r12b
je 0x19cc2
cmpl $0x0, 0x225460(%rip)    # 0x23f080
je 0x19cc2
leaq 0x225c73(%rip), %rdi    # 0x23f8a0
xorl %esi, %esi
callq 0x110b0
movl $0x1, %ebx
testl %eax, %eax
jne 0x19c57
leaq 0x225d5c(%rip), %rdi    # 0x23f9a0
movl $0x1, %esi
callq 0x110b0
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
addl %ebx, %ebx
testl %ebx, %ebx
je 0x19cc2
leaq 0x225d3e(%rip), %rsi    # 0x23f9a0
leaq 0x1aa8(%rip), %rdx      # 0x1b711
xorl %edi, %edi
callq 0x132ff
cmpl $0x1, %ebx
jne 0x19c93
leaq 0x6a0b(%rip), %rdi      # 0x20687
leaq 0x225c1d(%rip), %rsi    # 0x23f8a0
xorl %eax, %eax
callq 0x12fba
leaq 0x6a16(%rip), %rdx      # 0x206a7
jmp 0x19c9a
leaq 0x6a2f(%rip), %rdx      # 0x206c9
leaq 0x674f(%rip), %rsi      # 0x203f0
leaq 0x225bf8(%rip), %rcx    # 0x23f8a0
leaq 0x225cf1(%rip), %r8     # 0x23f9a0
leaq 0x225dea(%rip), %r9     # 0x23faa0
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a227
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq