// File: /workspace/github_c_makefile_star2_O1/anuwu[P]ERPLAG-Compiler/ast.c
// Function: inorderAST
void inorderAST (astNode *node, int space)
{	
	if (node == NULL)
		return ;

	astNode *sib = node->child ;

	if (sib != NULL)
	{
		while (sib->next != NULL)
		{
			//inorderAST (sib, space + 1) ;
			sib = sib->next ;
		}

		
		while (sib != NULL)
		{
			inorderAST (sib, space+1) ;
			sib = sib->prev ;
		}
	}

	for (int i = 0 ; i < 2*space ; i++)
		printf (" ") ;

	
	if (node->tok == NULL)
	{
		if (node->dt == NULL)
			printf ("|(%s,%s)\n", tokenIDToString(node->id) , (node->parent == NULL)?"NULL":tokenIDToString(node->parent->id)) ;
		else
		{
			printf ("|(%s,%s) ---> ", tokenIDToString(node->id) , (node->parent == NULL)?"NULL":tokenIDToString(node->parent->id)) ;
			if (node->dtTag == PRIMITIVE)
				printf ("%s", tokenIDToString(node->dt->pType)) ;
			else
				printf ("%s[%s .. %s]", tokenIDToString(node->dt->arrType->type), node->dt->arrType->tokLeft->lexeme, node->dt->arrType->tokRight->lexeme) ;
			printf ("\n") ;
		}
	}
	else	
		printf ("|(%s,%s,%s)\n", tokenIDToString(node->id), node->tok->lexeme, (node->parent == NULL)?"NULL":tokenIDToString(node->parent->id)) ;

	//printf ("|(%s,%s)\n", (node->tok==NULL)?tokenIDToString(node->id):node->tok->lexeme, (node->parent == NULL)?"NULL":tokenIDToString(node->parent->id)) ;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x5d82
movl %esi, %r14d
movq %rdi, %rbx
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x5d2f
movq %rax, %r15
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x5d0b
leal 0x1(%r14), %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x5ce8
movq 0x40(%r15), %r15
testq %r15, %r15
jne 0x5d1b
testl %r14d, %r14d
jle 0x5d54
addl %r14d, %r14d
cmpl $0x2, %r14d
movl $0x1, %r15d
cmovgel %r14d, %r15d
movl $0x20, %edi
callq 0x1040
decl %r15d
jne 0x5d45
cmpq $0x0, 0x8(%rbx)
je 0x5d8b
movl (%rbx), %edi
callq 0x9270
movq %rax, %r14
movq 0x8(%rbx), %rcx
movq 0x28(%rbx), %rax
movq 0x8(%rcx), %rbx
testq %rax, %rax
je 0x5db3
movl (%rax), %edi
callq 0x9270
movq %rax, %rcx
jmp 0x5dba
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %r15
movl (%rbx), %edi
callq 0x9270
movq %rax, %r14
movq 0x28(%rbx), %rax
testq %r15, %r15
je 0x5dd6
testq %rax, %rax
je 0x5dee
movl (%rax), %edi
callq 0x9270
movq %rax, %rdx
jmp 0x5df5
leaq 0xbe38(%rip), %rcx      # 0x11bf2
leaq 0xbe52(%rip), %rdi      # 0x11c13
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10b0
testq %rax, %rax
je 0x5e6e
movl (%rax), %edi
callq 0x9270
movq %rax, %rdx
jmp 0x5e75
leaq 0xbdfd(%rip), %rdx      # 0x11bf2
leaq 0xbdfb(%rip), %rdi      # 0x11bf7
movq %r14, %rsi
xorl %eax, %eax
callq 0x10b0
cmpl $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rax
je 0x5e44
movq (%rax), %rax
movl (%rax), %edi
callq 0x9270
movq 0x18(%rbx), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0xbdce(%rip), %rdi      # 0x11c06
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x5e5c
movl (%rax), %edi
callq 0x9270
leaq 0xc8f7(%rip), %rdi      # 0x12749
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0xa, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1040
leaq 0xbd7d(%rip), %rdx      # 0x11bf2
leaq 0xbd6c(%rip), %rdi      # 0x11be8
movq %r14, %rsi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10b0