// File: /workspace/github_c_makefile_star2_O3/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 %rbx
pushq %rax
leaq 0x225d79(%rip), %rbx    # 0x23f8a0
leaq 0x225e72(%rip), %r14    # 0x23f9a0
leaq 0x225f6b(%rip), %r15    # 0x23faa0
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0x1526b
leaq 0x6891(%rip), %rsi      # 0x203e0
leaq 0x61e8(%rip), %rdx      # 0x1fd3e
movl $0x2, %edi
movq %rbx, %rcx
movq %r15, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x1a3e3
movl 0x224d03(%rip), %ebx    # 0x23e874
leaq 0x1c06(%rip), %rdi      # 0x1b77e
xorl %esi, %esi
callq 0x181e1
testq %rax, %rax
movl $0x1, %ebp
cmovel %ebx, %ebp
callq 0x13853
cmpl %ebp, %eax
jl 0x19db8
leaq 0x22d3(%rip), %rdi      # 0x1be71
xorl %esi, %esi
callq 0x181e1
movq %rax, %r14
leaq 0x22a5(%rip), %rdi      # 0x1be54
leaq 0x1b53(%rip), %rsi      # 0x1b709
callq 0x18256
movq %rax, %rbx
callq 0x117c0
subq %r14, %rax
movl 0x225cbc(%rip), %ecx    # 0x23f888
cmpq %rcx, %rax
jae 0x19c1a
cmpb $0x2a, (%rbx)
jne 0x19bdc
cmpb $0x0, 0x1(%rbx)
je 0x19bf0
leaq 0x225cbd(%rip), %rdi    # 0x23f8a0
movq %rbx, %rsi
callq 0x8350
testq %rax, %rax
je 0x19c1a
leaq 0x67e9(%rip), %rsi      # 0x203e0
leaq 0x69ac(%rip), %rdx      # 0x205aa
leaq 0x225c9b(%rip), %rcx    # 0x23f8a0
leaq 0x225d94(%rip), %r8     # 0x23f9a0
leaq 0x225e8d(%rip), %r9     # 0x23faa0
xorl %edi, %edi
jmp 0x19db1
leaq 0x225d7f(%rip), %rdi    # 0x23f9a0
leaq 0x6cfa(%rip), %rsi      # 0x20922
callq 0x13c3d
movl %eax, %ebx
leaq 0x67aa(%rip), %rsi      # 0x203e0
leaq 0x6ced(%rip), %rdx      # 0x2092a
movl $0x2, %edi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1a3e3
leaq 0x1b2c(%rip), %rdi      # 0x1b77e
xorl %esi, %esi
callq 0x181e1
cmpq $0x3, %rax
jne 0x19c9d
leaq 0x225d3a(%rip), %rdi    # 0x23f9a0
callq 0x142f5
testl %eax, %eax
je 0x19c73
movl %eax, %ebx
jmp 0x19c9d
leaq 0x225c26(%rip), %rdi    # 0x23f8a0
callq 0x142f5
movl %eax, %ebx
leaq 0x6758(%rip), %rsi      # 0x203e0
leaq 0x6cba(%rip), %rdx      # 0x20949
movl $0x2, %edi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1a3e3
leaq 0x225cfc(%rip), %rdi    # 0x23f9a0
callq 0x13d07
leaq 0x6cb5(%rip), %rdi      # 0x20965
movq %rax, %rsi
callq 0x8220
testl %eax, %eax
jne 0x19cdb
leaq 0x671d(%rip), %rsi      # 0x203e0
leaq 0x6ca0(%rip), %rdx      # 0x2096a
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a3e3
movl $0x1, %ebx
leaq 0x225bbe(%rip), %rdi    # 0x23f8a0
leaq 0x4b3f(%rip), %rsi      # 0x1e828
callq 0x83b0
testl %ebx, %ebx
je 0x19cfb
testq %rax, %rax
je 0x19db8
callq 0x117c0
subq 0x225e99(%rip), %rax    # 0x23fba0
cmpq $0x3d, %rax
jb 0x19d89
leaq 0x1a6a(%rip), %rdi      # 0x1b77e
xorl %esi, %esi
callq 0x181e1
testq %rax, %rax
leaq 0x224f53(%rip), %rax    # 0x23ec78
leaq 0x224b4c(%rip), %rdx    # 0x23e878
cmoveq %rax, %rdx
leaq 0x68ac(%rip), %rax      # 0x205e3
leaq 0x68c2(%rip), %rbx      # 0x20600
cmoveq %rax, %rbx
leaq 0x225c57(%rip), %r14    # 0x23f9a0
xorl %edi, %edi
movq %r14, %rsi
callq 0x13676
leaq 0x225b46(%rip), %r15    # 0x23f8a0
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x13337
leaq 0x6672(%rip), %rsi      # 0x203e0
leaq 0x68ac(%rip), %rdx      # 0x20621
leaq 0x225d24(%rip), %r9     # 0x23faa0
xorl %edi, %edi
movq %r15, %rcx
movq %r14, %r8
jmp 0x19e77
leaq 0x6650(%rip), %rsi      # 0x203e0
leaq 0x68aa(%rip), %rdx      # 0x20641
leaq 0x225b02(%rip), %rcx    # 0x23f8a0
leaq 0x225bfb(%rip), %r8     # 0x23f9a0
leaq 0x225cf4(%rip), %r9     # 0x23faa0
movl $0x2, %edi
xorl %eax, %eax
callq 0x1a3e3
cmpl $0x0, 0x2252c1(%rip)    # 0x23f080
je 0x19e7e
leaq 0x225ad4(%rip), %rdi    # 0x23f8a0
xorl %esi, %esi
callq 0x113be
testl %eax, %eax
je 0x19e26
leaq 0x225bc2(%rip), %rbx    # 0x23f9a0
leaq 0x1924(%rip), %rdx      # 0x1b709
xorl %edi, %edi
movq %rbx, %rsi
callq 0x13676
leaq 0x6881(%rip), %rdi      # 0x20677
leaq 0x225aa3(%rip), %r14    # 0x23f8a0
movq %r14, %rsi
xorl %eax, %eax
callq 0x13337
leaq 0x65d2(%rip), %rsi      # 0x203e0
leaq 0x6882(%rip), %rdx      # 0x20697
leaq 0x225c84(%rip), %r9     # 0x23faa0
movl $0x2, %edi
movq %r14, %rcx
jmp 0x19e74
leaq 0x225b73(%rip), %rdi    # 0x23f9a0
movl $0x1, %esi
callq 0x113be
testl %eax, %eax
je 0x19e7e
leaq 0x225b5e(%rip), %rbx    # 0x23f9a0
leaq 0x18c0(%rip), %rdx      # 0x1b709
xorl %edi, %edi
movq %rbx, %rsi
callq 0x13676
leaq 0x6586(%rip), %rsi      # 0x203e0
leaq 0x6858(%rip), %rdx      # 0x206b9
leaq 0x225a38(%rip), %rcx    # 0x23f8a0
leaq 0x225c31(%rip), %r9     # 0x23faa0
movl $0x2, %edi
movq %rbx, %r8
xorl %eax, %eax
callq 0x1a3e3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq