// File: /workspace/github_c_makefile_star2_O2/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 0x8973
movq %rax, %rdi
callq 0x8f80
movq %rax, %rbx
leaq 0xdf9c(%rip), %rsi      # 0x1c1b0
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x966f6(%rip)     # 0xa4920
leaq 0xdf95(%rip), %rsi      # 0x1c1c6
movsd 0xbdef(%rip), %xmm0     # 0x1a028
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x966d9(%rip)     # 0xa4924
leaq 0xdf8e(%rip), %rsi      # 0x1c1e0
movsd 0xdf4e(%rip), %xmm0     # 0x1c1a8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x966bc(%rip)     # 0xa4928
leaq 0xdf86(%rip), %rsi      # 0x1c1f9
movsd 0xc45d(%rip), %xmm0     # 0x1a6d8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x9669f(%rip)     # 0xa492c
leaq 0xdf81(%rip), %rsi      # 0x1c215
movq %rbx, %rdi
movsd 0xbd89(%rip), %xmm0     # 0x1a028
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x96a82(%rip)     # 0xa4d30
leaq 0x96a7f(%rip), %r14     # 0xa4d34
leaq 0xdf73(%rip), %r15      # 0x1c22f
movq %rsp, %r12
leaq 0xc443(%rip), %r13      # 0x1a709
xorl %ebp, %ebp
cmpq $0x78, %rbp
je 0xe30c
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 0x8ff5
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xe97a
incq %rbp
addq $0x400, %r14            # imm = 0x400
jmp 0xe2c8
leaq 0xdf34(%rip), %rsi      # 0x1c247
leaq 0xdf42(%rip), %rdx      # 0x1c25c
movq %rbx, %rdi
callq 0x8ff5
leaq 0x96607(%rip), %rdi     # 0xa4930
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
movq %rbx, %rdi
callq 0x8fd6
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq