// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGuiTextBuffer::appendfv(char const*, __va_list_tag*)
void ImGuiTextBuffer::appendfv(const char* fmt, va_list args)
{
    va_list args_copy;
    va_copy(args_copy, args);

    int len = ImFormatStringV(NULL, 0, fmt, args);         // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.
    if (len <= 0)
    {
        va_end(args_copy);
        return;
    }

    // Add zero-terminator the first time
    const int write_off = (Buf.Size != 0) ? Buf.Size : 1;
    const int needed_sz = write_off + len;
    if (write_off + len >= Buf.Capacity)
    {
        int new_capacity = Buf.Capacity * 2;
        Buf.reserve(needed_sz > new_capacity ? needed_sz : new_capacity);
    }

    Buf.resize(needed_sz);
    ImFormatStringV(&Buf[write_off - 1], (size_t)len + 1, fmt, args_copy);
    va_end(args_copy);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rcx
movq %rsi, %rbx
movq %rdi, %r15
movq 0x10(%rdx), %rax
movq %rax, -0x40(%rbp)
movups (%rdx), %xmm0
movaps %xmm0, -0x50(%rbp)
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0xc5c0
testl %eax, %eax
jle 0x43fc3
movl %eax, %r14d
movq %rbx, -0x38(%rbp)
movl (%r15), %r13d
movl 0x4(%r15), %eax
cmpl $0x1, %r13d
adcl $0x0, %r13d
leal (%r14,%r13), %r12d
cmpl %eax, %r12d
jl 0x43ee4
leal (%rax,%rax), %ebx
cmpl %ebx, %r12d
cmovgl %r12d, %ebx
cmpl %ebx, %eax
jge 0x43ee4
movslq %ebx, %rdi
movq 0xb9e50(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43e8b
incl 0x3b4(%rax)
movq 0xb9e4e(%rip), %rsi     # 0xfdce0
callq *0xb5678(%rip)          # 0xf9510
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x43edc
movslq (%r15), %rdx
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0xc080
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x43ecb
movq 0xb9e10(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43ecb
decl 0x3b4(%rax)
movq 0xb9e0e(%rip), %rsi     # 0xfdce0
callq *0xb5640(%rip)          # 0xf9518
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
movl %ebx, 0x4(%r15)
movl 0x4(%r15), %eax
cmpl %r12d, %eax
jge 0x43f80
testl %eax, %eax
je 0x43f02
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
addl %eax, %ebx
jmp 0x43f07
movl $0x8, %ebx
cmpl %r12d, %ebx
cmovlel %r12d, %ebx
cmpl %ebx, %eax
jge 0x43f80
movslq %ebx, %rdi
movq 0xb9db4(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43f27
incl 0x3b4(%rax)
movq 0xb9db2(%rip), %rsi     # 0xfdce0
callq *0xb55dc(%rip)          # 0xf9510
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x43f78
movslq (%r15), %rdx
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0xc080
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x43f67
movq 0xb9d74(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43f67
decl 0x3b4(%rax)
movq 0xb9d72(%rip), %rsi     # 0xfdce0
callq *0xb55a4(%rip)          # 0xf9518
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r15)
movl %ebx, 0x4(%r15)
movl %r12d, (%r15)
testl %r13d, %r13d
jle 0x43fd2
movl %r13d, %ebx
addq 0x8(%r15), %rbx
leal 0x1(%r14), %r15d
leaq -0x1(%rbx), %rdi
leaq -0x50(%rbp), %rcx
movq %r15, %rsi
movq -0x38(%rbp), %rdx
callq 0xc5c0
decq %rbx
je 0x43fc3
cmpl %r15d, %eax
movl %r14d, %ecx
cmovll %eax, %ecx
cmpl $-0x1, %eax
cmovel %r14d, %ecx
movslq %ecx, %rax
movb $0x0, (%rbx,%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7769f(%rip), %rdi     # 0xbb678
leaq 0x776ab(%rip), %rsi     # 0xbb68b
leaq 0x787b1(%rip), %rcx     # 0xbc798
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140