// File: /workspace/github_c_makefile_star2_O3/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 0x5daa
movl %esi, %r14d
movq %rdi, %rbx
movq 0x30(%rdi), %rax
testq %rax, %rax
je 0x5d57
movq %rax, %r15
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x5d33
leal 0x1(%r14), %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x5d10
movq 0x40(%r15), %r15
testq %r15, %r15
jne 0x5d43
testl %r14d, %r14d
jle 0x5d7c
addl %r14d, %r14d
cmpl $0x2, %r14d
movl $0x1, %r15d
cmovgel %r14d, %r15d
movl $0x20, %edi
callq 0x1040
decl %r15d
jne 0x5d6d
cmpq $0x0, 0x8(%rbx)
je 0x5db3
movl (%rbx), %edi
callq 0x87b8
movq %rax, %r14
movq 0x8(%rbx), %rcx
movq 0x28(%rbx), %rax
movq 0x8(%rcx), %rbx
testq %rax, %rax
je 0x5ddb
movl (%rax), %edi
callq 0x87b8
movq %rax, %rcx
jmp 0x5de2
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rbx), %r15
movl (%rbx), %edi
callq 0x87b8
movq %rax, %r14
movq 0x28(%rbx), %rax
testq %r15, %r15
je 0x5dfe
testq %rax, %rax
je 0x5e16
movl (%rax), %edi
callq 0x87b8
movq %rax, %rdx
jmp 0x5e1d
leaq 0xae10(%rip), %rcx      # 0x10bf2
leaq 0xae2a(%rip), %rdi      # 0x10c13
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 0x5e96
movl (%rax), %edi
callq 0x87b8
movq %rax, %rdx
jmp 0x5e9d
leaq 0xadd5(%rip), %rdx      # 0x10bf2
leaq 0xadd3(%rip), %rdi      # 0x10bf7
movq %r14, %rsi
xorl %eax, %eax
callq 0x10b0
cmpl $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rax
je 0x5e6c
movq (%rax), %rax
movl (%rax), %edi
callq 0x87b8
movq 0x18(%rbx), %rcx
movq (%rcx), %rcx
movq 0x8(%rcx), %rdx
movq 0x10(%rcx), %rcx
movq 0x8(%rdx), %rdx
movq 0x8(%rcx), %rcx
leaq 0xada6(%rip), %rdi      # 0x10c06
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
jmp 0x5e84
movl (%rax), %edi
callq 0x87b8
leaq 0xb8df(%rip), %rdi      # 0x11759
movq %rax, %rsi
xorl %eax, %eax
callq 0x10b0
movl $0xa, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1040
leaq 0xad55(%rip), %rdx      # 0x10bf2
leaq 0xad44(%rip), %rdi      # 0x10be8
movq %r14, %rsi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10b0