// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_textedit_redo
NK_API void
nk_textedit_redo(struct nk_text_edit *state)
{
    struct nk_text_undo_state *s = &state->undo;
    struct nk_text_undo_record *u, r;
    if (s->redo_point == NK_TEXTEDIT_UNDOSTATECOUNT)
        return;

    /* we need to do two things: apply the redo record, and create an undo record */
    u = &s->undo_rec[s->undo_point];
    r = s->undo_rec[s->redo_point];

    /* we KNOW there must be room for the undo record, because the redo record
    was derived from an undo record */
    u->delete_length = r.insert_length;
    u->insert_length = r.delete_length;
    u->where = r.where;
    u->char_storage = -1;

    if (r.delete_length) {
        /* the redo record requires us to delete characters, so the undo record
        needs to store the characters */
        if (s->undo_char_point + u->insert_length > s->redo_char_point) {
            u->insert_length = 0;
            u->delete_length = 0;
        } else {
            int i;
            u->char_storage = s->undo_char_point;
            s->undo_char_point = (short)(s->undo_char_point + u->insert_length);

            /* now save the characters */
            for (i=0; i < u->insert_length; ++i) {
                s->undo_char[u->char_storage + i] =
                    nk_str_rune_at(&state->string, u->where + i);
            }
        }
        nk_str_delete_runes(&state->string, r.where, r.delete_length);
    }

    if (r.insert_length) {
        /* easy case: need to insert n characters */
        nk_str_insert_text_runes(&state->string, r.where,
            &s->undo_char[r.char_storage], r.insert_length);
    }
    state->cursor = r.where + r.insert_length;

    s->undo_point++;
    s->redo_point++;
}

// Assembly:
movswq 0x1502(%rdi), %rcx
cmpq $0x63, %rcx
je 0x475d0
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movswq 0x1500(%rdi), %rax
imulq $0xc, %rax, %rax
imulq $0xc, %rcx, %rcx
movl 0xc0(%rdi,%rcx), %ebp
movswl 0xc4(%rdi,%rcx), %r14d
movswl 0xc6(%rdi,%rcx), %r15d
movswq 0xc8(%rdi,%rcx), %rcx
orw $-0x1, 0xc8(%rdi,%rax)
movw %r14w, 0xc6(%rdi,%rax)
movw %r15w, 0xc4(%rdi,%rax)
movl %ebp, 0xc0(%rdi,%rax)
testl %r15d, %r15d
je 0x4757d
movq %rcx, 0x10(%rsp)
movl %r14d, 0xc(%rsp)
leaq (%rbx,%rax), %r13
addq $0xc0, %r13
movswl 0x1504(%rbx), %eax
leal (%rax,%r15), %ecx
movswl 0x1506(%rbx), %edx
cmpl %edx, %ecx
jle 0x475d1
andl $0x0, 0x4(%r13)
leaq 0x18(%rbx), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x12e20
movl 0xc(%rsp), %r14d
movq 0x10(%rsp), %rcx
testw %r14w, %r14w
je 0x4759e
leaq 0x18(%rbx), %rdi
leaq (%rbx,%rcx,4), %rdx
addq $0x564, %rdx            # imm = 0x564
movl %ebp, %esi
movl %r14d, %ecx
callq 0x13c20
jmp 0x475a1
xorl %r14d, %r14d
addl %r14d, %ebp
movl %ebp, 0xa8(%rbx)
movd 0x1500(%rbx), %xmm0
pcmpeqd %xmm1, %xmm1
psubw %xmm1, %xmm0
movd %xmm0, 0x1500(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movw %ax, 0x8(%r13)
addl %r15d, %eax
movw %ax, 0x1504(%rbx)
leaq 0x18(%rbx), %r12
xorl %r14d, %r14d
movl %r15d, %eax
cwtl
cmpl %eax, %r14d
jge 0x47565
movl (%r13), %esi
addl %r14d, %esi
movq %r12, %rdi
callq 0x12a60
movswq 0x8(%r13), %rcx
addq %r14, %rcx
movl %eax, 0x564(%rbx,%rcx,4)
movzwl 0x4(%r13), %eax
incq %r14
jmp 0x475ea