// File: /workspace/github_c_makefile_star2_O2/neosploit[P]compiler/ast_print.c
// Function: ast_definition_print
void ast_definition_print(AstPrintState* state, Definition* definition) {

    switch (definition->tag) {
        case DEFINITION_PROGRAM:
            fprintf(state->fp, "[DEFINITION_PROGRAM]");
            ast_tag_space_print(state, strlen("[DEFINITION_PROGRAM]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->program.id);

            break;
        case DEFINITION_CONSTANT:
            fprintf(state->fp, "\n[DEFINITION_CONSTANT]");
            ast_tag_space_print(state, strlen("[DEFINITION_CONSTANT]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->constant.id);
            ast_expression_print(state, definition->constant.expression);

            break;
        case DEFINITION_TYPE:
            fprintf(state->fp, "\n[DEFINITION_TYPE]");
            ast_tag_space_print(state, strlen("[DEFINITION_TYPE]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->type.id);
            ast_type_print(state, definition->type.type);

            break;
        case DEFINITION_FIELD:
            fprintf(state->fp, "\n[DEFINITION_FIELD]");
            ast_tag_space_print(state, strlen("[DEFINITION_FIELD]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->field.identifiers);
            ast_type_print(state, definition->field.type);

            break;
        case DEFINITION_VARIABLE:
            fprintf(state->fp, "\n[DEFINITION_VARIABLE]");
            ast_tag_space_print(state, strlen("[DEFINITION_VARIABLE]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->variable.identifiers);
            ast_type_print(state, definition->variable.type);

            break;
        case DEFINITION_SUBPROGRAM_FORWARD:
            fprintf(state->fp, "\n[DEFINITION_SUBPROGRAM_FORWARD]");
            ast_tag_space_print(state, strlen("[DEFINITION_SUBPROGRAM_FORWARD]"));

            ast_definition_print(state, definition->subprogram_forward.sub_header);

            break;
        case DEFINITION_SUBPROGRAM:
            fprintf(state->fp, "[DEFINITION_SUBPROGRAM]");

            ast_definition_print(state, definition->subprogram.sub_header);

            state->indent++;

            ast_declaration_print(state, definition->subprogram.declarations);
            if (definition->subprogram.subprograms) ast_definition_print(state, definition->subprogram.subprograms);
            if (definition->subprogram.comp_statement) ast_statement_print(state, definition->subprogram.comp_statement);

            state->indent--;

            break;
        case DEFINITION_FUNCTION:
            fprintf(state->fp, "\n[DEFINITION_FUNCTION]");
            ast_tag_space_print(state, strlen("[DEFINITION_FUNCTION]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->function.id);
            if (definition->function.formal_parameters) ast_definition_print(state, definition->function.formal_parameters);
            if (definition->function.type) ast_type_print(state, definition->function.type);

            break;
        case DEFINITION_PROCEDURE:
            fprintf(state->fp, "\n[DEFINITION_PROCEDURE]");
            ast_tag_space_print(state, strlen("[DEFINITION_PROCEDURE]"));
            ast_indent_space_print(state);

            ast_id_print(state, definition->procedure.id);
            if (definition->procedure.formal_parameters) ast_definition_print(state, definition->procedure.formal_parameters);

            break;
        case DEFINITION_PARAMETER:
            fprintf(state->fp, "[DEFINITION_PARAMETER:");

            fprintf(state->fp, " (PASS: %s)", PassString[definition->parameter.pass]);
            ast_id_print(state, definition->parameter.identifiers);
            ast_type_print(state, definition->parameter.type);

            fprintf(state->fp, "]");
    }

    if (definition->next) ast_definition_print(state, definition->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 0xc05c(%rip), %r12      # 0x17de4
pushq $0x1
popq %r13
pushq $0x16
popq %r15
movl 0x4(%rbx), %eax
cmpq $0x9, %rax
ja 0xc026
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq 0x48(%r14), %rcx
leaq 0xc18f(%rip), %rdi      # 0x17f40
pushq $0x14
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x14
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc32c
jmp 0xc026
movq 0x48(%r14), %rcx
leaq 0xc1a8(%rip), %rdi      # 0x17f93
movq %r15, %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x15
jmp 0xbe97
movq 0x48(%r14), %rcx
leaq 0xc207(%rip), %rdi      # 0x18012
movq %r15, %rsi
movq %r13, %rdx
callq 0x7270
movq 0x48(%r14), %rdi
movl 0x10(%rbx), %eax
leaq 0x143ec(%rip), %rcx     # 0x20210
movq (%rcx,%rax,8), %rdx
leaq 0xc1fa(%rip), %rsi      # 0x18029
xorl %eax, %eax
callq 0x7180
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc32c
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0xc632
movq 0x48(%r14), %rsi
pushq $0x5d
popq %rdi
callq 0x7140
jmp 0xc026
movq 0x48(%r14), %rcx
leaq 0xc102(%rip), %rdi      # 0x17f6c
pushq $0x12
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x11
jmp 0xbe97
movq 0x48(%r14), %rcx
leaq 0xc0f8(%rip), %rdi      # 0x17f7f
pushq $0x13
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x12
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc32c
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc632
jmp 0xc026
movq 0x48(%r14), %rcx
leaq 0xc116(%rip), %rdi      # 0x17fe3
movq %r15, %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x15
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 0xbf08
movq %r14, %rdi
callq 0xbd6d
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
jne 0xbeb5
jmp 0xc026
movq 0x48(%r14), %rcx
leaq 0xc034(%rip), %rdi      # 0x17f55
movq %r15, %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x15
popq %rsi
callq 0xc368
movq %r14, %rdi
callq 0xc3a6
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc32c
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc3e1
jmp 0xc026
movq 0x48(%r14), %rcx
leaq 0xc043(%rip), %rdi      # 0x17faa
pushq $0x20
popq %rsi
movq %r13, %rdx
callq 0x7270
movq %r14, %rdi
pushq $0x1f
popq %rsi
callq 0xc368
movq 0x10(%rbx), %rsi
jmp 0xc01e
movq 0x48(%r14), %rcx
leaq 0xc03a(%rip), %rdi      # 0x17fcb
pushq $0x17
popq %rsi
movq %r13, %rdx
callq 0x7270
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xbd6d
incl 0x40(%r14)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc042
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0xbfc9
movq %r14, %rdi
callq 0xbd6d
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0xbfda
movq %r14, %rdi
callq 0xc08a
decl 0x40(%r14)
jmp 0xc026
movq 0x48(%r14), %rcx
leaq 0xc00f(%rip), %rdi      # 0x17ffa
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 0xc32c
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0xc026
movq %r14, %rdi
callq 0xbd6d
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xbd90
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq