// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: nk_clear
NK_API void
nk_clear(struct nk_context *ctx)
{
    struct nk_window *iter;
    struct nk_window *next;
    NK_ASSERT(ctx);

    if (!ctx) return;
    if (ctx->use_pool)
        nk_buffer_clear(&ctx->memory);
    else nk_buffer_reset(&ctx->memory, NK_BUFFER_FRONT);

    ctx->build = 0;
    ctx->memory.calls = 0;
    ctx->last_widget_state = 0;
    ctx->style.cursor_active = ctx->style.cursors[NK_CURSOR_ARROW];
    NK_MEMSET(&ctx->overlay, 0, sizeof(ctx->overlay));

    /* garbage collector */
    iter = ctx->begin;
    while (iter) {
        /* make sure valid minimized windows do not get removed */
        if ((iter->flags & NK_WINDOW_MINIMIZED) &&
            !(iter->flags & NK_WINDOW_CLOSED) &&
            iter->seq == ctx->seq) {
            iter = iter->next;
            continue;
        }
        /* remove hotness from hidden or closed windows*/
        if (((iter->flags & NK_WINDOW_HIDDEN) ||
            (iter->flags & NK_WINDOW_CLOSED)) &&
            iter == ctx->active) {
            ctx->active = iter->prev;
            ctx->end = iter->prev;
            if (!ctx->end)
                ctx->begin = 0;
            if (ctx->active)
                ctx->active->flags &= ~(unsigned)NK_WINDOW_ROM;
        }
        /* free unused popup windows */
        if (iter->popup.win && iter->popup.win->seq != ctx->seq) {
            nk_free_window(ctx, iter->popup.win);
            iter->popup.win = 0;
        }
        /* remove unused window state tables */
        {struct nk_table *n, *it = iter->tables;
        while (it) {
            n = it->next;
            if (it->seq != ctx->seq) {
                nk_remove_table(iter, it);
                nk_zero(it, sizeof(union nk_page_data));
                nk_free_table(ctx, it);
                if (it == iter->tables)
                    iter->tables = n;
            } it = n;
        }}
        /* window itself is not used anymore so free */
        if (iter->seq != ctx->seq || iter->flags & NK_WINDOW_CLOSED) {
            next = iter->next;
            nk_remove_window(ctx, iter);
            nk_free_window(ctx, iter);
            iter = next;
        } else iter = iter->next;
    }
    ctx->seq++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3688e
movq %rdi, %rbx
cmpl $0x0, 0x471c(%rdi)
je 0x368c5
xorps %xmm0, %xmm0
movups %xmm0, 0x2560(%rbx)
movq 0x2550(%rbx), %rax
movq %rax, 0x2578(%rbx)
jmp 0x368d3
movq 0x4e75b(%rip), %rbx     # 0x84ff0
movq (%rbx), %rdi
leaq 0x3346d(%rip), %rsi     # 0x69d0c
leaq 0x33484(%rip), %rdx     # 0x69d2a
movl $0x4ac6, %ecx           # imm = 0x4AC6
xorl %eax, %eax
callq 0x12ea0
movq (%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x13960
leaq 0x2508(%rbx), %rdi
xorl %esi, %esi
callq 0x12850
andl $0x0, 0x4718(%rbx)
andq $0x0, 0x2570(%rbx)
andl $0x0, 0x2598(%rbx)
movq 0x170(%rbx), %rax
movq %rax, 0x1a8(%rbx)
leaq 0x46d8(%rbx), %rdi
pushq $0x40
popq %rsi
callq 0x338b1
movq 0x4768(%rbx), %r14
testq %r14, %r14
je 0x36a30
movl 0x48(%r14), %eax
movl %eax, %ecx
andl $0xc000, %ecx           # imm = 0xC000
cmpl $0x8000, %ecx           # imm = 0x8000
jne 0x36939
movl (%r14), %ecx
cmpl 0x4794(%rbx), %ecx
je 0x369ff
testw $0x6000, %ax            # imm = 0x6000
je 0x36970
cmpq 0x4778(%rbx), %r14
jne 0x36970
movq 0x1d0(%r14), %rax
movq %rax, 0x4778(%rbx)
movq %rax, 0x4770(%rbx)
testq %rax, %rax
je 0x36968
andb $-0x11, 0x49(%rax)
jmp 0x36970
andq $0x0, 0x4768(%rbx)
movq 0x120(%r14), %rsi
testq %rsi, %rsi
je 0x36996
movl (%rsi), %eax
cmpl 0x4794(%rbx), %eax
je 0x36996
movq %rbx, %rdi
callq 0x36a42
andq $0x0, 0x120(%r14)
movq 0x1b8(%r14), %r12
testq %r12, %r12
je 0x369ed
movq %r12, %r15
movq 0x1e8(%r12), %r12
movl (%r15), %eax
cmpl 0x4794(%rbx), %eax
je 0x3699d
movq %r14, %rdi
movq %r15, %rsi
callq 0x36acd
movl $0x1f8, %esi            # imm = 0x1F8
movq %r15, %rdi
callq 0x23ed0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x51795
cmpq 0x1b8(%r14), %r15
jne 0x3699d
movq %r12, 0x1b8(%r14)
jmp 0x3699d
movl (%r14), %eax
cmpl 0x4794(%rbx), %eax
jne 0x36a0b
testb $0x40, 0x49(%r14)
jne 0x36a0b
movq 0x1c8(%r14), %r14
jmp 0x3690d
movq 0x1c8(%r14), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x36b0e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x36a42
movq %r15, %r14
jmp 0x3690d
incl 0x4794(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq