// File: /workspace/github_cpp_makefile_star2_O2/ssubrandon[P]460Project2/SyntacticalAnalyzer.cpp
// Function: SyntacticalAnalyzer::program()
int SyntacticalAnalyzer::program(){
  //This is the program function and is also rule one of our language this will check for
  //correct syntax and send the program off to the next rule using recursion.

	ruleFile  << "Entering Program function; current token is: " << lex ->GetTokenName (token) << ", lexeme: " << lex->GetLexeme() <<  endl; 
	int errors = 0;
	ruleFile << "Using Rule 1" << endl;

	if(token != LPAREN_T){
		errors++;
		ReportError(string("expected a LPAREN_T, currently in program, but found  " + lex->GetTokenName(token)));
	}
	token = lex->GetToken();

	errors += define();

	if(token != LPAREN_T){
		errors++;
		ReportError(string("expected a LPAREN_T in program, but found  " + lex->GetTokenName(token)));
	}

	token = lex->GetToken();
	errors += more_defines();
	if (token != EOF_T) {
		errors ++;		
		ReportError(string("expected a EOF_T in program, but found  " + lex->GetTokenName(token)));
	} // end of if EOF
	ruleFile << "Exiting Program function; current token is: " << lex ->GetTokenName (token) << endl;

	return errors;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
leaq 0x420(%rdi), %r14
leaq 0x42ee(%rip), %rsi      # 0x88c2
movq %r14, %rdi
callq 0x21f0
movq %rax, %r15
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
leaq -0x40(%rbp), %r12
movq %r12, %rdi
callq 0x3df8
movq %r15, %rdi
movq %r12, %rsi
callq 0x21d0
leaq 0x42ec(%rip), %rsi      # 0x88f0
movq %rax, %rdi
callq 0x21f0
movq %rax, %r15
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %rdi
callq 0x3e22
leaq -0x60(%rbp), %rsi
movq %r15, %rdi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
leaq -0x60(%rbp), %rdi
callq 0x2398
leaq -0x40(%rbp), %rdi
callq 0x2398
leaq 0x42b2(%rip), %rsi      # 0x88fb
movq %r14, %rdi
callq 0x21f0
movq %rax, %rdi
callq 0x2130
movl 0x10(%rbx), %edx
xorl %r15d, %r15d
cmpl $0x1f, %edx
je 0x46a9
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0x3df8
leaq 0x428d(%rip), %rsi      # 0x8908
leaq -0x40(%rbp), %rdi
movq %r15, %rdx
callq 0x76ba
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x48e6
leaq -0x40(%rbp), %rdi
callq 0x2398
leaq -0x60(%rbp), %rdi
callq 0x2398
pushq $0x1
popq %r15
movq 0x8(%rbx), %rdi
callq 0x35fa
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x49e2
movl %eax, %r12d
addl %r15d, %r12d
movl 0x10(%rbx), %edx
cmpl $0x1f, %edx
je 0x470f
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %r15
movq %r15, %rdi
callq 0x3df8
leaq 0x425d(%rip), %rsi      # 0x893f
leaq -0x40(%rbp), %rdi
movq %r15, %rdx
callq 0x76ba
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x48e6
incl %r12d
leaq -0x40(%rbp), %rdi
callq 0x2398
leaq -0x60(%rbp), %rdi
callq 0x2398
movq 0x8(%rbx), %rdi
callq 0x35fa
movl %eax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x4d1a
movl %eax, %r15d
addl %r12d, %r15d
movl 0x10(%rbx), %edx
cmpl $0x23, %edx
je 0x4775
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %r12
movq %r12, %rdi
callq 0x3df8
leaq 0x4223(%rip), %rsi      # 0x896b
leaq -0x40(%rbp), %rdi
movq %r12, %rdx
callq 0x76ba
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x48e6
incl %r15d
leaq -0x40(%rbp), %rdi
callq 0x2398
leaq -0x60(%rbp), %rdi
callq 0x2398
leaq 0x4218(%rip), %rsi      # 0x8994
movq %r14, %rdi
callq 0x21f0
movq %rax, %r14
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %edx
leaq -0x40(%rbp), %rbx
movq %rbx, %rdi
callq 0x3df8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x21d0
movq %rax, %rdi
callq 0x2130
leaq -0x40(%rbp), %rdi
callq 0x2398
movl %r15d, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x47ce
jmp 0x47dc
jmp 0x47ce
jmp 0x47dc
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2398
jmp 0x47df
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
jmp 0x47fe
jmp 0x47f7
jmp 0x47f7
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2398
jmp 0x47fa
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2398
movq %rbx, %rdi
callq 0x2330
nop