// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3a087
movq %rdi, %r13
cmpl $0x0, 0x471c(%rdi)
je 0x3a0c1
leaq 0x2568(%r13), %rax
movq $0x0, 0x2560(%r13)
movq 0x2550(%r13), %rcx
movq %rcx, 0x2578(%r13)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x3a0f9
movq 0x4df62(%rip), %rbx     # 0x87ff0
movq (%rbx), %rdi
leaq 0x37cf4(%rip), %rsi     # 0x71d8c
leaq 0x37d0b(%rip), %rdx     # 0x71daa
movl $0x4ac6, %ecx           # imm = 0x4AC6
xorl %eax, %eax
callq 0x12d80
movq (%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x13780
movq 0x2510(%r13), %rax
movq %rax, %rcx
subq 0x2560(%r13), %rcx
addq %rcx, 0x2568(%r13)
xorl %ecx, %ecx
cmpl $0x0, 0x2508(%r13)
cmovneq %rax, %rcx
movq %rcx, 0x2560(%r13)
movl $0x0, 0x2508(%r13)
xorl %eax, %eax
movl %eax, 0x4718(%r13)
movq $0x0, 0x2570(%r13)
movl %eax, 0x2598(%r13)
movq 0x170(%r13), %rax
movq %rax, 0x1a8(%r13)
leaq 0x46d8(%r13), %r14
movq %r14, %r15
andq $0x3, %r15
je 0x3a151
movl $0x4, %r12d
subq %r15, %r12
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x12b50
orq $0x3c, %r15
addq %r12, %r14
jmp 0x3a157
movl $0x40, %r15d
movl %r15d, %r12d
andl $-0x4, %r12d
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x12b50
andq $0x3, %r15
je 0x3a181
addq %r12, %r14
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x12b50
movq 0x4768(%r13), %r14
testq %r14, %r14
je 0x3a35a
movl 0x48(%r14), %eax
movl %eax, %ecx
andl $0xc000, %ecx           # imm = 0xC000
cmpl $0x8000, %ecx           # imm = 0x8000
jne 0x3a1b5
movl (%r14), %ecx
cmpl 0x4794(%r13), %ecx
je 0x3a329
testl $0x6000, %eax           # imm = 0x6000
je 0x3a1f0
cmpq 0x4778(%r13), %r14
jne 0x3a1f0
movq 0x1d0(%r14), %rax
movq %rax, 0x4778(%r13)
movq %rax, 0x4770(%r13)
testq %rax, %rax
je 0x3a1e5
andb $-0x11, 0x49(%rax)
jmp 0x3a1f0
movq $0x0, 0x4768(%r13)
movq 0x120(%r14), %rsi
testq %rsi, %rsi
je 0x3a21a
movl (%rsi), %eax
cmpl 0x4794(%r13), %eax
je 0x3a21a
movq %r13, %rdi
callq 0x3a370
movq $0x0, 0x120(%r14)
movq 0x1b8(%r14), %rbx
testq %rbx, %rbx
je 0x3a316
movq %r14, (%rsp)
movq %rbx, %r15
movq 0x1e8(%rbx), %rbx
movl (%r15), %eax
cmpl 0x4794(%r13), %eax
je 0x3a30d
cmpq %r15, 0x1b8(%r14)
jne 0x3a258
movq %rbx, 0x1b8(%r14)
testq %rbx, %rbx
je 0x3a26b
movq 0x1f0(%r15), %rax
movq %rax, 0x1f0(%rbx)
movq 0x1f0(%r15), %rax
testq %rax, %rax
je 0x3a27e
movq %rbx, 0x1e8(%rax)
movq %r13, %r14
leaq 0x1e8(%r15), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r15, %r12
andq $0x3, %r12
je 0x3a2b9
movl $0x4, %r13d
subq %r12, %r13
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x12b50
orq $0x1f4, %r12            # imm = 0x1F4
addq %r15, %r13
jmp 0x3a2c2
movl $0x1f8, %r12d           # imm = 0x1F8
movq %r15, %r13
movl %r12d, %ebp
andl $-0x4, %ebp
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x12b50
andq $0x3, %r12
je 0x3a2eb
addq %rbp, %r13
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x12b50
movq %r14, %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x576ac
movq (%rsp), %r14
cmpq 0x1b8(%r14), %r15
jne 0x3a30d
movq %rbx, 0x1b8(%r14)
testq %rbx, %rbx
jne 0x3a22e
movl (%r14), %eax
cmpl 0x4794(%r13), %eax
jne 0x3a335
testb $0x40, 0x49(%r14)
jne 0x3a335
movq 0x1c8(%r14), %r14
jmp 0x3a188
movq 0x1c8(%r14), %rbx
movq %r13, %rdi
movq %r14, %rsi
callq 0x3a437
movq %r13, %rdi
movq %r14, %rsi
callq 0x3a370
movq %rbx, %r14
jmp 0x3a188
incl 0x4794(%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq