// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_str_at_rune
NK_API char*
nk_str_at_rune(struct nk_str *str, int pos, nk_rune *unicode, int *len)
{
    int i = 0;
    int src_len = 0;
    int glyph_len = 0;
    char *text;
    int text_len;

    NK_ASSERT(str);
    NK_ASSERT(unicode);
    NK_ASSERT(len);

    if (!str || !unicode || !len) return 0;
    if (pos < 0) {
        *unicode = 0;
        *len = 0;
        return 0;
    }

    text = (char*)str->buffer.memory.ptr;
    text_len = (int)str->buffer.allocated;
    glyph_len = nk_utf_decode(text, unicode, text_len);
    while (glyph_len) {
        if (i == pos) {
            *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 != pos) return 0;
    return text + src_len;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x30b6a
movq 0x944b2(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80858(%rip), %rsi     # 0xb13a0
leaq 0x8086f(%rip), %rdx     # 0xb13be
movl $0x226e, %ecx           # imm = 0x226E
movb $0x0, %al
callq 0x13ec0
movq 0x9448e(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30b6c
jmp 0x30b6e
cmpq $0x0, 0x28(%rsp)
jne 0x30ba9
movq 0x94473(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x80819(%rip), %rsi     # 0xb13a0
leaq 0x80830(%rip), %rdx     # 0xb13be
movl $0x226f, %ecx           # imm = 0x226F
movb $0x0, %al
callq 0x13ec0
movq 0x9444f(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30bab
jmp 0x30bad
cmpq $0x0, 0x20(%rsp)
jne 0x30be8
movq 0x94434(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
leaq 0x807da(%rip), %rsi     # 0xb13a0
leaq 0x807f1(%rip), %rdx     # 0xb13be
movl $0x2270, %ecx           # imm = 0x2270
movb $0x0, %al
callq 0x13ec0
movq 0x94410(%rip), %rax     # 0xc4ff0
movq (%rax), %rdi
callq 0x149a0
jmp 0x30bea
cmpq $0x0, 0x38(%rsp)
je 0x30c02
cmpq $0x0, 0x28(%rsp)
je 0x30c02
cmpq $0x0, 0x20(%rsp)
jne 0x30c10
movq $0x0, 0x40(%rsp)
jmp 0x30cee
cmpl $0x0, 0x34(%rsp)
jge 0x30c3b
movq 0x28(%rsp), %rax
movl $0x0, (%rax)
movq 0x20(%rsp), %rax
movl $0x0, (%rax)
movq $0x0, 0x40(%rsp)
jmp 0x30cee
movq 0x38(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rax
movq 0x58(%rax), %rax
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 0x30cc7
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jne 0x30c8b
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
jmp 0x30cc7
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 0x30c6d
movl 0x1c(%rsp), %eax
cmpl 0x34(%rsp), %eax
je 0x30cdc
movq $0x0, 0x40(%rsp)
jmp 0x30cee
movq 0x8(%rsp), %rax
movslq 0x18(%rsp), %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
nopl (%rax,%rax)