// File: /workspace/github_c_makefile_star2_O2/naleksiev[P]fin/src/fin_ast.c
// Function: fin_ast_stmt_destroy
static void fin_ast_stmt_destroy(fin_ast_module_t* mod, fin_ast_stmt_t* stmt) {
    if (!stmt)
        return;
    fin_ast_stmt_destroy(mod, stmt->next);
    switch (stmt->type) {
        case fin_ast_stmt_type_expr: {
            fin_ast_expr_stmt_t* expr_stmt = (fin_ast_expr_stmt_t*)stmt;
            fin_ast_expr_destroy(mod, expr_stmt->expr);
            break;
        }
        case fin_ast_stmt_type_ret: {
            fin_ast_ret_stmt_t* ret_stmt = (fin_ast_ret_stmt_t*)stmt;
            fin_ast_expr_destroy(mod, ret_stmt->expr);
            break;
        }
        case fin_ast_stmt_type_if: {
            fin_ast_if_stmt_t* if_stmt = (fin_ast_if_stmt_t*)stmt;
            fin_ast_expr_destroy(mod, if_stmt->cond);
            fin_ast_stmt_destroy(mod, if_stmt->true_stmt);
            fin_ast_stmt_destroy(mod, if_stmt->false_stmt);
            break;
        }
        case fin_ast_stmt_type_for: {
            fin_ast_for_stmt_t* for_stmt = (fin_ast_for_stmt_t*)stmt;
            fin_ast_expr_destroy(mod, for_stmt->init);
            fin_ast_expr_destroy(mod, for_stmt->cond);
            fin_ast_expr_destroy(mod, for_stmt->loop);
            fin_ast_stmt_destroy(mod, for_stmt->stmt);
            break;
        }
        case fin_ast_stmt_type_while: {
            fin_ast_while_stmt_t* while_stmt = (fin_ast_while_stmt_t*)stmt;
            fin_ast_expr_destroy(mod, while_stmt->cond);
            fin_ast_stmt_destroy(mod, while_stmt->stmt);
            break;
        }
        case fin_ast_stmt_type_do: {
            fin_ast_do_stmt_t* do_stmt = (fin_ast_do_stmt_t*)stmt;
            fin_ast_expr_destroy(mod, do_stmt->cond);
            fin_ast_stmt_destroy(mod, do_stmt->stmt);
            break;
        }
        case fin_ast_stmt_type_decl: {
            fin_ast_decl_stmt_t* decl_stmt = (fin_ast_decl_stmt_t*)stmt;
            fin_ast_type_ref_destroy(mod, decl_stmt->type);
            fin_str_destroy(mod->ctx, decl_stmt->name);
            fin_ast_expr_destroy(mod, decl_stmt->init);
            break;
        }
        case fin_ast_stmt_type_block: {
            fin_ast_block_stmt_t* block_stmt = (fin_ast_block_stmt_t*)stmt;
            fin_ast_stmt_destroy(mod, block_stmt->stmts);
            break;
        }
    }
    mod->ctx->alloc(stmt, 0);
}

// Assembly:
testq %rsi, %rsi
je 0x4b26
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rsi
callq 0x4ae9
movl (%rbx), %eax
cmpq $0x7, %rax
ja 0x4bbf
leaq 0x454d(%rip), %rcx      # 0x9064
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%rbx), %rsi
jmp 0x4b9d
retq
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
movq 0x18(%rbx), %rsi
jmp 0x4bb7
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x4ae9
movq 0x20(%rbx), %rsi
jmp 0x4bb7
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
movq 0x28(%rbx), %rsi
jmp 0x4bb7
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x4bd0
movq (%r14), %rdi
movq 0x18(%rbx), %rsi
callq 0x79ab
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
jmp 0x4bbf
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0x4c0a
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x4ae9
movq (%r14), %rax
movq (%rax), %rax
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmpq *%rax