// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/pirebooter.c
// Function: pirebooterInitConfig
int pirebooterInitConfig( void )
{
    cfsPtr cP;

    cP = cfsCreate( sissmGetConfigPath() );

    // read "pirebooter.pluginstate" variable from the .cfg file
    pirebooterConfig.pluginState = (int) cfsFetchNum( cP, "pirebooter.pluginState", 0.0 );  // disabled by default
    pirebooterConfig.rebootIdleSec = (long int) cfsFetchNum( cP, "pirebooter.rebootidlesec", (double)   20*60 );
    pirebooterConfig.rebootBusySec = (long int) cfsFetchNum( cP, "pirebooter.rebootbusysec", (double) 5*60*60 );
    pirebooterConfig.rebootDeadSec = (long int) cfsFetchNum( cP, "pirebooter.rebootdeadsec", (double)    5*60 );
    pirebooterConfig.rebootHungSec = (long int) cfsFetchNum( cP, "pirebooter.reboothungsec", (double)   20*60 );

    pirebooterConfig.rebootOnEOR   = (long int) cfsFetchNum( cP, "pirebooter.rebootoneor",   (double)       0 );

    // read the daily reboot time, e.g., "19:03".  Add colon "19:03:" so that it can be pattern
    // checked quickly against HH:MM:SS system clockstring and not get mistaken for MM:SS check.
    //
    strlcpy( pirebooterConfig.rebootDailyHM, cfsFetchStr( cP, "pirebooter.rebootDailyHM", "99:99"), CFS_FETCH_MAX );
    if ( 5 == strlen( pirebooterConfig.rebootDailyHM )) 
        strlcat( pirebooterConfig.rebootDailyHM, ":", CFS_FETCH_MAX );
    else
        strlcat( pirebooterConfig.rebootDailyHM, "99:99:", CFS_FETCH_MAX );

    pirebooterConfig.logUpdateSec  = (int)      cfsFetchNum( cP, "pirebooter.logUpdateSec",  (double)      60 );

    strlcpy( pirebooterConfig.rebootWarning, 
        cfsFetchStr( cP, "pirebooter.rebootWarning", "Server restart at end of round - up in 60sec" ), CFS_FETCH_MAX);
    strlcpy( pirebooterConfig.rebootDaily, 
        cfsFetchStr( cP, "pirebooter.rebootDaily", "** Server will reboot shortly - up in 60sec" ), CFS_FETCH_MAX);

    cfsDestroy( cP );
    
    pirebooterConfig.timeLastReboot = apiTimeGet();
    pirebooterConfig.timeLastProgress = apiTimeGet();
    pirebooterConfig.timeFirstIdle  = 0;

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x8973
movq %rax, %rdi
callq 0x8f80
movq %rax, %rbx
leaq 0xedc1(%rip), %rsi      # 0x1bb18
xorpd %xmm0, %xmm0
movq %rax, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6e713(%rip)     # 0x7b480
leaq 0xedbb(%rip), %rsi      # 0x1bb2f
movsd 0xed7c(%rip), %xmm0     # 0x1baf8
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %rax
movq %rax, 0x6e6f8(%rip)     # 0x7b488
leaq 0xedb1(%rip), %rsi      # 0x1bb48
movsd 0xed61(%rip), %xmm0     # 0x1bb00
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %rax
movq %rax, 0x6e6dd(%rip)     # 0x7b490
leaq 0xeda7(%rip), %rsi      # 0x1bb61
movsd 0xed46(%rip), %xmm0     # 0x1bb08
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %rax
movq %rax, 0x6e6c2(%rip)     # 0x7b498
leaq 0xed9d(%rip), %rsi      # 0x1bb7a
movq %rbx, %rdi
movsd 0xed10(%rip), %xmm0     # 0x1baf8
callq 0x91bd
cvttsd2si %xmm0, %rax
movq %rax, 0x6e6a7(%rip)     # 0x7b4a0
leaq 0xed93(%rip), %rsi      # 0x1bb93
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %rax
movq %rax, 0x6ea90(%rip)     # 0x7b8a8
leaq 0xed8b(%rip), %rsi      # 0x1bbaa
leaq 0xed9d(%rip), %rdx      # 0x1bbc3
movq %rbx, %rdi
callq 0x8ff5
leaq 0x6e673(%rip), %r14     # 0x7b4a8
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rax, %rsi
callq 0xe97a
movq %r14, %rdi
callq 0x8120
cmpq $0x5, %rax
leaq 0x10015(%rip), %rax     # 0x1ce6d
leaq 0xed6a(%rip), %rsi      # 0x1bbc9
cmoveq %rax, %rsi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
callq 0xe918
leaq 0xed59(%rip), %rsi      # 0x1bbd0
movsd 0xec91(%rip), %xmm0     # 0x1bb10
movq %rbx, %rdi
callq 0x91bd
cvttsd2si %xmm0, %eax
movl %eax, 0x6e5f3(%rip)     # 0x7b484
leaq 0xed50(%rip), %rsi      # 0x1bbe8
leaq 0xed62(%rip), %rdx      # 0x1bc01
movq %rbx, %rdi
callq 0x8ff5
leaq 0x6ea1a(%rip), %rdi     # 0x7b8c8
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
leaq 0xed6c(%rip), %rsi      # 0x1bc2e
leaq 0xed7c(%rip), %rdx      # 0x1bc45
movq %rbx, %rdi
callq 0x8ff5
leaq 0x6edf0(%rip), %rdi     # 0x7bcc8
movl $0x400, %edx            # imm = 0x400
movq %rax, %rsi
callq 0xe97a
movq %rbx, %rdi
callq 0x8fd6
callq 0x10b6a
movq %rax, 0x6e9b7(%rip)     # 0x7b8b0
callq 0x10b6a
movq %rax, 0x6e9bb(%rip)     # 0x7b8c0
andq $0x0, 0x6e9ab(%rip)     # 0x7b8b8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq