// File: /workspace/github_c_makefile_star2_O3/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 0x4b457
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movswq 0x1500(%rdi), %rax
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rcx,2), %rcx
movl 0xc0(%rdi,%rcx,4), %ebp
movswl 0xc4(%rdi,%rcx,4), %r14d
movswl 0xc6(%rdi,%rcx,4), %esi
movswq 0xc8(%rdi,%rcx,4), %rcx
movw %r14w, 0xc6(%rdi,%rax,4)
movw %si, 0xc4(%rdi,%rax,4)
movl %ebp, 0xc0(%rdi,%rax,4)
movw $0xffff, 0xc8(%rdi,%rax,4) # imm = 0xFFFF
testl %esi, %esi
je 0x4b404
movq %rcx, 0x18(%rsp)
movl %r14d, 0x8(%rsp)
movl %ebp, 0xc(%rsp)
leaq (%rbx,%rax,4), %rbp
addq $0xc0, %rbp
movswl 0x1504(%rbx), %eax
leal (%rax,%rsi), %ecx
movswl 0x1506(%rbx), %edx
cmpl %edx, %ecx
movq %rsi, 0x10(%rsp)
jle 0x4b388
movl $0x0, 0x4(%rbp)
jmp 0x4b3e6
movw %ax, 0x8(%rbp)
addl %esi, %eax
movw %ax, 0x1504(%rbx)
testw %si, %si
jle 0x4b3e6
leaq 0x18(%rbx), %r12
xorl %r15d, %r15d
leaq 0x4(%rsp), %r13
leaq 0x24(%rsp), %r14
movl (%rbp), %esi
addl %r15d, %esi
movl $0x0, 0x4(%rsp)
movq %r12, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0x13f60
movl 0x4(%rsp), %eax
movswq 0x8(%rbp), %rcx
addq %r15, %rcx
movl %eax, 0x564(%rbx,%rcx,4)
movswl 0x4(%rbp), %eax
incq %r15
cmpl %eax, %r15d
jl 0x4b3ab
leaq 0x18(%rbx), %rdi
movl 0xc(%rsp), %ebp
movl %ebp, %esi
movq 0x10(%rsp), %rdx
callq 0x12d10
movl 0x8(%rsp), %r14d
movq 0x18(%rsp), %rcx
testw %r14w, %r14w
je 0x4b425
leaq 0x18(%rbx), %rdi
leaq (%rbx,%rcx,4), %rdx
addq $0x564, %rdx            # imm = 0x564
movl %ebp, %esi
movl %r14d, %ecx
callq 0x13a20
jmp 0x4b428
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 $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq