// File: /workspace/github_c_makefile_star2_O0/schroeder-lvb[P]sissm/src/piwebgen.c
// Function: convertNameToHyperlink
char *_convertNameToHyperlink( char *identString )
{
    static char retStr[256];
    char playerID[80], playerName[64], *q;
    int nameIndex, formatOfID = 0;

    //    internal test injection
    //    strlcpy( identString, "fe6c0000000000000000000000000001|20000000000000000000000000000003 111.001.034.025 Random Person", 256 );
    //    strlcpy( identString,  "0123456789012345 111.001.034.025 Random Person", 256 );

    // Get the first word of identString and check if Steam or EPIC
    //
    if ( NULL != (q = getWord( identString, 0, " " ))) {
        strlcpy( playerID, q, 80 );
        formatOfID = rosterIsValidGUID( playerID );
    }

    switch( formatOfID ) {
    case 1: // Steam
        nameIndex = 34;
        strlcpy( playerName, &identString[nameIndex], 64 );
        snprintf( retStr, 256, PROFILE_STEAM, playerID, playerName );
        break;
    case 2: // EPIC
        nameIndex = 82;
        strlcpy( playerName, &identString[nameIndex], 64 );
        snprintf( retStr, 256, PROFILE_EPIC, playerID, playerName );
        break;
    case 3: // WinGDK
        nameIndex = 33;
        strlcpy( playerName, &identString[nameIndex], 64 );
        snprintf( retStr, 256, PROFILE_WINGDK, playerID, playerName );
        break;
    default:
        strlcpy( retStr, "*InternalError*", 256 );
        break;
    }

    return( retStr );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
xorl %esi, %esi
leaq 0x10942(%rip), %rdx     # 0x24158
callq 0x122d0
movq %rax, %rcx
movq %rcx, -0xa8(%rbp)
xorl %eax, %eax
cmpq %rcx, %rax
je 0x13850
leaq -0x60(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movl $0x50, %edx
callq 0x11bc0
leaq -0x60(%rbp), %rdi
callq 0x190a0
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0xb4(%rbp)
subl $0x1, %eax
je 0x13884
jmp 0x13863
movl -0xb4(%rbp), %eax
subl $0x2, %eax
je 0x138d7
jmp 0x13870
movl -0xb4(%rbp), %eax
subl $0x3, %eax
je 0x13927
jmp 0x13977
movl $0x22, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rsi
movslq -0xac(%rbp), %rax
addq %rax, %rsi
movl $0x40, %edx
callq 0x11bc0
leaq -0x60(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq 0xc18c1(%rip), %rdi     # 0xd5180
movl $0x100, %esi            # imm = 0x100
leaq 0x12148(%rip), %rdx     # 0x25a13
movb $0x0, %al
callq 0x8180
jmp 0x1398f
movl $0x52, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rsi
movslq -0xac(%rbp), %rax
addq %rax, %rsi
movl $0x40, %edx
callq 0x11bc0
leaq -0x60(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq 0xc186e(%rip), %rdi     # 0xd5180
movl $0x100, %esi            # imm = 0x100
leaq 0x1213d(%rip), %rdx     # 0x25a5b
movb $0x0, %al
callq 0x8180
jmp 0x1398f
movl $0x21, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
movq -0x8(%rbp), %rsi
movslq -0xac(%rbp), %rax
addq %rax, %rsi
movl $0x40, %edx
callq 0x11bc0
leaq -0x60(%rbp), %rcx
leaq -0xa0(%rbp), %r8
leaq 0xc181e(%rip), %rdi     # 0xd5180
movl $0x100, %esi            # imm = 0x100
leaq 0x1212d(%rip), %rdx     # 0x25a9b
movb $0x0, %al
callq 0x8180
jmp 0x1398f
leaq 0xc1802(%rip), %rdi     # 0xd5180
leaq 0x12156(%rip), %rsi     # 0x25adb
movl $0x100, %edx            # imm = 0x100
callq 0x11bc0
leaq 0xc17ea(%rip), %rax     # 0xd5180
addq $0xc0, %rsp
popq %rbp
retq
nop