// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x5bdc
jmp 0x5da8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x5bc0
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x58(%rbp)
subq $0x7, %rax
ja 0x5d96
movq -0x58(%rbp), %rax
leaq 0x75ac(%rip), %rcx      # 0xd1b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5e10
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5e10
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5e10
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x5bc0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x5bc0
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5e10
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x5e10
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x5e10
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x5bc0
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5e10
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x5bc0
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x5e10
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5bc0
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5db0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0xb0b0
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x5e10
jmp 0x5d96
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x5bc0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq *%rax
addq $0x60, %rsp
popq %rbp
retq
nop