// File: /workspace/github_c_makefile_star2_O2/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 0x8fa1(%rip), %rbp      # 0x1da22
leaq 0x20(%rsp), %r13
leaq 0x202c13(%rip), %rbx    # 0x2176a0
xorl %r12d, %r12d
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %r15, %rdi
movl %r12d, %esi
movq %rbp, %rdx
callq 0xed9c
testq %rax, %rax
je 0x14bf4
movl $0x400, %edx            # imm = 0x400
movq %r13, %rdi
movq %rax, %rsi
callq 0xe97a
cmpb $0x0, 0x20(%rsp)
je 0x14bf4
movq %r14, %rdi
movq %r13, %rsi
callq 0x83c0
testq %rax, %rax
jne 0x14bec
movq %r13, %rdi
xorl %esi, %esi
leaq 0x8f35(%rip), %rdx      # 0x1da21
callq 0xed9c
testq %rax, %rax
je 0x14b0c
movl $0xff, %edx
leaq 0x202a9e(%rip), %rdi    # 0x2175a0
movq %rax, %rsi
callq 0xe97a
jmp 0x14b18
leaq 0x202a8d(%rip), %rdi    # 0x2175a0
callq 0xed98
movq %r13, %rdi
pushq $0x1
popq %rsi
leaq 0x8efc(%rip), %rdx      # 0x1da21
callq 0xed9c
testq %rax, %rax
je 0x14b41
movl $0xff, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0xe97a
jmp 0x14b49
movq %rbx, %rdi
callq 0xed98
movq %rbx, %r14
leaq 0x202a4d(%rip), %rdi    # 0x2175a0
callq 0x8120
movq %rax, %rbp
movq %rbx, %rdi
callq 0x8120
addl %ebp, %eax
addl $0x2, %eax
cltq
leaq 0x20(%rsp,%rax), %rsi
movl $0xff, %edx
leaq 0x202c25(%rip), %rbp    # 0x2177a0
movq %rbp, %rdi
callq 0xe97a
pushq $0x3
popq %rbx
movl %ebx, %edi
leaq 0x8bb1(%rip), %r15      # 0x1d740
movq %r15, %rsi
leaq 0x8e8b(%rip), %rdx      # 0x1da24
leaq 0x20(%rsp), %r13
movq %r13, %rcx
xorl %eax, %eax
callq 0x1920b
movl %ebx, %edi
movq %r15, %rsi
leaq 0x8e87(%rip), %rdx      # 0x1da3b
movq %rbp, %rcx
leaq 0x2029e2(%rip), %rbx    # 0x2175a0
movq %rbx, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x1920b
movq %rbp, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq *0x18(%rsp)
leaq 0x8e43(%rip), %rbp      # 0x1da22
movq %r14, %rbx
movq 0x8(%rsp), %r14
movq 0x10(%rsp), %r15
incl %r12d
jmp 0x14a9a
xorl %eax, %eax
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq