// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::ArithOpPrime(int&, int&, bool, bool)
bool Parser::ArithOpPrime( int &inputType, int &inputSize, bool catchTypeError, bool catchSizeError ){
	//Size and type of next Relation in the ArithOp sequence
	int relationType, relationSize;
	
	//Get operation to pass to the codegenerator
	string op = token->ascii;
	
	//if '+' or '-' can't be found then return false ('null'). Otherwise continue function.
	if( CheckToken(T_ADD) );
	else if( CheckToken(T_SUBTRACT) );
	else return false;
	
	//Get next Relation. Otherwise report Missing Relation error.
	if( Relation(relationType, relationSize)){
		//Only allow number (integer / float) relations in arithmetic operations.
		if(catchTypeError){
			if( !isNumber(relationType) || !isNumber(inputType) ){
				ReportError("Only integer and float values are allowed for arithmetic operations.");
				catchTypeError = false;
			}
		}
		//Ensure compatible sizes are used in ArithOp.
		if(catchSizeError){
			//Error if sizes are not identical and both are non-zero
			if( (inputSize != relationSize) && (inputSize != 0) && (relationSize != 0) ){
				ReportError("Expected Relation of size " + to_string(inputSize) + ", but found one of size " + to_string(relationSize) + ".");
				catchSizeError = false;
			}
			//Assign inputSize as exprSize if inputSize is non-zero.
			else if(relationSize != 0) inputSize = relationSize;
		}
	}
	else{
		ReportError("Expected relation after arithmetic operator.");
		catchTypeError = false;
		catchSizeError = false;
	}
	//Continue to look for other +/- <relation> in case there is a missing arithOp or doubled up arithmetic operators
	ArithOpPrime( inputType, inputSize, catchTypeError, catchSizeError );
	
	//Evaluate arith op and push to the stack
	generator->evalExpr( op, inputSize, relationSize, inputType, relationType );
	
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movl %r8d, %ebp
movl %ecx, %r12d
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x80(%rdi), %rax
leaq 0xc8(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0x3bac
movq %r15, %rdi
movl $0x132, %esi            # imm = 0x132
callq 0x5c08
testb %al, %al
jne 0xb542
movq %r15, %rdi
movl $0x133, %esi            # imm = 0x133
callq 0x5c08
testb %al, %al
je 0xb777
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
movq %r15, %rdi
callq 0xb486
testb %al, %al
je 0xb668
testb %r12b, %r12b
je 0xb5d3
movl 0x10(%rsp), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
jne 0xb57e
movl (%rbx), %eax
andl $-0x2, %eax
movb $0x1, %sil
cmpl $0x10a, %eax            # imm = 0x10A
je 0xb5d5
leaq 0x148(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xee3b(%rip), %rsi      # 0x1a3cd
leaq 0xee78(%rip), %rdx      # 0x1a411
leaq 0x138(%rsp), %rdi
callq 0x3c42
leaq 0x138(%rsp), %rsi
movq %r15, %rdi
callq 0x5694
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0xb5d3
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %esi, %esi
testb %bpl, %bpl
je 0xb6bf
movl (%r14), %r12d
movl 0xc(%rsp), %ecx
cmpl %ecx, %r12d
je 0xb7aa
testq %r12, %r12
sete %al
testl %ecx, %ecx
sete %dl
orb %al, %dl
jne 0xb7aa
movl %r12d, %ebp
negl %ebp
cmovsl %r12d, %ebp
movl $0x1, %r13d
cmpl $0xa, %ebp
jb 0xb7c5
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0xb7bc
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xb7c2
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xb7c5
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xb626
addl $-0x3, %r13d
jmp 0xb7c5
leaq 0x128(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xedb1(%rip), %rsi      # 0x1a42d
leaq 0xedd6(%rip), %rdx      # 0x1a459
leaq 0x118(%rsp), %rdi
callq 0x3c42
leaq 0x118(%rsp), %rsi
movq %r15, %rdi
callq 0x5694
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0xb6bd
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %esi, %esi
xorl %eax, %eax
movzbl %sil, %ecx
movzbl %al, %r8d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb4d2
movq 0x98(%r15), %r15
leaq 0x108(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
addq %rsi, %rdx
leaq 0xf8(%rsp), %rdi
callq 0x3bac
movl (%r14), %ecx
movl 0xc(%rsp), %r8d
movl (%rbx), %r9d
movl 0x10(%rsp), %eax
movl %eax, (%rsp)
leaq 0x158(%rsp), %rdi
leaq 0xf8(%rsp), %rdx
movq %r15, %rsi
callq 0x11dd6
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb756
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf8(%rsp), %rdi
movb $0x1, %bl
cmpq %r12, %rdi
je 0xb779
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xb779
xorl %ebx, %ebx
movq 0xb8(%rsp), %rdi
cmpq %r13, %rdi
je 0xb796
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2200
movl %ebx, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
testl %ecx, %ecx
je 0xb6c1
movl %ecx, (%r14)
jmp 0xb6c1
addl $-0x2, %r13d
jmp 0xb7c5
decl %r13d
movl %esi, 0x14(%rsp)
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x78(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
leaq 0x78(%rsp), %rax
addq (%rax), %r12
movq %r12, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0xdf80
leaq 0xec0a(%rip), %rcx      # 0x1a412
movl $0x1a, %r8d
leaq 0x78(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0xa8(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xb84c
movq %rdx, 0x98(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xa8(%rsp)
jmp 0xb852
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0x98(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xeb10(%rip), %rsi      # 0x1a388
callq 0x2380
leaq 0x48(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xb8a4
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0xb8aa
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, 0x40(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl 0xc(%rsp), %r12d
movl %r12d, %ebp
negl %ebp
cmovsl %r12d, %ebp
movl $0x1, %r13d
cmpl $0xa, %ebp
jb 0xb924
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0xb91b
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xb921
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xb924
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xb8e8
addl $-0x3, %r13d
jmp 0xb924
addl $-0x2, %r13d
jmp 0xb924
decl %r13d
shrl $0x1f, %r12d
leal (%r12,%r13), %esi
leaq 0x28(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x18(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
addq 0x18(%rsp), %r12
movq %r12, %rdi
movl %r13d, %esi
movl %ebp, %edx
callq 0xdf80
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x20(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
leaq 0x48(%rsp), %rbp
cmpq %rbp, %rcx
je 0xb97d
movq 0x48(%rsp), %rdi
movq 0x18(%rsp), %rsi
cmpq %rdi, %rax
leaq 0xc8(%rsp), %r13
jbe 0xb9a8
movl $0xf, %edi
leaq 0x28(%rsp), %r9
cmpq %r9, %rsi
je 0xb9a3
movq 0x28(%rsp), %rdi
cmpq %rdi, %rax
jbe 0xb9b4
leaq 0x38(%rsp), %rdi
callq 0x20c0
jmp 0xb9c2
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0x68(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0xb9e6
movq %rsi, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0xb9ec
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x60(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0xea9c(%rip), %rsi      # 0x1a4ac
leaq 0x58(%rsp), %rdi
callq 0x2380
leaq 0xe8(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xba4b
movq %rdx, 0xd8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe8(%rsp)
jmp 0xba53
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0xd8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %r15, %rdi
callq 0x5694
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0xba97
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbab2
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xbace
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x38(%rsp), %rdi
cmpq %rbp, %rdi
je 0xbae5
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbb0a
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xbb2c
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %eax, %eax
movl 0x14(%rsp), %esi
jmp 0xb6c1
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbb5c
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbb5c
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbb7c
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbb7c
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xbb9d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbb9d
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xbbbe
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbbbe
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbbe8
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbbe8
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xbc63
movq 0x88(%rsp), %rsi
jmp 0xbc56
jmp 0xbc60
movq %rax, %rbx
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0xbc63
movq 0x148(%rsp), %rsi
jmp 0xbc56
jmp 0xbc60
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0xbc63
movq 0x128(%rsp), %rsi
jmp 0xbc56
jmp 0xbc60
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbc63
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbc63
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xbc88
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330