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

    cP = cfsCreate( sissmGetConfigPath() );

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

    pidynbotsConfig.MinimumEnemies  = (int) cfsFetchNum( cP, "pidynbots.MinimumEnemies",  3.0 );  // minimumenemies
    pidynbotsConfig.MaximumEnemies  = (int) cfsFetchNum( cP, "pidynbots.MaximumEnemies", 18.0 );  // maximumenemies
    pidynbotsConfig.MaxPlayersToScaleEnemyCount = (int) cfsFetchNum( cP, "pidynbots.MaxPlayerToScaleEnemyCount", 10.0);
    pidynbotsConfig.AIDifficulty = (double) cfsFetchNum( cP, "pidynbots.AIDifficulty",    0.5 );  // AIDifficulty

    pidynbotsConfig.enableObjAdj         = (int) cfsFetchNum( cP, "pidynbots.enableObjAdj", 0.0 );  
    pidynbotsConfig.enableDisconnAdj     = (int) cfsFetchNum( cP, "pidynbots.enableDisconnAdj", 0.0 );  
    pidynbotsConfig.enableConnAdj        = (int) cfsFetchNum( cP, "pidynbots.enableConnAdj", 0.0 );  
    pidynbotsConfig.MaxBotsCrashProtect  = (int) cfsFetchNum( cP, "pidynbots.MaxBotsCrashProtect", 200.0 ); 

    strlcpy( pidynbotsConfig.showInGame, cfsFetchStr( cP, "pidynbots.showInGame", "" ), CFS_FETCH_MAX );  

    // Read the adjustment table
    //
    for ( i=0; i<PIDYN_MAXADJUSTERS; i++ ) {
        snprintf( varArray, 256, "pidynbots.Adjuster[%d]", i );
        strlcpy( pidynbotsConfig.Adjuster[i], cfsFetchStr( cP, varArray,  "" ), CFS_FETCH_MAX);
    }

    // Read the game mode adjustment offset table
    //
    for ( i=0; i<PIDYN_MAXMODES; i++ ) {
        snprintf( varArray, 256, "pidynbots.modeAdjust[%d]", i );
        strlcpy( pidynbotsConfig.modeAdjust[i], cfsFetchStr( cP, varArray,  "" ), CFS_FETCH_MAX);
        logPrintf( LOG_LEVEL_INFO, "pidynbots", "Reading GameMode BotOffset Table: ::%d::%s::", i, pidynbotsConfig.modeAdjust[i] ); 
    }

    // Read the botbias table
    //
    strlcpy( pidynbotsConfig.BotBias, cfsFetchStr( cP, "pidynbots.botbias",  "" ), 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 0xe830(%rip), %rsi      # 0x1be28
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6eada(%rip)     # 0x7c0e8
leaq 0xe829(%rip), %rsi      # 0x1be3e
movsd 0xc9f3(%rip), %xmm0     # 0x1a010
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6eabd(%rip)     # 0x7c0ec
leaq 0xe821(%rip), %rsi      # 0x1be57
movsd 0xe7d2(%rip), %xmm0     # 0x1be10
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6eaa0(%rip)     # 0x7c0f0
leaq 0xe819(%rip), %rsi      # 0x1be70
movsd 0xd079(%rip), %xmm0     # 0x1a6d8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6ea83(%rip)     # 0x7c0f4
leaq 0xe81d(%rip), %rsi      # 0x1be95
movsd 0xe798(%rip), %xmm0     # 0x1be18
movq %rbx, %rdi
callq 0x91bd
movsd %xmm0, 0x6ea70(%rip)    # 0x7c100
leaq 0xe815(%rip), %rsi      # 0x1beac
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x92e5b(%rip)     # 0xa0508
leaq 0xe80f(%rip), %rsi      # 0x1bec3
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x92e42(%rip)     # 0xa050c
leaq 0xe80d(%rip), %rsi      # 0x1bede
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x92e29(%rip)     # 0xa0510
leaq 0xe808(%rip), %rsi      # 0x1bef6
movsd 0xcff2(%rip), %xmm0     # 0x1a6e8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6e9f0(%rip)     # 0x7c0f8
leaq 0xe805(%rip), %rsi      # 0x1bf14
leaq 0xcff3(%rip), %r14      # 0x1a709
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x92dec(%rip), %rdi     # 0xa0514
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x6e9cc(%rip), %r15     # 0x7c108
leaq 0xe7e6(%rip), %r12      # 0x1bf29
movq %rsp, %r13
xorl %ebp, %ebp
cmpq $0x80, %rbp
je 0xd78f
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 0x8ff5
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
movq %rax, %rsi
callq 0xe97a
incq %rbp
addq $0x400, %r15            # imm = 0x400
jmp 0xd748
leaq 0x8e972(%rip), %r14     # 0x9c108
movq %rsp, %r12
leaq 0xe7c3(%rip), %r15      # 0x1bf63
pushq $0x2
popq %r13
xorl %ebp, %ebp
cmpq $0x10, %rbp
je 0xd80b
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdi
leaq 0xe785(%rip), %rdx      # 0x1bf40
movl %ebp, %ecx
xorl %eax, %eax
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
leaq 0xcf38(%rip), %rdx      # 0x1a709
callq 0x8ff5
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xe97a
movl %r13d, %edi
leaq 0xe769(%rip), %rsi      # 0x1bf59
movq %r15, %rdx
movl %ebp, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x1920b
incq %rbp
addq $0x400, %r14            # imm = 0x400
jmp 0xd7a6
leaq 0xe77e(%rip), %rsi      # 0x1bf90
leaq 0xcef0(%rip), %rdx      # 0x1a709
movq %rbx, %rdi
callq 0x8ff5
leaq 0x928e0(%rip), %rdi     # 0xa0108
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