// File: /workspace/github_c_makefile_star2_O0/janet-lang[P]janet/src/core/gc.c
// Function: janet_clear_memory
void janet_clear_memory(void) {
#ifdef JANET_EV
    JanetKV *items = janet_vm.threaded_abstracts.data;
    for (int32_t i = 0; i < janet_vm.threaded_abstracts.capacity; i++) {
        if (janet_checktype(items[i].key, JANET_ABSTRACT)) {
            void *abst = janet_unwrap_abstract(items[i].key);
            if (0 == janet_abstract_decref(abst)) {
                JanetAbstractHead *head = janet_abstract_head(abst);
                if (head->type->gc) {
                    janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
                }
                janet_free(janet_abstract_head(abst));
            }
        }
    }
#endif
    JanetGCObject *current = janet_vm.blocks;
    while (NULL != current) {
        janet_deinit_block(current);
        JanetGCObject *next = current->data.next;
        janet_free(current);
        current = next;
    }
    janet_vm.blocks = NULL;
    janet_free_all_scratch();
    janet_free(janet_vm.scratch_mem);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x288(%rax), %rax
movq %rax, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x34(%rbp)
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq %rax, %rcx
movl -0x34(%rbp), %eax
cmpl 0x27c(%rcx), %eax
jge 0x3a783
xorl %eax, %eax
testb $0x1, %al
jne 0x3a64a
jmp 0x3a68f
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd (%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x3a66a
jmp 0x3a6be
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
shrq $0x2f, %rax
andq $0xf, %rax
cmpq $0x0, %rax
je 0x3a6be
jmp 0x3a773
movq -0x8(%rbp), %rcx
movslq -0xc(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rcx
movabsq $-0x800000000000, %rax  # imm = 0xFFFF800000000000
andq (%rcx), %rax
movabsq $-0x1000000000000, %rcx # imm = 0xFFFF000000000000
cmpq %rcx, %rax
jne 0x3a773
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x7b260
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x13150
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x3a771
movq -0x18(%rbp), %rax
addq $-0x20, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x3a764
jmp 0x3a70b
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rsi
callq *%rax
cmpl $0x0, %eax
je 0x3a760
jmp 0x3a730
movq 0x758b9(%rip), %rax     # 0xafff0
movq (%rax), %rdi
leaq 0x468d3(%rip), %rsi     # 0x81014
movl $0x2a6, %edx            # imm = 0x2A6
leaq 0x50603(%rip), %rcx     # 0x8ad50
leaq 0x5060a(%rip), %r8      # 0x8ad5e
movb $0x0, %al
callq 0x125f0
callq 0x12100
jmp 0x3a762
jmp 0x3a764
movq -0x18(%rbp), %rdi
addq $-0x20, %rdi
callq 0x120b0
jmp 0x3a773
jmp 0x3a775
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x3a61a
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0x90(%rax), %rax
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
je 0x3a7ce
movq -0x28(%rbp), %rdi
callq 0x39c70
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x120b0
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x3a79e
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq $0x0, 0x90(%rax)
callq 0x3a230
movq %fs:0x0, %rax
leaq -0x348(%rax), %rax
movq 0xd8(%rax), %rdi
callq 0x120b0
addq $0x40, %rsp
popq %rbp
retq