// File: /workspace/github_c_makefile_star2_O0/schroeder-lvb[P]sissm/src/api.c
// Function: apiKickOrBan
int apiKickOrBan( int isBan, char *playerGUID, char *reason )
{
    char rconCmd[API_T_BUFSIZE], rconResp[API_R_BUFSIZE], playerName[256];
    int bytesRead, errCode, guidType = 0;

    // "stub" for dev testing - do not kick or ban
    //
    if ( 0L != p2pGetL( "dev.p2p.nokick", 0L )) {
        return 0;
    }

    if ( isBan ) {
        snprintf( rconCmd, API_T_BUFSIZE, "banid \"%s\" -1 \"%s\"", playerGUID, reason );
        errCode = rdrvCommand( _rPtr, 2, rconCmd, rconResp, &bytesRead );
    }
    else {

        guidType = rosterIsValidGUID( playerGUID ) ;
        switch ( guidType ) {
        case 1:         // Steam - kick by Steam ID
            snprintf( rconCmd, API_T_BUFSIZE, "kick \"%s\" \"%s\"", playerGUID, reason );
            errCode = rdrvCommand( _rPtr, 2, rconCmd, rconResp, &bytesRead );
            break;
        case 2:         // EPIC - kick by Name:  bug workaround 
            strlcpy( playerName, rosterLookupNameFromGUID( playerGUID ), 256 ); 
            if ( strlen( playerName ) > 3 ) {
                snprintf( rconCmd, API_T_BUFSIZE, "kick \"%s\" \"%s\"", playerName, reason );
                errCode = rdrvCommand( _rPtr, 2, rconCmd, rconResp, &bytesRead );
            }
            break;
        } 
    }

    logPrintf( LOG_LEVEL_WARN, "api", "apiKickOrBan ::%s::", rconCmd );
 
    return errCode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2140, %rsp           # imm = 0x2140
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x212c(%rbp)
leaq 0xca46(%rip), %rdi      # 0x2475d
xorl %eax, %eax
movl %eax, %esi
callq 0x1eda0
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x17d36
movl $0x0, -0x4(%rbp)
jmp 0x17ed0
cmpl $0x0, -0x8(%rbp)
je 0x17d8f
leaq -0x1020(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movl $0x1000, %esi           # imm = 0x1000
leaq 0xe733(%rip), %rdx      # 0x2648a
movb $0x0, %al
callq 0x8180
movq 0xc9733(%rip), %rdi     # 0xe1498
leaq -0x1020(%rbp), %rdx
leaq -0x2020(%rbp), %rcx
movl $0x2, %esi
leaq -0x2124(%rbp), %r8
callq 0x9f20
movl %eax, -0x2128(%rbp)
jmp 0x17ea6
movq -0x10(%rbp), %rdi
callq 0x190a0
movl %eax, -0x212c(%rbp)
movl -0x212c(%rbp), %eax
movl %eax, -0x2130(%rbp)
subl $0x1, %eax
je 0x17dc1
jmp 0x17db1
movl -0x2130(%rbp), %eax
subl $0x2, %eax
je 0x17e14
jmp 0x17ea4
leaq -0x1020(%rbp), %rdi
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %r8
movl $0x1000, %esi           # imm = 0x1000
leaq 0xbe9c(%rip), %rdx      # 0x23c78
movb $0x0, %al
callq 0x8180
movq 0xc96ae(%rip), %rdi     # 0xe1498
leaq -0x1020(%rbp), %rdx
leaq -0x2020(%rbp), %rcx
movl $0x2, %esi
leaq -0x2124(%rbp), %r8
callq 0x9f20
movl %eax, -0x2128(%rbp)
jmp 0x17ea4
leaq -0x2120(%rbp), %rax
movq %rax, -0x2138(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1a150
movq -0x2138(%rbp), %rdi
movq %rax, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x11bc0
leaq -0x2120(%rbp), %rdi
callq 0x8110
cmpq $0x3, %rax
jbe 0x17ea2
leaq -0x1020(%rbp), %rdi
leaq -0x2120(%rbp), %rcx
movq -0x18(%rbp), %r8
movl $0x1000, %esi           # imm = 0x1000
leaq 0xbe09(%rip), %rdx      # 0x23c78
movb $0x0, %al
callq 0x8180
movq 0xc961b(%rip), %rdi     # 0xe1498
leaq -0x1020(%rbp), %rdx
leaq -0x2020(%rbp), %rcx
movl $0x2, %esi
leaq -0x2124(%rbp), %r8
callq 0x9f20
movl %eax, -0x2128(%rbp)
jmp 0x17ea4
jmp 0x17ea6
leaq -0x1020(%rbp), %rcx
movl $0x1, %edi
leaq 0xdfde(%rip), %rsi      # 0x25e97
leaq 0xe5dd(%rip), %rdx      # 0x2649d
movb $0x0, %al
callq 0x21bf0
movl -0x2128(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2140, %rsp           # imm = 0x2140
popq %rbp
retq
nopl (%rax)