// File: 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 %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
movl $0x12d, %esi            # imm = 0x12D
callq 0x9300
testb $0x1, %al
jne 0x10a65
jmp 0x10bc7
movq -0xb8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0xcab0
testb $0x1, %al
jne 0x10a82
jmp 0x10b39
movq -0xb8(%rbp), %rdi
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movl $0x12e, %esi            # imm = 0x12E
callq 0x9300
testb $0x1, %al
jne 0x10aab
jmp 0x10ab4
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
leaq -0x49(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x3430
movq -0xc0(%rbp), %rdx
leaq 0x15d7c(%rip), %rsi     # 0x2684e
leaq -0x48(%rbp), %rdi
callq 0x62d0
jmp 0x10add
movq -0xb8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x88a0
jmp 0x10aef
leaq -0x48(%rbp), %rdi
callq 0x31a0
leaq -0x49(%rbp), %rdi
callq 0x32e0
jmp 0x10b34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x10b26
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x31a0
leaq -0x49(%rbp), %rdi
callq 0x32e0
jmp 0x10eb7
jmp 0x10bc2
leaq -0x81(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x3430
movq -0xc8(%rbp), %rdx
leaq 0x15d21(%rip), %rsi     # 0x2687b
leaq -0x80(%rbp), %rdi
callq 0x62d0
jmp 0x10b65
movq -0xb8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x88a0
jmp 0x10b77
leaq -0x80(%rbp), %rdi
callq 0x31a0
leaq -0x81(%rbp), %rdi
callq 0x32e0
jmp 0x10bc2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x10bb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x31a0
leaq -0x81(%rbp), %rdi
callq 0x32e0
jmp 0x10eb7
jmp 0x10ea7
movq -0xb8(%rbp), %rdi
movl $0x133, %esi            # imm = 0x133
callq 0x9300
testb $0x1, %al
jne 0x10be1
jmp 0x10d8a
movq -0xb8(%rbp), %rdi
callq 0x113e0
testb $0x1, %al
jne 0x10bf3
jmp 0x10c2f
movq -0xb8(%rbp), %rax
movq -0x18(%rbp), %rcx
movl $0x10a, (%rcx)          # imm = 0x10A
movq -0x20(%rbp), %rcx
movl $0x0, (%rcx)
movq 0x98(%rax), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
callq 0x1c510
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
callq 0x114f0
testb $0x1, %al
jne 0x10c41
jmp 0x10c7d
movq -0xb8(%rbp), %rax
movq -0x18(%rbp), %rcx
movl $0x10b, (%rcx)          # imm = 0x10B
movq -0x20(%rbp), %rcx
movl $0x0, (%rcx)
movq 0x98(%rax), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
callq 0x1c510
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x11600
testb $0x1, %al
jne 0x10c9a
jmp 0x10d81
movq -0xb8(%rbp), %rdi
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rsi
callq 0xf850
testb $0x1, %al
jne 0x10d59
leaq -0xa9(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x3430
movq -0xd0(%rbp), %rdx
leaq 0x15bc7(%rip), %rsi     # 0x268ac
leaq -0xa8(%rbp), %rdi
callq 0x62d0
jmp 0x10cf3
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x9060
jmp 0x10d08
leaq -0xa8(%rbp), %rdi
callq 0x31a0
leaq -0xa9(%rbp), %rdi
callq 0x32e0
jmp 0x10d59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x10d48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x31a0
leaq -0xa9(%rbp), %rdi
callq 0x32e0
jmp 0x10eb7
movq -0xb8(%rbp), %rax
movq 0x98(%rax), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
callq 0x1c510
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movb $0x0, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
leaq -0x24(%rbp), %rsi
leaq -0x28(%rbp), %rdx
callq 0x11600
testb $0x1, %al
jne 0x10da4
jmp 0x10dbf
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
callq 0x113e0
testb $0x1, %al
jne 0x10dd1
jmp 0x10dee
movq -0x18(%rbp), %rax
movl $0x10a, (%rax)          # imm = 0x10A
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
callq 0x114f0
testb $0x1, %al
jne 0x10e00
jmp 0x10e1d
movq -0x18(%rbp), %rax
movl $0x10b, (%rax)          # imm = 0x10B
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
callq 0x11da0
testb $0x1, %al
jne 0x10e2f
jmp 0x10e49
movq -0x18(%rbp), %rax
movl $0x10d, (%rax)          # imm = 0x10D
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
callq 0x11eb0
testb $0x1, %al
jne 0x10e5b
jmp 0x10e75
movq -0x18(%rbp), %rax
movl $0x10e, (%rax)          # imm = 0x10E
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movq -0xb8(%rbp), %rdi
callq 0x11fc0
testb $0x1, %al
jne 0x10e87
jmp 0x10ea1
movq -0x18(%rbp), %rax
movl $0x10c, (%rax)          # imm = 0x10C
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0x10ea9
movb $0x0, -0x1(%rbp)
jmp 0x10ea9
ud2
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xd0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x3420