// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/codegen.c
// Function: for_stmt_to_c
struct rope *for_stmt_to_c(struct ast *ast)
{
    struct rope *rope = for_sp_lparen_rope;
    struct ast *init_expr_ast = ast_ast(ast, 0);
    struct ast *cond_expr_ast = ast_ast(ast, 1);
    struct ast *update_expr_ast = ast_ast(ast, 2);
    struct ast *block_ast = ast_ast(ast, 3);

    push_scope();

    if (init_expr_ast != NULL) {
        struct expr init_expr = eval_expr(NULL, init_expr_ast);
        rope = rope_new_tree(rope, init_expr.rope);
    }
    rope = rope_new_tree(rope, semi_rope);

    if (cond_expr_ast != NULL) {
        rope = rope_new_tree(rope, sp_rope);

        struct expr cond_expr = eval_expr(NULL, cond_expr_ast);
        if (!is_bool_type(cond_expr.type))
            fatal(ast->loc, "condition has to be of boolean type");

        rope = rope_new_tree(rope, cond_expr.rope);
    }
    rope = rope_new_tree(rope, semi_rope);

    if (update_expr_ast != NULL) {
        rope = rope_new_tree(rope, sp_rope);

        struct expr update_expr = eval_expr(NULL, update_expr_ast);
        rope = rope_new_tree(rope, update_expr.rope);
    }
    rope = rope_new_tree(rope, rparen_sp_rope);

    zc_loop_level++;
    rope = rope_new_tree(rope, block_to_c(block_ast));
    zc_loop_level--;

    pop_scope();

    return add_indent_nl(rope);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x14b0d(%rip), %rax     # 0x195b0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2a40
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x2a40
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x2a40
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x2a40
movq %rax, -0x30(%rbp)
callq 0x3cc0
cmpq $0x0, -0x18(%rbp)
je 0x4b20
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x81b0
movq %rax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0xf2a0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x149a5(%rip), %rsi     # 0x194d0
callq 0xf2a0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4b98
movq -0x10(%rbp), %rdi
leaq 0x14b2a(%rip), %rsi     # 0x19670
callq 0xf2a0
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x81b0
movq %rax, -0x50(%rbp)
movq %rdx, -0x48(%rbp)
movq -0x50(%rbp), %rdi
callq 0x4590
testb $0x1, %al
jne 0x4b87
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xd8e7(%rip), %rsi      # 0x12467
movb $0x0, %al
callq 0x6610
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xf2a0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x1492d(%rip), %rsi     # 0x194d0
callq 0xf2a0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4bed
movq -0x10(%rbp), %rdi
leaq 0x14ab2(%rip), %rsi     # 0x19670
callq 0xf2a0
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0x81b0
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xf2a0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x146f8(%rip), %rsi     # 0x192f0
callq 0xf2a0
movq %rax, -0x10(%rbp)
leaq 0x151c0(%rip), %rax     # 0x19dc8
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x151b4(%rip), %rax     # 0x19dc8
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rdi
callq 0x45b0
movq -0x68(%rbp), %rdi
movq %rax, %rsi
callq 0xf2a0
movq %rax, -0x10(%rbp)
leaq 0x1518a(%rip), %rax     # 0x19dc8
movl (%rax), %ecx
addl $-0x1, %ecx
leaq 0x1517e(%rip), %rax     # 0x19dc8
movl %ecx, (%rax)
callq 0x3cf0
movq -0x10(%rbp), %rdi
callq 0x3db0
addq $0x70, %rsp
popq %rbp
retq