// File: /workspace/github_c_makefile_star2_O2/neosploit[P]compiler/ast_print.c
// Function: ast_statement_print
void ast_statement_print(AstPrintState* state, Statement* statement) {

    switch (statement->tag) {
        case STATEMENT_ASSIGNMENT:
            fprintf(state->fp, "\n[STATEMENT_ASSIGNMENT]");
            ast_tag_space_print(state, strlen("[STATEMENT_ASSIGNMENT]"));
            ast_indent_space_print(state);

            ast_variable_print(state, statement->assignment.variable);
            ast_expression_print(state, statement->assignment.expression);

            break;
        case STATEMENT_IF:
            fprintf(state->fp, "\n[STATEMENT_IF]");
            ast_tag_space_print(state, strlen("[STATEMENT_IF]"));
            ast_indent_space_print(state);

            ast_expression_print(state, statement->if_.expression);

            state->indent++;
            ast_statement_print(state, statement->if_.if_statement);
            state->indent--;

            if (statement->if_.else_statement) {
                fprintf(state->fp, "\n");
                ast_tag_space_print(state, strlen(""));
                ast_indent_space_print(state);
                fprintf(state->fp, " (ELSE)");
                
                state->indent++;
                ast_statement_print(state, statement->if_.else_statement);
                state->indent--;
            }

            break;
        case STATEMENT_WHILE:
            fprintf(state->fp, "\n[STATEMENT_WHILE]");
            ast_tag_space_print(state, strlen("[STATEMENT_WHILE]"));
            ast_indent_space_print(state);

            ast_expression_print(state, statement->while_.expression);

            state->indent++;
            ast_statement_print(state, statement->while_.statement);
            state->indent--;

            break;
        case STATEMENT_FOR:
            fprintf(state->fp, "\n[STATEMENT_FOR]");
            ast_tag_space_print(state, strlen("[STATEMENT_FOR]"));
            ast_indent_space_print(state);

            ast_expression_print(state, statement->for_.iter_space);

            state->indent++;
            ast_statement_print(state, statement->for_.statement);
            state->indent--;

            break;
        case STATEMENT_WITH:
            fprintf(state->fp, "\n[STATEMENT_WITH]");
            ast_tag_space_print(state, strlen("[STATEMENT_WITH]"));
            ast_indent_space_print(state);

            ast_variable_print(state, statement->with.variable);
            ast_statement_print(state, statement->with.statement);

            break;
        case STATEMENT_PROCEDURE_CALL:
            fprintf(state->fp, "\n[STATEMENT_PROCEDURE_CALL]");
            ast_tag_space_print(state, strlen("[STATEMENT_PROCEDURE_CALL]"));
            ast_indent_space_print(state);

            ast_id_print(state, statement->procedure_call.id);
            if (statement->procedure_call.expressions) ast_expression_print(state, statement->procedure_call.expressions);

            break;
        case STATEMENT_IO_READ:
            fprintf(state->fp, "\n[STATEMENT_IO_READ]");
            ast_tag_space_print(state, strlen("[STATEMENT_IO_READ]"));
            ast_indent_space_print(state);

            ast_variable_print(state, statement->io_read.read_list);

            break;
        case STATEMENT_IO_WRITE:
            fprintf(state->fp, "\n[STATEMENT_IO_WRITE]");
            ast_tag_space_print(state, strlen("[STATEMENT_IO_WRITE]"));
            ast_indent_space_print(state);

            ast_expression_print(state, statement->io_write.write_list);
    }

    if (statement->next) ast_statement_print(state, statement->next);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xbd67(%rip), %r15      # 0x17e0c
pushq $0x1
popq %r13
pushq $0x14
popq %r12
movl 0x4(%rbx), %eax
cmpq $0x7, %rax
ja 0xc310
movslq (%r15,%rax,4), %rax
addq %r15, %rax
jmpq *%rax
movq 0x48(%r14), %rcx
leaq 0xc1e2(%rip), %rdi      # 0x182b0
pushq $0x17
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x16
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc802
movq 0x18(%rbx), %rsi
jmp 0xc2d1
movq 0x48(%r14), %rcx
leaq 0xc1f8(%rip), %rdi      # 0x18304
pushq $0x11
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x10
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc802
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc08a
jmp 0xc310
movq 0x48(%r14), %rcx
leaq 0xc18e(%rip), %rdi      # 0x182e0
pushq $0x12
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x11
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc3e1
incl 0x40(%r14)
movq 0x18(%rbx), %rsi
jmp 0xc285
movq 0x48(%r14), %rcx
leaq 0xc15f(%rip), %rdi      # 0x182f3
pushq $0x10
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0xf
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc3e1
jmp 0xc27d
movq 0x48(%r14), %rcx
leaq 0xc179(%rip), %rdi      # 0x18347
pushq $0x15
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
movl %r12d, %esi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
jmp 0xc2d1
movq 0x48(%r14), %rcx
leaq 0xc0c8(%rip), %rdi      # 0x182c8
pushq $0xf
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0xe
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc3e1
incl 0x40(%r14)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc08a
decl 0x40(%r14)
cmpq $0x0, 0x20(%rbx)
je 0xc310
movq 0x48(%r14), %rsi
pushq $0xa
popq %rdi
callq 0x7140
movq %r14, %rdi
xorl %esi, %esi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x48(%r14), %rcx
leaq 0xc066(%rip), %rdi      # 0x182d8
pushq $0x7
popq %rsi
movq %r13, %rdx
callq 0x7270
incl 0x40(%r14)
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0xc08a
decl 0x40(%r14)
jmp 0xc310
movq 0x48(%r14), %rcx
leaq 0xc078(%rip), %rdi      # 0x18316
pushq $0x1b
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x1a
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc32c
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0xc310
movq %r14, %rdi
callq 0xc3e1
jmp 0xc310
movq 0x48(%r14), %rcx
leaq 0xc04c(%rip), %rdi      # 0x18332
pushq $0x14
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x13
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc802
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xc0ad
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq