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

    _queueReboot = REBOOT_CANCEL;

    cP = cfsCreate( sissmGetConfigPath() );

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

    // Read the humanized responses for when a command is issued can was successfully executed
    //
    strlcpy( picladminConfig.msgOk[0],       cfsFetchStr( cP, "picladmin.msgOk[0]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[1],       cfsFetchStr( cP, "picladmin.msgOk[1]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[2],       cfsFetchStr( cP, "picladmin.msgOk[2]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[3],       cfsFetchStr( cP, "picladmin.msgOk[3]",      "Ok!" ),             CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgOk[4],       cfsFetchStr( cP, "picladmin.msgOk[4]",      "Ok!" ),             CFS_FETCH_MAX);

    // Read the humanized responses for when a command has an error
    //
    strlcpy( picladminConfig.msgErr[0],      cfsFetchStr( cP, "picladmin.msgErr[0]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[1],      cfsFetchStr( cP, "picladmin.msgErr[1]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[2],      cfsFetchStr( cP, "picladmin.msgErr[2]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[3],      cfsFetchStr( cP, "picladmin.msgErr[3]",     "Invalid Syntax!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgErr[4],      cfsFetchStr( cP, "picladmin.msgErr[4]",     "Invalid Syntax!" ), CFS_FETCH_MAX);

    // Read the humanized responses for when a non-admin tries to use a command
    //
    strlcpy( picladminConfig.msgInvalid[0], cfsFetchStr( cP, "picladmin.msgInvalid[0]",  "Unauthorized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[1], cfsFetchStr( cP, "picladmin.msgInvalid[1]",  "Unauthroized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[2], cfsFetchStr( cP, "picladmin.msgInvalid[2]",  "Unauthroized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[3], cfsFetchStr( cP, "picladmin.msgInvalid[3]",  "Unauthroized!" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.msgInvalid[4], cfsFetchStr( cP, "picladmin.msgInvalid[4]",  "Unauthorized!" ),   CFS_FETCH_MAX);


    // Read the 5-element rules list
    //
    strlcpy( picladminConfig.rulesInfo[0], cfsFetchStr( cP, "picladmin.rulesInfo[0]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[1], cfsFetchStr( cP, "picladmin.rulesInfo[1]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[2], cfsFetchStr( cP, "picladmin.rulesInfo[2]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[3], cfsFetchStr( cP, "picladmin.rulesInfo[3]",  "" ),   CFS_FETCH_MAX);
    strlcpy( picladminConfig.rulesInfo[4], cfsFetchStr( cP, "picladmin.rulesInfo[4]",  "" ),   CFS_FETCH_MAX);

    // Read the interval (sec) on how fast the rules are printed on player screen.  0 = no rules
    //
    picladminConfig.rulesIntervalSec = (int) cfsFetchNum( cP, "picladmin.rulesIntervalSec", 2.0 );  //  2sec apart

    // Read the server contacts info
    //
    strlcpy( picladminConfig.contactInfo, cfsFetchStr( cP, "picladmin.contactInfo",  "Contact info not set" ),   CFS_FETCH_MAX);

    // Read the operator-specified "macro" (alias) sequence
    //
    for ( i=0; i<NUM_MACROS; i++ ) {
        snprintf( varArray, 256, "picladmin.macros[%d]", i );
        strlcpy( picladminConfig.macros[i],     cfsFetchStr( cP, varArray,  "" ),   CFS_FETCH_MAX);
        replaceDoubleColonWithBell( picladminConfig.macros[i] );
    }

    strlcpy( picladminConfig.cmdPrefix,      cfsFetchStr( cP, "picladmin.cmdPrefix",      "!" ),              CFS_FETCH_MAX);

    // if nil cmdPrefix is in the .cfg file, this will cause every command to be admin command, so
    // we override that here.
    //
    if ( 0 == strlen( picladminConfig.cmdPrefix )) strlcpy( picladminConfig.cmdPrefix, "!", CFS_FETCH_MAX );

    // Set bot count max and default min values 
    // if Max value is set too high and admin issues a !bf or !bs, servers & clients may crash
    //
    picladminConfig.botMaxAllowed = (int) cfsFetchNum( cP, "picladmin.botMaxAllowed", 200.0 );
    picladminConfig.botMinDefault = (int) cfsFetchNum( cP, "picladmin.botMinDefault",  6.0 );
    if ( picladminConfig.botMaxAllowed < 2 ) picladminConfig.botMaxAllowed = 4;
    if ( picladminConfig.botMinDefault < 2 ) picladminConfig.botMinDefault = 2;

    // BotUpperMin limits the maximum number admin can specify in !botscaled !bs command.
    // Recommended value:  10.  If "0" is set (default) the limiter is disabled.
    //
    picladminConfig.botUpperMin = (int) cfsFetchNum( cP, "picladmin.botUpperMin", 0.0 );

    // text to show in-game for !ask, !prep, and !warn
    //
    strlcpy( picladminConfig.prepBlow, cfsFetchStr( cP, "picladmin.prepBlow",  
        "*Planting/Ready to detonate!" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.prepCapture, cfsFetchStr( cP, "picladmin.prepCapture",  
        "*Testing Capture Point - Stepping On then Off" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.askBlow, cfsFetchStr( cP, "picladmin.askBlow",  
        "*DETONATING in 5-sec, <NEGATIVE> to halt" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.askCapture, cfsFetchStr( cP, "picladmin.askCapture",  
        "*BREACHING in 5-sec, <NEGATIVE> to halt" ), CFS_FETCH_MAX);
    strlcpy( picladminConfig.warnRusher, cfsFetchStr( cP, "picladmin.warnRusher",  
        "*Do NOT BREACH/DETONATE CACHE without ASKING TEAM" ), CFS_FETCH_MAX);

    // Read the "reasons" preset strings for ban/banid/kick/kickid commmands
    //
    for ( i=0; i<NUM_REASONS; i++ ) {
        snprintf( varArray, 256, "picladmin.reason[%d]", i );
        strlcpy( picladminConfig.reason[i],     cfsFetchStr( cP, varArray,  "" ),   CFS_FETCH_MAX);
        replaceDoubleColonWithBell( picladminConfig.reason[i] );
    }

    // Read the temp ban duration in minutes
    //
    picladminConfig.tempBanMinutes = (int) cfsFetchNum( cP, "picladmin.tempBanMinutes", 1440.0 );

    // Read the nokick exemption (from antirush autokick) window time in seconds
    //
    picladminConfig.noKickProtectSec = (int) cfsFetchNum( cP, "picladmin.noKickProtectSec",  15.0 );
    if ( picladminConfig.noKickProtectSec < 0 ) picladminConfig.noKickProtectSec = 0;

    // Info text that is shown when a player types !strict
    //
    strlcpy( picladminConfig.strictTutorial,  cfsFetchStr( cP, "picladmin.strictTutorial",
        "*Auto-kick if no '11' before breach/detonate!"), 
        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
movl $0x0, 0x51b76(%rip)     # 0x5dd5c
callq 0x8970
movq %rax, %rdi
callq 0x8ffc
movq %rax, %rbx
leaq 0x1000e(%rip), %rsi     # 0x1c20b
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x2872d(%rip)     # 0x34940
leaq 0x10007(%rip), %rsi     # 0x1c221
leaq 0x10013(%rip), %r14     # 0x1c234
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x28711(%rip), %rdi     # 0x34944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfff1(%rip), %rsi      # 0x1c238
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x28aeb(%rip), %rdi     # 0x34d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xffde(%rip), %rsi      # 0x1c24b
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x28ec5(%rip), %rdi     # 0x35144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xffcb(%rip), %rsi      # 0x1c25e
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x2929f(%rip), %rdi     # 0x35544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xffb8(%rip), %rsi      # 0x1c271
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x29679(%rip), %rdi     # 0x35944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xffa5(%rip), %rsi      # 0x1c284
leaq 0xffb2(%rip), %r14      # 0x1c298
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x29a4c(%rip), %rdi     # 0x35d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff9c(%rip), %rsi      # 0x1c2a8
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x29e26(%rip), %rdi     # 0x36144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff8a(%rip), %rsi      # 0x1c2bc
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x2a200(%rip), %rdi     # 0x36544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff78(%rip), %rsi      # 0x1c2d0
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x2a5da(%rip), %rdi     # 0x36944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff66(%rip), %rsi      # 0x1c2e4
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x2a9b4(%rip), %rdi     # 0x36d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff54(%rip), %rsi      # 0x1c2f8
leaq 0xff65(%rip), %r14      # 0x1c310
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x2ad87(%rip), %rdi     # 0x37144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff4d(%rip), %rsi      # 0x1c31e
leaq 0xff5e(%rip), %r15      # 0x1c336
movq %rbx, %rdi
movq %r15, %rdx
callq 0x9073
leaq 0x2b15a(%rip), %rdi     # 0x37544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff46(%rip), %rsi      # 0x1c344
movq %rbx, %rdi
movq %r15, %rdx
callq 0x9073
leaq 0x2b534(%rip), %rdi     # 0x37944
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff38(%rip), %rsi      # 0x1c35c
movq %rbx, %rdi
movq %r15, %rdx
callq 0x9073
leaq 0x2b90e(%rip), %rdi     # 0x37d44
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff2a(%rip), %rsi      # 0x1c374
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x2bce8(%rip), %rdi     # 0x38144
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff1c(%rip), %rsi      # 0x1c38c
leaq 0xf292(%rip), %r14      # 0x1b709
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x500c7(%rip), %rdi     # 0x5c550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xff06(%rip), %rsi      # 0x1c3a3
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x504a1(%rip), %rdi     # 0x5c950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfef7(%rip), %rsi      # 0x1c3ba
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x5087b(%rip), %rdi     # 0x5cd50
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfee8(%rip), %rsi      # 0x1c3d1
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x50c55(%rip), %rdi     # 0x5d150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfed9(%rip), %rsi      # 0x1c3e8
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x5102f(%rip), %rdi     # 0x5d550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfeca(%rip), %rsi      # 0x1c3ff
movsd 0xeacb(%rip), %xmm0     # 0x1b008
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x51401(%rip)     # 0x5d950
leaq 0xfec4(%rip), %rsi      # 0x1c41a
leaq 0xfed3(%rip), %rdx      # 0x1c430
movq %rbx, %rdi
callq 0x9073
leaq 0x4fbe4(%rip), %rdi     # 0x5c150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0x2c3c4(%rip), %r15     # 0x38944
leaq 0xfebe(%rip), %r12      # 0x1c445
movq %rsp, %r13
xorl %ebp, %ebp
movl $0x100, %esi            # imm = 0x100
movq %r13, %rdi
movq %r12, %rdx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x8190
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x9073
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
movq %rax, %rsi
callq 0xf384
movq %r15, %rdi
callq 0xfb4a
incq %rbp
addq $0x400, %r15            # imm = 0x400
cmpq $0x80, %rbp
jne 0xc58c
leaq 0xfe7a(%rip), %rsi      # 0x1c45a
leaq 0x1420c(%rip), %rdx     # 0x207f3
movq %rbx, %rdi
callq 0x9073
leaq 0x2bf4e(%rip), %rdi     # 0x38544
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
cmpb $0x0, 0x2bf3a(%rip)     # 0x38544
jne 0xc615
movw $0x21, 0x2bf2f(%rip)    # 0x38544
leaq 0xfe52(%rip), %rsi      # 0x1c46e
movsd 0xf0c4(%rip), %xmm0     # 0x1b6e8
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x4c30e(%rip)     # 0x58944
leaq 0xfe49(%rip), %rsi      # 0x1c486
movsd 0xf0ab(%rip), %xmm0     # 0x1b6f0
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x4c2f1(%rip)     # 0x58948
cmpl $0x1, 0x4c2e6(%rip)     # 0x58944
jg 0xc66a
movl $0x4, 0x4c2da(%rip)     # 0x58944
cmpl $0x1, %eax
jg 0xc679
movl $0x2, 0x4c2cf(%rip)     # 0x58948
leaq 0xfe1e(%rip), %rsi      # 0x1c49e
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x4c2b6(%rip)     # 0x5894c
leaq 0xfe17(%rip), %rsi      # 0x1c4b4
leaq 0xfe23(%rip), %rdx      # 0x1c4c7
movq %rbx, %rdi
callq 0x9073
leaq 0x4c29d(%rip), %rdi     # 0x58950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfe1d(%rip), %rsi      # 0x1c4e4
leaq 0xfe2c(%rip), %rdx      # 0x1c4fa
movq %rbx, %rdi
callq 0x9073
leaq 0x4c673(%rip), %rdi     # 0x58d50
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfe37(%rip), %rsi      # 0x1c528
leaq 0xfe42(%rip), %rdx      # 0x1c53a
movq %rbx, %rdi
callq 0x9073
leaq 0x4ca49(%rip), %rdi     # 0x59150
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfe48(%rip), %rsi      # 0x1c563
leaq 0xfe56(%rip), %rdx      # 0x1c578
movq %rbx, %rdi
callq 0x9073
leaq 0x4ce1f(%rip), %rdi     # 0x59550
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0xfe5b(%rip), %rsi      # 0x1c5a0
leaq 0xfe69(%rip), %rdx      # 0x1c5b5
movq %rbx, %rdi
callq 0x9073
leaq 0x4d1f5(%rip), %rdi     # 0x59950
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0x4d5e1(%rip), %r14     # 0x59d50
leaq 0xfe71(%rip), %r15      # 0x1c5e7
movq %rsp, %r12
leaq 0xef89(%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
movq %r14, %rdi
callq 0xfb4a
incq %rbp
addq $0x400, %r14            # imm = 0x400
cmpq $0x9, %rbp
jne 0xc782
leaq 0xfe29(%rip), %rsi      # 0x1c5fc
movsd 0xef1d(%rip), %xmm0     # 0x1b6f8
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x51167(%rip)     # 0x5d954
leaq 0xfe21(%rip), %rsi      # 0x1c615
movsd 0xef04(%rip), %xmm0     # 0x1b700
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movl %eax, 0x51143(%rip)     # 0x5d958
leaq 0xfe14(%rip), %rsi      # 0x1c630
leaq 0xfe26(%rip), %rdx      # 0x1c649
movq %rbx, %rdi
callq 0x9073
leaq 0x5112a(%rip), %rdi     # 0x5d95c
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