// File: Danis98[P]PietGen/parse.cpp
// Function: print_ast()
void print_ast(){
	std::cout<<"[DEBUG] BEGIN STATEMENT LIST\n";
	for(int i=0;i<cur_node->stmts.size();i++){
		int type=cur_node->stmts[i]->getID();
		switch(type){
		case STMT:
			std::cout<<"[DEBUG] STATEMENT {"<<keyword_to_str(cur_node->stmts[i]->cmd);
			if(cur_node->stmts[i]->cmd==TOK_PUSH)
				std::cout<<", "<<cur_node->stmts[i]->val<<"}\n";
			else if(cur_node->stmts[i]->cmd==TOK_IN || cur_node->stmts[i]->cmd==TOK_OUT)
				std::cout<<", "<<keyword_to_str(cur_node->stmts[i]->io_type)<<"}\n";
			else if(cur_node->stmts[i]->cmd==TOK_CALL)
				std::cout<<", "<<cur_node->stmts[i]->id<<"}\n";
			else
				std::cout<<"}\n";
			break;
		case PROC:{
			std::cout<<"[DEBUG] PROCEDURE {"<<cur_node->stmts[i]->id<<"}\n";
			NStatementList *prev=cur_node;
			cur_node=&(((NProcedure*)cur_node->stmts[i])->block);
			print_ast();
			cur_node=prev;
			std::cout<<"[DEBUG] END OF PROCEDURE\n";
			break;}
		default: break;
		}
	}
	std::cout<<"[DEBUG] END STATEMENT LIST\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq 0x90d6(%rip), %rdi      # 0xdfd8
leaq 0x420b(%rip), %rsi      # 0x9114
callq 0x21d0
movl $0x0, -0x4(%rbp)
movslq -0x4(%rbp), %rax
movq %rax, -0x68(%rbp)
movq 0x930c(%rip), %rdi      # 0xe230
addq $0x8, %rdi
callq 0x5fe0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x527a
movq 0x92ec(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x6c(%rbp)
subl $-0x3, %eax
je 0x51c6
jmp 0x4f71
movl -0x6c(%rbp), %eax
subl $-0x2, %eax
jne 0x5268
jmp 0x4f7f
movq 0x9052(%rip), %rdi      # 0xdfd8
leaq 0x41a5(%rip), %rsi      # 0x9132
callq 0x21d0
movq %rax, -0x80(%rbp)
movq 0x9293(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
movl 0x8(%rax), %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x47c0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x21a0
jmp 0x4fcc
leaq -0x28(%rbp), %rdi
callq 0x2120
movq 0x9254(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
cmpl $0x3, 0x8(%rax)
jne 0x5060
movq 0x8fdf(%rip), %rdi      # 0xdfd8
leaq 0x4146(%rip), %rsi      # 0x9146
callq 0x21d0
movq %rax, -0x88(%rbp)
movq 0x921d(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq -0x88(%rbp), %rdi
movq (%rax), %rax
movl 0x10(%rax), %esi
callq 0x22d0
movq %rax, %rdi
leaq 0x410d(%rip), %rsi      # 0x9149
callq 0x21d0
jmp 0x51c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x2120
jmp 0x5296
movq 0x91c9(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
cmpl $0x10, 0x8(%rax)
je 0x509e
movq 0x91ac(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
cmpl $0x11, 0x8(%rax)
jne 0x513b
movq 0x8f33(%rip), %rdi      # 0xdfd8
leaq 0x409a(%rip), %rsi      # 0x9146
callq 0x21d0
movq %rax, -0xa0(%rbp)
movq 0x9171(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
movl 0xc(%rax), %esi
leaq -0x58(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x47c0
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x21a0
movq %rax, -0x90(%rbp)
jmp 0x50fe
movq -0x90(%rbp), %rdi
leaq 0x403d(%rip), %rsi      # 0x9149
callq 0x21d0
jmp 0x5113
leaq -0x58(%rbp), %rdi
callq 0x2120
jmp 0x51bf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x2120
jmp 0x5296
movq 0x90ee(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
cmpl $0x14, 0x8(%rax)
jne 0x51aa
movq 0x8e79(%rip), %rdi      # 0xdfd8
leaq 0x3fe0(%rip), %rsi      # 0x9146
callq 0x21d0
movq %rax, -0xa8(%rbp)
movq 0x90b7(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq -0xa8(%rbp), %rdi
movq (%rax), %rsi
addq $0x18, %rsi
callq 0x21a0
movq %rax, %rdi
leaq 0x3fa6(%rip), %rsi      # 0x9149
callq 0x21d0
jmp 0x51bd
movq 0x8e27(%rip), %rdi      # 0xdfd8
leaq 0x3f91(%rip), %rsi      # 0x9149
callq 0x21d0
jmp 0x51bf
jmp 0x51c1
jmp 0x526a
movq 0x8e0b(%rip), %rdi      # 0xdfd8
leaq 0x3f78(%rip), %rsi      # 0x914c
callq 0x21d0
movq %rax, -0xb0(%rbp)
movq 0x9049(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq -0xb0(%rbp), %rdi
movq (%rax), %rsi
addq $0x18, %rsi
callq 0x21a0
movq %rax, %rdi
leaq 0x3f38(%rip), %rsi      # 0x9149
callq 0x21d0
movq 0x9013(%rip), %rax      # 0xe230
movq %rax, -0x60(%rbp)
movq 0x9008(%rip), %rdi      # 0xe230
addq $0x8, %rdi
movslq -0x4(%rbp), %rsi
callq 0x6000
movq (%rax), %rax
addq $0x58, %rax
movq %rax, 0x8fed(%rip)      # 0xe230
callq 0x4ef0
movq -0x60(%rbp), %rax
movq %rax, 0x8fdd(%rip)      # 0xe230
movq 0x8d7e(%rip), %rdi      # 0xdfd8
leaq 0x3eff(%rip), %rsi      # 0x9160
callq 0x21d0
jmp 0x526a
jmp 0x526a
jmp 0x526c
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x4f15
movq 0x8d57(%rip), %rdi      # 0xdfd8
leaq 0x3ef2(%rip), %rsi      # 0x917a
callq 0x21d0
addq $0xb0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x22e0
nop