// File: /workspace/github_c_makefile_star2_O3/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 0xf829
cmpb $0x0, (%rbx)
je 0xba6c
movq %rbx, 0x8(%rsp)
leaq 0x1064f(%rip), %rsi     # 0x1bfc9
movq %r15, %rdi
callq 0x8350
testq %rax, %rax
setne 0x7(%rsp)
leaq 0x1063f(%rip), %rsi     # 0x1bfd0
movq %r15, %rdi
callq 0x8350
testq %rax, %rax
setne 0x6(%rsp)
leaq 0x10(%rsp), %rdi
callq 0xf829
leaq 0x1079c(%rip), %rdx     # 0x1c14e
movq %r15, %rdi
movl $0x2, %esi
callq 0xf82d
testq %rax, %rax
je 0xba15
movq %rax, %rbx
movl $0x3, %ebp
leaq 0x1077b(%rip), %r12     # 0x1c14e
leaq 0x10(%rsp), %r13
cmpb $0x0, (%rbx)
je 0xba15
movq %rbx, %rdi
callq 0x13e8a
testl %eax, %eax
je 0xb9f9
movl $0x50, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf384
leal 0x1(%rbp), %r14d
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0xf82d
movq %rax, %rbx
movl %r14d, %ebp
testq %rax, %rax
jne 0xb9d8
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 0xba3f
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 0x13ece
testl %eax, %eax
je 0xba7f
leaq 0x1056d(%rip), %rdi     # 0x1bfd5
movl %eax, %ebx
jmp 0xba78
movl $0x1, %ebx
leaq 0x1052a(%rip), %rdi     # 0x1bfa2
xorl %eax, %eax
callq 0x134e5
movl %ebx, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq