// File: /workspace/github_c_makefile_star2_O0/schroeder-lvb[P]sissm/src/api.c
// Function: apiMapChange
int apiMapChange( char *mapName, char *gameMode, int secIns, int dayNight, char *mutatorsList, int clearMutators )
{
    int i, errCode = 1;
    char strOut[300], strResp[300];

    for (i = 0; i<API_MAXMAPS; i++ ) {

        if ( 0 == strlen( mapCycleList[i].reqName ))  
            break;

        // For map change to execute, the mapCycleList[].travel element must match input parameters 
        // on 1) day-night, 2) ins-security, and 3) either gamemode must be 'blank' or must match what is specified
        //
        if ( NULL != strcasestr( mapCycleList[i].reqName, mapName ) ) {
            if ( mapCycleList[i].dayNight == dayNight ) {
                if (( mapCycleList[i].secIns == -1 ) || ( mapCycleList[i].secIns == secIns )) {
                    if ( ( 0 == strlen( gameMode )) || ( 0 == strcasecmp( mapCycleList[i].gameMode, gameMode )) ) {
                        snprintf( strOut, 300, "travel %s", mapCycleList[i].traveler );
                        if ( 0 != strlen( mutatorsList )) {
                            strlcat( strOut, "?Mutators=", 300 );
                            if ( clearMutators ) strlcat( strOut, "?", 300 );
                            strlcat( strOut, mutatorsList, 300 );
                        }
                        logPrintf( LOG_LEVEL_INFO, "api", "*** Admin command map change ::%s::", strOut );
                        apiRcon( strOut, strResp );
                        errCode = 0;
                        break;
                    }
                } 
            }
        } 
    }

    if ( errCode ) {
        logPrintf( LOG_LEVEL_INFO, "api", 
            "Admin issued invalid map change ::%s::%d::%d", 
            mapName, secIns, dayNight );
    }
                        
    return( errCode );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl $0x1, -0x2c(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x200, -0x28(%rbp)     # imm = 0x200
jge 0x18bc0
movslq -0x28(%rbp), %rax
leaq 0x167519(%rip), %rdi    # 0x17fef0
imulq $0x430, %rax, %rax      # imm = 0x430
addq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
callq 0x8110
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x189fc
jmp 0x18bc0
movslq -0x28(%rbp), %rax
leaq 0x1674e9(%rip), %rdi    # 0x17fef0
imulq $0x430, %rax, %rax      # imm = 0x430
addq %rax, %rdi
addq $0x100, %rdi            # imm = 0x100
movq -0x8(%rbp), %rsi
callq 0x8340
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x18bb0
movslq -0x28(%rbp), %rcx
leaq 0x1674b6(%rip), %rax    # 0x17fef0
imulq $0x430, %rcx, %rcx      # imm = 0x430
addq %rcx, %rax
movl 0x400(%rax), %eax
cmpl -0x18(%rbp), %eax
jne 0x18bae
movslq -0x28(%rbp), %rcx
leaq 0x167492(%rip), %rax    # 0x17fef0
imulq $0x430, %rcx, %rcx      # imm = 0x430
addq %rcx, %rax
cmpl $-0x1, 0x404(%rax)
je 0x18a95
movslq -0x28(%rbp), %rcx
leaq 0x167474(%rip), %rax    # 0x17fef0
imulq $0x430, %rcx, %rcx      # imm = 0x430
addq %rcx, %rax
movl 0x404(%rax), %eax
cmpl -0x14(%rbp), %eax
jne 0x18bac
movq -0x10(%rbp), %rdi
callq 0x8110
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x18ad9
movslq -0x28(%rbp), %rax
leaq 0x16743d(%rip), %rdi    # 0x17fef0
imulq $0x430, %rax, %rax      # imm = 0x430
addq %rax, %rdi
addq $0x408, %rdi            # imm = 0x408
movq -0x10(%rbp), %rsi
callq 0x8040
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x18baa
leaq -0x160(%rbp), %rdi
movslq -0x28(%rbp), %rax
leaq 0x167405(%rip), %rcx    # 0x17fef0
imulq $0x430, %rax, %rax      # imm = 0x430
addq %rax, %rcx
addq $0x300, %rcx            # imm = 0x300
movl $0x12c, %esi            # imm = 0x12C
leaq 0xdb4c(%rip), %rdx      # 0x26654
movb $0x0, %al
callq 0x8180
movq -0x20(%rbp), %rdi
callq 0x8110
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x18b6d
leaq -0x160(%rbp), %rdi
leaq 0xdb2e(%rip), %rsi      # 0x2665e
movl $0x12c, %edx            # imm = 0x12C
callq 0x11aa0
cmpl $0x0, -0x24(%rbp)
je 0x18b58
leaq -0x160(%rbp), %rdi
leaq 0xdb1b(%rip), %rsi      # 0x26669
movl $0x12c, %edx            # imm = 0x12C
callq 0x11aa0
leaq -0x160(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x12c, %edx            # imm = 0x12C
callq 0x11aa0
leaq -0x160(%rbp), %rcx
movl $0x2, %edi
leaq 0xd317(%rip), %rsi      # 0x25e97
leaq 0xdae4(%rip), %rdx      # 0x2666b
movb $0x0, %al
callq 0x21bf0
leaq -0x160(%rbp), %rdi
leaq -0x290(%rbp), %rsi
callq 0x17fa0
movl $0x0, -0x2c(%rbp)
jmp 0x18bc0
jmp 0x18bac
jmp 0x18bae
jmp 0x18bb0
jmp 0x18bb2
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x189bf
cmpl $0x0, -0x2c(%rbp)
je 0x18bec
movq -0x8(%rbp), %rcx
movl -0x14(%rbp), %r8d
movl -0x18(%rbp), %r9d
movl $0x2, %edi
leaq 0xd2b9(%rip), %rsi      # 0x25e97
leaq 0xdaaa(%rip), %rdx      # 0x2668f
movb $0x0, %al
callq 0x21bf0
movl -0x2c(%rbp), %eax
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
nopl (%rax,%rax)