// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::TermPrime(int&, int&, bool, bool)
bool Parser::TermPrime(int &inputType, int &inputSize, bool catchTypeError, bool catchSizeError){
	//Next factor type and size.
	int factorType, factorSize;
	
	//get term op to pass to the code generator
	string op = token->ascii;
	
	//Check for '*' or '/' token, otherwise return false ('null').
	if( CheckToken(T_MULTIPLY) );
	else if( CheckToken(T_DIVIDE) );
	else return false;
	
	//Get next factor, otherwise report missing factor error.
	if( Factor(factorType, factorSize) ){
		//Ensure both factors are numbers for arithmetic operators.
		if( !isNumber(inputType) || !isNumber(factorType) ){
			ReportError("Only integer and float factors are defined for arithmetic operations in term.");
			catchTypeError = false;
		}
		if( (inputSize != factorSize) && ( (inputSize != 0) && (factorSize != 0) ) ){
			ReportError("Expected factor of size " + to_string(inputSize) + ", but found one of size " + to_string(factorSize) + ".");
			catchSizeError = false;
		}
		else if(factorSize != 0) inputSize = factorSize;
	}
	else{
		ReportError("Expected factor after arithmetic operator in term.");
		catchTypeError = false;
		catchSizeError = false;
	}
	TermPrime(inputType, inputSize, catchTypeError, catchSizeError);
	
	//evaluate term and push to the code generator expression stack
	generator->evalExpr( op, inputSize, factorSize, inputType, factorType );
	
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %r8d, %r13d
movl %ecx, %r12d
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x80(%rdi), %rax
leaq 0x98(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x3bac
movq %r15, %rdi
movl $0x131, %esi            # imm = 0x131
callq 0x5c08
testb %al, %al
jne 0xc780
movq %r15, %rdi
movl $0x130, %esi            # imm = 0x130
callq 0x5c08
testb %al, %al
je 0xc91d
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0xc482
testb %al, %al
je 0xc8a1
movq %rbx, 0x20(%rsp)
movl (%rbx), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
jne 0xc7b9
movl 0x1c(%rsp), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
je 0xc811
leaq 0x158(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xdd21(%rip), %rsi      # 0x1a4ee
leaq 0xdd67(%rip), %rdx      # 0x1a53b
leaq 0x148(%rsp), %rdi
callq 0x3c42
leaq 0x148(%rsp), %rsi
movq %r15, %rdi
callq 0x5694
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0xc80e
movq 0x158(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %r12d, %r12d
movl %r12d, 0x14(%rsp)
movl (%r14), %ebp
movl 0x18(%rsp), %r12d
cmpl %r12d, %ebp
je 0xc903
testq %rbp, %rbp
sete %al
testl %r12d, %r12d
sete %cl
orb %al, %cl
jne 0xc903
movl %ebp, %r13d
negl %r13d
cmovsl %ebp, %r13d
movl $0x1, %ebx
cmpl $0xa, %r13d
jb 0xc92b
movl $0x4, %ebx
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0xc924
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xc929
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xc92b
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebx
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xc861
addl $-0x3, %ebx
jmp 0xc92b
leaq 0x138(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xdca0(%rip), %rsi      # 0x1a555
leaq 0xdccb(%rip), %rdx      # 0x1a587
leaq 0x128(%rsp), %rdi
callq 0x3c42
leaq 0x128(%rsp), %rsi
movq %r15, %rdi
callq 0x5694
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0xc8f6
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %eax, %eax
xorl %r13d, %r13d
movq %rbx, %r12
jmp 0xcc99
testl %r12d, %r12d
leaq 0x98(%rsp), %rbp
je 0xc913
movl %r12d, (%r14)
movq 0x20(%rsp), %r12
jmp 0xcc95
xorl %ebx, %ebx
jmp 0xcd4c
addl $-0x2, %ebx
jmp 0xc92b
decl %ebx
shrl $0x1f, %ebp
leal (%rbx,%rbp), %esi
leaq 0xb8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xa8(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
leaq 0xa8(%rsp), %rax
addq (%rax), %rbp
movq %rbp, %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0xdf80
leaq 0xdbce(%rip), %rcx      # 0x1a53c
movl $0x18, %r8d
leaq 0xa8(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0xd8(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xc9b5
movq %rdx, 0xc8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd8(%rsp)
jmp 0xc9bb
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0xc8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xd9a7(%rip), %rsi      # 0x1a388
callq 0x2380
leaq 0x78(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xca10
movq %rsi, %r13
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xca19
movups (%rcx), %xmm0
movq %rsi, %r13
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x70(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl %r12d, %ebp
negl %ebp
cmovsl %r12d, %ebp
movl $0x1, %ebx
cmpl $0xa, %ebp
jb 0xca88
movl $0x4, %ebx
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0xca81
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xca86
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xca88
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebx
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xca50
addl $-0x3, %ebx
jmp 0xca88
addl $-0x2, %ebx
jmp 0xca88
decl %ebx
shrl $0x1f, %r12d
leal (%rbx,%r12), %esi
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x28(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
addq 0x28(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0xdf80
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r13, %rcx
je 0xcadb
movq 0x78(%rsp), %rdi
movq 0x28(%rsp), %rsi
cmpq %rdi, %rax
leaq 0x98(%rsp), %rbp
jbe 0xcb06
movl $0xf, %edi
leaq 0x38(%rsp), %r9
cmpq %r9, %rsi
je 0xcb01
movq 0x38(%rsp), %rdi
cmpq %rdi, %rax
jbe 0xcb12
leaq 0x68(%rsp), %rdi
callq 0x20c0
jmp 0xcb20
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0x58(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0xcb44
movq %rsi, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0xcb4a
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x50(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xd93e(%rip), %rsi      # 0x1a4ac
leaq 0x48(%rsp), %rdi
callq 0x2380
leaq 0xf8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xcba9
movq %rdx, 0xe8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xf8(%rsp)
jmp 0xcbb1
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0xe8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
callq 0x5694
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0xcbf5
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movq 0x20(%rsp), %r12
je 0xcc15
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcc31
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xcc48
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xcc6d
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0xcc92
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %r13d, %r13d
movl 0x14(%rsp), %eax
movzbl %al, %ecx
movzbl %r13b, %r8d
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xc710
movq 0x98(%r15), %rbx
leaq 0x118(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
leaq 0x108(%rsp), %rdi
callq 0x3bac
movl (%r14), %ecx
movl 0x18(%rsp), %r8d
movl (%r12), %r9d
movl 0x1c(%rsp), %eax
movl %eax, (%rsp)
leaq 0x168(%rsp), %rdi
leaq 0x108(%rsp), %rdx
movq %rbx, %rsi
callq 0x11dd6
leaq 0x178(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcd2d
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x108(%rsp), %rdi
movb $0x1, %bl
cmpq %r15, %rdi
je 0xcd4c
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0xcd69
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0xcda2
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcda2
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcdc2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcdc2
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcde3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcde3
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xcdff
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcdff
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xce29
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xce29
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0xcea7
movq 0xb8(%rsp), %rsi
jmp 0xce9a
jmp 0xcea4
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0xcea7
movq 0x158(%rsp), %rsi
jmp 0xce9a
jmp 0xcea4
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0xcea7
movq 0x138(%rsp), %rsi
jmp 0xce9a
jmp 0xcea4
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0xcea7
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcea7
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xcecc
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330