// File: /workspace/github_c_makefile_star2_O3/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 0x11d38(%rip), %rsi     # 0x1c0c5
movq %rsp, %rdx
xorl %eax, %eax
callq 0x82d0
leaq 0x2b9a6(%rip), %r15     # 0x35d44
movl $0x1, %ebx
cmpl $0x1, %eax
jne 0xa4b2
movl (%rsp), %eax
cmpl $0x2, %eax
jl 0xa4b2
cmpl 0x4e586(%rip), %eax     # 0x58944
jg 0xa4b2
movl 0x4e57e(%rip), %ebp     # 0x58948
leaq 0x11cf4(%rip), %rsi     # 0x1c0c5
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x82d0
cmpl $0x1, %eax
jne 0xa422
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
movl %ecx, (%rsp)
movl 0x4e557(%rip), %edx     # 0x5894c
cmpl %edx, %eax
movl %edx, %ebp
cmovll %eax, %ebp
testl %edx, %edx
cmovel %eax, %ebp
cmpl %ecx, %ebp
setle %al
cmpl 0x4e538(%rip), %ecx     # 0x58944
setle %dl
cmpl $0x2, %ecx
setge %cl
andb %dl, %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa4b2
movl %ebp, %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
sarl %ecx
leaq 0x53a3e(%rip), %rbx     # 0x5de70
leaq 0x11c8c(%rip), %r14     # 0x1c0c5
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x8190
leaq 0x115e9(%rip), %rdi     # 0x1ba3b
movq %rbx, %rsi
callq 0x131ed
movl (%rsp), %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movl $0x100, %esi            # imm = 0x100
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x8190
leaq 0x115cb(%rip), %rdi     # 0x1ba4a
movq %rbx, %rsi
callq 0x131ed
leaq 0x115d7(%rip), %rdi     # 0x1ba65
movl $0x1, %esi
callq 0x180a5
leaq 0x115e4(%rip), %rdi     # 0x1ba83
movl $0x1, %esi
callq 0x180a5
leaq 0x2a494(%rip), %r15     # 0x34944
xorl %ebx, %ebx
callq 0x83c0
cltq
imulq $0x66666667, %rax, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x21, %rcx
addl %edx, %ecx
leal (%rcx,%rcx,4), %ecx
subl %ecx, %eax
movslq %eax, %rdi
shlq $0xa, %rdi
addq %r15, %rdi
xorl %eax, %eax
callq 0x134e5
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq