// File: /workspace/github_c_makefile_star2_O1/neosploit[P]compiler/ast_free.c
// Function: ast_definition_free
static void ast_definition_free(Definition* definition) {

    if (definition->next) ast_definition_free(definition->next);

    switch (definition->tag) {
        case DEFINITION_PROGRAM:
            ast_id_free(definition->program.id);

            break;
        case DEFINITION_CONSTANT:
            ast_id_free(definition->constant.id);
            ast_expression_free(definition->constant.expression);

            break;
        case DEFINITION_TYPE:
            ast_id_free(definition->type.id);
            ast_type_free(definition->type.type);

            break;
        case DEFINITION_FIELD:
            ast_id_free(definition->field.identifiers);
            ast_type_free(definition->field.type);

            break;
        case DEFINITION_VARIABLE:
            ast_id_free(definition->variable.identifiers);
            ast_type_free(definition->variable.type);

            break;
        case DEFINITION_SUBPROGRAM_FORWARD:
            ast_definition_free(definition->subprogram_forward.sub_header);

            break;
        case DEFINITION_SUBPROGRAM:
            ast_definition_free(definition->subprogram.sub_header);
            ast_declaration_free(definition->subprogram.declarations);
            if (definition->subprogram.subprograms) ast_definition_free(definition->subprogram.subprograms);
            if (definition->subprogram.comp_statement) ast_statement_free(definition->subprogram.comp_statement);

            break;
        case DEFINITION_FUNCTION:
            ast_id_free(definition->function.id);
            if (definition->function.formal_parameters) ast_definition_free(definition->function.formal_parameters);
            if (definition->function.type) ast_type_free(definition->function.type);

            break;
        case DEFINITION_PROCEDURE:
            ast_id_free(definition->procedure.id);
            if (definition->procedure.formal_parameters) ast_definition_free(definition->procedure.formal_parameters);

            break;
        case DEFINITION_PARAMETER:
            ast_id_free(definition->parameter.identifiers);
            ast_type_free(definition->parameter.type);
    }

    free(definition);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0xd03f
callq 0xd028
movl 0x4(%rbx), %eax
cmpq $0x9, %rax
ja 0xd110
leaq 0xc325(%rip), %rcx      # 0x19378
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%rbx), %rdi
callq 0xd22b
movq 0x18(%rbx), %rdi
jmp 0xd0bc
movq 0x18(%rbx), %rdi
callq 0xd22b
movq 0x20(%rbx), %rdi
jmp 0xd0bc
movq 0x10(%rbx), %rdi
callq 0xd22b
jmp 0xd110
movq 0x10(%rbx), %rdi
callq 0xd22b
movq 0x18(%rbx), %rdi
callq 0xd258
jmp 0xd110
movq 0x10(%rbx), %rdi
callq 0xd22b
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xd0b3
callq 0xd028
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xd110
callq 0xd2f8
jmp 0xd110
movq 0x10(%rbx), %rdi
jmp 0xd10b
movq 0x10(%rbx), %rdi
callq 0xd028
movq 0x18(%rbx), %rdi
callq 0xd11e
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xd0e9
callq 0xd028
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0xd110
callq 0xd15e
jmp 0xd110
movq 0x10(%rbx), %rdi
callq 0xd22b
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xd110
callq 0xd028
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x72c0