// File: AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::declareRunTime()
void Parser::declareRunTime(){
	//Procedure to be added to the symbol tables
	scopeValue procVal;
	procVal.size = 0;
	procVal.type = TYPE_PROCEDURE;
	procVal.paramType = TYPE_PARAM_NULL;
	
	// input / output parameter of the runtime procedure
	scopeValue inputVal;
	inputVal.arguments.clear();
	
	string IDs[10] = {"GETBOOL", "GETINTEGER", "GETFLOAT", "GETSTRING", "GETCHAR", "PUTBOOL", "PUTINTEGER", "PUTFLOAT", "PUTSTRING", "PUTCHAR"};
	int ParamTypes[10] = {TYPE_PARAM_OUT, TYPE_PARAM_OUT, TYPE_PARAM_OUT, TYPE_PARAM_OUT, TYPE_PARAM_OUT, TYPE_PARAM_IN, TYPE_PARAM_IN, TYPE_PARAM_IN, TYPE_PARAM_IN, TYPE_PARAM_IN};
	int Types[10] = {TYPE_BOOL, TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_CHAR, TYPE_BOOL, TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_CHAR};

	for(int i = 0; i < 10; i++){
		//clear parameter list
		procVal.arguments.clear();
		
		inputVal.size = 0;

		//get new parameter values
		inputVal.type = Types[i];
		inputVal.paramType = ParamTypes[i];
		
		//start new parameter list
		procVal.arguments.push_back(inputVal);
		
		//add procedure as a global symbol to the outermost scope
		string symbolID = IDs[i];
		procVal.CallLabel = IDs[i];
		Scopes->addSymbol(symbolID, procVal, true);
	}
	return;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x308(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x126b0
movl $0x0, -0x4c(%rbp)
movl $0x11e, -0x50(%rbp)     # imm = 0x11E
movl $0x122, -0x10(%rbp)     # imm = 0x122
leaq -0x98(%rbp), %rdi
callq 0x126b0
leaq -0x90(%rbp), %rdi
callq 0x126e0
movb $0x1, -0x206(%rbp)
leaq -0x1e0(%rbp), %rax
movq %rax, -0x300(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x1e9(%rbp), %rdi
movq %rdi, -0x2f8(%rbp)
callq 0x3430
movq -0x300(%rbp), %rdi
movq -0x2f8(%rbp), %rdx
leaq 0x1bf1d(%rip), %rsi     # 0x25561
callq 0x62d0
jmp 0x964b
leaq -0x1c0(%rbp), %rax
movq %rax, -0x318(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x1fd(%rbp), %rdi
movq %rdi, -0x310(%rbp)
callq 0x3430
movq -0x318(%rbp), %rdi
movq -0x310(%rbp), %rdx
leaq 0x1bee1(%rip), %rsi     # 0x25569
callq 0x62d0
jmp 0x968f
leaq -0x1a0(%rbp), %rax
movq %rax, -0x328(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x1fe(%rbp), %rdi
movq %rdi, -0x320(%rbp)
callq 0x3430
movq -0x328(%rbp), %rdi
movq -0x320(%rbp), %rdx
leaq 0x1bea8(%rip), %rsi     # 0x25574
callq 0x62d0
jmp 0x96d3
leaq -0x180(%rbp), %rax
movq %rax, -0x338(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x1ff(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x3430
movq -0x338(%rbp), %rdi
movq -0x330(%rbp), %rdx
leaq 0x1be6d(%rip), %rsi     # 0x2557d
callq 0x62d0
jmp 0x9717
leaq -0x160(%rbp), %rax
movq %rax, -0x348(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x200(%rbp), %rdi
movq %rdi, -0x340(%rbp)
callq 0x3430
movq -0x348(%rbp), %rdi
movq -0x340(%rbp), %rdx
leaq 0x1be33(%rip), %rsi     # 0x25587
callq 0x62d0
jmp 0x975b
leaq -0x140(%rbp), %rax
movq %rax, -0x358(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x201(%rbp), %rdi
movq %rdi, -0x350(%rbp)
callq 0x3430
movq -0x358(%rbp), %rdi
movq -0x350(%rbp), %rdx
leaq 0x1bdf7(%rip), %rsi     # 0x2558f
callq 0x62d0
jmp 0x979f
leaq -0x120(%rbp), %rax
movq %rax, -0x368(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x202(%rbp), %rdi
movq %rdi, -0x360(%rbp)
callq 0x3430
movq -0x368(%rbp), %rdi
movq -0x360(%rbp), %rdx
leaq 0x1bdbb(%rip), %rsi     # 0x25597
callq 0x62d0
jmp 0x97e3
leaq -0x100(%rbp), %rax
movq %rax, -0x378(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x203(%rbp), %rdi
movq %rdi, -0x370(%rbp)
callq 0x3430
movq -0x378(%rbp), %rdi
movq -0x370(%rbp), %rdx
leaq 0x1bd82(%rip), %rsi     # 0x255a2
callq 0x62d0
jmp 0x9827
leaq -0xe0(%rbp), %rax
movq %rax, -0x388(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x204(%rbp), %rdi
movq %rdi, -0x380(%rbp)
callq 0x3430
movq -0x388(%rbp), %rdi
movq -0x380(%rbp), %rdx
leaq 0x1bd47(%rip), %rsi     # 0x255ab
callq 0x62d0
jmp 0x986b
leaq -0xc0(%rbp), %rax
movq %rax, -0x398(%rbp)
movq %rax, -0x1e8(%rbp)
leaq -0x205(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x3430
movq -0x398(%rbp), %rdi
movq -0x390(%rbp), %rdx
leaq 0x1bd0d(%rip), %rsi     # 0x255b5
callq 0x62d0
jmp 0x98af
movb $0x0, -0x206(%rbp)
leaq -0x205(%rbp), %rdi
callq 0x32e0
leaq -0x204(%rbp), %rdi
callq 0x32e0
leaq -0x203(%rbp), %rdi
callq 0x32e0
leaq -0x202(%rbp), %rdi
callq 0x32e0
leaq -0x201(%rbp), %rdi
callq 0x32e0
leaq -0x200(%rbp), %rdi
callq 0x32e0
leaq -0x1ff(%rbp), %rdi
callq 0x32e0
leaq -0x1fe(%rbp), %rdi
callq 0x32e0
leaq -0x1fd(%rbp), %rdi
callq 0x32e0
leaq -0x1e9(%rbp), %rdi
callq 0x32e0
leaq -0x230(%rbp), %rdi
leaq 0x1d0f4(%rip), %rsi     # 0x26a30
movl $0x28, %edx
callq 0x3220
leaq -0x260(%rbp), %rdi
leaq 0x1d10c(%rip), %rsi     # 0x26a60
movl $0x28, %edx
callq 0x3220
movl $0x0, -0x264(%rbp)
cmpl $0xa, -0x264(%rbp)
jge 0x9cbe
leaq -0x48(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x126e0
movq -0x3a0(%rbp), %rdi
movl $0x0, -0x94(%rbp)
movslq -0x264(%rbp), %rax
movl -0x260(%rbp,%rax,4), %eax
movl %eax, -0x98(%rbp)
movslq -0x264(%rbp), %rax
movl -0x230(%rbp,%rax,4), %eax
movl %eax, -0x58(%rbp)
leaq -0x98(%rbp), %rsi
callq 0x12700
jmp 0x99c9
movslq -0x264(%rbp), %rax
shlq $0x5, %rax
leaq -0x1e0(%rbp,%rax), %rsi
leaq -0x288(%rbp), %rdi
callq 0x3130
jmp 0x99ea
movslq -0x264(%rbp), %rax
shlq $0x5, %rax
leaq -0x1e0(%rbp,%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x3050
jmp 0x9a08
movq -0x308(%rbp), %rax
movq 0x90(%rax), %rax
movq %rax, -0x3a8(%rbp)
leaq -0x2a8(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x3130
jmp 0x9a32
leaq -0x2f0(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x12770
jmp 0x9a44
movq -0x3a8(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
leaq -0x2f0(%rbp), %rdx
movl $0x1, %ecx
callq 0x183f0
jmp 0x9a65
leaq -0x2f0(%rbp), %rdi
callq 0x12800
leaq -0x2a8(%rbp), %rdi
callq 0x31a0
leaq -0x288(%rbp), %rdi
callq 0x31a0
movl -0x264(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x264(%rbp)
jmp 0x9968
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9bde
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9bd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9bc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9bba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9bae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9ba2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9b96
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9b8a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9b7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
leaq -0x205(%rbp), %rdi
callq 0x32e0
leaq -0x204(%rbp), %rdi
callq 0x32e0
leaq -0x203(%rbp), %rdi
callq 0x32e0
leaq -0x202(%rbp), %rdi
callq 0x32e0
leaq -0x201(%rbp), %rdi
callq 0x32e0
leaq -0x200(%rbp), %rdi
callq 0x32e0
leaq -0x1ff(%rbp), %rdi
callq 0x32e0
leaq -0x1fe(%rbp), %rdi
callq 0x32e0
leaq -0x1fd(%rbp), %rdi
callq 0x32e0
leaq -0x1e9(%rbp), %rdi
callq 0x32e0
testb $0x1, -0x206(%rbp)
jne 0x9bf5
jmp 0x9c42
movq -0x1e8(%rbp), %rax
leaq -0x1e0(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x3b0(%rbp)
je 0x9c40
movq -0x3b0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x31a0
movq -0x3b8(%rbp), %rax
leaq -0x1e0(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x3b0(%rbp)
jne 0x9c0f
jmp 0x9c42
jmp 0x9d76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9d28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9cb0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
jmp 0x9ca4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f8(%rbp)
movl %eax, -0x1fc(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x12800
leaq -0x2a8(%rbp), %rdi
callq 0x31a0
leaq -0x288(%rbp), %rdi
callq 0x31a0
jmp 0x9d28
leaq -0x1e0(%rbp), %rax
movq %rax, -0x3c8(%rbp)
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x3c0(%rbp)
movq -0x3c0(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x31a0
movq -0x3c8(%rbp), %rcx
movq -0x3d0(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x3c0(%rbp)
jne 0x9cd9
leaq -0x98(%rbp), %rdi
callq 0x12800
leaq -0x50(%rbp), %rdi
callq 0x12800
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
leaq -0x1e0(%rbp), %rax
movq %rax, -0x3e0(%rbp)
addq $0x140, %rax            # imm = 0x140
movq %rax, -0x3d8(%rbp)
movq -0x3d8(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x31a0
movq -0x3e0(%rbp), %rcx
movq -0x3e8(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x3d8(%rbp)
jne 0x9d43
jmp 0x9d76
leaq -0x98(%rbp), %rdi
callq 0x12800
leaq -0x50(%rbp), %rdi
callq 0x12800
movq -0x1f8(%rbp), %rdi
callq 0x3420
nopw (%rax,%rax)