// File: /workspace/github_c_makefile_star2_O1/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 0xc878(%rip), %r13      # 0x18e24
leaq 0xcdac(%rip), %r12      # 0x1935f
movl 0x4(%rbx), %eax
cmpq $0x7, %rax
ja 0xc8bb
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x48(%r14), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0xcce9(%rip), %rdi      # 0x192c8
callq 0x7280
movl $0x8, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc5ea
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xcdc6
movq 0x18(%rbx), %rsi
jmp 0xc86a
movq 0x48(%r14), %rcx
movl $0x11, %esi
movl $0x1, %edx
leaq 0xcced(%rip), %rdi      # 0x1931c
callq 0x7280
movl $0xe, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc63a
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xcdc6
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc591
jmp 0xc8bb
movq 0x48(%r14), %rcx
movl $0x12, %esi
movl $0x1, %edx
leaq 0xcc71(%rip), %rdi      # 0x192f8
callq 0x7280
movl $0xd, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc692
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc947
incl 0x40(%r14)
movq 0x18(%rbx), %rsi
jmp 0xc809
movq 0x48(%r14), %rcx
movl $0x10, %esi
movl $0x1, %edx
leaq 0xcc30(%rip), %rdi      # 0x1930b
callq 0x7280
movl $0xf, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc6e6
movq %r14, %rdi
callq 0xc913
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc947
jmp 0xc801
movq 0x48(%r14), %rcx
movl $0x15, %esi
movl $0x1, %edx
movq %r12, %rdi
callq 0x7280
movl $0xa, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc72e
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
jmp 0xc86a
movq 0x48(%r14), %rcx
movl $0xf, %esi
movl $0x1, %edx
leaq 0xcb79(%rip), %rdi      # 0x192e0
callq 0x7280
movl $0x10, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc772
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc947
incl 0x40(%r14)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc591
decl 0x40(%r14)
cmpq $0x0, 0x20(%rbx)
je 0xc8bb
movq 0x48(%r14), %rsi
movl $0xa, %edi
callq 0x7150
movl $0x1e, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc7cc
movq %r14, %rdi
callq 0xc913
movq 0x48(%r14), %rcx
movl $0x7, %esi
movl $0x1, %edx
leaq 0xcaf4(%rip), %rdi      # 0x192f0
callq 0x7280
incl 0x40(%r14)
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0xc591
decl 0x40(%r14)
jmp 0xc8bb
movq 0x48(%r14), %rcx
movl $0x1b, %esi
movl $0x1, %edx
leaq 0xcaff(%rip), %rdi      # 0x1932e
callq 0x7280
movl $0x4, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc83a
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0xc8bb
movq %r14, %rdi
callq 0xc947
jmp 0xc8bb
movq 0x48(%r14), %rcx
movl $0x14, %esi
movl $0x1, %edx
leaq 0xcac1(%rip), %rdi      # 0x1934a
callq 0x7280
movl $0xb, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc894
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xcdc6
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xc5b3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq