// File: /workspace/github_cpp_makefile_star2_O3/AndrewAlbert[P]Compiler-Theory/SourceCode/parser.cpp
// Function: Parser::Factor(int&, int&)
bool Parser::Factor(int &type, int &size){
	int tempType, tempSize;
	if( CheckToken(T_LPAREN) ){
		if( Expression(tempType, tempSize) ){
			type = tempType;
			size = tempSize;
			if( CheckToken(T_RPAREN) ){
				return true;
			}
			else ReportFatalError("expected ')' in factor around the expression");
		}
		else ReportFatalError("expected expression within parenthesis of factor");
	}
	else if( CheckToken(T_SUBTRACT) ){
		if( Integer() ){
			type = TYPE_INTEGER;
			size = 0;
			generator->NegateTopRegisters( type, size );
			return true;
		}
		else if( Float() ){
			type = TYPE_FLOAT;
			size = 0;
			generator->NegateTopRegisters( type, size );
			return true;
		}
		else if( Name(tempType, tempSize) ){
			type = tempType;
			size = tempSize;
			if( !isNumber(type) ) ReportError(" negation '-' before variable name is valid only for integers and floats.");
			generator->NegateTopRegisters( type, size );
			return true;
		}
		else return false;
	}
	else if( Name(tempType, tempSize) ){
		type = tempType;
		size = tempSize;
		return true;
	}
	else if( Integer() ){
		type = TYPE_INTEGER;
		size = 0;
		return true;
	}
	else if( Float() ){
		type = TYPE_FLOAT;
		size = 0;
		return true;
	}
	else if( String() ){
		type = TYPE_STRING;
		size = 0;
		return true;
	}
	else if( Char() ){
		type = TYPE_CHAR;
		size = 0;
		return true;
	}
	else if( Bool() ){
		type = TYPE_BOOL;
		size = 0;
		return true;
	}
	else{
		return false;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0x12d, %esi            # imm = 0x12D
callq 0x5c08
testb %al, %al
je 0xc516
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x858a
testb %al, %al
je 0xc6ab
movl 0xc(%rsp), %eax
movl %eax, (%r15)
movl 0x8(%rsp), %eax
movl %eax, (%r14)
movq %rbx, %rdi
movl $0x12e, %esi            # imm = 0x12E
callq 0x5c08
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0xc699
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xe091(%rip), %rsi      # 0x1a588
leaq 0xe0b6(%rip), %rdx      # 0x1a5b4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x3c42
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4a02
movq %rbx, %rdi
movl $0x133, %esi            # imm = 0x133
callq 0x5c08
testb %al, %al
je 0xc53c
movq %rbx, %rdi
callq 0xced4
testb %al, %al
je 0xc565
movl $0x10a, (%r15)          # imm = 0x10A
jmp 0xc578
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xd108
testb %al, %al
je 0xc595
movl 0xc(%rsp), %eax
movl %eax, (%r15)
movl 0x8(%rsp), %eax
movl %eax, (%r14)
jmp 0xc697
movq %rbx, %rdi
callq 0xcfee
testb %al, %al
je 0xc5b1
movl $0x10b, (%r15)          # imm = 0x10B
movl $0x0, (%r14)
movq 0x98(%rbx), %rdi
movl (%r15), %esi
xorl %edx, %edx
callq 0x136b4
jmp 0xc697
movq %rbx, %rdi
callq 0xced4
testb %al, %al
je 0xc63e
movl $0x10a, (%r15)          # imm = 0x10A
jmp 0xc690
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xd108
testb %al, %al
je 0xc6a7
movl 0xc(%rsp), %eax
movl %eax, (%r15)
movl 0x8(%rsp), %eax
movl %eax, (%r14)
movl (%r15), %eax
andl $-0x2, %eax
cmpl $0x10a, %eax            # imm = 0x10A
je 0xc62c
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xdff0(%rip), %rsi      # 0x1a5e6
leaq 0xe032(%rip), %rdx      # 0x1a62f
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x3c42
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5694
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0xc62c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x98(%rbx), %rdi
movl (%r15), %esi
movl (%r14), %edx
jmp 0xc58b
movq %rbx, %rdi
callq 0xcfee
testb %al, %al
je 0xc653
movl $0x10b, (%r15)          # imm = 0x10B
jmp 0xc690
movq %rbx, %rdi
callq 0xd870
testb %al, %al
je 0xc668
movl $0x10d, (%r15)          # imm = 0x10D
jmp 0xc690
movq %rbx, %rdi
callq 0xd98a
testb %al, %al
je 0xc67d
movl $0x10e, (%r15)          # imm = 0x10E
jmp 0xc690
movq %rbx, %rdi
callq 0xdaa4
testb %al, %al
je 0xc6a7
movl $0x10c, (%r15)          # imm = 0x10C
movl $0x0, (%r14)
movb $0x1, %al
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
jmp 0xc699
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xdefa(%rip), %rsi      # 0x1a5b5
leaq 0xdf23(%rip), %rdx      # 0x1a5e5
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x3c42
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4a02
movq %rax, %rbx
movq 0x10(%rsp), %rdi
jmp 0xc6f6
movq %rax, %rbx
movq 0x50(%rsp), %rdi
jmp 0xc6f6
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0xc707
movq (%r13), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
nop