// File: /workspace/github_c_makefile_star2_O1/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 0x8969
movq %rax, %rdi
callq 0x9004
movq %rax, %rbx
leaq 0xe934(%rip), %rsi      # 0x1d1d0
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x9606e(%rip)     # 0xa4920
leaq 0xe92d(%rip), %rsi      # 0x1d1e6
movsd 0xc767(%rip), %xmm0     # 0x1b028
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x96051(%rip)     # 0xa4924
leaq 0xe926(%rip), %rsi      # 0x1d200
movsd 0xe8e6(%rip), %xmm0     # 0x1d1c8
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x96034(%rip)     # 0xa4928
leaq 0xe91e(%rip), %rsi      # 0x1d219
movsd 0xcddd(%rip), %xmm0     # 0x1b6e0
movq %rbx, %rdi
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x96017(%rip)     # 0xa492c
leaq 0xe919(%rip), %rsi      # 0x1d235
movq %rbx, %rdi
movsd 0xc701(%rip), %xmm0     # 0x1b028
callq 0x9276
cvttsd2si %xmm0, %eax
movl %eax, 0x963fa(%rip)     # 0xa4d30
leaq 0x963f7(%rip), %r14     # 0xa4d34
leaq 0xe90b(%rip), %r15      # 0x1d24f
movq %rsp, %r12
leaq 0xcdc3(%rip), %r13      # 0x1b711
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 0x907b
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xf038
incq %rbp
addq $0x400, %r14            # imm = 0x400
cmpq $0x78, %rbp
jne 0xe950
leaq 0xe8ce(%rip), %rsi      # 0x1d267
leaq 0xe8dc(%rip), %rdx      # 0x1d27c
movq %rbx, %rdi
callq 0x907b
leaq 0x95f81(%rip), %rdi     # 0xa4930
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf038
movq %rbx, %rdi
callq 0x905c
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq