// File: /workspace/github_c_makefile_star2_O3/schroeder-lvb[P]sissm/src/piprotect.c
// Function: piprotectInitConfig
int piprotectInitConfig( void )
{
    cfsPtr cP;
    int i;
    char varArray[256];

    cP = cfsCreate( sissmGetConfigPath() );

    // read "piprotect.pluginstate" variable from the .cfg file
    piprotectConfig.pluginState = 
        (int) cfsFetchNum( cP, "piprotect.pluginState", 0.0 );  // disabled by default

    // algorithm #1 - detected repeated false starts and kick
    //
    piprotectConfig.enableStartFail = 
        (int) cfsFetchNum( cP, "piprotect.enableStartFail",     1.0 );  // 0=disable 1=enable
    piprotectConfig.countThreshold = 
        (int) cfsFetchNum( cP, "piprotect.countThreshold",     16.0 );  // 10 pkt/sec = 40ms/msg
    piprotectConfig.blackoutWindowSec = 
        (int) cfsFetchNum( cP, "piprotect.blackoutWindowSec",  10.0 );  // 10sec blackout after kick 


    // algorithm #2 - block join on high risk objectives/counterattacks
    //
    piprotectConfig.enableBlockJoin = 
        (int) cfsFetchNum( cP, "piprotect.enableBlockJoin",     1.0 );  // 0=disable 1=enable
    for ( i=0; i<PIPROT_MAXLASTOBJTABLE; i++ ) {
        // Read the join limit table
        //
        snprintf( varArray, 256, "piprotect.joinLimit[%d]", i );
        strlcpy( piprotectConfig.joinLimit[i], cfsFetchStr( cP, varArray,  "" ), CFS_FETCH_MAX);
    }

    strlcpy( piprotectConfig.kickReason, cfsFetchStr( cP, "piprotect.kickReason", "Server Internal Error" ), CFS_FETCH_MAX);

    cfsDestroy( cP );

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
callq 0x8970
movq %rax, %rdi
callq 0x8ffc
movq %rax, %rbx
leaq 0xe5bc(%rip), %rsi      # 0x1d1a8
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x95d1e(%rip)     # 0xa4920
leaq 0xe5b5(%rip), %rsi      # 0x1d1be
movsd 0xc417(%rip), %xmm0     # 0x1b028
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x95d01(%rip)     # 0xa4924
leaq 0xe5ae(%rip), %rsi      # 0x1d1d8
movsd 0xe56e(%rip), %xmm0     # 0x1d1a0
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x95ce4(%rip)     # 0xa4928
leaq 0xe5a6(%rip), %rsi      # 0x1d1f1
movsd 0xca85(%rip), %xmm0     # 0x1b6d8
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x95cc7(%rip)     # 0xa492c
leaq 0xe5a1(%rip), %rsi      # 0x1d20d
movq %rbx, %rdi
movsd 0xc3b1(%rip), %xmm0     # 0x1b028
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x960aa(%rip)     # 0xa4d30
leaq 0x960a7(%rip), %r14     # 0xa4d34
leaq 0xe593(%rip), %r15      # 0x1d227
movq %rsp, %r12
leaq 0xca6b(%rip), %r13      # 0x1b709
xorl %ebp, %ebp
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdi
movq %r15, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x9073
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xf384
incq %rbp
addq $0x400, %r14            # imm = 0x400
cmpq $0x78, %rbp
jne 0xeca0
leaq 0xe556(%rip), %rsi      # 0x1d23f
leaq 0xe564(%rip), %rdx      # 0x1d254
movq %rbx, %rdi
callq 0x9073
leaq 0x95c31(%rip), %rdi     # 0xa4930
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
movq %rbx, %rdi
callq 0x9054
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq