// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/api.c
// Function: apiBPCharPlayerCB
int _apiBPCharPlayerCB( char *strIn )
{
    char *w, *n = NULL;
    int i;

    if ( NULL != (w = strstr( strIn, SS_SUBSTR_BP_CHARNAME ) )) {
        _charTrackingActive = 1;      // indicate character tracking is enalbed for Insurgency.log
        w = strstr( strIn, "BP_Character_Player" );
        if ( w != NULL ) {
            if ( NULL != (n = getWord( w, 0, " .'" )) ) {
                ;;
                // printf("\nConnect ::%s::%s\n", n, _cachedName );
            }
        }
    }

    if (( 0 != strlen( _cachedName )) && ( n != NULL ) ) {

        // First pass, remove preexisting or duplicate characterID and playerName
        //
        for ( i = 0; i<API_MAXENTITIES; i++ )  {
            if ( 0 == strcmp( n, soldierTranslate[ i ].charID )) {
                strclr( soldierTranslate[ i ].charID );
                strclr( soldierTranslate[ i ].playerName );
            }
            if ( 0 == strcmp( _cachedName, soldierTranslate[ i ].playerName )) {
                strclr( soldierTranslate[ i ].charID );
                strclr( soldierTranslate[ i ].playerName );
            }
        }

        // insert into the translation table
        //
        for ( i = 0; i<API_MAXENTITIES; i++ )  {
            if ( 0 == strlen( soldierTranslate[ i ].charID ) ) {
                strlcpy( soldierTranslate[ i ].playerName, _cachedName, 256 );
                strlcpy( soldierTranslate[ i ].charID,               n, 256 );
                logPrintf( LOG_LEVEL_INFO, "api", "BPChar %s bound to '%s'", n, _cachedName );
                break;
            }
        }
    }

    strclr( _cachedName );
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0xb246(%rip), %rsi      # 0x1ca40
callq 0x83b0
testq %rax, %rax
je 0x11835
movb $0x1, 0xd7d95(%rip)     # 0xe95a0
leaq 0xc7c8(%rip), %rsi      # 0x1dfda
movq %rbx, %rdi
callq 0x83b0
testq %rax, %rax
je 0x11835
leaq 0xc7c8(%rip), %rdx      # 0x1dfee
movq %rax, %rdi
xorl %esi, %esi
callq 0xf4e1
movq %rax, %rbx
jmp 0x11837
xorl %ebx, %ebx
cmpb $0x0, 0xcfc62(%rip)     # 0xe14a0
setne %al
testq %rbx, %rbx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x11932
leaq 0xcfd47(%rip), %r14     # 0xe15a0
movl $0x40, %r13d
leaq 0xcfc3a(%rip), %r15     # 0xe14a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8220
testl %eax, %eax
jne 0x11889
movq %r14, %rdi
callq 0xf4dd
leaq 0x100(%r14), %rdi
callq 0xf4dd
leaq 0x100(%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x8220
testl %eax, %eax
jne 0x118af
movq %r14, %rdi
callq 0xf4dd
movq %r12, %rdi
callq 0xf4dd
addq $0x200, %r14            # imm = 0x200
decq %r13
jne 0x11866
xorl %eax, %eax
leaq 0xcfcdc(%rip), %r14     # 0xe15a0
xorl %ecx, %ecx
cmpb $0x0, (%rax,%r14)
je 0x118e4
addq $-0x200, %rcx           # imm = 0xFE00
addq $0x200, %rax            # imm = 0x200
cmpq $0x8000, %rax           # imm = 0x8000
jne 0x118c6
jmp 0x11932
subq %rcx, %r14
leaq 0x100(%r14), %rdi
leaq 0xcfbab(%rip), %r15     # 0xe14a0
movl $0x100, %edx            # imm = 0x100
movq %r15, %rsi
callq 0xf038
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf038
leaq 0xc576(%rip), %rsi      # 0x1de8f
leaq 0xc6d2(%rip), %rdx      # 0x1dff2
movl $0x2, %edi
movq %rbx, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x1a227
leaq 0xcfb67(%rip), %rdi     # 0xe14a0
callq 0xf4dd
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq