// File: /workspace/github_c_makefile_star2_O0/inflex[P]ripMIME/pldstr.c
// Function: PLD_dprintf
char *PLD_dprintf(const char *format, ...)
{
    int n, size = 1024; // Assume we don't need more than 1K to start with
    char *p;
    va_list ap;

    // Attempt to allocate and then check
    p = malloc(size *sizeof(char));
    if (p == NULL) return NULL;

    while (1)
    {
        // Attempt to print out string out into the allocated space
        va_start(ap, format);
        n = vsnprintf (p, size, format, ap);
        va_end(ap);

        // If things went well, then return the new string
        if ((n > -1) && (n < size)) return p;

        // If things didn't go well, then we have to allocate more space
        //  based on which glibc we're using ( fortunately, the return codes
        //  tell us which glibc is being used! *phew*
        //
        // If n > -1, then we're being told precisely how much space we need
        // else (older glibc) we have to just guess again ...

        if (n > -1) size = n+1; // Allocate precisely what is needed
        else size *= 2;  // Double the amount allocated, note, we could just increase by 1K, but if we have a long string, we'd end up using a lot of realloc's

        // We could just realloc 'blind', but that'd be wrong and potentially cause a DoS, so
        //  instead, we'll be good and first attempt to realloc to a temp variable then, if all
        //  is well, we go ahead and update
        if (1)
        {
            char *tmp_p;

            tmp_p = realloc(p, size);
            if (tmp_p == NULL){ if (p != NULL) free(p); return NULL; }
            else p = tmp_p;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
testb %al, %al
je 0x1136e
movaps %xmm0, -0xd0(%rbp)
movaps %xmm1, -0xc0(%rbp)
movaps %xmm2, -0xb0(%rbp)
movaps %xmm3, -0xa0(%rbp)
movaps %xmm4, -0x90(%rbp)
movaps %xmm5, -0x80(%rbp)
movaps %xmm6, -0x70(%rbp)
movaps %xmm7, -0x60(%rbp)
movq %r9, -0xd8(%rbp)
movq %r8, -0xe0(%rbp)
movq %rcx, -0xe8(%rbp)
movq %rdx, -0xf0(%rbp)
movq %rsi, -0xf8(%rbp)
movq %rdi, -0x10(%rbp)
movl $0x400, -0x18(%rbp)     # imm = 0x400
movslq -0x18(%rbp), %rdi
shlq $0x0, %rdi
callq 0x2290
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x113c1
movq $0x0, -0x8(%rbp)
jmp 0x11473
jmp 0x113c3
leaq -0x40(%rbp), %rax
leaq -0x100(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq -0x20(%rbp), %rdi
movslq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0x20c0
movl %eax, -0x14(%rbp)
leaq -0x40(%rbp), %rax
cmpl $-0x1, -0x14(%rbp)
jle 0x1141b
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x1141b
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11473
cmpl $-0x1, -0x14(%rbp)
jle 0x1142c
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x11434
movl -0x18(%rbp), %eax
shll %eax
movl %eax, -0x18(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x18(%rbp), %rsi
callq 0x2300
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x11466
cmpq $0x0, -0x20(%rbp)
je 0x1145c
movq -0x20(%rbp), %rdi
callq 0x2030
movq $0x0, -0x8(%rbp)
jmp 0x11473
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x113c3
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq