// File: /workspace/github_cpp_makefile_star2_O1/Ciaxur[P]yagb-emu/include/imgui/imgui.cpp
// Function: ImGuiTextBuffer::append(char const*, char const*)
void ImGuiTextBuffer::append(const char* str, const char* str_end)
{
    int len = str_end ? (int)(str_end - str) : (int)strlen(str);

    // 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);
    memcpy(&Buf[write_off - 1], str, (size_t)len);
    Buf[write_off - 1 + len] = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testq %rdx, %rdx
je 0x43bcf
movq %rdx, %r14
subq %rsi, %r14
jmp 0x43be0
movq %rsi, %rdi
movq %rsi, %r14
callq 0xc350
movq %r14, %rsi
movq %rax, %r14
movl (%rbx), %r13d
movl 0x4(%rbx), %eax
cmpl $0x1, %r13d
adcl $0x0, %r13d
leal (%r14,%r13), %r12d
cmpl %eax, %r12d
jl 0x43c81
leal (%rax,%rax), %r15d
cmpl %r15d, %r12d
cmovgl %r12d, %r15d
cmpl %r15d, %eax
jge 0x43c81
movq %rsi, -0x38(%rbp)
movslq %r15d, %rdi
movq 0xba0b7(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43c24
incl 0x3b4(%rax)
movq 0xba0b5(%rip), %rsi     # 0xfdce0
callq *0xb58df(%rip)          # 0xf9510
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x43c75
movslq (%rbx), %rdx
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0xc080
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x43c64
movq 0xba077(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43c64
decl 0x3b4(%rax)
movq 0xba075(%rip), %rsi     # 0xfdce0
callq *0xb58a7(%rip)          # 0xf9518
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rbx)
movl %r15d, 0x4(%rbx)
movq -0x38(%rbp), %rsi
movl 0x4(%rbx), %eax
cmpl %r12d, %eax
jge 0x43d2b
testl %eax, %eax
je 0x43ca3
movl %eax, %r15d
shrl $0x1f, %r15d
addl %eax, %r15d
sarl %r15d
addl %eax, %r15d
jmp 0x43ca9
movl $0x8, %r15d
cmpl %r12d, %r15d
cmovlel %r12d, %r15d
cmpl %r15d, %eax
jge 0x43d2b
movq %rsi, -0x38(%rbp)
movslq %r15d, %rdi
movq 0xba00d(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43cce
incl 0x3b4(%rax)
movq 0xba00b(%rip), %rsi     # 0xfdce0
callq *0xb5835(%rip)          # 0xf9510
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0x43d1f
movslq (%rbx), %rdx
movq %rax, -0x30(%rbp)
movq %rax, %rdi
callq 0xc080
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x43d0e
movq 0xb9fcd(%rip), %rax     # 0xfdcd0
testq %rax, %rax
je 0x43d0e
decl 0x3b4(%rax)
movq 0xb9fcb(%rip), %rsi     # 0xfdce0
callq *0xb57fd(%rip)          # 0xf9518
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rbx)
movl %r15d, 0x4(%rbx)
movq -0x38(%rbp), %rsi
movl %r12d, (%rbx)
testl %r14d, %r14d
js 0x43d74
testl %r13d, %r13d
jle 0x43d74
decl %r13d
movq 0x8(%rbx), %rdi
addq %r13, %rdi
movl %r14d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
callq 0xc080
addl %r14d, %r13d
js 0x43d74
cmpl %r13d, (%rbx)
jle 0x43d74
movq 0x8(%rbx), %rax
movl %r13d, %ecx
movb $0x0, (%rax,%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x778fd(%rip), %rdi     # 0xbb678
leaq 0x77909(%rip), %rsi     # 0xbb68b
leaq 0x78a0f(%rip), %rcx     # 0xbc798
movl $0x65c, %edx            # imm = 0x65C
callq 0xc140
nop