// File: rurban[P]dgnlib/cpl_error.cpp
// Function: CPLErrorV
void    CPLErrorV(CPLErr eErrClass, int err_no, const char *fmt, va_list args )
{
    CPLErrorContext *psCtx = CPLGetErrorContext();

/* -------------------------------------------------------------------- */
/*      Expand the error message                                        */
/* -------------------------------------------------------------------- */
#if defined(HAVE_VSNPRINTF)
    {
        int nPR;

        while( ((nPR = vsnprintf( psCtx->szLastErrMsg, 
                                 psCtx->nLastErrMsgMax, fmt, args )) == -1
                || nPR >= psCtx->nLastErrMsgMax-1)
               && psCtx->nLastErrMsgMax < 1000000 )
        {
            psCtx->nLastErrMsgMax *= 3;
            psCtx = (CPLErrorContext *) 
                CPLRealloc(psCtx, sizeof(CPLErrorContext) - DEFAULT_LAST_ERR_MSG_SIZE + psCtx->nLastErrMsgMax + 1);
            CPLSetTLS( CTLS_ERRORCONTEXT, psCtx, TRUE );
        }
    }
#else
    vsprintf( psCtx->szLastErrMsg, fmt, args);
#endif

/* -------------------------------------------------------------------- */
/*      If the user provided his own error handling function, then      */
/*      call it, otherwise print the error to stderr and return.        */
/* -------------------------------------------------------------------- */
    psCtx->nLastErrNo = err_no;
    psCtx->eLastErrType = eErrClass;

    if( CPLGetConfigOption("CPL_LOG_ERRORS",NULL) != NULL )
        CPLDebug( "CPLError", "%s", psCtx->szLastErrMsg );

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

    if( eErrClass == CE_Fatal )
        abort();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
callq 0x5990
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x14, %rdi
movq -0x20(%rbp), %rax
movslq 0x10(%rax), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x21a0
movl %eax, -0x24(%rbp)
cmpl $-0x1, %eax
je 0x583a
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl 0x10(%rax), %edx
subl $0x1, %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x4d(%rbp)
jl 0x584b
movq -0x20(%rbp), %rax
cmpl $0xf4240, 0x10(%rax)    # imm = 0xF4240
setl %al
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
testb $0x1, %al
jne 0x5854
jmp 0x5894
movq -0x20(%rbp), %rax
imull $0x3, 0x10(%rax), %ecx
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rax
movslq 0x10(%rax), %rsi
addq $0x14, %rsi
addq $0x1, %rsi
callq 0x3120
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
movl $0x5, %edi
movl $0x1, %edx
callq 0x6760
jmp 0x57ff
movl -0x8(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl -0x4(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
leaq 0x13c7a(%rip), %rdi     # 0x19528
xorl %eax, %eax
movl %eax, %esi
callq 0x40b0
cmpq $0x0, %rax
je 0x58da
movq -0x20(%rbp), %rdx
addq $0x14, %rdx
leaq 0x13c6b(%rip), %rdi     # 0x19537
leaq 0x13bf4(%rip), %rsi     # 0x194c7
movb $0x0, %al
callq 0x5a00
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5903
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq -0x20(%rbp), %rdx
addq $0x14, %rdx
callq *%rax
jmp 0x596c
leaq -0x40(%rbp), %rdi
leaq 0x19d52(%rip), %rsi     # 0x1f660
movsd 0x1390a(%rip), %xmm0    # 0x19220
leaq 0x13c23(%rip), %rdx     # 0x19540
movl $0xe5, %ecx
callq 0x6370
cmpq $0x0, 0x199a1(%rip)     # 0x1f2d0
je 0x5963
movq 0x19998(%rip), %rax     # 0x1f2d0
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq -0x20(%rbp), %rdx
addq $0x14, %rdx
callq *%rax
jmp 0x594a
jmp 0x5963
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x6390
jmp 0x597d
leaq -0x40(%rbp), %rdi
callq 0x6390
cmpl $0x4, -0x4(%rbp)
jne 0x5977
callq 0x2180
addq $0x50, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x24f0
nopw %cs:(%rax,%rax)