// File: /workspace/github_c_makefile_star2_O1/schroeder-lvb[P]sissm/src/picladmin.c
// Function: cmdBotScaled
int _cmdBotScaled( char *arg, char *arg2, char *passThru ) 
{ 
    int errCode = 1, botCount, botCountMin, botCountMax;

    if (1 == sscanf( arg, "%d", &botCountMax )) {    // assume single param case
        if ( (botCountMax <= picladminConfig.botMaxAllowed) && (botCountMax >= 2) ) {
            botCountMin = picladminConfig.botMinDefault;
            errCode = 0;
            if ( 1 == sscanf( arg2, "%d", &botCount )) {  // check for 2nd param
                botCountMin = botCountMax;
                botCountMax = botCount;
                if ( picladminConfig.botUpperMin != 0 ) {
                    if ( botCountMin > picladminConfig.botUpperMin )
                        botCountMin = picladminConfig.botUpperMin;   // limit min
                }
                if ( botCountMin > botCountMax )                   errCode = 1;
                if ( botCountMax > picladminConfig.botMaxAllowed ) errCode = 1;
                if ( botCountMax <  2 )                            errCode = 1;
            }
        }
    }
    if ( 0 == errCode ) {
        apiGameModePropertySet( "minimumenemies", _int2str( botCountMin / 2 ) );
        apiGameModePropertySet( "maximumenemies", _int2str( botCountMax / 2 ) );
        // apiGameModePropertySet( "soloenemies", _int2str( botCountMax ) );  
        p2pSetL( "picladmin.p2p.botAdminControl", 1L );  // flag as admin control
        p2pSetL( "pidynbots.p2p.sigBotScaled", 1L );  // signal to pidynbots (if running)
    }
    _stddResp( errCode );   // ok or error message to game

    return errCode; 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
leaq 0x11d48(%rip), %rsi     # 0x1c0cd
movq %rsp, %rdx
xorl %eax, %eax
callq 0x82d0
movl $0x1, %ebx
cmpl $0x1, %eax
jne 0xa405
movl (%rsp), %eax
cmpl $0x2, %eax
jl 0xa405
cmpl 0x4e59d(%rip), %eax     # 0x58944
jg 0xa405
movl 0x4e599(%rip), %ebp     # 0x58948
leaq 0x11d17(%rip), %rsi     # 0x1c0cd
xorl %ebx, %ebx
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x82d0
cmpl $0x1, %eax
jne 0xa405
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
movl %ecx, (%rsp)
movl 0x4e570(%rip), %edx     # 0x5894c
cmpl %edx, %eax
movl %edx, %ebp
cmovll %eax, %ebp
testl %edx, %edx
cmovel %eax, %ebp
cmpl %ecx, %ebp
setg %al
cmpl 0x4e551(%rip), %ecx     # 0x58944
setg %dl
cmpl $0x2, %ecx
setl %cl
orb %dl, %cl
orb %al, %cl
movzbl %cl, %ebx
jmp 0xa405
testl %ebx, %ebx
jne 0xa494
movl %ebp, %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
sarl %ecx
leaq 0x53a53(%rip), %r14     # 0x5de70
leaq 0x11ca9(%rip), %r15     # 0x1c0cd
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8190
leaq 0x11606(%rip), %rdi     # 0x1ba43
movq %r14, %rsi
callq 0x12e70
movl (%rsp), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8190
leaq 0x115e8(%rip), %rdi     # 0x1ba52
movq %r14, %rsi
callq 0x12e70
leaq 0x115f4(%rip), %rdi     # 0x1ba6d
movl $0x1, %esi
callq 0x17ea8
leaq 0x11601(%rip), %rdi     # 0x1ba8b
movl $0x1, %esi
callq 0x17ea8
movl %ebx, %edi
callq 0x9be3
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq