// File: /workspace/github_cpp_makefile_star2_O1/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, %r12d
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x80(%rdi), %rax
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x3ba4
movq %r15, %rdi
movl $0x132, %esi            # imm = 0x132
callq 0x5c0a
testb %al, %al
jne 0xb604
movq %r15, %rdi
movl $0x133, %esi            # imm = 0x133
callq 0x5c0a
testb %al, %al
je 0xb83b
leaq 0x14(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %r15, %rdi
callq 0xb54c
testb %al, %al
je 0xb72e
testb %bpl, %bpl
je 0xb69b
movl 0x14(%rsp), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
jne 0xb63d
movl (%rbx), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
je 0xb69b
leaq 0x148(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xed7d(%rip), %rsi      # 0x1a3cd
leaq 0xedba(%rip), %rdx      # 0x1a411
leaq 0x138(%rsp), %rdi
callq 0x3c34
leaq 0x138(%rsp), %rsi
movq %r15, %rdi
callq 0x5696
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0xb691
movq 0x148(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %ebp, %ebp
leaq 0x88(%rsp), %r13
testb %r12b, %r12b
je 0xb788
movl (%r14), %r13d
movl 0x10(%rsp), %eax
cmpl %eax, %r13d
je 0xb86b
testq %r13, %r13
sete %cl
testl %eax, %eax
sete %dl
orb %cl, %dl
jne 0xb86b
movl %r13d, %esi
negl %esi
cmovsl %r13d, %esi
movl $0x1, %r12d
cmpl $0xa, %esi
jb 0xb88c
movl $0x4, %r12d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %esi, %ecx
cmpl $0x63, %ecx
jbe 0xb883
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xb889
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xb88c
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r12d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xb6ec
addl $-0x3, %r12d
jmp 0xb88c
leaq 0x128(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xeceb(%rip), %rsi      # 0x1a42d
leaq 0xed10(%rip), %rdx      # 0x1a459
leaq 0x118(%rsp), %rdi
callq 0x3c34
leaq 0x118(%rsp), %rsi
movq %r15, %rdi
callq 0x5696
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0xb783
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x2200
xorl %ebp, %ebp
xorl %r12d, %r12d
movzbl %bpl, %ecx
movzbl %r12b, %r8d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xb598
movq 0x98(%r15), %r15
leaq 0x108(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x78(%rsp), %rsi
movq 0x80(%rsp), %rdx
addq %rsi, %rdx
leaq 0xf8(%rsp), %rdi
callq 0x3ba4
movl (%r14), %ecx
movl 0x10(%rsp), %r8d
movl (%rbx), %r9d
movl 0x14(%rsp), %eax
movl %eax, (%rsp)
leaq 0x158(%rsp), %rdi
leaq 0xf8(%rsp), %rdx
movq %r15, %rsi
callq 0x11eb8
leaq 0x168(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xb81a
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xf8(%rsp), %rdi
movb $0x1, %bl
cmpq %r12, %rdi
je 0xb83d
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xb83d
xorl %ebx, %ebx
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0xb857
movq 0x88(%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
testl %eax, %eax
leaq 0x88(%rsp), %r13
je 0xb788
movl %eax, (%r14)
jmp 0xb788
addl $-0x2, %r12d
jmp 0xb88c
decl %r12d
movl %esi, 0xc(%rsp)
shrl $0x1f, %r13d
leal (%r12,%r13), %esi
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x98(%rsp), %rdi
movl $0x2d, %edx
callq 0x2240
leaq 0x98(%rsp), %rax
addq (%rax), %r13
movq %r13, %rdi
movl %r12d, %esi
movl 0xc(%rsp), %edx
callq 0xe072
leaq 0xeb3b(%rip), %rcx      # 0x1a412
movl $0x1a, %r8d
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2220
leaq 0xc8(%rsp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0xb91e
movq %rdx, 0xb8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xc8(%rsp)
jmp 0xb924
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
leaq 0xb8(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xea3e(%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 0xb976
movq %rdx, 0x38(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x48(%rsp)
jmp 0xb97c
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 0x10(%rsp), %r12d
movl %r12d, %esi
negl %esi
cmovsl %r12d, %esi
movl $0x1, %r13d
cmpl $0xa, %esi
jb 0xb9f6
movl $0x4, %r13d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %esi, %ecx
cmpl $0x63, %ecx
jbe 0xb9ed
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0xb9f3
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0xb9f6
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r13d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0xb9ba
addl $-0x3, %r13d
jmp 0xb9f6
addl $-0x2, %r13d
jmp 0xb9f6
decl %r13d
movl %esi, 0xc(%rsp)
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 0xc(%rsp), %edx
callq 0xe072
movq 0x38(%rsp), %rcx
movq 0x40(%rsp), %r8
movq 0x20(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
leaq 0x48(%rsp), %rdi
cmpq %rdi, %rcx
je 0xba55
movq 0x48(%rsp), %rsi
cmpq %rsi, %rax
leaq 0x88(%rsp), %r13
jbe 0xba7d
movl $0xf, %esi
leaq 0x28(%rsp), %rdi
cmpq %rdi, 0x18(%rsp)
je 0xba78
movq 0x28(%rsp), %rsi
cmpq %rsi, %rax
jbe 0xba8e
movq 0x18(%rsp), %rsi
leaq 0x38(%rsp), %rdi
callq 0x20c0
jmp 0xba9c
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 0xbac0
movq %rsi, 0x58(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x68(%rsp)
jmp 0xbac6
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 0xe9c2(%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 0xbb25
movq %rdx, 0xd8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xe8(%rsp)
jmp 0xbb2d
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 0x5696
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbb71
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x2200
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
leaq 0x48(%rsp), %r12
je 0xbb91
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xbbad
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0xbbc4
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xbbe9
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xb785
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xb785
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbc3c
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbc3c
movq %rax, %rbx
leaq 0x68(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc5c
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbc5c
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0xbc7d
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbc7d
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xbc9e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbc9e
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0xbcc8
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbcc8
movq %rax, %rbx
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0xbd46
movq 0xa8(%rsp), %rsi
jmp 0xbd39
jmp 0xbd43
movq %rax, %rbx
movq 0x138(%rsp), %rdi
cmpq %r13, %rdi
je 0xbd46
movq 0x148(%rsp), %rsi
jmp 0xbd39
jmp 0xbd43
movq %rax, %rbx
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0xbd46
movq 0x128(%rsp), %rsi
jmp 0xbd39
jmp 0xbd43
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbd46
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x2200
jmp 0xbd46
movq %rax, %rbx
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xbd68
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330