// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x10, %rsp
callq 0x8a90
movq %rax, %rdi
callq 0x9370
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1593c(%rip), %rsi     # 0x24b40
xorps %xmm0, %xmm0
callq 0x97d0
cvttsd2si %xmm0, %eax
movl %eax, 0x7426a(%rip)     # 0x83480
movq -0x8(%rbp), %rdi
leaq 0x15936(%rip), %rsi     # 0x24b57
movsd 0x158f7(%rip), %xmm0    # 0x24b20
callq 0x97d0
cvttsd2si %xmm0, %rax
movq %rax, 0x7424e(%rip)     # 0x83488
movq -0x8(%rbp), %rdi
leaq 0x1592b(%rip), %rsi     # 0x24b70
movsd 0x158e3(%rip), %xmm0    # 0x24b30
callq 0x97d0
cvttsd2si %xmm0, %rax
movq %rax, 0x74232(%rip)     # 0x83490
movq -0x8(%rbp), %rdi
leaq 0x15920(%rip), %rsi     # 0x24b89
movsd 0x158b7(%rip), %xmm0    # 0x24b28
callq 0x97d0
cvttsd2si %xmm0, %rax
movq %rax, 0x74216(%rip)     # 0x83498
movq -0x8(%rbp), %rdi
leaq 0x15915(%rip), %rsi     # 0x24ba2
movsd 0x1588b(%rip), %xmm0    # 0x24b20
callq 0x97d0
cvttsd2si %xmm0, %rax
movq %rax, 0x741fa(%rip)     # 0x834a0
movq -0x8(%rbp), %rdi
leaq 0x1590a(%rip), %rsi     # 0x24bbb
xorps %xmm0, %xmm0
callq 0x97d0
cvttsd2si %xmm0, %rax
movq %rax, 0x745e3(%rip)     # 0x838a8
movq -0x8(%rbp), %rdi
leaq 0x15902(%rip), %rsi     # 0x24bd2
leaq 0x15914(%rip), %rdx     # 0x24beb
callq 0x9430
movq %rax, %rsi
leaq 0x7419a(%rip), %rdi     # 0x83480
addq $0x28, %rdi
movl $0x400, %edx            # imm = 0x400
callq 0x11bc0
leaq 0x741ad(%rip), %rdi     # 0x834a8
callq 0x8110
movq %rax, %rcx
movl $0x5, %eax
cmpq %rcx, %rax
jne 0xf32b
leaq 0x7416c(%rip), %rdi     # 0x83480
addq $0x28, %rdi
leaq 0x16b76(%rip), %rsi     # 0x25e95
movl $0x400, %edx            # imm = 0x400
callq 0x11aa0
jmp 0xf347
leaq 0x7414e(%rip), %rdi     # 0x83480
addq $0x28, %rdi
leaq 0x158b4(%rip), %rsi     # 0x24bf1
movl $0x400, %edx            # imm = 0x400
callq 0x11aa0
movq -0x8(%rbp), %rdi
leaq 0x158a6(%rip), %rsi     # 0x24bf8
movsd 0x157de(%rip), %xmm0    # 0x24b38
callq 0x97d0
cvttsd2si %xmm0, %eax
movl %eax, 0x7411b(%rip)     # 0x83484
movq -0x8(%rbp), %rdi
leaq 0x1589c(%rip), %rsi     # 0x24c10
leaq 0x158ae(%rip), %rdx     # 0x24c29
callq 0x9430
movq %rax, %rsi
leaq 0x740f6(%rip), %rdi     # 0x83480
addq $0x448, %rdi            # imm = 0x448
movl $0x400, %edx            # imm = 0x400
callq 0x11bc0
movq -0x8(%rbp), %rdi
leaq 0x158b0(%rip), %rsi     # 0x24c56
leaq 0x158c0(%rip), %rdx     # 0x24c6d
callq 0x9430
movq %rax, %rsi
leaq 0x740c4(%rip), %rdi     # 0x83480
addq $0x848, %rdi            # imm = 0x848
movl $0x400, %edx            # imm = 0x400
callq 0x11bc0
movq -0x8(%rbp), %rdi
callq 0x93f0
callq 0x150c0
movq %rax, 0x744ce(%rip)     # 0x838b0
callq 0x150c0
movq %rax, 0x744d2(%rip)     # 0x838c0
movq $0x0, 0x744bf(%rip) # 0x838b8
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)