// File: /workspace/github_c_makefile_star2_O1/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 0x1a28f
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 0x66e4(%rip), %rdx      # 0x2098f
leaq 0x10(%rsp), %rdi
movl $0x1a, %esi
movq %rax, %rcx
callq 0x82f0
cmpq $0x0, 0x22aa0b(%rip)    # 0x244cd0
jne 0x1a2e1
leaq 0x2298f2(%rip), %rdi    # 0x243bc0
leaq 0x367b(%rip), %rsi      # 0x1d950
callq 0x8320
movq %rax, 0x22a9ef(%rip)    # 0x244cd0
cmpq $0x0, 0x22a9e7(%rip)    # 0x244cd0
je 0x1a3ca
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 0x2299b3(%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 0x1a359
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movb (%rcx,%r15), %dl
andb $-0x2, %dl
cmpb $0xc, %dl
jne 0x1a351
movb $0x20, (%rcx,%r15)
incq %rcx
cmpq %rcx, %rax
jne 0x1a340
movq 0x22a970(%rip), %rdi    # 0x244cd0
testq %rdi, %rdi
je 0x1a3bc
cmpl %ebp, 0x229959(%rip)    # 0x243cc4
jl 0x1a3bc
leaq 0x4586(%rip), %rsi      # 0x1e8fa
leaq 0x229955(%rip), %r8     # 0x243cd0
leaq 0x10(%rsp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x8250
movq 0x22a93f(%rip), %rdi    # 0x244cd0
callq 0x82c0
cmpl $0x0, 0x229923(%rip)    # 0x243cc0
je 0x1a3bc
leaq 0x4554(%rip), %rdi      # 0x1e8fa
leaq 0x229923(%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 0x65d0(%rip), %rdi      # 0x209a1
leaq 0x2297e8(%rip), %rsi    # 0x243bc0
xorl %eax, %eax
callq 0x8180
movl $0x1, %edi
callq 0x8370
nopl (%rax)