// File: /workspace/github_cpp_makefile_star2_O2/Danis98[P]PietGen/parse.cpp
// Function: parse_stmt()
void parse_stmt(){
	token t=get_tok();
	NStatement *stmt=new NStatement;
	stmt->cmd=keyword_map[t];
	if(keyword_map[t]==TOK_PROC){
		stmt=new NProcedure;
		if(nested) parse_error("Procedures cannot be nested");
		NStatementList *prev_node=cur_node;
		token id=get_tok();
		if(keyword_map[id]!=TOK_INVALID)
			parse_error("Keywords are not permitted as procedure IDs: "
					+id+" used\n");
		nested=true;
		cur_node=&(((NProcedure*)stmt)->block);
		parse_stmt_list();
		cur_node=prev_node;
		nested=false;
		token end=get_tok();
		if(keyword_map[end]!=TOK_END)
			parse_error("Procedures must be ended with the end keyword");
	}
	else if(keyword_map[t]==TOK_PUSH){
		token v=get_tok();
		int val=to_num(v);
		if(val==-1) parse_error("Only integers can be pushed into the stack: "
					+v+" pushed instead");
		stmt->val=val;
	}
	else if(keyword_map[t]==TOK_IN){
		token io=get_tok();
		if(keyword_map[io]!=TOK_INT && keyword_map[io]!=TOK_CHAR)
			parse_error("Wrong token: "+io);
		stmt->io_type=keyword_map[io];}
	else if(keyword_map[t]==TOK_OUT){
		token io=get_tok();
		if(keyword_map[io]!=TOK_INT && keyword_map[io]!=TOK_CHAR)
			parse_error("Wrong token: "+io);
		stmt->io_type=keyword_map[io];
	}
	else if(keyword_map[t]==TOK_CALL){
		token id=get_tok();
		if(keyword_map[id]!=TOK_INVALID)
			parse_error("Keywords are not permitted as procedure IDs: "
					+id+" used\n");
		stmt->id=id;
	}
	
	cur_node->stmts.push_back(stmt);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
leaq -0x88(%rbp), %rdi
callq 0x2fd4
pushq $0x38
popq %rdi
callq 0x2190
movq %rax, %rbx
leaq 0x49cd(%rip), %rax      # 0x7d48
movq %rax, (%rbx)
leaq 0x28(%rbx), %rax
movq %rax, 0x18(%rbx)
andq $0x0, 0x20(%rbx)
movb $0x0, 0x28(%rbx)
movq %rbx, -0x68(%rbp)
leaq 0x4e16(%rip), %rdi      # 0x81b0
leaq -0x88(%rbp), %rsi
callq 0x3a38
movl (%rax), %eax
movl %eax, 0x8(%rbx)
leaq 0x4dfe(%rip), %rdi      # 0x81b0
leaq -0x88(%rbp), %rsi
callq 0x3a38
cmpl $0x1, (%rax)
jne 0x3469
pushq $0x78
popq %rdi
callq 0x2190
movq %rax, %rbx
movq %rax, %rdi
callq 0x3aa2
movq %rbx, -0x68(%rbp)
cmpb $0x1, 0x4e07(%rip)      # 0x81ec
je 0x3616
movq 0x4dee(%rip), %r14      # 0x81e0
leaq -0x40(%rbp), %rdi
callq 0x2fd4
leaq 0x4dae(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
cmpl $0x0, (%rax)
jne 0x3639
movb $0x1, 0x4dd1(%rip)      # 0x81ec
addq $0x58, %rbx
movq %rbx, 0x4dba(%rip)      # 0x81e0
callq 0x37f7
movq %r14, 0x4dae(%rip)      # 0x81e0
movb $0x0, 0x4db3(%rip)      # 0x81ec
leaq -0x60(%rbp), %rdi
callq 0x2fd4
leaq 0x4d67(%rip), %rdi      # 0x81b0
leaq -0x60(%rbp), %rsi
callq 0x3a38
cmpl $0x2, (%rax)
jne 0x3670
leaq -0x60(%rbp), %rdi
callq 0x20d0
jmp 0x3590
leaq 0x4d40(%rip), %rdi      # 0x81b0
leaq -0x88(%rbp), %rsi
callq 0x3a38
cmpl $0x3, (%rax)
jne 0x34c7
leaq -0x40(%rbp), %rdi
callq 0x2fd4
leaq -0x188(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x21d0
leaq -0x188(%rbp), %r15
movq %r15, %rdi
callq 0x2f6d
movl %eax, %r14d
movq %r15, %rdi
callq 0x20d0
cmpl $-0x1, %r14d
je 0x3693
movl %r14d, 0x10(%rbx)
jmp 0x3590
leaq 0x4ce2(%rip), %rdi      # 0x81b0
leaq -0x88(%rbp), %rsi
callq 0x3a38
cmpl $0x10, (%rax)
jne 0x3528
leaq -0x40(%rbp), %rdi
callq 0x2fd4
leaq 0x4cc1(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
cmpl $0x12, (%rax)
je 0x3516
leaq 0x4cac(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
cmpl $0x13, (%rax)
jne 0x36ca
leaq 0x4c93(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
jmp 0x358b
leaq 0x4c81(%rip), %rdi      # 0x81b0
leaq -0x88(%rbp), %rsi
callq 0x3a38
cmpl $0x11, (%rax)
jne 0x35c7
leaq -0x40(%rbp), %rdi
callq 0x2fd4
leaq 0x4c5c(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
cmpl $0x12, (%rax)
je 0x357b
leaq 0x4c47(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
cmpl $0x13, (%rax)
jne 0x36ed
leaq 0x4c2e(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
movl (%rax), %eax
movl %eax, 0xc(%rbx)
leaq -0x40(%rbp), %rdi
callq 0x20d0
movq 0x4c40(%rip), %rdi      # 0x81e0
addq $0x8, %rdi
leaq -0x68(%rbp), %rsi
callq 0x3b8a
leaq -0x88(%rbp), %rdi
callq 0x20d0
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4be2(%rip), %rdi      # 0x81b0
leaq -0x88(%rbp), %rsi
callq 0x3a38
cmpl $0x14, (%rax)
jne 0x3599
leaq -0x40(%rbp), %rdi
callq 0x2fd4
leaq 0x4bc1(%rip), %rdi      # 0x81b0
leaq -0x40(%rbp), %rsi
callq 0x3a38
cmpl $0x0, (%rax)
jne 0x3710
addq $0x18, %rbx
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x20f0
jmp 0x3590
leaq 0x1b79(%rip), %rsi      # 0x5196
leaq -0x168(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x20a0
leaq -0x168(%rbp), %rdi
callq 0x2a88
leaq 0x1b72(%rip), %rsi      # 0x51b2
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3b14
leaq 0x1b8c(%rip), %rdx      # 0x51e0
leaq -0x148(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3aeb
leaq -0x148(%rbp), %rdi
callq 0x2a88
leaq 0x1b70(%rip), %rsi      # 0x51e7
leaq -0x128(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x20a0
leaq -0x128(%rbp), %rdi
callq 0x2a88
leaq 0x1b7b(%rip), %rsi      # 0x5215
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3b14
leaq 0x1b94(%rip), %rdx      # 0x5242
leaq -0x108(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3aeb
leaq -0x108(%rbp), %rdi
callq 0x2a88
leaq 0x1b81(%rip), %rsi      # 0x5252
leaq -0xe8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3b14
leaq -0xe8(%rbp), %rdi
callq 0x2a88
leaq 0x1b5e(%rip), %rsi      # 0x5252
leaq -0xc8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3b14
leaq -0xc8(%rbp), %rdi
callq 0x2a88
leaq 0x1a9b(%rip), %rsi      # 0x51b2
leaq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x3b14
leaq 0x1ab5(%rip), %rdx      # 0x51e0
leaq -0xa8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3aeb
leaq -0xa8(%rbp), %rdi
callq 0x2a88
movq %rax, %rbx
leaq -0xa8(%rbp), %rdi
jmp 0x37a1
jmp 0x37c0
movq %rax, %rbx
leaq -0xc8(%rbp), %rdi
jmp 0x37c7
jmp 0x37d2
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
jmp 0x37c7
jmp 0x37e0
jmp 0x37d2
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
jmp 0x37a1
jmp 0x37c0
jmp 0x37e0
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
jmp 0x37a1
jmp 0x37c0
jmp 0x37d2
jmp 0x37e0
jmp 0x37d2
movq %rax, %rbx
leaq -0x128(%rbp), %rdi
callq 0x20d0
jmp 0x37c3
jmp 0x37c0
jmp 0x37d2
jmp 0x37d2
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
jmp 0x37d9
jmp 0x37e0
jmp 0x37e0
jmp 0x37d2
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20d0
jmp 0x37d5
jmp 0x37d2
jmp 0x37e0
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x37e3
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2250