// File: /workspace/github_c_makefile_star2_O3/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 0x141a5
testb $0x1, 0x1eff51(%rip)    # 0x2040f0
jne 0x14280
leaq 0xa4f5(%rip), %rdi      # 0x1e6a1
callq 0x132a1
leaq 0x15ba28(%rip), %rsi    # 0x16fbe0
leaq 0x200(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
callq 0xf384
leaq 0x9cab(%rip), %rsi      # 0x1de7f
leaq 0xa4cf(%rip), %rdx      # 0x1e6aa
xorl %r13d, %r13d
movl $0x3, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1a3e3
leaq 0x1efdfc(%rip), %r14    # 0x203ff0
movq %r14, %rdi
callq 0xf829
leaq 0x1421cd(%rip), %rbp    # 0x1563d0
movl $0x1, %r15d
leaq (,%r13,4), %r12
addq %r13, %r12
shlq $0x4, %r12
cmpb $0x0, (%r12,%rbp)
je 0x14280
addq %rbp, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8350
movq %rax, (%rsp,%r13,8)
testq %rax, %rax
je 0x14277
testq %r13, %r13
je 0x14253
xorl %ecx, %ecx
xorl %edx, %edx
cmpq (%rsp,%rcx,8), %rax
cmovel %r15d, %edx
incq %rcx
cmpq %rcx, %r13
jne 0x1423f
testl %edx, %edx
jne 0x14277
movl $0x50, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0xf310
movl $0x50, %edx
movq %r14, %rdi
leaq 0x7edc(%rip), %rsi      # 0x1c14e
callq 0xf310
incq %r13
cmpq $0x41, %r13
jne 0x14209
cmpb $0x0, 0x1efd69(%rip)    # 0x203ff0
jne 0x1429a
movb $0x0, 0x1efd64(%rip)    # 0x203ff4
movl $0x656e6f6e, 0x1efd56(%rip) # imm = 0x656E6F6E
leaq 0x1efd4f(%rip), %rbx    # 0x203ff0
movq %rbx, %rdi
callq 0xf92f
movb $0x1, 0x1efe40(%rip)    # 0x2040f0
movq %rbx, %rax
addq $0x1208, %rsp           # imm = 0x1208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq