// File: /workspace/github_c_makefile_star2_O3/almk277[P]ROSE/rasm/scanner.cpp
// Function: scanner::next()
tok scanner::next()
{
	static const std::unordered_map<string, tok> dirs = {
		{ "arg",    tok::ARG },
		{ "data",   tok::DATA },
		{ "export", tok::EXPORT },
		{ "extern", tok::EXTERN },
		{ "import", tok::IMPORT },
		{ "module", tok::MODULE },
		{ "str",    tok::STR },
		{ "sub",    tok::SUB },
		{ "var",    tok::VAR },
	};

	char c = in.peek();

	while (c == ' ' or c == '\t')
		c = in.ignore().peek();

	if (in.eof())
		return tok::END;

	if (std::isalpha(c) or c == '_') {
		in >> s;
		if (s.back() == ':') {
			s.pop_back();
			return tok::LABEL;
		}
		return tok::STRING;
	}

	if (std::isdigit(c) or c == '-') {
		in >> s;
		if (s.find('.') != string::npos) {
			std::size_t pos;
			d = std::stof(s, &pos);
			if (pos < s.size())
				throw error("wrong float: " + s);
			return tok::FLOAT;
		}
		if (s.back() == INT_SUFFIX) {
			s.pop_back();
			convert(n, s);
			return tok::INT;
		}
		convert(b, s);
		return tok::BYTE;
	}

	in.ignore();
	switch (c) {
	case '.':
	{
		if (!std::isalpha(in.peek()))
			throw error("ill-formed directive");
		in >> s;
		auto it = dirs.find(s);
		if (it == dirs.end())
			throw error("unknown directive:" + s);
		return it->second;
	}
	case '\n':
		++lineno;
		return tok::NEWLINE;
	case COMMENT:
		in.ignore(numeric_limits<std::streamsize>::max(), '\n');
		if (in.eof())
			return tok::END;
		++lineno;
		return tok::NEWLINE;
	case '"':
		a.clear();
		while (in.get(c)) {
			switch (c) {
			case '"':
				return tok::ARRAY;
			case '\n':
				throw error("unexpected end of line");
			case '\\':
				c = unescape(in.get());
				// fallthrough
			default:
				a.push_back(c);
			}
		}
		throw error("unexpected end of file");
	}

	throw error("unexpected symbol: "
			+ (std::isprint(c) ?
				string("'") + c + "'"
				: string("#") + std::to_string(int(c))));
	return tok::END; // nonreachable
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %r14
movb 0xece6(%rip), %al       # 0x14398
testb %al, %al
je 0x5a1c
movq (%r14), %rdi
callq 0x30f0
movl %eax, %r15d
movb %r15b, 0x8(%rsp)
cmpb $0x20, %r15b
je 0x56da
movzbl %r15b, %r13d
cmpl $0x9, %r13d
jne 0x56e7
movq (%r14), %rdi
callq 0x34e0
movq %rax, %rdi
jmp 0x56bd
movq (%r14), %r12
movq (%r12), %rax
movq -0x18(%rax), %rax
movl $0x7, %ebx
testb $0x2, 0x20(%r12,%rax)
jne 0x5a08
movsbl %r15b, %ebp
movl %ebp, %edi
callq 0x3420
cmpb $0x5f, %r15b
je 0x580d
testl %eax, %eax
jne 0x580d
addl $-0x30, %ebp
cmpl $0xa, %ebp
setae %al
cmpb $0x2d, %r15b
setne %cl
testb %al, %cl
jne 0x5843
leaq 0x10(%r14), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x3300
movq %r15, %rdi
movl $0x2e, %esi
xorl %edx, %edx
callq 0x3310
cmpq $-0x1, %rax
je 0x598d
movq (%r15), %r12
callq 0x3030
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0xa0(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x3340
movq (%r13), %rax
subq %r12, %rax
je 0x5c23
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x5c2f
testl %ecx, %ecx
jne 0x57a4
movl %ebp, (%rbx)
movss %xmm0, 0x38(%r14)
movl $0x4, %ebx
cmpq 0x18(%r14), %rax
jae 0x5a08
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8985(%rip), %rsi      # 0xe152
leaq 0xa0(%rsp), %rdi
movq %r15, %rdx
callq 0x670f
movb $0x1, %bpl
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %ebp, %ebp
movq 0xe7f7(%rip), %rsi      # 0x13ff0
movq 0xe7b0(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
jmp 0x5df0
leaq 0x10(%r14), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x3300
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
xorl %ebx, %ebx
cmpb $0x3a, -0x1(%rax,%rcx)
jne 0x5a08
movq %r15, %rdi
callq 0x32e0
movl $0x1, %ebx
jmp 0x5a08
movq %r12, %rdi
callq 0x34e0
cmpl $0x2d, %r13d
jg 0x593a
cmpl $0xa, %r13d
je 0x59e2
cmpl $0x22, %r13d
jne 0x5c3b
movq 0x40(%r14), %rax
cmpq %rax, 0x48(%r14)
je 0x5877
movq %rax, 0x48(%r14)
movq (%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3360
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5919
leaq 0x40(%r14), %rbx
leaq 0x8(%rsp), %r15
movzbl 0x8(%rsp), %eax
cmpl $0x5c, %eax
je 0x58bc
cmpl $0x22, %eax
je 0x59ed
cmpl $0xa, %eax
jne 0x58e3
jmp 0x5bf1
movq (%r14), %rdi
callq 0x32c0
cmpb $0x30, %al
je 0x58dd
movzbl %al, %ecx
cmpl $0x74, %ecx
je 0x58d9
cmpl $0x6e, %ecx
jne 0x58df
movb $0xa, %al
jmp 0x58df
movb $0x9, %al
jmp 0x58df
xorl %eax, %eax
movb %al, 0x8(%rsp)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x58f5
movb %al, (%rsi)
incq 0x48(%r14)
jmp 0x5900
movq %rbx, %rdi
movq %r15, %rdx
callq 0x738e
movq (%r14), %rdi
movq %r15, %rsi
callq 0x3360
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x589f
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8872(%rip), %rsi      # 0xe19f
movq %rax, %rdi
callq 0x3100
jmp 0x5c0d
cmpl $0x3b, %r13d
je 0x59ba
cmpl $0x2e, %r13d
jne 0x5c3b
movq (%r14), %rdi
callq 0x30f0
movl %eax, %edi
callq 0x3420
testl %eax, %eax
je 0x5cab
movq (%r14), %rdi
addq $0x10, %r14
movq %r14, %rsi
callq 0x3300
leaq 0xe9e9(%rip), %rdi      # 0x14360
movq %r14, %rsi
callq 0x7354
testq %rax, %rax
je 0x5ccc
movl 0x28(%rax), %ebx
jmp 0x5a08
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
cmpb $0x4c, -0x1(%rax,%rcx)
jne 0x59f4
movq %r15, %rdi
callq 0x32e0
addq $0x30, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x6797
movl $0x3, %ebx
jmp 0x5a08
movq (%r14), %rdi
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
movl $0xa, %edx
callq 0x31b0
movq (%r14), %rax
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x2, 0x20(%rax,%rcx)
jne 0x5a08
incl 0x8(%r14)
movl $0x6, %ebx
jmp 0x5a08
movl $0x5, %ebx
jmp 0x5a08
addq $0x34, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x68fe
movl $0x2, %ebx
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe975(%rip), %rdi      # 0x14398
callq 0x34d0
testl %eax, %eax
je 0x56ba
leaq 0x30(%rsp), %rdx
movl $0x8, (%rdx)
leaq 0x86e1(%rip), %rsi      # 0xe123
leaq 0xa0(%rsp), %rbx
movq %rbx, %rdi
callq 0x6662
leaq 0xc8(%rsp), %r15
leaq 0x10(%rsp), %rdx
movl $0x9, (%rdx)
leaq 0x86bc(%rip), %rsi      # 0xe128
movq %r15, %rdi
callq 0x669a
leaq 0xf0(%rsp), %r15
leaq 0x50(%rsp), %rdx
movl $0xa, (%rdx)
leaq 0x86a0(%rip), %rsi      # 0xe12e
movq %r15, %rdi
callq 0x66d2
leaq 0x118(%rsp), %r15
leaq 0x80(%rsp), %rdx
movl $0xb, (%rdx)
leaq 0x8683(%rip), %rsi      # 0xe136
movq %r15, %rdi
callq 0x66d2
leaq 0x140(%rsp), %r15
leaq 0x8(%rsp), %rdx
movl $0xc, (%rdx)
leaq 0x8669(%rip), %rsi      # 0xe13e
movq %r15, %rdi
callq 0x66d2
leaq 0x168(%rsp), %r15
leaq 0x7c(%rsp), %rdx
movl $0xd, (%rdx)
leaq 0x864f(%rip), %rsi      # 0xe146
movq %r15, %rdi
callq 0x66d2
leaq 0x190(%rsp), %r15
leaq 0x78(%rsp), %rdx
movl $0xe, (%rdx)
leaq 0x8959(%rip), %rsi      # 0xe472
movq %r15, %rdi
callq 0x6662
leaq 0x1b8(%rsp), %r15
leaq 0x74(%rsp), %rdx
movl $0xf, (%rdx)
leaq 0x899c(%rip), %rsi      # 0xe4d7
movq %r15, %rdi
callq 0x6662
leaq 0x1e0(%rsp), %r15
leaq 0x70(%rsp), %rdx
movl $0x10, (%rdx)
leaq 0x85f1(%rip), %rsi      # 0xe14e
movq %r15, %rdi
callq 0x6662
leaq 0x208(%rsp), %r12
leaq 0xd(%rsp), %rax
movq %rax, (%rsp)
leaq 0xe7e3(%rip), %rdi      # 0x14360
leaq 0xa0(%rsp), %rsi
leaq 0xf(%rsp), %r8
leaq 0xe(%rsp), %r9
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x6e4c
movq $-0x168, %rbx           # imm = 0xFE98
leaq 0x1f0(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x5bbc
movq (%r15), %rsi
incq %rsi
callq 0x3260
addq $-0x28, %r15
addq $0x28, %rbx
jne 0x5ba8
leaq 0xb3d(%rip), %rdi       # 0x670a
leaq 0xe78c(%rip), %rsi      # 0x14360
leaq 0xe6bd(%rip), %rdx      # 0x14298
callq 0x3230
leaq 0xe7b1(%rip), %rdi      # 0x14398
callq 0x31c0
jmp 0x56ba
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8583(%rip), %rsi      # 0xe188
movq %rax, %rdi
callq 0x3100
movq 0xe3dc(%rip), %rsi      # 0x13ff0
movq 0xe395(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
leaq 0x85d0(%rip), %rdi      # 0xe1fa
callq 0x3190
leaq 0x85c4(%rip), %rdi      # 0xe1fa
callq 0x33c0
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
movsbl %r15b, %r14d
movl %r14d, %edi
callq 0x34b0
movl %eax, %ebp
testl %eax, %eax
jne 0x5d20
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x855c(%rip), %rsi      # 0xe1ca
leaq 0x8556(%rip), %rdx      # 0xe1cb
leaq 0x10(%rsp), %rdi
callq 0x4f0e
leaq 0x80(%rsp), %rdi
movl %r14d, %esi
callq 0x6bde
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x6b36
jmp 0x5dab
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x84a1(%rip), %rsi      # 0xe160
movq %rax, %rdi
callq 0x3100
jmp 0x5c0d
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8495(%rip), %rsi      # 0xe175
leaq 0xa0(%rsp), %rdi
movq %r14, %rdx
callq 0x670f
movb $0x1, %bpl
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %ebp, %ebp
movq 0xe2e4(%rip), %rsi      # 0x13ff0
movq 0xe29d(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
jmp 0x5df0
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x89fd(%rip), %rsi      # 0xe72e
leaq 0x89f7(%rip), %rdx      # 0xe72f
leaq 0x50(%rsp), %rdi
callq 0x4f0e
movsbl %r15b, %edx
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x6ad5
leaq 0x89d2(%rip), %rsi      # 0xe72e
leaq 0x10(%rsp), %rdi
callq 0x3500
leaq 0x40(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
jne 0x5d86
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
jmp 0x5d93
movq %rsi, 0x30(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x40(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x38(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x8404(%rip), %rsi      # 0xe1b6
leaq 0xa0(%rsp), %rdi
leaq 0x30(%rsp), %rdx
callq 0x6a65
movb $0x1, %r15b
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %r15d, %r15d
movq 0xe20f(%rip), %rsi      # 0x13ff0
movq 0xe1c8(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
movq %rax, %r14
leaq 0xa0(%rsp), %rsi
movq %r12, %rdi
callq 0x356a
movb $0x1, %al
jmp 0x5e1a
jmp 0x5e15
jmp 0x5e15
jmp 0x5e15
jmp 0x5e15
jmp 0x5e15
jmp 0x5e15
jmp 0x5e15
movq %rax, %r14
xorl %eax, %eax
cmpq %r15, %rbx
sete %cl
testb %al, %al
jne 0x5e49
testb %cl, %cl
jne 0x5e49
movq -0x28(%r15), %rdi
leaq -0x18(%r15), %rax
cmpq %rdi, %rax
je 0x5e40
movq (%rax), %rsi
incq %rsi
callq 0x3260
addq $-0x28, %r15
cmpq %rbx, %r15
jne 0x5e28
leaq 0xe548(%rip), %rdi      # 0x14398
callq 0x31a0
jmp 0x5f9f
movq %rax, %r14
jmp 0x5e49
movq %rax, %r14
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5e8b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5e8b
movq %rax, %r14
movb $0x1, %r15b
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5ea6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x3260
testl %ebp, %ebp
jne 0x5eb2
jmp 0x5ee8
movq %rax, %r14
movb $0x1, %r15b
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5ecd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f48
movq 0x60(%rsp), %rsi
jmp 0x5f40
movq %rax, %r14
movb $0x1, %r15b
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f2d
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5f2d
movq %rax, %r14
movq 0x50(%rsp), %rdi
cmpq %r12, %rdi
je 0x5f97
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5f97
movq %rax, %r14
movb $0x1, %r15b
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f48
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
testb %r15b, %r15b
jne 0x5f97
jmp 0x5f9f
jmp 0x5f94
jmp 0x5f94
jmp 0x5f59
jmp 0x5f94
jmp 0x5f94
movq %rax, %r14
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f7d
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3260
testb %bpl, %bpl
jne 0x5f97
jmp 0x5f9f
jmp 0x5f94
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x5f9f
movl %ebp, (%rbx)
jmp 0x5f9f
jmp 0x5f94
movq %rax, %r14
movq %rbx, %rdi
callq 0x31f0
movq %r14, %rdi
callq 0x34a0
nop