// File: /workspace/github_c_makefile_star2_O1/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 0xcbf6(%rip), %r13      # 0x18dfc
leaq 0xce34(%rip), %r12      # 0x19041
movl 0x4(%rbx), %eax
cmpq $0x9, %rax
ja 0xc52d
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq 0x48(%r14), %rcx
movl $0x14, %esi
movl $0x1, %edx
leaq 0xcd1f(%rip), %rdi      # 0x18f58
callq 0x7280
movl $0xa, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc244
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
jmp 0xc52d
movq 0x48(%r14), %rcx
movl $0x16, %esi
movl $0x1, %edx
leaq 0xcd26(%rip), %rdi      # 0x18fab
callq 0x7280
movl $0x9, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc290
jmp 0xc371
movq 0x48(%r14), %rcx
movl $0x16, %esi
movl $0x1, %edx
leaq 0xcd6d(%rip), %rdi      # 0x1902a
callq 0x7280
movq 0x48(%r14), %rdi
movl 0x10(%rbx), %eax
leaq 0x14f40(%rip), %rcx     # 0x21210
movq (%rcx,%rax,8), %rdx
movq %r12, %rsi
xorl %eax, %eax
callq 0x7190
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
movq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0xcbcb
movq 0x48(%r14), %rsi
movl $0x5d, %edi
callq 0x7150
jmp 0xc52d
movq 0x48(%r14), %rcx
movl $0x12, %esi
movl $0x1, %edx
leaq 0xcc66(%rip), %rdi      # 0x18f84
callq 0x7280
movl $0xd, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc329
jmp 0xc371
movq 0x48(%r14), %rcx
movl $0x13, %esi
movl $0x1, %edx
leaq 0xcc44(%rip), %rdi      # 0x18f97
callq 0x7280
movl $0xc, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc35e
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xcbcb
jmp 0xc52d
movq 0x48(%r14), %rcx
movl $0x16, %esi
movl $0x1, %edx
leaq 0xcc50(%rip), %rdi      # 0x18ffb
callq 0x7280
movl $0x9, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc3b6
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0xc3ee
movq %r14, %rdi
callq 0xc1eb
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
jne 0xc389
jmp 0xc52d
movq 0x48(%r14), %rcx
movl $0x16, %esi
movl $0x1, %edx
leaq 0xcb5c(%rip), %rdi      # 0x18f6d
callq 0x7280
movl $0x9, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc41c
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc947
jmp 0xc52d
movq 0x48(%r14), %rcx
movl $0x20, %esi
movl $0x1, %edx
leaq 0xcb59(%rip), %rdi      # 0x18fc2
callq 0x7280
movq 0x10(%rbx), %rsi
jmp 0xc525
movq 0x48(%r14), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0xcb57(%rip), %rdi      # 0x18fe3
callq 0x7280
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc1eb
incl 0x40(%r14)
movq 0x18(%rbx), %rsi
movq %r14, %rdi
callq 0xc549
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0xc4be
movq %r14, %rdi
callq 0xc1eb
movq 0x28(%rbx), %rsi
testq %rsi, %rsi
je 0xc4cf
movq %r14, %rdi
callq 0xc591
decl 0x40(%r14)
jmp 0xc52d
movq 0x48(%r14), %rcx
movl $0x17, %esi
movl $0x1, %edx
leaq 0xcb28(%rip), %rdi      # 0x19012
callq 0x7280
movl $0x8, %r15d
movq 0x48(%r14), %rsi
movl $0x20, %edi
callq 0x7150
decl %r15d
jne 0xc4f5
movq %r14, %rdi
callq 0xc913
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0xc8d7
movq 0x18(%rbx), %rsi
testq %rsi, %rsi
je 0xc52d
movq %r14, %rdi
callq 0xc1eb
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
jne 0xc20d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq