// File: ssubrandon[P]460Project2/SyntacticalAnalyzer.cpp
// Function: SyntacticalAnalyzer::param_list()
int SyntacticalAnalyzer::param_list(){
  //This function deals with the param_list rules (16-17) and will check for syntactical correctness,
  //this function will then, depending on the token seen, send the program to param_list or return.
  ruleFile << "Entering param_list function; Current token is: " << lex ->GetTokenName(token) << ", lexeme: " << lex->GetLexeme() << endl;

	int errors = 0;

	if(token == RPAREN_T) {
		ruleFile << "Using Rule 17" << endl;    
		ruleFile << "Exiting param_list function; current token is: " << lex ->GetTokenName (token) << endl;
		return errors;
	}
	else if (token == IDENT_T){
	  ruleFile << "Using Rule 16" << endl;
	  token = lex->GetToken();
	  errors += param_list();
	  ruleFile << "Exiting param_list function; current token is: " << lex ->GetTokenName (token) << endl;
	  return errors;
	}
	else{//we have an error
	  errors++;
		ReportError(string("expected a IDENT_T or RPAREN_T in paramList, but found  " + lex->GetTokenName(token)));
		ruleFile << "Exiting param_list function; current token is: " << lex ->GetTokenName (token) << endl;
		return errors;
	}
	ruleFile << "Exiting param_list function; current token is: " << lex ->GetTokenName (token) << endl;
	return errors;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x128(%rbp)
addq $0x420, %rdi            # imm = 0x420
leaq 0x6871(%rip), %rsi      # 0x10b09
callq 0x3270
movq %rax, %rcx
movq -0x128(%rbp), %rax
movq %rcx, -0x120(%rbp)
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
leaq -0x30(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x6f40
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rsi
callq 0x3240
movq %rax, -0x110(%rbp)
jmp 0xa2e1
movq -0x110(%rbp), %rdi
leaq 0x6165(%rip), %rsi      # 0x10454
callq 0x3270
movq %rax, -0x130(%rbp)
jmp 0xa2fd
movq -0x128(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x60(%rbp), %rdi
callq 0x6f80
jmp 0xa313
movq -0x130(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x3240
movq %rax, -0x138(%rbp)
jmp 0xa32c
movq -0x138(%rbp), %rdi
movq 0xac86(%rip), %rsi      # 0x14fc0
callq 0x32c0
jmp 0xa341
leaq -0x60(%rbp), %rdi
callq 0x34b8
leaq -0x30(%rbp), %rdi
callq 0x34b8
movq -0x128(%rbp), %rax
movl $0x0, -0x64(%rbp)
cmpl $0x20, 0x10(%rax)
jne 0xa46f
movq -0x128(%rbp), %rdi
addq $0x420, %rdi            # imm = 0x420
movq %rdi, -0x158(%rbp)
leaq 0x67b3(%rip), %rsi      # 0x10b3a
callq 0x3270
movq %rax, %rdi
movq 0xac2a(%rip), %rsi      # 0x14fc0
callq 0x32c0
movq -0x158(%rbp), %rdi
leaq 0x679f(%rip), %rsi      # 0x10b48
callq 0x3270
movq %rax, %rcx
movq -0x128(%rbp), %rax
movq %rcx, -0x150(%rbp)
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
leaq -0x88(%rbp), %rdi
movq %rdi, -0x148(%rbp)
callq 0x6f40
movq -0x150(%rbp), %rdi
movq -0x148(%rbp), %rsi
callq 0x3240
movq %rax, -0x140(%rbp)
jmp 0xa3f5
movq -0x140(%rbp), %rdi
movq 0xabbd(%rip), %rsi      # 0x14fc0
callq 0x32c0
jmp 0xa40a
leaq -0x88(%rbp), %rdi
callq 0x34b8
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa6c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa444
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x34b8
leaq -0x30(%rbp), %rdi
callq 0x34b8
jmp 0xa6d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x34b8
jmp 0xa6d2
movq -0x128(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0xa57c
movq -0x128(%rbp), %rdi
addq $0x420, %rdi            # imm = 0x420
movq %rdi, -0x178(%rbp)
leaq 0x66dc(%rip), %rsi      # 0x10b78
callq 0x3270
movq %rax, %rdi
movq 0xab15(%rip), %rsi      # 0x14fc0
callq 0x32c0
movq -0x128(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5fd0
movq -0x128(%rbp), %rdi
movl %eax, 0x10(%rdi)
callq 0xa270
movq -0x178(%rbp), %rdi
movl %eax, %ecx
movl -0x64(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x64(%rbp)
leaq 0x6661(%rip), %rsi      # 0x10b48
callq 0x3270
movq %rax, %rcx
movq -0x128(%rbp), %rax
movq %rcx, -0x170(%rbp)
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x6f40
movq -0x170(%rbp), %rdi
movq -0x168(%rbp), %rsi
callq 0x3240
movq %rax, -0x160(%rbp)
jmp 0xa533
movq -0x160(%rbp), %rdi
movq 0xaa7f(%rip), %rsi      # 0x14fc0
callq 0x32c0
jmp 0xa548
leaq -0xa8(%rbp), %rdi
callq 0x34b8
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa6c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x34b8
jmp 0xa6d2
movq -0x128(%rbp), %rax
movl -0x64(%rbp), %ecx
incl %ecx
movl %ecx, -0x64(%rbp)
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x180(%rbp)
callq 0x6f40
movq -0x180(%rbp), %rdx
leaq 0x65d3(%rip), %rsi      # 0x10b86
leaq -0xc8(%rbp), %rdi
callq 0xf1b0
jmp 0xa5c1
movq -0x128(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x91a0
jmp 0xa5d6
leaq -0xc8(%rbp), %rdi
callq 0x34b8
leaq -0xe8(%rbp), %rdi
callq 0x34b8
movq -0x128(%rbp), %rdi
addq $0x420, %rdi            # imm = 0x420
leaq 0x6545(%rip), %rsi      # 0x10b48
callq 0x3270
movq %rax, %rcx
movq -0x128(%rbp), %rax
movq %rcx, -0x198(%rbp)
movq 0x8(%rax), %rsi
movl 0x10(%rax), %edx
leaq -0x108(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x6f40
movq -0x198(%rbp), %rdi
movq -0x190(%rbp), %rsi
callq 0x3240
movq %rax, -0x188(%rbp)
jmp 0xa64f
movq -0x188(%rbp), %rdi
movq 0xa963(%rip), %rsi      # 0x14fc0
callq 0x32c0
jmp 0xa664
leaq -0x108(%rbp), %rdi
callq 0x34b8
movl -0x64(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa6c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xa69e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x34b8
leaq -0xe8(%rbp), %rdi
callq 0x34b8
jmp 0xa6d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x34b8
jmp 0xa6d2
movl -0x4(%rbp), %eax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3430
nopl (%rax,%rax)