// File: /workspace/github_c_makefile_star2_O2/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 0xab81(%rip), %rsi      # 0x1ba22
callq 0x83c0
testq %rax, %rax
je 0x10edc
movb $0x1, 0xd86ee(%rip)     # 0xe95a0
leaq 0xc101(%rip), %rsi      # 0x1cfba
movq %rbx, %rdi
callq 0x83c0
testq %rax, %rax
je 0x10edc
leaq 0xc101(%rip), %rdx      # 0x1cfce
movq %rax, %rdi
xorl %esi, %esi
callq 0xed9c
movq %rax, %rbx
jmp 0x10ede
xorl %ebx, %ebx
cmpb $0x0, 0xd05bb(%rip)     # 0xe14a0
setne %al
testq %rbx, %rbx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x10fe0
pushq $0x40
popq %r13
leaq 0xd069c(%rip), %r14     # 0xe15a0
leaq 0xd0595(%rip), %r15     # 0xe14a0
subq $0x1, %r13
jb 0x10f63
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8220
testl %eax, %eax
jne 0x10f34
movq %r14, %rdi
callq 0xed98
leaq 0x100(%r14), %rdi
callq 0xed98
leaq 0x100(%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x8220
testl %eax, %eax
jne 0x10f5a
movq %r14, %rdi
callq 0xed98
movq %r12, %rdi
callq 0xed98
addq $0x200, %r14            # imm = 0x200
jmp 0x10f0b
leaq 0xd0636(%rip), %rcx     # 0xe15a0
xorl %eax, %eax
addq $-0x200, %rax           # imm = 0xFE00
cmpq $-0x8200, %rax          # imm = 0xFFFF7E00
je 0x10fe0
cmpb $0x0, (%rcx)
leaq 0x200(%rcx), %rcx
jne 0x10f6c
leaq 0xd0613(%rip), %r14     # 0xe15a0
subq %rax, %r14
leaq -0x100(%r14), %rdi
leaq 0xd0502(%rip), %r15     # 0xe14a0
movl $0x100, %edx            # imm = 0x100
movq %r15, %rsi
callq 0xe97a
addq $-0x200, %r14           # imm = 0xFE00
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe97a
leaq 0xbea6(%rip), %rsi      # 0x1ce6f
leaq 0xc002(%rip), %rdx      # 0x1cfd2
pushq $0x2
popq %rdi
movq %rbx, %rcx
movq %r15, %r8
xorl %eax, %eax
callq 0x1920b
leaq 0xd04b9(%rip), %rdi     # 0xe14a0
callq 0xed98
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq