// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/gc.c
// Function: janet_deinit_block
static void janet_deinit_block(JanetGCObject *mem) {
    switch (mem->flags & JANET_MEM_TYPEBITS) {
        default:
        case JANET_MEMORY_FUNCTION:
            break; /* Do nothing for non gc types */
        case JANET_MEMORY_SYMBOL:
            janet_symbol_deinit(((JanetStringHead *) mem)->data);
            break;
        case JANET_MEMORY_ARRAY:
        case JANET_MEMORY_ARRAY_WEAK:
            janet_free(((JanetArray *) mem)->data);
            break;
        case JANET_MEMORY_TABLE:
        case JANET_MEMORY_TABLE_WEAKK:
        case JANET_MEMORY_TABLE_WEAKV:
        case JANET_MEMORY_TABLE_WEAKKV:
            janet_free(((JanetTable *) mem)->data);
            break;
        case JANET_MEMORY_FIBER: {
            JanetFiber *f = (JanetFiber *)mem;
#ifdef JANET_EV
            if (f->ev_state && !(f->flags & JANET_FIBER_EV_FLAG_IN_FLIGHT)) {
                janet_ev_dec_refcount();
                janet_free(f->ev_state);
            }
#endif
            janet_free(f->data);
        }
        break;
        case JANET_MEMORY_BUFFER:
            janet_buffer_deinit((JanetBuffer *) mem);
            break;
        case JANET_MEMORY_ABSTRACT: {
            JanetAbstractHead *head = (JanetAbstractHead *)mem;
            if (head->type->gc) {
                janet_assert(!head->type->gc(head->data, head->size), "finalizer failed");
            }
        }
        break;
        case JANET_MEMORY_FUNCENV: {
            JanetFuncEnv *env = (JanetFuncEnv *)mem;
            if (0 == env->offset)
                janet_free(env->as.values);
        }
        break;
        case JANET_MEMORY_FUNCDEF: {
            JanetFuncDef *def = (JanetFuncDef *)mem;
            /* TODO - get this all with one alloc and one free */
            janet_free(def->defs);
            janet_free(def->environments);
            janet_free(def->constants);
            janet_free(def->bytecode);
            janet_free(def->sourcemap);
            janet_free(def->closure_bitset);
            janet_free(def->symbolmap);
        }
        break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzbl (%rdi), %eax
addl $-0x2, %eax
cmpl $0xf, %eax
ja 0x2b66c
movq %rdi, %rbx
leaq 0x32742(%rip), %rcx     # 0x5dcf0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rbx), %rdi
jmp 0x2b643
movq 0x18(%rbx), %rdi
jmp 0x2b643
cmpl $0x0, 0x1c(%rbx)
jne 0x2b66c
movq 0x10(%rbx), %rdi
jmp 0x2b643
addq $0x18, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x46f17
movq 0x20(%rbx), %rdi
callq 0x120b0
movq 0x10(%rbx), %rdi
callq 0x120b0
movq 0x18(%rbx), %rdi
callq 0x120b0
movq 0x28(%rbx), %rdi
callq 0x120b0
movq 0x38(%rbx), %rdi
callq 0x120b0
movq 0x30(%rbx), %rdi
callq 0x120b0
movq 0x50(%rbx), %rdi
jmp 0x2b643
cmpq $0x0, 0x60(%rbx)
je 0x2b63f
testb $0x1, 0x10(%rbx)
jne 0x2b63f
callq 0x223f8
movq 0x60(%rbx), %rdi
callq 0x120b0
movq 0x30(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x120b0
movq 0x10(%rbx), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x2b66c
movq 0x18(%rbx), %rsi
addq $0x20, %rbx
movq %rbx, %rdi
callq *%rax
testl %eax, %eax
jne 0x2b681
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x176e1
callq 0x13878