// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/api.c
// Function: apiMutActive
char *apiMutActive( int fetchNow ) 
{
    static char mutatorsActive[ API_LINE_STRING_MAX ]; 
    static int  firstTime = 1;
    char        mutatorsGMP[ API_MUT_GMP_MAX ];
    char        *savedPointer[ API_MUT_MAXLIST ];
    int         i, j, skipThis;

    if ( firstTime || fetchNow ) {

        strlcpy( mutatorsGMP, apiGameModePropertyGetRaw( "mutators" ), API_MUT_GMP_MAX );
        logPrintf( LOG_LEVEL_DEBUG, "api", "RCON Mutators ::%s::", mutatorsGMP );

        strclr( mutatorsActive );
        j = 0;

        while (0 != strlen( mutAllowedListSorted[j] )) {

            if ( NULL != (savedPointer[j] = strcasestr( mutatorsGMP, mutAllowedListSorted[j] ) )) {

                // look for previously found duplicate at the same string position to 
                // eliminate erroneous reporting of mutator names that are subset string
                // e.g., "bob100" and "bob10" -- for this to work "sorted" list must be used
                // with descending string size (greatest to least string size)
                //
                skipThis = 0;
                if (j != 0) 
                    for (i = 0; i<j; i++ ) 
                        if ( savedPointer[j] == savedPointer[i] ) 
                            skipThis = 1;

                // if no duplicate found, append to list of active mutators
                //
                if ( !skipThis ) {
                    strlcat( mutatorsActive, mutAllowedListSorted[j], API_MUT_MAXCHAR );
                    strlcat( mutatorsActive, " ",                     API_MUT_MAXCHAR );
                }
            }

            if ( ++j > API_MUT_MAXLIST ) break;   // increment w/ memory overwrite safety stop
        }
    }

    // If no mutators found, return "none".  
    // then eliminate all leading/trailing spaces.
    //
    if ( 0 == strlen( mutatorsActive ) ) strlcpy( mutatorsActive, "none",  API_LINE_STRING_MAX );
    strTrimInPlace( mutatorsActive );

    firstTime = 0;

    return mutatorsActive;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1208, %rsp           # imm = 0x1208
testl %edi, %edi
jne 0x1331e
testb $0x1, 0x1f0dd8(%rip)    # 0x2040f0
jne 0x133ec
leaq 0xa36c(%rip), %rdi      # 0x1d691
callq 0x12514
leaq 0x15c8af(%rip), %rsi    # 0x16fbe0
leaq 0x200(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
callq 0xe97a
leaq 0x9b22(%rip), %rsi      # 0x1ce6f
leaq 0xa346(%rip), %rdx      # 0x1d69a
xorl %ebp, %ebp
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1920b
leaq 0x1f0c86(%rip), %r14    # 0x203ff0
movq %r14, %rdi
callq 0xed98
leaq 0x143057(%rip), %r12    # 0x1563d0
pushq $0x1
popq %r15
imulq $0x50, %rbp, %r13
cmpb $0x0, (%r13,%r12)
je 0x133ec
addq %r12, %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8360
movq %rax, (%rsp,%rbp,8)
testq %rax, %rax
je 0x133e3
testq %rbp, %rbp
je 0x133bf
xorl %ecx, %ecx
xorl %edx, %edx
cmpq %rcx, %rbp
je 0x133bb
cmpq (%rsp,%rcx,8), %rax
cmovel %r15d, %edx
incq %rcx
jmp 0x133a9
testl %edx, %edx
jne 0x133e3
movq %r14, %rdi
movq %r13, %rsi
pushq $0x50
popq %r13
movq %r13, %rdx
callq 0xe918
movq %r14, %rdi
leaq 0x7d73(%rip), %rsi      # 0x1b14e
movq %r13, %rdx
callq 0xe918
incq %rbp
cmpq $0x41, %rbp
jne 0x1337d
cmpb $0x0, 0x1f0bfd(%rip)    # 0x203ff0
jne 0x13406
movb $0x0, 0x1f0bf8(%rip)    # 0x203ff4
movl $0x656e6f6e, 0x1f0bea(%rip) # imm = 0x656E6F6E
leaq 0x1f0be3(%rip), %rbx    # 0x203ff0
movq %rbx, %rdi
callq 0xee76
movb $0x1, 0x1f0cd4(%rip)    # 0x2040f0
movq %rbx, %rax
addq $0x1208, %rsp           # imm = 0x1208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq