// File: /workspace/github_c_makefile_star2_O3/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 0xaeab(%rip), %rsi      # 0x1ca1a
callq 0x83b0
testq %rax, %rax
je 0x11cab
movb $0x1, 0xd7a1c(%rip)     # 0xe95a0
leaq 0xc43f(%rip), %rsi      # 0x1dfca
movq %rbx, %rdi
callq 0x83b0
testq %rax, %rax
je 0x11cab
leaq 0xc43b(%rip), %rdx      # 0x1dfde
movq %rax, %rdi
xorl %esi, %esi
callq 0xf82d
movq %rax, %rbx
cmpb $0x0, 0xcf8e9(%rip)     # 0xe14a0
setne %al
testq %rbx, %rbx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x11cab
leaq 0xcf9ce(%rip), %r14     # 0xe15a0
movl $0x40, %r13d
leaq 0xcf8c1(%rip), %r15     # 0xe14a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8220
testl %eax, %eax
jne 0x11c02
movq %r14, %rdi
callq 0xf829
leaq 0x100(%r14), %rdi
callq 0xf829
leaq 0x100(%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x8220
testl %eax, %eax
jne 0x11c28
movq %r14, %rdi
callq 0xf829
movq %r12, %rdi
callq 0xf829
addq $0x200, %r14            # imm = 0x200
decq %r13
jne 0x11bdf
xorl %eax, %eax
leaq 0xcf963(%rip), %r14     # 0xe15a0
xorl %ecx, %ecx
cmpb $0x0, (%rax,%r14)
je 0x11c5d
addq $-0x200, %rcx           # imm = 0xFE00
addq $0x200, %rax            # imm = 0x200
cmpq $0x8000, %rax           # imm = 0x8000
jne 0x11c3f
jmp 0x11cab
subq %rcx, %r14
leaq 0x100(%r14), %rdi
leaq 0xcf832(%rip), %r15     # 0xe14a0
movl $0x100, %edx            # imm = 0x100
movq %r15, %rsi
callq 0xf384
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbx, %rsi
callq 0xf384
leaq 0xc1ed(%rip), %rsi      # 0x1de7f
leaq 0xc349(%rip), %rdx      # 0x1dfe2
movl $0x2, %edi
movq %rbx, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x1a3e3
leaq 0xcf7ee(%rip), %rdi     # 0xe14a0
callq 0xf829
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq