// File: /workspace/github_c_makefile_star2_O0/chgzm[P]minic/generator.c
// Function: process_selection_stmt
static void process_selection_stmt(const SelectionStmtNode* node) {
    switch (node->selection_type) {
    case SELECT_IF: {
        const char* label1 = get_label();

        process_expr(node->expr_node);
        printf("  pop rax\n");
        printf("  cmp rax, 0\n");
        printf("  je %s\n", label1);
        process_stmt(node->stmt_node_0);
        printf("%s:\n", label1);

        break;
    }
    case SELECT_IF_ELSE: {
        const char* label2 = get_label();
        const char* label3 = get_label();

        process_expr(node->expr_node);
        printf("  pop rax\n");
        printf("  cmp rax, 0\n");
        printf("  je %s\n", label2);
        process_stmt(node->stmt_node_0);
        printf("  jmp %s\n", label3);
        printf("%s:\n", label2);
        process_stmt(node->stmt_node_1);
        printf("%s:\n", label3);

        break;
    }
    case SELECT_SWITCH: {
        char* label4 = get_label();
        stack_push(break_label_stack, label4);
        stack_push(current_stmt_label_stack, get_label()); 

        process_expr(node->expr_node);
        process_stmt(node->stmt_node_0);

        printf("%s:\n", label4);
        stack_pop(break_label_stack);
        stack_pop(current_stmt_label_stack); 
        break;
    }
    default: {
        break;
    }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0x6a36
jmp 0x6a1b
movl -0x2c(%rbp), %eax
subl $0x1, %eax
je 0x6a9e
jmp 0x6a25
movl -0x2c(%rbp), %eax
subl $0x2, %eax
je 0x6b3d
jmp 0x6bb8
callq 0x6500
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4c20
leaq 0x8c91(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0x8d5e(%rip), %rdi      # 0xf7bf
movb $0x0, %al
callq 0x1090
movq -0x10(%rbp), %rsi
leaq 0x8d5a(%rip), %rdi      # 0xf7cd
movb $0x0, %al
callq 0x1090
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x44b0
movq -0x10(%rbp), %rsi
leaq 0x8b5b(%rip), %rdi      # 0xf5ed
movb $0x0, %al
callq 0x1090
jmp 0x6bba
callq 0x6500
movq %rax, -0x18(%rbp)
callq 0x6500
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4c20
leaq 0x8c20(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0x8ced(%rip), %rdi      # 0xf7bf
movb $0x0, %al
callq 0x1090
movq -0x18(%rbp), %rsi
leaq 0x8ce9(%rip), %rdi      # 0xf7cd
movb $0x0, %al
callq 0x1090
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x44b0
movq -0x20(%rbp), %rsi
leaq 0x8cd3(%rip), %rdi      # 0xf7d6
movb $0x0, %al
callq 0x1090
movq -0x18(%rbp), %rsi
leaq 0x8ad8(%rip), %rdi      # 0xf5ed
movb $0x0, %al
callq 0x1090
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x44b0
movq -0x20(%rbp), %rsi
leaq 0x8ab9(%rip), %rdi      # 0xf5ed
movb $0x0, %al
callq 0x1090
jmp 0x6bba
callq 0x6500
movq %rax, -0x28(%rbp)
movq 0xe5d3(%rip), %rdi      # 0x15120
movq -0x28(%rbp), %rsi
callq 0xe6e0
movq 0xe5db(%rip), %rax      # 0x15138
movq %rax, -0x38(%rbp)
callq 0x6500
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0xe6e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x4c20
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x44b0
movq -0x28(%rbp), %rsi
leaq 0x8a56(%rip), %rdi      # 0xf5ed
movb $0x0, %al
callq 0x1090
movq 0xe57b(%rip), %rdi      # 0x15120
callq 0xe7a0
movq 0xe587(%rip), %rdi      # 0x15138
callq 0xe7a0
jmp 0x6bba
jmp 0x6bba
addq $0x40, %rsp
popq %rbp
retq