// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
testb %al, %al
je 0x21c34
movaps %xmm0, -0xf0(%rbp)
movaps %xmm1, -0xe0(%rbp)
movaps %xmm2, -0xd0(%rbp)
movaps %xmm3, -0xc0(%rbp)
movaps %xmm4, -0xb0(%rbp)
movaps %xmm5, -0xa0(%rbp)
movaps %xmm6, -0x90(%rbp)
movaps %xmm7, -0x80(%rbp)
movq %r9, -0xf8(%rbp)
movq %r8, -0x100(%rbp)
movq %rcx, -0x108(%rbp)
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x8280
leaq -0x20(%rbp), %rdi
callq 0x8050
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rcx
movl $0x1a, %esi
leaq 0x6cf9(%rip), %rdx      # 0x28977
callq 0x82e0
cmpq $0x0, 0x22b045(%rip)    # 0x24ccd0
jne 0x21ca7
leaq 0x229f2c(%rip), %rdi    # 0x24bbc0
leaq 0x3cb5(%rip), %rsi      # 0x25950
callq 0x8310
movq %rax, 0x22b029(%rip)    # 0x24ccd0
cmpq $0x0, 0x22b021(%rip)    # 0x24ccd0
jne 0x21cd0
leaq 0x6cd1(%rip), %rdi      # 0x28989
leaq 0x229f01(%rip), %rsi    # 0x24bbc0
movb $0x0, %al
callq 0x8170
movl $0x1, %edi
callq 0x8360
leaq -0x70(%rbp), %rax
leaq -0x120(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x18, (%rax)
movq -0x18(%rbp), %rdx
leaq -0x70(%rbp), %rcx
leaq 0x229fcd(%rip), %rdi    # 0x24bcd0
movl $0x1000, %esi           # imm = 0x1000
callq 0x80b0
leaq 0x229fbc(%rip), %rdi    # 0x24bcd0
callq 0x8110
movl %eax, %ecx
movl %ecx, -0x54(%rbp)
xorl %eax, %eax
cmpl %ecx, %eax
je 0x21d6f
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jge 0x21d6d
movslq -0x4c(%rbp), %rcx
leaq 0x229f92(%rip), %rax    # 0x24bcd0
movsbl (%rax,%rcx), %eax
movl %eax, -0x50(%rbp)
cmpl $0xd, -0x50(%rbp)
je 0x21d51
cmpl $0xc, -0x50(%rbp)
jne 0x21d60
movslq -0x4c(%rbp), %rcx
leaq 0x229f74(%rip), %rax    # 0x24bcd0
movb $0x20, (%rax,%rcx)
jmp 0x21d62
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x21d2b
jmp 0x21d6f
cmpq $0x0, 0x22af59(%rip)    # 0x24ccd0
je 0x21dde
movl -0x4(%rbp), %eax
cmpl 0x229f42(%rip), %eax    # 0x24bcc4
jg 0x21ddc
movq 0x22af45(%rip), %rdi    # 0x24ccd0
leaq -0x40(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0x4b74(%rip), %rsi      # 0x2690e
leaq 0x229f2f(%rip), %r8     # 0x24bcd0
movb $0x0, %al
callq 0x8230
movq 0x22af21(%rip), %rdi    # 0x24ccd0
callq 0x82b0
cmpl $0x0, 0x229f05(%rip)    # 0x24bcc0
je 0x21dda
leaq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x4b42(%rip), %rdi      # 0x2690e
leaq 0x229efd(%rip), %rcx    # 0x24bcd0
movb $0x0, %al
callq 0x8170
jmp 0x21ddc
jmp 0x21dde
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw (%rax,%rax)