// File: /workspace/github_c_makefile_star2_O3/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 0x8970
movq %rax, %rdi
callq 0x8ffc
movq %rax, %rbx
leaq 0xef34(%rip), %rsi      # 0x1ce20
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x6e1e6(%rip)     # 0x7c0e8
leaq 0xef2d(%rip), %rsi      # 0x1ce36
movsd 0xd0ff(%rip), %xmm0     # 0x1b010
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x6e1c9(%rip)     # 0x7c0ec
leaq 0xef25(%rip), %rsi      # 0x1ce4f
movsd 0xeed6(%rip), %xmm0     # 0x1ce08
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x6e1ac(%rip)     # 0x7c0f0
leaq 0xef1d(%rip), %rsi      # 0x1ce68
movsd 0xd785(%rip), %xmm0     # 0x1b6d8
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x6e18f(%rip)     # 0x7c0f4
leaq 0xef21(%rip), %rsi      # 0x1ce8d
movsd 0xee9c(%rip), %xmm0     # 0x1ce10
movq %rbx, %rdi
callq 0x926a
movsd %xmm0, 0x6e17c(%rip)    # 0x7c100
leaq 0xef19(%rip), %rsi      # 0x1cea4
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x92567(%rip)     # 0xa0508
leaq 0xef13(%rip), %rsi      # 0x1cebb
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x9254e(%rip)     # 0xa050c
leaq 0xef11(%rip), %rsi      # 0x1ced6
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x92535(%rip)     # 0xa0510
leaq 0xef0c(%rip), %rsi      # 0x1ceee
movsd 0xd6fe(%rip), %xmm0     # 0x1b6e8
movq %rbx, %rdi
callq 0x926a
cvttsd2si %xmm0, %eax
movl %eax, 0x6e0fc(%rip)     # 0x7c0f8
leaq 0xef09(%rip), %rsi      # 0x1cf0c
leaq 0xd6ff(%rip), %r14      # 0x1b709
movq %rbx, %rdi
movq %r14, %rdx
callq 0x9073
leaq 0x924f8(%rip), %rdi     # 0xa0514
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xf384
leaq 0x6e0d8(%rip), %r15     # 0x7c108
leaq 0xeeea(%rip), %r12      # 0x1cf21
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
incq %rbp
addq $0x400, %r15            # imm = 0x400
cmpq $0x80, %rbp
jne 0xe03c
leaq 0x8e080(%rip), %r14     # 0x9c108
movq %rsp, %r12
leaq 0xeebf(%rip), %rbp      # 0x1cf51
leaq 0xeec2(%rip), %r15      # 0x1cf5b
xorl %r13d, %r13d
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdi
leaq 0xee8d(%rip), %rdx      # 0x1cf38
movl %r13d, %ecx
xorl %eax, %eax
callq 0x8190
movq %rbx, %rdi
movq %r12, %rsi
leaq 0xd647(%rip), %rdx      # 0x1b709
callq 0x9073
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xf384
movl $0x2, %edi
movq %rbp, %rsi
movq %r15, %rdx
movl %r13d, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x1a3e3
incq %r13
addq $0x400, %r14            # imm = 0x400
cmpq $0x10, %r13
jne 0xe09c
leaq 0xee82(%rip), %rsi      # 0x1cf88
leaq 0xd5fc(%rip), %rdx      # 0x1b709
movq %rbx, %rdi
callq 0x9073
leaq 0x91fec(%rip), %rdi     # 0xa0108
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