// File: /workspace/github_cpp_makefile_star2_O1/rurban[P]dgnlib/cpl_error.cpp
// Function: CPLDebug
void CPLDebug( const char * pszCategory, const char * pszFormat, ... )

{
    CPLErrorContext *psCtx = CPLGetErrorContext();
    char        *pszMessage;
    va_list     args;
    const char  *pszDebug = CPLGetConfigOption("CPL_DEBUG",NULL);

#define ERROR_MAX 25000

/* -------------------------------------------------------------------- */
/*      Does this message pass our current criteria?                    */
/* -------------------------------------------------------------------- */
    if( pszDebug == NULL )
        return;

    if( !EQUAL(pszDebug,"ON") && !EQUAL(pszDebug,"") )
    {
        int            i, nLen = strlen(pszCategory);

        for( i = 0; pszDebug[i] != '\0'; i++ )
        {
            if( EQUALN(pszCategory,pszDebug+i,nLen) )
                break;
        }

        if( pszDebug[i] == '\0' )
            return;
    }

/* -------------------------------------------------------------------- */
/*    Allocate a block for the error.                                   */
/* -------------------------------------------------------------------- */
    pszMessage = (char *) VSIMalloc( ERROR_MAX );
    if( pszMessage == NULL )
        return;
        
/* -------------------------------------------------------------------- */
/*      Dal -- always log a timestamp as the first part of the line     */
/*      to ensure one is looking at what one should be looking at!      */
/* -------------------------------------------------------------------- */

    pszMessage[0] = '\0';
#ifdef TIMESTAMP_DEBUG
    if( CPLGetConfigOption( "CPL_TIMESTAMP", NULL ) != NULL )
    {
        strcpy( pszMessage, VSICTime( VSITime(NULL) ) );
        
        // On windows anyway, ctime puts a \n at the end, but I'm not 
        // convinced this is standard behaviour, so we'll get rid of it
        // carefully

        if (pszMessage[strlen(pszMessage) -1 ] == '\n')
        {
            pszMessage[strlen(pszMessage) - 1] = 0; // blow it out
        }
        strcat( pszMessage, ": " );
    }
#endif

/* -------------------------------------------------------------------- */
/*      Add the category.                                               */
/* -------------------------------------------------------------------- */
    strcat( pszMessage, pszCategory );
    strcat( pszMessage, ": " );
    
/* -------------------------------------------------------------------- */
/*      Format the application provided portion of the debug message.   */
/* -------------------------------------------------------------------- */
    va_start(args, pszFormat);
#if defined(HAVE_VSNPRINTF)
    vsnprintf(pszMessage+strlen(pszMessage), ERROR_MAX - strlen(pszMessage), 
              pszFormat, args);
#else
    vsprintf(pszMessage+strlen(pszMessage), pszFormat, args);
#endif
    va_end(args);

/* -------------------------------------------------------------------- */
/*      Invoke the current error handler.                               */
/* -------------------------------------------------------------------- */
    if( psCtx->psHandlerStack != NULL )
    {
        psCtx->psHandlerStack->pfnHandler( CE_Debug, CPLE_None, pszMessage );
    }
    else
    {
        CPLMutexHolderD( &hErrorMutex );
        if( pfnErrorHandler != NULL )
            pfnErrorHandler( CE_Debug, CPLE_None, pszMessage );
    }

    VSIFree( pszMessage );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movq %rdx, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x68(%rsp)
testb %al, %al
je 0x4945
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
callq 0x488f
movq %rax, %r14
leaq 0xbbda(%rip), %rdi      # 0x1052e
xorl %esi, %esi
callq 0x38e7
testq %rax, %rax
je 0x4b29
movq %rax, %r12
leaq 0xc362(%rip), %rsi      # 0x10cd0
movq %rax, %rdi
callq 0x22f0
testl %eax, %eax
je 0x49e9
leaq 0xc633(%rip), %rsi      # 0x10fb4
movq %r12, %rdi
callq 0x22f0
testl %eax, %eax
je 0x49e9
cmpb $0x0, (%r12)
sete %bpl
je 0x4b29
movq %r15, %rdi
callq 0x2120
movslq %eax, %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x23c0
testl %eax, %eax
je 0x49e0
incq %r12
cmpb $0x0, (%r12)
sete %bpl
je 0x4b29
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x23c0
incq %r12
testl %eax, %eax
jne 0x49bc
testb %bpl, %bpl
jne 0x4b29
movl $0x61a8, %edi           # imm = 0x61A8
callq 0x7013
testq %rax, %rax
je 0x4b29
movq %rax, %r12
movb $0x0, (%rax)
leaq 0xbb2f(%rip), %rdi      # 0x10538
xorl %esi, %esi
callq 0x38e7
testq %rax, %rax
je 0x4a5a
xorl %edi, %edi
callq 0x7031
movq %rax, %rdi
callq 0x7046
movq %r12, %rdi
movq %rax, %rsi
callq 0x22b0
movq %r12, %rdi
callq 0x2120
cmpb $0xa, -0x1(%r12,%rax)
jne 0x4a45
movb $0x0, -0x1(%r12,%rax)
movq %r12, %rdi
callq 0x2120
movw $0x203a, (%r12,%rax)    # imm = 0x203A
movb $0x0, 0x2(%r12,%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x2520
movq %r12, %rdi
callq 0x2120
movw $0x203a, (%r12,%rax)    # imm = 0x203A
movb $0x0, 0x2(%r12,%rax)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
leaq 0x20(%rsp), %r15
movq %rax, (%r15)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%r15)
leaq 0x40(%rsp), %rax
movq %rax, 0x10(%r15)
movq %r12, %rdi
callq 0x2120
movq %r12, %rdi
addq %rax, %rdi
movl $0x61a8, %esi           # imm = 0x61A8
subq %rax, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x21a0
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x4ada
movl $0x1, %edi
xorl %esi, %esi
movq %r12, %rdx
callq *0x8(%rax)
jmp 0x4b21
leaq 0x1187f(%rip), %rsi     # 0x16360
leaq 0xba38(%rip), %rdx      # 0x10520
leaq 0x8(%rsp), %rdi
movsd 0xb723(%rip), %xmm0     # 0x10218
movl $0x15e, %ecx            # imm = 0x15E
callq 0x4f80
movq 0x117d2(%rip), %rax     # 0x162d8
testq %rax, %rax
je 0x4b17
movl $0x1, %edi
xorl %esi, %esi
movq %r12, %rdx
callq *%rax
leaq 0x8(%rsp), %rdi
callq 0x4f82
movq %r12, %rdi
callq 0x701d
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4f82
movq %rbx, %rdi
callq 0x2510