// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_str_insert_at_char
NK_API int
nk_str_insert_at_char(struct nk_str *s, int pos, const char *str, int len)
{
    int i;
    void *mem;
    char *src;
    char *dst;

    int copylen;
    NK_ASSERT(s);
    NK_ASSERT(str);
    NK_ASSERT(len >= 0);
    if (!s || !str || !len || (nk_size)pos > s->buffer.allocated) return 0;
    if ((s->buffer.allocated + (nk_size)len >= s->buffer.memory.size) &&
        (s->buffer.type == NK_BUFFER_FIXED)) return 0;

    copylen = (int)s->buffer.allocated - pos;
    if (!copylen) {
        nk_str_append_text_char(s, str, len);
        return 1;
    }
    mem = nk_buffer_alloc(&s->buffer, NK_BUFFER_FRONT, (nk_size)len * sizeof(char), 0);
    if (!mem) return 0;

    /* memmove */
    NK_ASSERT(((int)pos + (int)len + ((int)copylen - 1)) >= 0);
    NK_ASSERT(((int)pos + ((int)copylen - 1)) >= 0);
    dst = nk_ptr_add(char, s->buffer.memory.ptr, pos + len + (copylen - 1));
    src = nk_ptr_add(char, s->buffer.memory.ptr, pos + (copylen-1));
    for (i = 0; i < copylen; ++i) *dst-- = *src--;
    mem = nk_ptr_add(void, s->buffer.memory.ptr, pos);
    NK_MEMCPY(mem, str, (nk_size)len * sizeof(char));
    s->len = nk_utf_len((char *)s->buffer.memory.ptr, (int)s->buffer.allocated);
    return 1;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movl %ecx, 0x24(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x30691
movq 0x9498b(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80d31(%rip), %rsi     # 0xb13a0
leaq 0x80d48(%rip), %rdx     # 0xb13be
movl $0x219f, %ecx           # imm = 0x219F
movb $0x0, %al
callq 0x13ec0
movq 0x94967(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30693
jmp 0x30695
cmpq $0x0, 0x28(%rsp)
jne 0x306d0
movq 0x9494c(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80cf2(%rip), %rsi     # 0xb13a0
leaq 0x80d09(%rip), %rdx     # 0xb13be
movl $0x21a0, %ecx           # imm = 0x21A0
movb $0x0, %al
callq 0x13ec0
movq 0x94928(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x306d2
jmp 0x306d4
cmpl $0x0, 0x24(%rsp)
jge 0x3070e
movq 0x9490e(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80cb4(%rip), %rsi     # 0xb13a0
leaq 0x80ccb(%rip), %rdx     # 0xb13be
movl $0x21a1, %ecx           # imm = 0x21A1
movb $0x0, %al
callq 0x13ec0
movq 0x948ea(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30710
cmpq $0x0, 0x38(%rsp)
je 0x30737
cmpq $0x0, 0x28(%rsp)
je 0x30737
cmpl $0x0, 0x24(%rsp)
je 0x30737
movslq 0x34(%rsp), %rax
movq 0x38(%rsp), %rcx
cmpq 0x58(%rcx), %rax
jbe 0x30744
movl $0x0, 0x44(%rsp)
jmp 0x3095d
movq 0x38(%rsp), %rax
movq 0x58(%rax), %rax
movslq 0x24(%rsp), %rcx
addq %rcx, %rax
movq 0x38(%rsp), %rcx
cmpq 0x48(%rcx), %rax
jb 0x30778
movq 0x38(%rsp), %rax
cmpl $0x0, 0x38(%rax)
jne 0x30778
movl $0x0, 0x44(%rsp)
jmp 0x3095d
movq 0x38(%rsp), %rax
movq 0x58(%rax), %rax
subl 0x34(%rsp), %eax
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jne 0x307b0
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x24(%rsp), %edx
callq 0x14820
movl $0x1, 0x44(%rsp)
jmp 0x3095d
movq 0x38(%rsp), %rdi
movslq 0x24(%rsp), %rdx
shlq $0x0, %rdx
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %ecx
callq 0x2f2e0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x307e3
movl $0x0, 0x44(%rsp)
jmp 0x3095d
jmp 0x307e5
movl 0x34(%rsp), %eax
addl 0x24(%rsp), %eax
movl 0x4(%rsp), %ecx
subl $0x1, %ecx
addl %ecx, %eax
cmpl $0x0, %eax
jge 0x3082e
movq 0x947ee(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80b94(%rip), %rsi     # 0xb13a0
leaq 0x80bab(%rip), %rdx     # 0xb13be
movl $0x21af, %ecx           # imm = 0x21AF
movb $0x0, %al
callq 0x13ec0
movq 0x947ca(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30830
jmp 0x30832
movl 0x34(%rsp), %eax
movl 0x4(%rsp), %ecx
subl $0x1, %ecx
addl %ecx, %eax
cmpl $0x0, %eax
jge 0x30877
movq 0x947a5(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80b4b(%rip), %rsi     # 0xb13a0
leaq 0x80b62(%rip), %rdx     # 0xb13be
movl $0x21b0, %ecx           # imm = 0x21B0
movb $0x0, %al
callq 0x13ec0
movq 0x94781(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30879
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rax
movl 0x34(%rsp), %ecx
addl 0x24(%rsp), %ecx
movl 0x4(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rax
movl 0x34(%rsp), %ecx
movl 0x4(%rsp), %edx
subl $0x1, %edx
addl %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x4(%rsp), %eax
jge 0x30904
movq 0x10(%rsp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rsp)
movb (%rax), %cl
movq 0x8(%rsp), %rax
movq %rax, %rdx
addq $-0x1, %rdx
movq %rdx, 0x8(%rsp)
movb %cl, (%rax)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x308c7
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rax
movslq 0x34(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq 0x28(%rsp), %rsi
movslq 0x24(%rsp), %rdx
shlq $0x0, %rdx
callq 0x2f750
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x38(%rsp), %rax
movq 0x58(%rax), %rax
movl %eax, %esi
callq 0x137e0
movl %eax, %ecx
movq 0x38(%rsp), %rax
movl %ecx, 0x78(%rax)
movl $0x1, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)