// File: /workspace/github_c_makefile_star2_O1/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 0x929d(%rip), %rdx      # 0x1ea42
xorl %esi, %esi
callq 0xf4e1
testq %rax, %rax
je 0x1591e
movl $0x1, %ebx
leaq 0x20(%rsp), %r12
leaq 0x201eda(%rip), %r13    # 0x2176a0
movq %r15, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movl $0x400, %edx            # imm = 0x400
movq %r12, %rdi
movq %rax, %rsi
callq 0xf038
cmpb $0x0, 0x20(%rsp)
je 0x1591e
movq %r14, %rdi
movq %r12, %rsi
callq 0x83b0
testq %rax, %rax
jne 0x158ff
movq %r12, %rdi
xorl %esi, %esi
leaq 0x9236(%rip), %rbp      # 0x1ea41
movq %rbp, %rdx
callq 0xf4e1
testq %rax, %rax
je 0x1582e
movl $0xff, %edx
leaq 0x201d7c(%rip), %rdi    # 0x2175a0
movq %rax, %rsi
callq 0xf038
jmp 0x1583a
leaq 0x201d6b(%rip), %rdi    # 0x2175a0
callq 0xf4dd
movq %r12, %rdi
movl $0x1, %esi
movq %rbp, %rdx
callq 0xf4e1
testq %rax, %rax
je 0x15861
movl $0xff, %edx
movq %r13, %rdi
movq %rax, %rsi
callq 0xf038
jmp 0x15869
movq %r13, %rdi
callq 0xf4dd
movq %r13, %r14
leaq 0x201d2d(%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 0x201f02(%rip), %rbp    # 0x2177a0
movq %rbp, %rdi
callq 0xf038
movl $0x3, %edi
leaq 0x8eae(%rip), %r15      # 0x1e760
movq %r15, %rsi
leaq 0x9188(%rip), %rdx      # 0x1ea44
movq %r12, %rcx
xorl %eax, %eax
callq 0x1a227
movl $0x3, %edi
movq %r15, %rsi
leaq 0x9186(%rip), %rdx      # 0x1ea5b
movq %rbp, %rcx
movq %r13, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x1a227
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 0x9134(%rip), %rdx      # 0x1ea42
callq 0xf4e1
movl %ebp, %ebx
testq %rax, %rax
jne 0x157d0
xorl %eax, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop