// File: /workspace/github_cpp_makefile_star2_O1/Blaze2305[P]Compiler-Design-2021-Assignment/src/Scanner/Scanner.cpp
// Function: Scanner::scanToken()
TokenType Scanner::scanToken(){
	TokenType result;
	switch(this->currentChar){
		case ')':
			result = RParen;
			acceptChar();
			break;
		case '(':
			result = LParen;
			acceptChar();
			break;
		case '\u0000':
			result = EOT;
			break;
		default:
			if(isLetter(this->currentChar)){
				while(isLetter(this->currentChar)){
					acceptChar();
					if(isKeyword(this->currentString)){
						try{
							result = TOKEN_MAP.at(this->currentString);
						}catch(std::out_of_range err){
							result = Identifier;
						}
					}else if(isType(this->currentString)){
						result = Type;
					}else if(isStatement(this->currentString)){
						try{
							result = TOKEN_MAP.at(this->currentString);
						}catch(std::out_of_range err){
							result = Statement;
						}
					}else if(isConditional(this->currentString)){
						result = Conditional;
					}else{
						result = Identifier;
					}
				}
			}else if(isDigit(this->currentChar)){
				while(isDigit(this->currentChar)){
					acceptChar();
					result = Number;
				}
			}else if(isOperator(std::string(1,this->currentChar))){
				while(isOperator(std::string(1,this->currentChar))){
					acceptChar();
				}
				
				// get semicolon ,assignment and colon
				try{
					result = TOKEN_MAP.at(this->currentString);
				}catch(std::out_of_range err){
					if(isOperator(this->currentString)){
						result = Operator;
					}else{
						result = None;
					}
				}
			}
			else{
				result = None;
			}
			break;
	}
	return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movzbl (%rdi), %eax
testl %eax, %eax
je 0x95ca
movq %rdi, %rbx
cmpl $0x28, %eax
je 0x95ba
cmpl $0x29, %eax
jne 0x95e5
movq %rbx, %rdi
callq 0x94da
movl $0x7, %r12d
jmp 0x95d0
movq %rbx, %rdi
callq 0x94da
movl $0x6, %r12d
jmp 0x95d0
movl $0x8, %r12d
movl %r12d, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl %al, %edi
callq 0xb204
movb (%rbx), %cl
movsbl %cl, %edi
testb %al, %al
je 0x97e7
callq 0xb204
leaq 0x8(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq -0xe8(%rbp), %r14
leaq -0xf8(%rbp), %r15
movq %rbx, %rdi
callq 0x94da
movq %r14, -0xf8(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x67ca
movq %r15, %rdi
callq 0xb2da
movl %eax, %r12d
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0x965d
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r12b, %r12b
je 0x967a
leaq 0x8407(%rip), %rdi      # 0x11a70
movq -0x38(%rbp), %rsi
callq 0x9b0e
movl (%rax), %r12d
jmp 0x9795
leaq -0xc8(%rbp), %r12
movq %r12, -0xd8(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %r13
movq %r13, %rdi
callq 0x67ca
movq %r13, %rdi
callq 0xb245
movl %eax, %r13d
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x96c8
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21e0
movl $0x2, %r12d
testb %r13b, %r13b
leaq -0xa8(%rbp), %r13
jne 0x9795
movq %r13, -0xb8(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %r12
movq %r12, %rdi
callq 0x67ca
movq %r12, %rdi
callq 0xb271
movl %eax, %r12d
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x9725
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r12b, %r12b
leaq -0x88(%rbp), %r13
je 0x9746
leaq 0x8338(%rip), %rdi      # 0x11a70
movq -0x38(%rbp), %rsi
callq 0x9b0e
jmp 0x9672
movq %r13, -0x98(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %r12
movq %r12, %rdi
callq 0x67ca
movq %r12, %rdi
callq 0xb29d
movl %eax, %r12d
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x978d
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21e0
movzbl %r12b, %eax
leal (%rax,%rax,8), %r12d
movsbl (%rbx), %edi
callq 0xb204
testb %al, %al
jne 0x9615
jmp 0x95d0
movq %rax, -0x30(%rbp)
cmpl $0x1, %edx
jne 0x9a4f
movq -0x30(%rbp), %rdi
movl %edx, %esi
callq 0x23f4
movl $0x5, %r12d
jmp 0x9795
movq %rax, -0x30(%rbp)
cmpl $0x1, %edx
jne 0x9a4f
movq -0x30(%rbp), %rdi
movl %edx, %esi
callq 0x2442
xorl %r12d, %r12d
jmp 0x9795
callq 0xb1f3
movb (%rbx), %cl
testb %al, %al
je 0x981a
movsbl %cl, %edi
callq 0xb1f3
movl $0x1, %r12d
testb %al, %al
je 0x95d0
movq %rbx, %rdi
callq 0x94da
movsbl (%rbx), %edi
callq 0xb1f3
jmp 0x9800
leaq -0x118(%rbp), %r15
movq %r15, -0x10(%r15)
movsbl %cl, %edx
leaq -0x128(%rbp), %r14
movl $0x1, %esi
movq %r14, %rdi
callq 0x2220
movq %r14, %rdi
callq 0xb219
movl %eax, %r14d
movq -0x128(%rbp), %rdi
cmpq %r15, %rdi
je 0x9862
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x21e0
movl $0x16, %r12d
testb %r14b, %r14b
je 0x95d0
leaq -0x68(%rbp), %r12
leaq -0x78(%rbp), %r14
movsbl (%rbx), %edx
movq %r12, -0x78(%rbp)
movl $0x1, %esi
movq %r14, %rdi
callq 0x2220
movq %r14, %rdi
callq 0xb219
movl %eax, %r15d
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x98ad
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r15b, %r15b
je 0x98bc
movq %rbx, %rdi
callq 0x94da
jmp 0x9879
leaq 0x8(%rbx), %rsi
leaq 0x81a9(%rip), %rdi      # 0x11a70
callq 0x9b0e
movl (%rax), %r12d
jmp 0x95d0
movq %rax, -0x30(%rbp)
cmpl $0x1, %edx
jne 0x9a4f
movq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0x2270
leaq -0x108(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x2350
movq 0x66b2(%rip), %rax      # 0xffb8
addq $0x10, %rax
movq %rax, (%r14)
movq %r15, %rdi
callq 0x20c0
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rdi
callq 0x67ca
leaq -0x58(%rbp), %rdi
callq 0xb219
movl %eax, %ebx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x9951
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %bl, %bl
movl $0x3, %eax
movl $0x16, %r12d
cmovnel %eax, %r12d
leaq -0x108(%rbp), %rdi
callq 0x22b0
callq 0x2330
jmp 0x95d0
movq %rax, -0x30(%rbp)
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x9997
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21e0
jmp 0x9997
movq %rax, -0x30(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x22b0
callq 0x2330
jmp 0x9a4f
movq %rax, %rdi
callq 0x63ac
movq %rax, -0x30(%rbp)
movq -0x128(%rbp), %rdi
cmpq %r15, %rdi
je 0x9a4f
movq -0x118(%rbp), %rsi
jmp 0x9a47
movq %rax, -0x30(%rbp)
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x9a4f
movq -0x88(%rbp), %rsi
jmp 0x9a47
movq %rax, -0x30(%rbp)
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x9a4f
movq -0xa8(%rbp), %rsi
jmp 0x9a47
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x9a4f
movq -0x68(%rbp), %rsi
jmp 0x9a47
movq %rax, -0x30(%rbp)
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9a4f
movq -0xc8(%rbp), %rsi
jmp 0x9a47
movq %rax, -0x30(%rbp)
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0x9a4f
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x30(%rbp), %rdi
callq 0x2390