// File: /workspace/github_c_makefile_star2_O0/jiribenes[P]scheme/src/value.c
// Function: ptr_free
void ptr_free(vm_t *vm, ptrvalue_t *ptr) {
    if (ptr->type == T_STRING) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_CONS) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_SYMBOL) {
        symbol_t *ptr_sym = (symbol_t *) ptr;
        symbol_t *prev = NULL;
        symbol_t *s = vm->symbol_table;
        while (s != NULL) {
            if (s->len == ptr_sym->len &&
                memcmp(s->name, ptr_sym->name, s->len * sizeof(char)) == 0) {
                if (prev != NULL) {
                    prev->next = s->next;
                    vm->symbol_table = prev;
                } else {
                    vm->symbol_table = s->next;
                }
                break;
            }
            prev = s;
            s = s->next;
        }
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_PRIMITIVE) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_FUNCTION || ptr->type == T_MACRO) {
        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_VECTOR) {
        vector_t *vec = (vector_t *) ptr;

        vm_realloc(vm, vec->data, 0, 0);

        vec->data = NULL;
        vec->capacity = 0;
        vec->count = 0;

        vm_realloc(vm, ptr, 0, 0);
    } else if (ptr->type == T_ENV) {
        vm_realloc(vm, ptr, 0, 0);
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x63f3
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65f0
movq 0x28(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x6418
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65ee
movq 0x28(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x6505
movq 0x28(%rsp), %rax
movq %rax, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x64ea
movq 0x10(%rsp), %rax
movl 0x10(%rax), %eax
movq 0x20(%rsp), %rcx
cmpl 0x10(%rcx), %eax
jne 0x64cd
movq 0x10(%rsp), %rdi
addq $0x20, %rdi
movq 0x20(%rsp), %rsi
addq $0x20, %rsi
movq 0x10(%rsp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
shlq $0x0, %rdx
callq 0x10f0
cmpl $0x0, %eax
jne 0x64cd
cmpq $0x0, 0x18(%rsp)
je 0x64b9
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x18(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0x64cb
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x18(%rax)
jmp 0x64ea
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x6447
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65ec
movq 0x28(%rsp), %rax
cmpl $0x3, (%rax)
jne 0x652a
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65ea
movq 0x28(%rsp), %rax
cmpl $0x4, (%rax)
je 0x653e
movq 0x28(%rsp), %rax
cmpl $0x5, (%rax)
jne 0x6559
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65e8
movq 0x28(%rsp), %rax
cmpl $0x6, (%rax)
jne 0x65c4
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
movq 0x8(%rsp), %rax
movq $0x0, 0x18(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x10(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x14(%rax)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65e6
movq 0x28(%rsp), %rax
cmpl $0x7, (%rax)
jne 0x65e4
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x76b0
jmp 0x65e6
jmp 0x65e8
jmp 0x65ea
jmp 0x65ec
jmp 0x65ee
jmp 0x65f0
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)