// File: /workspace/github_c_makefile_star2_O1/ryvnf[P]czc/codegen.c
// Function: clause_to_c
struct rope *clause_to_c(struct ast *ast)
{
    struct rope *rope = NULL;
    struct ast *stmt_list;

    switch (ast->tag) {
        case CASE_CLAUSE: {
            size_t n_asts;
            struct ast **asts = ast_asts(ast_ast(ast, 0), &n_asts);

            for (size_t i = 0; i < n_asts; i++) {
                rope = rope_new_tree(rope, add_indent(case_sp_rope));
                
                size_t n = eval_size(asts[i]);

                rope = rope_new_tree(rope, rope_new_fmt("%d", n));
                rope = rope_new_tree(rope, colon_nl_rope);
            }

            stmt_list = ast_ast(ast, 1);
            break;
        }
        case DEFAULT_CLAUSE: {
            rope = add_indent(default_colon_nl_rope);
            stmt_list = ast_ast(ast, 0);
            break;
        }
    }

    zc_indent_level++;
    bool fallthrough = false;

    size_t n_stmts;
    ast_asts(stmt_list, &n_stmts);

    if (n_stmts != 0) 
        rope = stmt_list_to_c(rope, stmt_list, &fallthrough);
    else
        rope = add_indent_nl(semi_rope);

    if (!fallthrough)
        rope = rope_new_tree(rope, add_indent_nl(break_semi_rope));
    zc_indent_level--;

    return rope;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
movl (%rdi), %eax
cmpl $0x410a, %eax           # imm = 0x410A
je 0x3a04
xorl %r14d, %r14d
cmpl $0x4109, %eax           # imm = 0x4109
jne 0x3a43
movq %r12, 0x10(%rsp)
movq %r12, %rdi
xorl %esi, %esi
callq 0x27c8
leaq 0x8(%rsp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x2805
cmpq $0x0, (%r12)
je 0x39f8
movq %rax, %r15
leaq 0x10329(%rip), %rbx     # 0x13ca0
leaq 0xf902(%rip), %rbp      # 0x13280
xorl %r14d, %r14d
xorl %r12d, %r12d
leaq 0x10449(%rip), %rax     # 0x13dd4
movslq (%rax), %r13
movq %rbx, %rax
testq %r13, %r13
je 0x39a9
movq %rbx, %rax
movq %rbp, %rdi
movq %rax, %rsi
callq 0xb136
decq %r13
jne 0x3999
movq %r14, %rdi
movq %rax, %rsi
callq 0xb136
movq %rax, %r14
movq (%r15,%r12,8), %rdi
callq 0x6806
leaq 0x9f42(%rip), %rdi      # 0xd909
movq %rax, %rsi
xorl %eax, %eax
callq 0xb16e
movq %r14, %rdi
movq %rax, %rsi
callq 0xb136
movq %rax, %rdi
leaq 0x102fa(%rip), %rsi     # 0x13ce0
callq 0xb136
movq %rax, %r14
incq %r12
cmpq 0x8(%rsp), %r12
jb 0x3984
movl $0x1, %esi
movq 0x10(%rsp), %rdi
jmp 0x3a39
leaq 0x103c9(%rip), %rax     # 0x13dd4
movslq (%rax), %rbx
leaq 0x102ab(%rip), %r14     # 0x13cc0
testq %rbx, %rbx
je 0x3a34
leaq 0xf85f(%rip), %r15      # 0x13280
movq %r15, %rdi
movq %r14, %rsi
callq 0xb136
movq %rax, %r14
decq %rbx
jne 0x3a21
movq %r12, %rdi
xorl %esi, %esi
callq 0x27c8
movq %rax, %rbx
jmp 0x3a43
leaq 0x1038a(%rip), %r12     # 0x13dd4
incl (%r12)
movb $0x0, 0x7(%rsp)
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2805
cmpq $0x0, (%r15)
je 0x3a7b
leaq 0x7(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3ac1
jmp 0x3a87
leaq 0xfa5e(%rip), %rdi      # 0x134e0
callq 0x33f7
movq %rax, %rbx
cmpb $0x0, 0x7(%rsp)
jne 0x3aab
leaq 0xf9e8(%rip), %rdi      # 0x13480
callq 0x33f7
movq %rbx, %rdi
movq %rax, %rsi
callq 0xb136
movq %rax, %rbx
decl (%r12)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq