// File: /workspace/github_c_makefile_star2_O3/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 0x1a44b
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 0x6518(%rip), %rdx      # 0x2097f
leaq 0x10(%rsp), %rdi
movl $0x1a, %esi
movq %rax, %rcx
callq 0x82f0
cmpq $0x0, 0x22a84f(%rip)    # 0x244cd0
jne 0x1a4a6
leaq 0x229736(%rip), %rdi    # 0x243bc0
leaq 0x3497(%rip), %rsi      # 0x1d928
callq 0x8320
movq %rax, 0x22a833(%rip)    # 0x244cd0
testq %rax, %rax
je 0x1a581
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 0x2297fc(%rip), %r15    # 0x243cd0
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rdx
callq 0x80c0
movq %r15, %rdi
callq 0x8120
testl %eax, %eax
jle 0x1a510
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movb (%rcx,%r15), %dl
andb $-0x2, %dl
cmpb $0xc, %dl
jne 0x1a508
movb $0x20, (%rcx,%r15)
incq %rcx
cmpq %rcx, %rax
jne 0x1a4f7
movq 0x22a7b9(%rip), %rdi    # 0x244cd0
testq %rdi, %rdi
je 0x1a573
cmpl %ebp, 0x2297a2(%rip)    # 0x243cc4
jl 0x1a573
leaq 0x43bf(%rip), %rsi      # 0x1e8ea
leaq 0x22979e(%rip), %r8     # 0x243cd0
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8250
movq 0x22a788(%rip), %rdi    # 0x244cd0
callq 0x82c0
cmpl $0x0, 0x22976c(%rip)    # 0x243cc0
je 0x1a573
leaq 0x438d(%rip), %rdi      # 0x1e8ea
leaq 0x22976c(%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 0x6409(%rip), %rdi      # 0x20991
leaq 0x229631(%rip), %rsi    # 0x243bc0
xorl %eax, %eax
callq 0x8180
movl $0x1, %edi
callq 0x8370