// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/sissm.c
// Function: sissmInitLogAndConfig
int sissmInitLogAndConfig( char *configPath )
{
    cfsPtr cP;

    strlcpy( sissmConfig.configFile, configPath, CFS_FETCH_MAX );      // store it for the plugins

    cP = cfsCreate( configPath );

    // read the log info first, so that log module can be used to report
    // status of remaining configuration reads.
    //
    strlcpy( sissmConfig.logFile, cfsFetchStr( cP, "sissm.logfile", "sissm.log" ), CFS_FETCH_MAX );
    strlcpy( sissmConfig.serverName, cfsFetchStr( cP, "sissm.serverName", "Unknown Server" ), CFS_FETCH_MAX );
    sissmConfig.loglevel = (int) cfsFetchNum( cP, "sissm.loglevel", 2.0 );
    sissmConfig.logEchoToScreen = (int) cfsFetchNum( cP, "sissm.logechotoscreen", LOG_LEVEL_DEBUG );

    // Initialize the log system based on parameters read above
    // Options for loglevel: _DEBUG _INFO _WARN _CRITICAL 
    // 
    logPrintfInit( sissmConfig.loglevel, sissmConfig.logFile, sissmConfig.logEchoToScreen ); 

    // read the RCON parameters
    //
    strlcpy( sissmConfig.rconIP, cfsFetchStr( cP, "sissm.rconip", "127.0.0.1" ), CFS_FETCH_MAX );
    strlcpy( sissmConfig.rconPassword, cfsFetchStr( cP, "sissm.rconpassword", "" ), CFS_FETCH_MAX );
    sissmConfig.rconPort = (int) cfsFetchNum( cP, "sissm.rconport", 27015 );

    // read the game log file path
    //
    strlcpy( sissmConfig.gameLogFile, cfsFetchStr( cP, "sissm.gamelogfile", "Insurgency.log" ), CFS_FETCH_MAX );

    // read the server restart script
    //
#if SISSM_RESTRICTED
    strclr( sissmConfig.restartScript );
#else
    strlcpy( sissmConfig.restartScript, cfsFetchStr( cP, "sissm.restartscript", "" ), CFS_FETCH_MAX );
#endif
    sissmConfig.restartDelay = (int) cfsFetchNum( cP, "sissm.restartdelay", 30.0 );

    // graceful exit - when enabled, SISSM will install a signal handler for terminating itself to 
    // generate a SIGTERM event to the plugins.
    //
    sissmConfig.gracefulExit = (int) cfsFetchNum( cP, "sissm.gracefulExit", 1.0 );

    cfsDestroy( cP );

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x22ba8(%rip), %rdi     # 0x2b31c
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rsi
callq 0xe97a
leaq 0x21788(%rip), %r14     # 0x29f10
movq %rbx, %rdi
callq 0x8f80
movq %rax, %rbx
leaq 0x11908(%rip), %rsi     # 0x1a0a2
leaq 0x1190f(%rip), %rdx     # 0x1a0b0
movq %rax, %rdi
callq 0x8ff5
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xe97a
leaq 0x118fa(%rip), %rsi     # 0x1a0ba
leaq 0x11904(%rip), %rdx     # 0x1a0cb
movq %rbx, %rdi
callq 0x8ff5
leaq 0x21b42(%rip), %rdi     # 0x2a318
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x118f0(%rip), %rsi     # 0x1a0da
movsd 0x11816(%rip), %xmm0    # 0x1a008
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x21b0c(%rip)     # 0x2a310
leaq 0x118de(%rip), %rsi     # 0x1a0e9
movsd 0x117fd(%rip), %xmm0    # 0x1a010
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %edx
movl %edx, 0x21aef(%rip)     # 0x2a314
movl 0x21ae5(%rip), %edi     # 0x2a310
movq %r14, %rsi
callq 0x191e0
leaq 0x118c5(%rip), %rsi     # 0x1a0ff
leaq 0x118cb(%rip), %rdx     # 0x1a10c
movq %rbx, %rdi
callq 0x8ff5
leaq 0x222cc(%rip), %rdi     # 0x2ab1c
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x118b2(%rip), %rsi     # 0x1a116
leaq 0x11e9e(%rip), %r14     # 0x1a709
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x21e9f(%rip), %rdi     # 0x2a71c
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x11898(%rip), %rsi     # 0x1a129
movsd 0x1177f(%rip), %xmm0    # 0x1a018
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x21e6d(%rip)     # 0x2a718
leaq 0x11886(%rip), %rsi     # 0x1a138
leaq 0x13d10(%rip), %rdx     # 0x1c5c9
movq %rbx, %rdi
callq 0x8ff5
leaq 0x22654(%rip), %rdi     # 0x2af1c
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x1186e(%rip), %rsi     # 0x1a14a
movq %rbx, %rdi
movq %r14, %rdx
callq 0x8ff5
leaq 0x22e2e(%rip), %rdi     # 0x2b71c
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0x1185c(%rip), %rsi     # 0x1a15e
movsd 0x11716(%rip), %xmm0    # 0x1a020
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x23200(%rip)     # 0x2bb1c
leaq 0x1184e(%rip), %rsi     # 0x1a171
movsd 0x116fd(%rip), %xmm0    # 0x1a028
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x231e3(%rip)     # 0x2bb20
movq %rbx, %rdi
callq 0x8fd6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq