// File: /workspace/github_c_makefile_star2_O1/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 0x13e69
testb $0x1, 0x1f028d(%rip)    # 0x2040f0
jne 0x13f44
leaq 0xa841(%rip), %rdi      # 0x1e6b1
callq 0x12f24
leaq 0x15bd64(%rip), %rsi    # 0x16fbe0
leaq 0x200(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
callq 0xf038
leaq 0x9ff7(%rip), %rsi      # 0x1de8f
leaq 0xa81b(%rip), %rdx      # 0x1e6ba
xorl %r13d, %r13d
movl $0x3, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1a227
leaq 0x1f0138(%rip), %r14    # 0x203ff0
movq %r14, %rdi
callq 0xf4dd
leaq 0x142509(%rip), %rbp    # 0x1563d0
movl $0x1, %r15d
leaq (,%r13,4), %r12
addq %r13, %r12
shlq $0x4, %r12
cmpb $0x0, (%r12,%rbp)
je 0x13f44
addq %rbp, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8350
movq %rax, (%rsp,%r13,8)
testq %rax, %rax
je 0x13f3b
testq %r13, %r13
je 0x13f17
xorl %ecx, %ecx
xorl %edx, %edx
cmpq (%rsp,%rcx,8), %rax
cmovel %r15d, %edx
incq %rcx
cmpq %rcx, %r13
jne 0x13f03
testl %edx, %edx
jne 0x13f3b
movl $0x50, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0xefc4
movl $0x50, %edx
movq %r14, %rdi
leaq 0x8220(%rip), %rsi      # 0x1c156
callq 0xefc4
incq %r13
cmpq $0x41, %r13
jne 0x13ecd
cmpb $0x0, 0x1f00a5(%rip)    # 0x203ff0
jne 0x13f5e
movb $0x0, 0x1f00a0(%rip)    # 0x203ff4
movl $0x656e6f6e, 0x1f0092(%rip) # imm = 0x656E6F6E
leaq 0x1f008b(%rip), %rbx    # 0x203ff0
movq %rbx, %rdi
callq 0xf5e3
movb $0x1, 0x1f017c(%rip)    # 0x2040f0
movq %rbx, %rax
addq $0x1208, %rsp           # imm = 0x1208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq