// File: /workspace/github_c_makefile_star2_O3/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 0x3994f
movq %rdi, %rbx
cmpl $0x0, 0x471c(%rdi)
je 0x39989
xorps %xmm0, %xmm0
movups %xmm0, 0x2560(%rbx)
movq 0x2550(%rbx), %rax
movq %rax, 0x2578(%rbx)
jmp 0x399bf
movq 0x4d69a(%rip), %rbx     # 0x86ff0
movq (%rbx), %rdi
leaq 0x3743c(%rip), %rsi     # 0x70d9c
leaq 0x37453(%rip), %rdx     # 0x70dba
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(%rbx), %rax
movq %rax, %rcx
subq 0x2560(%rbx), %rcx
addq %rcx, 0x2568(%rbx)
xorl %ecx, %ecx
cmpl $0x0, 0x2508(%rbx)
cmovneq %rax, %rcx
movq %rcx, 0x2560(%rbx)
movl $0x0, 0x2508(%rbx)
xorl %eax, %eax
movl %eax, 0x4718(%rbx)
movq $0x0, 0x2570(%rbx)
movl %eax, 0x2598(%rbx)
movq 0x170(%rbx), %rax
movq %rax, 0x1a8(%rbx)
leaq 0x46d8(%rbx), %r15
movq %r15, %r14
andq $0x3, %r14
je 0x39a33
movl $0x4, %r12d
subq %r14, %r12
movq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x12b50
xorps %xmm0, %xmm0
leaq (%r15,%r12), %rdi
addq $0x3c, %rdi
movups %xmm0, -0x3c(%rdi)
movups %xmm0, -0x2c(%rdi)
movups %xmm0, -0x1c(%rdi)
movups %xmm0, -0x10(%rdi)
xorl %esi, %esi
movq %r14, %rdx
callq 0x12b50
jmp 0x39a49
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r15)
movups %xmm0, 0x20(%r15)
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
movq 0x4768(%rbx), %r14
testq %r14, %r14
je 0x39c01
movl 0x48(%r14), %eax
movl %eax, %ecx
andl $0xc000, %ecx           # imm = 0xC000
cmpl $0x8000, %ecx           # imm = 0x8000
jne 0x39a7c
movl (%r14), %ecx
cmpl 0x4794(%rbx), %ecx
je 0x39bd0
testl $0x6000, %eax           # imm = 0x6000
je 0x39ab7
cmpq 0x4778(%rbx), %r14
jne 0x39ab7
movq 0x1d0(%r14), %rax
movq %rax, 0x4778(%rbx)
movq %rax, 0x4770(%rbx)
testq %rax, %rax
je 0x39aac
andb $-0x11, 0x49(%rax)
jmp 0x39ab7
movq $0x0, 0x4768(%rbx)
movq 0x120(%r14), %rsi
testq %rsi, %rsi
je 0x39ae0
movl (%rsi), %eax
cmpl 0x4794(%rbx), %eax
je 0x39ae0
movq %rbx, %rdi
callq 0x39c16
movq $0x0, 0x120(%r14)
movq 0x1b8(%r14), %rax
testq %rax, %rax
je 0x39bbe
movq %rax, %rbp
movq %rbp, %r15
movq 0x1e8(%rbp), %rbp
movl (%r15), %ecx
cmpl 0x4794(%rbx), %ecx
je 0x39bb5
cmpq %r15, %rax
jne 0x39b18
movq %rbp, 0x1b8(%r14)
movq 0x1f0(%r15), %rax
testq %rbp, %rbp
je 0x39b2b
movq %rax, 0x1f0(%rbp)
testq %rax, %rax
je 0x39b37
movq %rbp, 0x1e8(%rax)
leaq 0x1e8(%r15), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r15, %r12
andq $0x3, %r12
je 0x39b85
movl $0x4, %r13d
subq %r12, %r13
movq %r15, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0x12b50
leaq (%r15,%r13), %rdi
movl $0x1f4, %edx            # imm = 0x1F4
xorl %esi, %esi
callq 0x12b50
leaq (%r15,%r13), %rdi
addq $0x1f4, %rdi            # imm = 0x1F4
xorl %esi, %esi
movq %r12, %rdx
jmp 0x39b8f
movl $0x1f8, %edx            # imm = 0x1F8
movq %r15, %rdi
xorl %esi, %esi
callq 0x12b50
movq %rbx, %rdi
movq %r15, %rsi
callq 0x56ab8
movq 0x1b8(%r14), %rax
cmpq %rax, %r15
jne 0x39bb5
movq %rbp, 0x1b8(%r14)
movq %rbp, %rax
testq %rbp, %rbp
jne 0x39af3
movl (%r14), %eax
cmpl 0x4794(%rbx), %eax
jne 0x39bdc
testb $0x40, 0x49(%r14)
jne 0x39bdc
movq 0x1c8(%r14), %r14
jmp 0x39a50
movq 0x1c8(%r14), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x39cdf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x39c16
movq %r15, %r14
jmp 0x39a50
incl 0x4794(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq