// File: /workspace/github_c_makefile_star2_O0/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
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x30(%rbp)
subl $0xf, %eax
ja 0x39ca5
movq -0x30(%rbp), %rax
leaq 0x51074(%rip), %rcx     # 0x8ad10
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x39ca7
jmp 0x39e32
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
callq 0x68930
jmp 0x39e32
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x120b0
jmp 0x39e32
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x120b0
jmp 0x39e32
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x39d16
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x39d16
callq 0x2a820
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x120b0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x120b0
jmp 0x39e32
movq -0x8(%rbp), %rdi
callq 0x18460
jmp 0x39e32
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x39da8
jmp 0x39d4f
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movq -0x18(%rbp), %rcx
movq 0x18(%rcx), %rsi
callq *%rax
cmpl $0x0, %eax
je 0x39da4
jmp 0x39d74
movq 0x76275(%rip), %rax     # 0xafff0
movq (%rax), %rdi
leaq 0x4728f(%rip), %rsi     # 0x81014
movl $0x15e, %edx            # imm = 0x15E
leaq 0x50fbf(%rip), %rcx     # 0x8ad50
leaq 0x50fc6(%rip), %r8      # 0x8ad5e
movb $0x0, %al
callq 0x125f0
callq 0x12100
jmp 0x39da6
jmp 0x39da8
jmp 0x39e32
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl 0x1c(%rcx), %eax
jne 0x39dcd
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x120b0
jmp 0x39e32
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x120b0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x120b0
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x120b0
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x120b0
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x120b0
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rdi
callq 0x120b0
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x120b0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)