// File: /workspace/github_c_makefile_star2_O0/neosploit[P]compiler/ast_free.c
// Function: ast_statement_free
static void ast_statement_free(Statement* statement) {

    if (statement->next) ast_statement_free(statement->next);

    switch (statement->tag) {
        case STATEMENT_ASSIGNMENT:
            ast_variable_free(statement->assignment.variable);
            ast_expression_free(statement->assignment.expression);

            break;
        case STATEMENT_IF:
            ast_expression_free(statement->if_.expression);
            ast_statement_free(statement->if_.if_statement);
            if (statement->if_.else_statement) ast_statement_free(statement->if_.else_statement);

            break;
        case STATEMENT_WHILE:
            ast_expression_free(statement->while_.expression);
            ast_statement_free(statement->while_.statement);

            break;
        case STATEMENT_FOR:
            ast_id_free(statement->for_.id);
            ast_expression_free(statement->for_.iter_space);
            ast_statement_free(statement->for_.statement);

            break;
        case STATEMENT_WITH:
            ast_variable_free(statement->with.variable);
            ast_statement_free(statement->with.statement);

            break;
        case STATEMENT_PROCEDURE_CALL:
            ast_id_free(statement->procedure_call.id);
            if (statement->procedure_call.expressions) ast_expression_free(statement->procedure_call.expressions);

            break;
        case STATEMENT_IO_READ:
            ast_variable_free(statement->io_read.read_list);

            break;
        case STATEMENT_IO_WRITE:
            ast_expression_free(statement->io_write.write_list);
    }

    free(statement);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0xfea4
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xfe80
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, -0x10(%rbp)
subq $0x7, %rax
ja 0xffca
movq -0x10(%rbp), %rax
leaq 0x12790(%rip), %rcx     # 0x22654
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10260
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x10020
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10020
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xfe80
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xff1e
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xfe80
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10020
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xfe80
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xffe0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x10020
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xfe80
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10260
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xfe80
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xffe0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0xffac
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x10020
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10260
jmp 0xffca
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x10020
movq -0x8(%rbp), %rdi
callq 0x7290
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)