// File: /workspace/github_cpp_makefile_star2_O1/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 0x5c0a
testb %al, %al
je 0xc614
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x8632
testb %al, %al
je 0xc7a9
movl 0xc(%rsp), %eax
movl %eax, (%r15)
movl 0x8(%rsp), %eax
movl %eax, (%r14)
movq %rbx, %rdi
movl $0x12e, %esi            # imm = 0x12E
callq 0x5c0a
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0xc797
leaq 0x60(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xdf93(%rip), %rsi      # 0x1a588
leaq 0xdfb8(%rip), %rdx      # 0x1a5b4
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0x3c34
movq %rbx, %rdi
movq %r14, %rsi
callq 0x49ee
movq %rbx, %rdi
movl $0x133, %esi            # imm = 0x133
callq 0x5c0a
testb %al, %al
je 0xc63a
movq %rbx, %rdi
callq 0xcfd4
testb %al, %al
je 0xc663
movl $0x10a, (%r15)          # imm = 0x10A
jmp 0xc676
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xd208
testb %al, %al
je 0xc693
movl 0xc(%rsp), %eax
movl %eax, (%r15)
movl 0x8(%rsp), %eax
movl %eax, (%r14)
jmp 0xc795
movq %rbx, %rdi
callq 0xd0ee
testb %al, %al
je 0xc6af
movl $0x10b, (%r15)          # imm = 0x10B
movl $0x0, (%r14)
movq 0x98(%rbx), %rdi
movl (%r15), %esi
xorl %edx, %edx
callq 0x1379a
jmp 0xc795
movq %rbx, %rdi
callq 0xcfd4
testb %al, %al
je 0xc73c
movl $0x10a, (%r15)          # imm = 0x10A
jmp 0xc78e
leaq 0xc(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0xd208
testb %al, %al
je 0xc7a5
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 0xc72a
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xdef2(%rip), %rsi      # 0x1a5e6
leaq 0xdf34(%rip), %rdx      # 0x1a62f
leaq 0x10(%rsp), %r12
movq %r12, %rdi
callq 0x3c34
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5696
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0xc72a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2200
movq 0x98(%rbx), %rdi
movl (%r15), %esi
movl (%r14), %edx
jmp 0xc689
movq %rbx, %rdi
callq 0xd0ee
testb %al, %al
je 0xc751
movl $0x10b, (%r15)          # imm = 0x10B
jmp 0xc78e
movq %rbx, %rdi
callq 0xd970
testb %al, %al
je 0xc766
movl $0x10d, (%r15)          # imm = 0x10D
jmp 0xc78e
movq %rbx, %rdi
callq 0xda8a
testb %al, %al
je 0xc77b
movl $0x10e, (%r15)          # imm = 0x10E
jmp 0xc78e
movq %rbx, %rdi
callq 0xdba4
testb %al, %al
je 0xc7a5
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 0xc797
leaq 0x40(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0xddfc(%rip), %rsi      # 0x1a5b5
leaq 0xde25(%rip), %rdx      # 0x1a5e5
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x3c34
movq %rbx, %rdi
movq %r14, %rsi
callq 0x49ee
movq %rax, %rbx
movq 0x10(%rsp), %rdi
jmp 0xc7f4
movq %rax, %rbx
movq 0x50(%rsp), %rdi
jmp 0xc7f4
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r13, %rdi
je 0xc805
movq (%r13), %rsi
incq %rsi
callq 0x2200
movq %rbx, %rdi
callq 0x2330
nop