// File: /workspace/github_c_makefile_star2_O3/schroeder-lvb[P]sissm/src/roster.c
// Function: rosterSyntheticChangeEvent
int rosterSyntheticChangeEvent( char *prevRoster, char *currRoster, int (*callback)( char *, char *, char *) )
{
    char *w, *q, lineBuf[1024];
    static char playerGUID[256], playerIP[256], playerName[256];
    int  startOfName,  i = 0;

    while (1 == 1) {
        if ( NULL == (w = getWord( prevRoster, i++, "\011" )) )    // tab deliminated
            break;
        strlcpy( lineBuf, w, 1024 );
        if ( 0 == strlen( lineBuf ) ) break;

        if ( NULL == strstr( currRoster, lineBuf ) ) {  // if missing

            // parse the record into fields -- is follows 
            // rosterPlayerList( type=4, delim="tab" ) format.
            // 76561100000000000 001.002.003.004 Player Name<tab>
            //
            if ( NULL != (q = getWord( lineBuf, 0, " \011" ))) 
                strlcpy( playerGUID, q, 255 );
            else  
                strclr( playerGUID );
            
            if ( NULL != (q = getWord( lineBuf, 1, " \011" ))) 
                strlcpy( playerIP, q, 255 );   // <---- fails
            else 
                strclr( playerIP );

            startOfName = (int) strlen( playerGUID ) + (int) strlen( playerIP ) + 2;
            strlcpy( playerName, &lineBuf[ startOfName ], 255 );

            logPrintf( LOG_LEVEL_DEBUG, "roster", "Change Line    ::%s::\n", lineBuf ) ;
            logPrintf( LOG_LEVEL_DEBUG, "roster", "Change Parsed  ::%s::%s::%s::\n", playerName, playerGUID, playerIP );

            (*callback)( playerName, playerIP, playerGUID );
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rdx, 0x18(%rsp)
movq %rsi, %r14
movq %rdi, %r15
leaq 0x9018(%rip), %rdx      # 0x1ea32
xorl %esi, %esi
callq 0xf82d
testq %rax, %rax
je 0x15b93
movl $0x1, %ebx
leaq 0x20(%rsp), %r12
leaq 0x201c65(%rip), %r13    # 0x2176a0
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movl $0x400, %edx            # imm = 0x400
movq %r12, %rdi
movq %rax, %rsi
callq 0xf384
cmpb $0x0, 0x20(%rsp)
je 0x15b93
movq %r14, %rdi
movq %r12, %rsi
callq 0x83b0
testq %rax, %rax
jne 0x15b74
movq %r12, %rdi
xorl %esi, %esi
leaq 0x8fb1(%rip), %rbp      # 0x1ea31
movq %rbp, %rdx
callq 0xf82d
testq %rax, %rax
je 0x15aa3
movl $0xff, %edx
leaq 0x201b07(%rip), %rdi    # 0x2175a0
movq %rax, %rsi
callq 0xf384
jmp 0x15aaf
leaq 0x201af6(%rip), %rdi    # 0x2175a0
callq 0xf829
movq %r12, %rdi
movl $0x1, %esi
movq %rbp, %rdx
callq 0xf82d
testq %rax, %rax
je 0x15ad6
movl $0xff, %edx
movq %r13, %rdi
movq %rax, %rsi
callq 0xf384
jmp 0x15ade
movq %r13, %rdi
callq 0xf829
movq %r13, %r14
leaq 0x201ab8(%rip), %r13    # 0x2175a0
movq %r13, %rdi
callq 0x8120
movq %rax, %rbp
movq %r14, %rdi
callq 0x8120
addl %ebp, %eax
addl $0x2, %eax
cltq
leaq 0x20(%rsp,%rax), %rsi
movl $0xff, %edx
leaq 0x201c8d(%rip), %rbp    # 0x2177a0
movq %rbp, %rdi
callq 0xf384
movl $0x3, %edi
leaq 0x8c29(%rip), %r15      # 0x1e750
movq %r15, %rsi
leaq 0x8f03(%rip), %rdx      # 0x1ea34
movq %r12, %rcx
xorl %eax, %eax
callq 0x1a3e3
movl $0x3, %edi
movq %r15, %rsi
leaq 0x8f01(%rip), %rdx      # 0x1ea4b
movq %rbp, %rcx
movq %r13, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x1a3e3
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq *0x18(%rsp)
movq %r14, %r13
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %r15
leal 0x1(%rbx), %ebp
movq %r15, %rdi
movl %ebx, %esi
leaq 0x8eaf(%rip), %rdx      # 0x1ea32
callq 0xf82d
movl %ebp, %ebx
testq %rax, %rax
jne 0x15a45
xorl %eax, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop