// File: /workspace/github_cpp_makefile_star2_O1/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 0x3ba4
movq %r15, %rdi
movl $0x131, %esi            # imm = 0x131
callq 0x5c0a
testb %al, %al
jne 0xc87e
movq %r15, %rdi
movl $0x130, %esi            # imm = 0x130
callq 0x5c0a
testb %al, %al
je 0xca1b
leaq 0x1c(%rsp), %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0xc580
testb %al, %al
je 0xc99f
movq %rbx, 0x20(%rsp)
movl (%rbx), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
jne 0xc8b7
movl 0x1c(%rsp), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
je 0xc90f
leaq 0x158(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xdc23(%rip), %rsi      # 0x1a4ee
leaq 0xdc69(%rip), %rdx      # 0x1a53b
leaq 0x148(%rsp), %rdi
callq 0x3c34
leaq 0x148(%rsp), %rsi
movq %r15, %rdi
callq 0x5696
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0xc90c
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 0xca01
testq %rbp, %rbp
sete %al
testl %r12d, %r12d
sete %cl
orb %al, %cl
jne 0xca01
movl %ebp, %r13d
negl %r13d
cmovsl %ebp, %r13d
movl $0x1, %ebx
cmpl $0xa, %r13d
jb 0xca29
movl $0x4, %ebx
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %r13d, %ecx
cmpl $0x63, %ecx
jbe 0xca22
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xca27
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xca29
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebx
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xc95f
addl $-0x3, %ebx
jmp 0xca29
leaq 0x138(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xdba2(%rip), %rsi      # 0x1a555
leaq 0xdbcd(%rip), %rdx      # 0x1a587
leaq 0x128(%rsp), %rdi
callq 0x3c34
leaq 0x128(%rsp), %rsi
movq %r15, %rdi
callq 0x5696
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0xc9f4
movq 0x138(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %eax, %eax
xorl %r13d, %r13d
movq %rbx, %r12
jmp 0xcd99
testl %r12d, %r12d
leaq 0x98(%rsp), %rbp
je 0xca11
movl %r12d, (%r14)
movq 0x20(%rsp), %r12
jmp 0xcd95
xorl %ebx, %ebx
jmp 0xce4c
addl $-0x2, %ebx
jmp 0xca29
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 0xe072
leaq 0xdad0(%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 0xcab3
movq %rdx, 0xc8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xd8(%rsp)
jmp 0xcab9
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 0xd8a9(%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 0xcb0e
movq %rsi, %r13
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0xcb17
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 0xcb86
movl $0x4, %ebx
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0xcb7f
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xcb84
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xcb86
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %ebx
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xcb4e
addl $-0x3, %ebx
jmp 0xcb86
addl $-0x2, %ebx
jmp 0xcb86
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 0xe072
movq 0x68(%rsp), %rcx
movq 0x70(%rsp), %r8
movq 0x30(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r13, %rcx
je 0xcbd9
movq 0x78(%rsp), %rsi
cmpq %rsi, %rax
leaq 0x98(%rsp), %rbp
jbe 0xcc01
movl $0xf, %esi
leaq 0x38(%rsp), %rdi
cmpq %rdi, 0x28(%rsp)
je 0xcbfc
movq 0x38(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xcc12
movq 0x28(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x20c0
jmp 0xcc20
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 0xcc44
movq %rsi, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
jmp 0xcc4a
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 0xd83e(%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 0xcca9
movq %rdx, 0xe8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xf8(%rsp)
jmp 0xccb1
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 0x5696
movq 0xe8(%rsp), %rdi
cmpq %r12, %rdi
je 0xccf5
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
movq 0x20(%rsp), %r12
je 0xcd15
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcd31
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xcd48
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xcd6d
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0xcd92
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 0xc80e
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 0x3ba4
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 0x11eb8
leaq 0x178(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xce2d
movq 0x178(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x108(%rsp), %rdi
movb $0x1, %bl
cmpq %r15, %rdi
je 0xce4c
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x88(%rsp), %rdi
cmpq %rbp, %rdi
je 0xce69
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 0xcea2
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcea2
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xcec2
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcec2
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xcee3
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcee3
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xceff
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xceff
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0xcf29
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcf29
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
leaq 0xb8(%rsp), %rax
cmpq %rax, %rdi
je 0xcfa7
movq 0xb8(%rsp), %rsi
jmp 0xcf9a
jmp 0xcfa4
movq %rax, %rbx
movq 0x148(%rsp), %rdi
cmpq %r12, %rdi
je 0xcfa7
movq 0x158(%rsp), %rsi
jmp 0xcf9a
jmp 0xcfa4
movq %rax, %rbx
movq 0x128(%rsp), %rdi
cmpq %r12, %rdi
je 0xcfa7
movq 0x138(%rsp), %rsi
jmp 0xcf9a
jmp 0xcfa4
movq %rax, %rbx
movq 0x108(%rsp), %rdi
cmpq %r15, %rdi
je 0xcfa7
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xcfa7
movq %rax, %rbx
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0xcfcc
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330