// File: /workspace/github_c_makefile_star2_O2/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 0x59ee
movl %esi, %r14d
movq %rdi, %rbx
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x599f
movq %rax, %r15
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x5979
leal 0x1(%r14), %r12d
testq %r15, %r15
je 0x599f
movq %r15, %rdi
movl %r12d, %esi
callq 0x5956
movq 0x40(%r15), %r15
jmp 0x5989
addl %r14d, %r14d
xorl %r15d, %r15d
testl %r14d, %r14d
cmovgl %r14d, %r15d
pushq $0x20
popq %r14
subl $0x1, %r15d
jb 0x59c0
movl %r14d, %edi
callq 0x1040
jmp 0x59b0
cmpq $0x0, 0x8(%rbx)
je 0x59f7
movl (%rbx), %edi
callq 0x81d3
movq %rax, %r14
movq 0x8(%rbx), %rcx
movq 0x28(%rbx), %rax
movq 0x8(%rcx), %rbx
testq %rax, %rax
je 0x5a1f
movl (%rax), %edi
callq 0x81d3
movq %rax, %rcx
jmp 0x5a26
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %r15
movl (%rbx), %edi
callq 0x81d3
movq %rax, %r14
movq 0x28(%rbx), %rax
testq %r15, %r15
je 0x5a42
testq %rax, %rax
je 0x5a5a
movl (%rax), %edi
callq 0x81d3
movq %rax, %rdx
jmp 0x5a61
leaq 0xa1cc(%rip), %rcx      # 0xfbf2
leaq 0xa1e6(%rip), %rdi      # 0xfc13
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 0x5ad8
movl (%rax), %edi
callq 0x81d3
movq %rax, %rdx
jmp 0x5adf
leaq 0xa191(%rip), %rdx      # 0xfbf2
leaq 0xa18f(%rip), %rdi      # 0xfbf7
movq %r14, %rsi
xorl %eax, %eax
callq 0x10b0
cmpl $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rax
je 0x5ab0
movq (%rax), %rax
movl (%rax), %edi
callq 0x81d3
movq 0x18(%rbx), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0xa162(%rip), %rdi      # 0xfc06
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x5ac8
movl (%rax), %edi
callq 0x81d3
leaq 0xac8b(%rip), %rdi      # 0x10749
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
pushq $0xa
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1040
leaq 0xa113(%rip), %rdx      # 0xfbf2
leaq 0xa102(%rip), %rdi      # 0xfbe8
movq %r14, %rsi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10b0