// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_utf_at
NK_API const char*
nk_utf_at(const char *buffer, int length, int index,
    nk_rune *unicode, int *len)
{
    int i = 0;
    int src_len = 0;
    int glyph_len = 0;
    const char *text;
    int text_len;

    NK_ASSERT(buffer);
    NK_ASSERT(unicode);
    NK_ASSERT(len);

    if (!buffer || !unicode || !len) return 0;
    if (index < 0) {
        *unicode = NK_UTF_INVALID;
        *len = 0;
        return 0;
    }

    text = buffer;
    text_len = length;
    glyph_len = nk_utf_decode(text, unicode, text_len);
    while (glyph_len) {
        if (i == index) {
            *len = glyph_len;
            break;
        }

        i++;
        src_len = src_len + glyph_len;
        glyph_len = nk_utf_decode(text + src_len, unicode, text_len - src_len);
    }
    if (i != index) return 0;
    return buffer + src_len;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movl %edx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %r8, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x2ed3e
movq 0x962de(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x82684(%rip), %rsi     # 0xb13a0
leaq 0x8269b(%rip), %rdx     # 0xb13be
movl $0x1ff3, %ecx           # imm = 0x1FF3
movb $0x0, %al
callq 0x13ec0
movq 0x962ba(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x2ed40
jmp 0x2ed42
cmpq $0x0, 0x28(%rsp)
jne 0x2ed7d
movq 0x9629f(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x82645(%rip), %rsi     # 0xb13a0
leaq 0x8265c(%rip), %rdx     # 0xb13be
movl $0x1ff4, %ecx           # imm = 0x1FF4
movb $0x0, %al
callq 0x13ec0
movq 0x9627b(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x2ed7f
jmp 0x2ed81
cmpq $0x0, 0x20(%rsp)
jne 0x2edbc
movq 0x96260(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x82606(%rip), %rsi     # 0xb13a0
leaq 0x8261d(%rip), %rdx     # 0xb13be
movl $0x1ff5, %ecx           # imm = 0x1FF5
movb $0x0, %al
callq 0x13ec0
movq 0x9623c(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x2edbe
cmpq $0x0, 0x38(%rsp)
je 0x2edd6
cmpq $0x0, 0x28(%rsp)
je 0x2edd6
cmpq $0x0, 0x20(%rsp)
jne 0x2ede4
movq $0x0, 0x40(%rsp)
jmp 0x2eeb9
cmpl $0x0, 0x30(%rsp)
jge 0x2ee0f
movq 0x28(%rsp), %rax
movl $0xfffd, (%rax)         # imm = 0xFFFD
movq 0x20(%rsp), %rax
movl $0x0, (%rax)
movq $0x0, 0x40(%rsp)
jmp 0x2eeb9
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x34(%rsp), %eax
movl %eax, 0x4(%rsp)
movq 0x8(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x4(%rsp), %edx
callq 0x14030
movl %eax, 0x14(%rsp)
cmpl $0x0, 0x14(%rsp)
je 0x2ee92
movl 0x1c(%rsp), %eax
cmpl 0x30(%rsp), %eax
jne 0x2ee56
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
jmp 0x2ee92
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x18(%rsp), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movslq 0x18(%rsp), %rax
addq %rax, %rdi
movq 0x28(%rsp), %rsi
movl 0x4(%rsp), %edx
subl 0x18(%rsp), %edx
callq 0x14030
movl %eax, 0x14(%rsp)
jmp 0x2ee38
movl 0x1c(%rsp), %eax
cmpl 0x30(%rsp), %eax
je 0x2eea7
movq $0x0, 0x40(%rsp)
jmp 0x2eeb9
movq 0x38(%rsp), %rax
movslq 0x18(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)