// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/picladmin.c
// Function: cmdMapX
int _cmdMapX( char *arg, char *arg2, char *passThru ) 
{ 
    int errCode = 0;
    int isNight = 0, isIns = 0;
    char *w, gameMode[80];
    char mutatorsList[256];
    int i, j;

    strclr( mutatorsList );
    if ( 0 == strlen( arg ) ) {
        apiSaySys( "You must specify a map.  Type !maplist");
        errCode = 1;
    }
    else {
        // Look for "ins" (Insurgent) and "night" (Night lighting) modes.
        //
        if (NULL != strcasestr( passThru, " night" )) isNight = 1;
        if (NULL != strcasestr( passThru, " ins"   )) isIns   = 1;

        // Look for optional gamemode:  checkpoint, checkpointhardcore, etc.
        // Because new game mode may be added as a mod, this table must be 
        // maintained in the config file.
        //
        j = 2;
        strclr( gameMode );
        while ( 1 == 1 ) {
            w = getWord( passThru, j++, " " );
            if ( w == NULL )       break;
            if ( 0 == strlen( w )) break;
#if 0 
            if ( w[0] == '%' ) {
                strlcat( mutatorsList, &w[1], 256 );
                strlcat( mutatorsList, ",",  256 );
            };
#endif

            if ( apiIsSupportedGameMode( w ) ) {
                strlcpy( gameMode, w, 80 );
            }
        } 

        // clean up the mutatorsList (remove trailing comma)
        //
        if ( 0 != ( i = (int) strlen( mutatorsList ) )) {
            mutatorsList[ i-1 ] = 0;
        }

        // change map
        errCode = apiMapChange( arg, gameMode, isIns, isNight, mutatorsList, 0 );

        if ( errCode ) {
            apiSaySys( "Map/mode/side not found" );
        }
    }
    return errCode;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdx, %r15
movq %rdi, %rbx
leaq 0x60(%rsp), %rdi
callq 0xf4dd
cmpb $0x0, (%rbx)
je 0xb705
movq %rbx, 0x8(%rsp)
leaq 0x109be(%rip), %rsi     # 0x1bfd1
movq %r15, %rdi
callq 0x8350
testq %rax, %rax
setne 0x7(%rsp)
leaq 0x109ae(%rip), %rsi     # 0x1bfd8
movq %r15, %rdi
callq 0x8350
testq %rax, %rax
setne 0x6(%rsp)
leaq 0x10(%rsp), %rdi
callq 0xf4dd
leaq 0x10b0b(%rip), %rdx     # 0x1c156
movq %r15, %rdi
movl $0x2, %esi
callq 0xf4e1
testq %rax, %rax
je 0xb6ae
movq %rax, %rbx
movl $0x3, %ebp
leaq 0x10aea(%rip), %r12     # 0x1c156
leaq 0x10(%rsp), %r13
cmpb $0x0, (%rbx)
je 0xb6ae
movq %rbx, %rdi
callq 0x13b3f
testl %eax, %eax
je 0xb692
movl $0x50, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf038
leal 0x1(%rbp), %r14d
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0xf4e1
movq %rax, %rbx
movl %r14d, %ebp
testq %rax, %rax
jne 0xb671
xorl %ebp, %ebp
movb 0x7(%rsp), %al
movb %al, %bpl
xorl %r14d, %r14d
movb 0x6(%rsp), %al
movb %al, %r14b
leaq 0x60(%rsp), %rdi
callq 0x8120
testl %eax, %eax
je 0xb6d8
decl %eax
cltq
movb $0x0, 0x60(%rsp,%rax)
leaq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %r8
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
movl %r14d, %edx
movl %ebp, %ecx
xorl %r9d, %r9d
callq 0x13b83
testl %eax, %eax
je 0xb718
leaq 0x108dc(%rip), %rdi     # 0x1bfdd
movl %eax, %ebx
jmp 0xb711
movl $0x1, %ebx
leaq 0x10899(%rip), %rdi     # 0x1bfaa
xorl %eax, %eax
callq 0x1316b
movl %ebx, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq