// File: /workspace/github_c_makefile_star2_O1/Mithreindeir[P]ewcc/src/debug.c
// Function: node_debug
void node_debug(struct node *n)
{
	static char depth_str[256] = { 0 };
	static int di = 0;
	if (di > 250) {
		di = 0;
	}
	if (!n)
		return;
	if (di)
		printf("%.*s`--", di - 1, depth_str);
	switch (n->type) {
	case node_ident:
		printf("ident: %s\n", IDENT(n));
		break;
	case node_cnum:
		printf("cnum: %ld\n", CNUM(n));
		break;
	case node_unop:
		printf("unop \'%s\'\n", operator_str[UNOP(n)->op]);
		depth_str[di++] = ' ';
		depth_str[di++] = ' ';
		node_debug(UNOP(n)->term);
		di -= 2;
		break;
	case node_binop:
		printf("binop \'%s\':\n", operator_str[BINOP(n)->op]);
		depth_str[di++] = ' ';
		depth_str[di++] = '|';
		node_debug(BINOP(n)->lhs);
		depth_str[di - 1] = ' ';
		node_debug(BINOP(n)->rhs);
		di -= 2;
		break;
	case node_unit:
		for (int i = 0; i < UNIT(n)->num_decls; i++)
			node_debug(UNIT(n)->edecls[i]);
		break;
	case node_block:
		printf("block:\n");
		depth_str[di++] = ' ';
		depth_str[di++] = '|';
		for (int i = 0; i < BLOCK(n)->num_stmt; i++) {
			if ((i + 1) >= BLOCK(n)->num_stmt)
				depth_str[di - 1] = ' ';
			node_debug(BLOCK(n)->stmt_list[i]);
		}
		di -= 2;
		break;
	case node_cond:
		printf("conditional:\n");
		depth_str[di++] = '|';
		depth_str[di++] = ' ';
		node_debug(COND(n)->condition);
		if (!COND(n)->otherwise)
			depth_str[di - 2] = ' ';
		node_debug(COND(n)->body);
		depth_str[di - 2] = ' ';
		if (COND(n)->otherwise)
			node_debug(COND(n)->otherwise);
		di -= 2;;
		break;
	case node_loop:
		printf("loop:\n");
		depth_str[di++] = ' ';
		depth_str[di++] = '|';
		node_debug(LOOP(n)->init);
		node_debug(LOOP(n)->condition);
		if (!LOOP(n)->body)
			depth_str[di - 1] = ' ';
		node_debug(LOOP(n)->iter);
		depth_str[di - 1] = ' ';
		node_debug(LOOP(n)->body);
		di -= 2;
		break;
	case node_func:
		printf("func %s: ", FUNC(n)->ident);
		print_type(FUNC(n)->ftype);
		printf("\n");
		depth_str[di++] = ' ';
		depth_str[di++] = ' ';
		node_debug(FUNC(n)->body);
		di -= 2;
		break;
	case node_call:
		printf("call\n");
		depth_str[di++] = ' ';
		depth_str[di++] = '|';
		node_debug(CALL(n)->func);
		for (int i = 0; i < CALL(n)->argc;i++) {
			if ((i + 1) >= CALL(n)->argc)
				depth_str[di - 1] = ' ';
			node_debug(CALL(n)->argv[i]);
		}
		depth_str[di-1] = ' ';
		di -= 2;

		break;
	case node_decl:
		printf("decl:");
		print_type(DECL(n)->type);
		printf(" %s\n", DECL(n)->ident);
		depth_str[di++] = ' ';
		depth_str[di++] = ' ';
		if (DECL(n)->initializer) {
			node_debug(DECL(n)->initializer);
		}
		di -= 2;
		break;
	case node_empty:
		printf("empty\n");
		break;
	case node_break:
		printf("break\n");
		break;
	case node_continue:
		printf("continue\n");
		break;
	case node_return:
		printf("return\n");
		depth_str[di++] = ' ';
		depth_str[di++] = ' ';
		node_debug(RET(n));
		di -= 2;
		break;
	case node_cast:
		printf("cast: ");
		print_type(TYPE(n));
		printf("\n");
		depth_str[di++] = ' ';
		depth_str[di++] = ' ';
		node_debug(n->child);
		di -= 2;
		break;
	default:
		break;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0xfb, 0xc02d(%rip)     # 0xe710
jl 0x26ef
movl $0x0, 0xc021(%rip)      # 0xe710
testq %rbx, %rbx
je 0x2b7d
movl 0xc012(%rip), %esi      # 0xe710
testl %esi, %esi
je 0x2719
decl %esi
leaq 0x6a83(%rip), %rdi      # 0x918e
leaq 0xbefe(%rip), %rdx      # 0xe610
xorl %eax, %eax
callq 0x2080
movl (%rbx), %eax
cmpq $0xf, %rax
ja 0x2b7d
leaq 0x68fc(%rip), %rcx      # 0x9028
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6aec(%rip), %rdi      # 0x9228
jmp 0x2a3b
leaq 0x73f7(%rip), %rdi      # 0x9b3f
jmp 0x2a3b
leaq 0x6ada(%rip), %rdi      # 0x922e
callq 0x2060
movslq 0xbfb0(%rip), %rax      # 0xe710
leaq 0xbea9(%rip), %r14      # 0xe610
movw $0x7c20, (%rax,%r14)    # imm = 0x7C20
addl $0x2, %eax
movl %eax, 0xbf99(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movq (%rax), %rdi
callq 0x26d1
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x26d1
movq 0x8(%rbx), %rax
cmpq $0x0, 0x18(%rax)
jne 0x27a8
movslq 0xbf6e(%rip), %rax      # 0xe710
movb $0x20, -0x1(%rax,%r14)
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x26d1
movslq 0xbf54(%rip), %rax      # 0xe710
movb $0x20, -0x1(%rax,%r14)
movq 0x8(%rbx), %rax
movq 0x18(%rax), %rdi
jmp 0x2b71
movq 0x8(%rbx), %rax
movq (%rax), %rsi
leaq 0x69c4(%rip), %rdi      # 0x91a1
jmp 0x28fe
leaq 0x69e5(%rip), %rdi      # 0x91ce
xorl %eax, %eax
callq 0x2080
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x81ed
movq 0x8(%rbx), %rax
movq (%rax), %rsi
leaq 0x6991(%rip), %rdi      # 0x919c
xorl %eax, %eax
callq 0x2080
movslq 0xbef7(%rip), %rax      # 0xe710
leaq 0xbdf0(%rip), %rcx      # 0xe610
movw $0x2020, (%rax,%rcx)    # imm = 0x2020
addl $0x2, %eax
movl %eax, 0xbee1(%rip)      # 0xe710
jmp 0x2b11
leaq 0x6a06(%rip), %rdi      # 0x9241
callq 0x2060
movslq 0xbec9(%rip), %rax      # 0xe710
leaq 0xbdc2(%rip), %r14      # 0xe610
movw $0x7c20, (%rax,%r14)    # imm = 0x7C20
addl $0x2, %eax
movl %eax, 0xbeb2(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movl 0x8(%rax), %ecx
testl %ecx, %ecx
jle 0x2b76
xorl %eax, %eax
leaq 0x1(%rax), %r15
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0x2888
movslq 0xbe8e(%rip), %rcx      # 0xe710
movb $0x20, -0x1(%rcx,%r14)
movq 0x8(%rbx), %rcx
movq (%rcx), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x26d1
movq 0x8(%rbx), %rax
movslq 0x8(%rax), %rcx
movq %r15, %rax
cmpq %rcx, %r15
jl 0x286f
jmp 0x2b76
movq 0x8(%rbx), %rax
cmpl $0x0, 0x8(%rax)
jle 0x2b7d
xorl %r14d, %r14d
movq (%rax), %rax
movq (%rax,%r14,8), %rdi
callq 0x26d1
incq %r14
movq 0x8(%rbx), %rax
movslq 0x8(%rax), %rcx
cmpq %rcx, %r14
jl 0x28be
jmp 0x2b7d
leaq 0x727a(%rip), %rdi      # 0x9b60
callq 0x2060
jmp 0x29c5
movq 0x8(%rbx), %rax
movq (%rax), %rsi
leaq 0x6898(%rip), %rdi      # 0x9196
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x2080
leaq 0x705e(%rip), %rdi      # 0x996f
callq 0x2060
movslq 0xbdf3(%rip), %rax      # 0xe710
leaq 0xbcec(%rip), %r14      # 0xe610
movw $0x7c20, (%rax,%r14)    # imm = 0x7C20
addl $0x2, %eax
movl %eax, 0xbddc(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x26d1
movq 0x8(%rbx), %rax
movl (%rax), %ecx
testl %ecx, %ecx
jle 0x2986
xorl %eax, %eax
leaq 0x1(%rax), %r15
movslq %ecx, %rcx
cmpq %rcx, %r15
jl 0x2966
movslq 0xbdb0(%rip), %rcx      # 0xe710
movb $0x20, -0x1(%rcx,%r14)
movq 0x8(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x26d1
movq 0x8(%rbx), %rax
movslq (%rax), %rcx
movq %r15, %rax
cmpq %rcx, %r15
jl 0x294d
movslq 0xbd83(%rip), %rax      # 0xe710
movb $0x20, -0x1(%rax,%r14)
addl $-0x2, %eax
movl %eax, 0xbd74(%rip)      # 0xe710
jmp 0x2b7d
leaq 0x682c(%rip), %rdi      # 0x91d4
xorl %eax, %eax
callq 0x2080
movq 0x10(%rbx), %rax
movq (%rax), %rdi
callq 0x81ed
movl $0xa, %edi
callq 0x2040
movslq 0xbd44(%rip), %rax      # 0xe710
leaq 0xbc3d(%rip), %rcx      # 0xe610
movw $0x2020, (%rax,%rcx)    # imm = 0x2020
addl $0x2, %eax
movl %eax, 0xbd2e(%rip)      # 0xe710
movq 0x8(%rbx), %rdi
jmp 0x2b71
movq 0x8(%rbx), %rax
movl 0x8(%rax), %eax
leaq 0xbab7(%rip), %rcx      # 0xe4b0
movq (%rcx,%rax,8), %rsi
leaq 0x67a8(%rip), %rdi      # 0x91ac
xorl %eax, %eax
callq 0x2080
movslq 0xbcfe(%rip), %rax      # 0xe710
leaq 0xbbf7(%rip), %rcx      # 0xe610
movw $0x2020, (%rax,%rcx)    # imm = 0x2020
addl $0x2, %eax
movl %eax, 0xbce8(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movq (%rax), %rdi
jmp 0x2b71
leaq 0x70e6(%rip), %rdi      # 0x9b21
popq %rbx
popq %r14
popq %r15
jmp 0x2060
movq 0x8(%rbx), %rax
movl 0x10(%rax), %eax
leaq 0xba5d(%rip), %rcx      # 0xe4b0
movq (%rcx,%rax,8), %rsi
leaq 0x6759(%rip), %rdi      # 0x91b7
xorl %eax, %eax
callq 0x2080
movslq 0xbca4(%rip), %rax      # 0xe710
leaq 0xbb9d(%rip), %r14      # 0xe610
movw $0x7c20, (%rax,%r14)    # imm = 0x7C20
addl $0x2, %eax
movl %eax, 0xbc8d(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movq (%rax), %rdi
callq 0x26d1
movslq 0xbc7a(%rip), %rax      # 0xe710
movb $0x20, -0x1(%rax,%r14)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
jmp 0x2b71
leaq 0x6784(%rip), %rdi      # 0x9234
callq 0x2060
movslq 0xbc54(%rip), %rax      # 0xe710
leaq 0xbb4d(%rip), %r14      # 0xe610
movw $0x207c, (%rax,%r14)    # imm = 0x207C
addl $0x2, %eax
movl %eax, 0xbc3d(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movq (%rax), %rdi
callq 0x26d1
movq 0x8(%rbx), %rax
cmpq $0x0, 0x10(%rax)
jne 0x2af7
movslq 0xbc1f(%rip), %rax      # 0xe710
movb $0x20, -0x2(%rax,%r14)
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x26d1
movslq 0xbc05(%rip), %rax      # 0xe710
movb $0x20, -0x2(%rax,%r14)
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
testq %rdi, %rdi
jne 0x2b71
jmp 0x2b76
movq 0x8(%rbx), %rax
movq (%rax), %rsi
leaq 0x6696(%rip), %rdi      # 0x91c4
xorl %eax, %eax
callq 0x2080
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x81ed
movl $0xa, %edi
callq 0x2040
movslq 0xbbbd(%rip), %rax      # 0xe710
leaq 0xbab6(%rip), %rcx      # 0xe610
movw $0x2020, (%rax,%rcx)    # imm = 0x2020
addl $0x2, %eax
movl %eax, 0xbba7(%rip)      # 0xe710
movq 0x8(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x26d1
addl $-0x2, 0xbb93(%rip)     # 0xe710
popq %rbx
popq %r14
popq %r15
retq
nop