// File: /workspace/github_cpp_makefile_star2_O1/iamlouk[P]asbi/src/tokenizer.cc
// Function: tok::Tokenizer::next()
Token Tokenizer::next() {
	if (tokbuffed) {
		tokbuffed = false;
		return tokbuf;
	}

	if (pos >= source.length())
		return Token(EOFTok, line);

	char c = source[pos];
	switch (c) {
	case '\n':
		line += 1;
	case ' ': case '\t': case '\v':
		pos++;
		return next();
	case '#':
		while (pos < source.length() && source[pos] != '\n') pos++;
		line++;
		pos++;
		return next();
	case '"':
	case '\'':
		return next_string(c);
	case '(':
		pos++;
		return Token(LeftBracket, line);
	case ')':
		pos++;
		return Token(RightBracket, line);
	case '{':
		pos++;
		return Token(LeftCurlyBracket, line);
	case '}':
		pos++;
		return Token(RightCurlyBracket, line);
	case '[':
		pos++;
		return Token(LeftSquareBracket, line);
	case ']':
		pos++;
		return Token(RightSquareBracket, line);
	case '-':
		pos++;
		if (pos < source.length() && source[pos] == '>') {
			pos++;
			return Token(Arrow, line);
		}
		return Token(Minus, line);
	case '+':
		pos++;
		return Token(Plus, line);
	case '*':
		pos++;
		return Token(Mul, line);
	case '/':
		pos++;
		if (pos < source.length() && source[pos] == '/') {
			while (pos < source.length() && source[pos] != '\n') pos++;
			line++;
			pos++;
			return next();
		}
		if (pos < source.length() && source[pos] == '*') {
			pos++;
			while (pos + 1 < source.length() && !(source[pos] == '*' && source[pos + 1] == '/')) {
				if (source[pos++] == '\n') {
					line++;
				}
			}
			pos += 2;
			return next();
		}
		return Token(Div, line);
	case '!':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(EqualsNot, line);
		}
		return Token(Not, line);
	case '=':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(Equals, line);
		}
		return Token(Assign, line);
	case '|':
		pos++;
		return Token(Or, line);
	case '&':
		pos++;
		return Token(And, line);
	case ',':
		pos++;
		return Token(Comma, line);
	case ':':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(Declare, line);
		}
		if (pos < source.length() && source[pos] == ':') {
			pos++;
			return Token(DoubleColon, line);
		}
		return Token(Colon, line);
	case '<':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(SmallerOrEqual, line);
		}
		return Token(Smaller, line);
	case '>':
		pos++;
		if (pos < source.length() && source[pos] == '=') {
			pos++;
			return Token(BiggerOrEqual, line);
		}
		return Token(Bigger, line);
	case ';':
		pos++;
		return Token(Semicolon, line);
	case '.':
		pos++;
		return Token(Dot, line);
	case '~':
		pos++;
		return Token(KeyValue, line);
	default:
		if ('0' <= c && c <= '9')
			return next_number();

		if (!is_identifier(c))
			throw utils::tokenizer_error("unkown char", line, source[pos]);

		std::string* str = new std::string("");
		while (pos < source.length()) {
			char c = source[pos];
			if (!is_identifier(c))
				break;

			*str += c;
			pos++;
		}

		auto mappos = keywords.find(*str);
		if (mappos == keywords.end()) {
			return Token(Identifier, str, line);
		} else {
			delete str;
			mappos->second.line = line;
			return mappos->second;
		}
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x1, 0x28(%rdi)
jne 0x6a6a
movb $0x0, 0x28(%rbx)
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %r14
movq %rax, %rcx
shrq $0x20, %rcx
jmp 0x6abe
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movq 0x8(%rcx), %rdx
cmpq %rdx, %rax
jae 0x6ab3
movq (%rcx), %rcx
movzbl (%rcx,%rax), %esi
cmpl $0x5a, %esi
jg 0x6ad6
leal -0x9(%rsi), %edi
cmpl $0x35, %edi
ja 0x6d8f
leaq 0x10827(%rip), %r8      # 0x172c0
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
movsbl %sil, %esi
movq %rbx, %rdi
callq 0x6714
jmp 0x6c11
movl 0x8(%rbx), %ecx
movl $0x25, %eax
xorl %r14d, %r14d
shlq $0x20, %rcx
movl %eax, %eax
orq %rcx, %rax
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leal -0x7b(%rsi), %ecx
cmpl $0x3, %ecx
ja 0x6afe
leaq 0x108b3(%rip), %rdx     # 0x17398
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x19, %eax
jmp 0x6abb
cmpl $0x5b, %esi
je 0x6d7c
cmpl $0x5d, %esi
jne 0x6d8f
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x1c, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x20, %eax
jmp 0x6abb
movq (%rbx), %rax
cmpq %rdx, %rax
jae 0x6c00
cmpb $0xa, (%rcx,%rax)
je 0x6c00
incq %rax
movq %rax, (%rbx)
cmpq %rax, %rdx
jne 0x6b3c
movq %rdx, %rax
jmp 0x6c00
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6f04
cmpb $0x3d, (%rcx,%rsi)
jne 0x6ee5
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x7, %eax
jmp 0x6abb
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6da3
cmpb $0x3d, (%rcx,%rsi)
jne 0x6da3
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x13, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x17, %eax
jmp 0x6abb
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6f65
cmpb $0x2f, (%rcx,%rsi)
jne 0x6f11
movq (%rbx), %rax
cmpq %rdx, %rax
jae 0x6c00
cmpb $0xa, (%rcx,%rax)
je 0x6c00
incq %rax
movq %rax, (%rbx)
cmpq %rax, %rdx
jne 0x6bea
jmp 0x6b51
incl 0x8(%rbx)
incq %rax
movq %rax, (%rbx)
movq %rbx, %rdi
callq 0x6a44
movq %rdx, %r14
jmp 0x6a61
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x16, %eax
jmp 0x6abb
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6db0
cmpb $0x3d, (%rcx,%rsi)
jne 0x6db0
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0xf, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x1d, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0xa, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x18, %eax
jmp 0x6abb
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6dbd
cmpb $0x3e, (%rcx,%rsi)
jne 0x6dbd
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0xc, %eax
jmp 0x6abb
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6dca
cmpb $0x3d, (%rcx,%rsi)
jne 0x6dca
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0xe, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x1e, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x8, %eax
jmp 0x6abb
leaq 0x1(%rax), %rsi
movq %rsi, (%rbx)
cmpq %rdx, %rsi
jae 0x6dd7
cmpb $0x3d, (%rcx,%rsi)
jne 0x6dd7
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x12, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x1a, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0xd, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x15, %eax
jmp 0x6abb
incq %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x1b, %eax
jmp 0x6abb
leal -0x30(%rsi), %eax
cmpb $0x9, %al
ja 0x6de4
movq %rbx, %rdi
callq 0x6830
jmp 0x6c11
movl 0x8(%rbx), %ecx
movl $0x11, %eax
jmp 0x6abb
movl 0x8(%rbx), %ecx
movl $0x14, %eax
jmp 0x6abb
movl 0x8(%rbx), %ecx
movl $0x9, %eax
jmp 0x6abb
movl 0x8(%rbx), %ecx
movl $0x6, %eax
jmp 0x6abb
movl 0x8(%rbx), %ecx
movl $0x10, %eax
jmp 0x6abb
leal -0x24(%rsi), %eax
movabsq $0x800000010000001, %r15 # imm = 0x800000010000001
cmpl $0x3b, %eax
ja 0x6dfc
btq %rax, %r15
jb 0x6e0e
andb $-0x21, %sil
addb $-0x41, %sil
cmpb $0x1a, %sil
jae 0x6f7c
movl $0x20, %edi
callq 0x5380
movq %rax, %r14
leaq 0x10(%rax), %r12
movq %r12, (%rax)
leaq 0x102db(%rip), %rdx     # 0x17104
movq %rax, %rdi
movq %rdx, %rsi
callq 0x6684
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
cmpq 0x8(%rcx), %rax
jae 0x6e87
movq (%rcx), %rcx
movzbl (%rcx,%rax), %eax
movl %eax, %ecx
addl $-0x24, %ecx
cmpl $0x3b, %ecx
ja 0x6e72
btq %rcx, %r15
jae 0x6e72
movsbl %al, %esi
movq %r14, %rdi
callq 0x5300
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
incq %rax
movq %rax, (%rbx)
jmp 0x6e3b
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
jb 0x6e58
movl %eax, %ecx
andb $-0x21, %cl
addb $-0x41, %cl
cmpb $0x1a, %cl
jb 0x6e58
leaq 0x1a4ca(%rip), %rdi     # 0x21358
movq %r14, %rsi
callq 0x8062
movq %rax, %r15
leaq 0x1a4c0(%rip), %rax     # 0x21360
cmpq %rax, %r15
je 0x6f72
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x6ebd
movq (%r12), %rsi
incq %rsi
callq 0x5390
movl $0x20, %esi
movq %r14, %rdi
callq 0x5390
movl 0x8(%rbx), %eax
movl %eax, 0x44(%r15)
movq 0x40(%r15), %rax
movq %rax, %rcx
shrq $0x20, %rcx
movq 0x48(%r15), %r14
jmp 0x6abe
cmpq %rdx, %rsi
jae 0x6f04
cmpb $0x3a, (%rcx,%rsi)
jne 0x6f04
addq $0x2, %rax
movq %rax, (%rbx)
movl 0x8(%rbx), %ecx
movl $0x21, %eax
jmp 0x6abb
movl 0x8(%rbx), %ecx
movl $0x1f, %eax
jmp 0x6abb
cmpq %rdx, %rsi
jae 0x6f65
cmpb $0x2a, (%rcx,%rsi)
jne 0x6f65
leaq 0x2(%rax), %rsi
movq %rsi, (%rbx)
addq $0x3, %rax
cmpq %rdx, %rax
jae 0x6f59
movl 0x8(%rbx), %esi
cmpb $0x2a, -0x1(%rcx,%rax)
jne 0x6f3c
cmpb $0x2f, (%rcx,%rax)
je 0x6f53
movq %rax, (%rbx)
cmpb $0xa, -0x1(%rcx,%rax)
jne 0x6f4b
incl %esi
movl %esi, 0x8(%rbx)
incq %rax
cmpq %rax, %rdx
jne 0x6f2f
decq %rax
movq %rax, %rsi
addq $0x2, %rsi
movq %rsi, (%rbx)
jmp 0x6c09
movl 0x8(%rbx), %ecx
movl $0xb, %eax
jmp 0x6abb
movl 0x8(%rbx), %ecx
xorl %eax, %eax
jmp 0x6abe
movl $0x38, %edi
callq 0x51b0
movq %rax, %r14
movl 0x8(%rbx), %edx
movq 0x10(%rbx), %rax
movq (%rbx), %rcx
movq (%rax), %rax
movsbl (%rax,%rcx), %ecx
leaq 0x104bd(%rip), %rsi     # 0x1745e
movq %r14, %rdi
callq 0xa838
leaq 0x19588(%rip), %rsi     # 0x20538
leaq 0xb4f(%rip), %rdx       # 0x7b06
movq %r14, %rdi
callq 0x55d0
movq %rax, %rbx
movq %r14, %rdi
callq 0x5280
jmp 0x6fdc
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x5390
movq %rbx, %rdi
callq 0x55e0