// File: /workspace/github_c_makefile_star2_O0/schroeder-lvb[P]sissm/src/piantirush.c
// Function: startOfEverything
void _startOfEverything( void )
{
    int currentPlayerCount;
   
    // this block is for the offset timer/values used in "training mode" 
    // from PICLADMIN: "!wax on/off" 
    //
    if ( 0L == p2pGetL( "piantirush.p2p.training", 0L )) {
        piantirushConfig.trTimeOfs     = 0;
        piantirushConfig.trSlowOfs     = 0;
        piantirushConfig.trEarlyOfs    = 0;
        piantirushConfig.trEarDesOfs   = 0;
        piantirushConfig.trNPlayerOfs  = 0;
    }
    else {
        piantirushConfig.trTimeOfs     = piantirushConfig.lockIntervalSecTrainOffset;
        piantirushConfig.trSlowOfs     = piantirushConfig.slowIntervalSecTrainOffset;
        piantirushConfig.trEarlyOfs    = piantirushConfig.earlyBreachSpeedupTrainOffset;
        piantirushConfig.trEarDesOfs   = piantirushConfig.destroySpeedupTrainOffset;
        piantirushConfig.trNPlayerOfs  = piantirushConfig.nPlayerExemptionTrainOffset;
    }

    currentPlayerCount = apiPlayersGetCount();
    if (currentPlayerCount >= piantirushConfig.nPlayerLockThreshold ) {
        alarmReset( aPtr, piantirushConfig.lockIntervalSec + piantirushConfig.trTimeOfs );
        if ( 0L != p2pGetL( "piantirush.p2p.training", 0L ) )     // if training mode enabled "on" or "perm"
            alarmReset( xPtr, piantirushConfig.lockIntervalSec );   // training mode reminder
        // logPrintf(LOG_LEVEL_DEBUG, "piantirush", "Antirush start LOCK alarm set %d", piantirushConfig.lockIntervalSec + piantirushConfig.trTimeOfs);
        _captureSpeed( 2 );
    }
    else if (currentPlayerCount > ( piantirushConfig.nPlayerExemption + piantirushConfig.trNPlayerOfs ) )  { 
        if ( 0L != p2pGetL( "piantirush.p2p.training", 0L ) )     // if training mode enabled "on" or "perm"
            alarmReset( xPtr, piantirushConfig.slowIntervalSec );   // training mode reminder 
        alarmReset( aPtr, piantirushConfig.slowIntervalSec +  piantirushConfig.trSlowOfs);
        // logPrintf(LOG_LEVEL_DEBUG, "piantirush", "Antirush start SLOW alarm set %d", piantirushConfig.lockIntervalSec +  piantirushConfig.trSlowOfs);
        _captureSpeed( 1 );
    }
    else {
        alarmCancel( aPtr );  
        alarmCancel( xPtr );
        _captureSpeed( 0 );   
    }

    return;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x80d3(%rip), %rdi      # 0x23912
xorl %eax, %eax
movl %eax, %esi
callq 0x1eda0
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x1b886
movl $0x0, 0x20a084(%rip)    # 0x2258e0
movl $0x0, 0x20a082(%rip)    # 0x2258e8
movl $0x0, 0x20a080(%rip)    # 0x2258f0
movl $0x0, 0x20a07e(%rip)    # 0x2258f8
movl $0x0, 0x20a07c(%rip)    # 0x225900
jmp 0x1b8c2
movl 0x20a050(%rip), %eax    # 0x2258dc
movl %eax, 0x20a04e(%rip)    # 0x2258e0
movl 0x20a04c(%rip), %eax    # 0x2258e4
movl %eax, 0x20a04a(%rip)    # 0x2258e8
movl 0x20a048(%rip), %eax    # 0x2258ec
movl %eax, 0x20a046(%rip)    # 0x2258f0
movl 0x20a044(%rip), %eax    # 0x2258f4
movl %eax, 0x20a042(%rip)    # 0x2258f8
movl 0x20a040(%rip), %eax    # 0x2258fc
movl %eax, 0x20a03e(%rip)    # 0x225900
callq 0x17fe0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x203fd5(%rip), %eax    # 0x21f8a8
jl 0x1b92c
movq 0x20c044(%rip), %rdi    # 0x227920
movl 0x2057ce(%rip), %eax    # 0x2210b0
addl 0x209ff8(%rip), %eax    # 0x2258e0
movslq %eax, %rsi
callq 0x12a40
leaq 0x801b(%rip), %rdi      # 0x23912
xorl %eax, %eax
movl %eax, %esi
callq 0x1eda0
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1b91d
movq 0x20c017(%rip), %rdi    # 0x227928
movslq 0x205798(%rip), %rsi    # 0x2210b0
callq 0x12a40
movl $0x2, %edi
callq 0x1b9c0
jmp 0x1b9b4
movl -0x4(%rbp), %eax
movl 0x203f6f(%rip), %ecx    # 0x21f8a4
addl 0x209fc5(%rip), %ecx    # 0x225900
cmpl %ecx, %eax
jle 0x1b993
leaq 0x7fcc(%rip), %rdi      # 0x23912
xorl %eax, %eax
movl %eax, %esi
callq 0x1eda0
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
je 0x1b96c
movq 0x20bfc8(%rip), %rdi    # 0x227928
movslq 0x204b45(%rip), %rsi    # 0x2204ac
callq 0x12a40
movq 0x20bfad(%rip), %rdi    # 0x227920
movl 0x204b33(%rip), %eax    # 0x2204ac
addl 0x209f69(%rip), %eax    # 0x2258e8
movslq %eax, %rsi
callq 0x12a40
movl $0x1, %edi
callq 0x1b9c0
jmp 0x1b9b2
movq 0x20bf86(%rip), %rdi    # 0x227920
callq 0x12a80
movq 0x20bf82(%rip), %rdi    # 0x227928
callq 0x12a80
xorl %edi, %edi
callq 0x1b9c0
jmp 0x1b9b4
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)