// File: /workspace/github_c_makefile_star2_O2/schroeder-lvb[P]sissm/src/log.c
// Function: logPrintf
void logPrintf( int logLevel, char *ident, const char * format, ... )
{
    time_t timer;
    char timeBuffer[26];
    struct tm* tm_info;
    static char buffer[LOG_MAXSTRINGSIZE];
    static FILE *fpw = NULL;
    int i, testEOL, bufLen;

    time( &timer );
    tm_info = localtime( &timer );
    strftime( timeBuffer, 26, "%Y-%m-%d %H:%M:%S", tm_info );

    if ( fpw == NULL ) 
        fpw = fopen( _logFileName, "at" );

    if ( fpw == NULL ) {
        printf( "Module log.c:  Logfile creation error, filename '%s'\n", _logFileName ); 
        exit( 1 );
    }

    va_list args;
    va_start( args, format );
    vsnprintf( buffer, LOG_MAXSTRINGSIZE, format, args );

    // If a there is a embedded \n or \r in the input string then 
    // replace it with <space> 
    // 
    if ( 0 != (bufLen = ( int ) strlen( buffer )) ) {
        for ( i = 0; i<bufLen; i++ ) {
            testEOL = buffer[i];
            if ( ( testEOL == 0x0d ) || ( testEOL == 0x0c ) ) {
                buffer[i] = 0x20;    
            }
        }
    }

    if ( fpw != NULL ) {
        if ( logLevel <= _logLevel ) { 
            fprintf( fpw, "%s::%s::%s\n", timeBuffer, ident, buffer );
            fflush( fpw );
            if ( _logEchoToConsole ) printf( "%s::%s::%s\n", timeBuffer, ident, buffer );
        }
    }
    va_end (args);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
movq %rcx, 0x68(%rsp)
movq %r8, 0x70(%rsp)
movq %r9, 0x78(%rsp)
testb %al, %al
je 0x19273
movaps %xmm0, 0x80(%rsp)
movaps %xmm1, 0x90(%rsp)
movaps %xmm2, 0xa0(%rsp)
movaps %xmm3, 0xb0(%rsp)
movaps %xmm4, 0xc0(%rsp)
movaps %xmm5, 0xd0(%rsp)
movaps %xmm6, 0xe0(%rsp)
movaps %xmm7, 0xf0(%rsp)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x82a0
movq %r15, %rdi
callq 0x8070
leaq 0x66b0(%rip), %rdx      # 0x1f93f
leaq 0x10(%rsp), %rdi
pushq $0x1a
popq %rsi
movq %rax, %rcx
callq 0x8300
cmpq $0x0, 0x22ba29(%rip)    # 0x244cd0
jne 0x192cc
leaq 0x22a910(%rip), %rdi    # 0x243bc0
leaq 0x3679(%rip), %rsi      # 0x1c930
callq 0x8330
movq %rax, 0x22ba0d(%rip)    # 0x244cd0
testq %rax, %rax
je 0x193a9
leaq 0x50(%rsp), %rax
leaq 0x30(%rsp), %rcx
movq %rax, 0x10(%rcx)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
leaq 0x22a9d6(%rip), %r15    # 0x243cd0
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rdx
callq 0x80c0
movq %r15, %rdi
callq 0x8120
testl %eax, %eax
je 0x19338
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
cmpq %rcx, %rax
je 0x19338
movb (%rcx,%r15), %dl
andb $-0x2, %dl
cmpb $0xc, %dl
jne 0x19333
movb $0x20, (%rcx,%r15)
incq %rcx
jmp 0x1931d
movq 0x22b991(%rip), %rdi    # 0x244cd0
testq %rdi, %rdi
je 0x1939b
cmpl %ebp, 0x22a97a(%rip)    # 0x243cc4
jl 0x1939b
leaq 0x4587(%rip), %rsi      # 0x1d8da
leaq 0x22a976(%rip), %r8     # 0x243cd0
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8250
movq 0x22b960(%rip), %rdi    # 0x244cd0
callq 0x82c0
cmpl $0x0, 0x22a944(%rip)    # 0x243cc0
je 0x1939b
leaq 0x4555(%rip), %rdi      # 0x1d8da
leaq 0x22a944(%rip), %rcx    # 0x243cd0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x8180
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x65a1(%rip), %rdi      # 0x1f951
leaq 0x22a809(%rip), %rsi    # 0x243bc0
xorl %eax, %eax
callq 0x8180
pushq $0x1
popq %rdi
callq 0x8380
nop