// File: /workspace/github_cpp_makefile_star2_O3/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 0x958e
movq %rdi, %rbx
cmpl $0x28, %eax
je 0x957e
cmpl $0x29, %eax
jne 0x95a9
movq %rbx, %rdi
callq 0x949e
movl $0x7, %r12d
jmp 0x9594
movq %rbx, %rdi
callq 0x949e
movl $0x6, %r12d
jmp 0x9594
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 0xb1d0
movb (%rbx), %cl
movsbl %cl, %edi
testb %al, %al
je 0x97ab
callq 0xb1d0
leaq 0x8(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq -0xe8(%rbp), %r14
leaq -0xf8(%rbp), %r15
movq %rbx, %rdi
callq 0x949e
movq %r14, -0xf8(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x67c4
movq %r15, %rdi
callq 0xb2a6
movl %eax, %r12d
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0x9621
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r12b, %r12b
je 0x963e
leaq 0x8443(%rip), %rdi      # 0x11a70
movq -0x38(%rbp), %rsi
callq 0x9aca
movl (%rax), %r12d
jmp 0x9759
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 0x67c4
movq %r13, %rdi
callq 0xb211
movl %eax, %r13d
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x968c
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x21e0
movl $0x2, %r12d
testb %r13b, %r13b
leaq -0xa8(%rbp), %r13
jne 0x9759
movq %r13, -0xb8(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %r12
movq %r12, %rdi
callq 0x67c4
movq %r12, %rdi
callq 0xb23d
movl %eax, %r12d
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x96e9
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r12b, %r12b
leaq -0x88(%rbp), %r13
je 0x970a
leaq 0x8374(%rip), %rdi      # 0x11a70
movq -0x38(%rbp), %rsi
callq 0x9aca
jmp 0x9636
movq %r13, -0x98(%rbp)
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %r12
movq %r12, %rdi
callq 0x67c4
movq %r12, %rdi
callq 0xb269
movl %eax, %r12d
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x9751
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x21e0
movzbl %r12b, %eax
leal (%rax,%rax,8), %r12d
movsbl (%rbx), %edi
callq 0xb1d0
testb %al, %al
jne 0x95d9
jmp 0x9594
movq %rax, -0x30(%rbp)
cmpl $0x1, %edx
jne 0x9a13
movq -0x30(%rbp), %rdi
movl %edx, %esi
callq 0x23f4
movl $0x5, %r12d
jmp 0x9759
movq %rax, -0x30(%rbp)
cmpl $0x1, %edx
jne 0x9a13
movq -0x30(%rbp), %rdi
movl %edx, %esi
callq 0x2442
xorl %r12d, %r12d
jmp 0x9759
callq 0xb1bf
movb (%rbx), %cl
testb %al, %al
je 0x97de
movsbl %cl, %edi
callq 0xb1bf
movl $0x1, %r12d
testb %al, %al
je 0x9594
movq %rbx, %rdi
callq 0x949e
movsbl (%rbx), %edi
callq 0xb1bf
jmp 0x97c4
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 0xb1e5
movl %eax, %r14d
movq -0x128(%rbp), %rdi
cmpq %r15, %rdi
je 0x9826
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x21e0
movl $0x16, %r12d
testb %r14b, %r14b
je 0x9594
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 0xb1e5
movl %eax, %r15d
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x9871
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x21e0
testb %r15b, %r15b
je 0x9880
movq %rbx, %rdi
callq 0x949e
jmp 0x983d
leaq 0x8(%rbx), %rsi
leaq 0x81e5(%rip), %rdi      # 0x11a70
callq 0x9aca
movl (%rax), %r12d
jmp 0x9594
movq %rax, -0x30(%rbp)
cmpl $0x1, %edx
jne 0x9a13
movq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0x2270
leaq -0x108(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x2350
movq 0x66ee(%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 0x67c4
leaq -0x58(%rbp), %rdi
callq 0xb1e5
movl %eax, %ebx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x9915
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 0x9594
movq %rax, -0x30(%rbp)
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
je 0x995b
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x21e0
jmp 0x995b
movq %rax, -0x30(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x22b0
callq 0x2330
jmp 0x9a13
movq %rax, %rdi
callq 0x63ac
movq %rax, -0x30(%rbp)
movq -0x128(%rbp), %rdi
cmpq %r15, %rdi
je 0x9a13
movq -0x118(%rbp), %rsi
jmp 0x9a0b
movq %rax, -0x30(%rbp)
movq -0x98(%rbp), %rdi
cmpq %r13, %rdi
je 0x9a13
movq -0x88(%rbp), %rsi
jmp 0x9a0b
movq %rax, -0x30(%rbp)
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0x9a13
movq -0xa8(%rbp), %rsi
jmp 0x9a0b
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x9a13
movq -0x68(%rbp), %rsi
jmp 0x9a0b
movq %rax, -0x30(%rbp)
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9a13
movq -0xc8(%rbp), %rsi
jmp 0x9a0b
movq %rax, -0x30(%rbp)
movq -0xf8(%rbp), %rdi
cmpq %r14, %rdi
je 0x9a13
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x21e0
movq -0x30(%rbp), %rdi
callq 0x2390