// File: /workspace/github_c_makefile_star2_O1/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 $0x228, %rsp            # imm = 0x228
movq %rdi, %r14
movb 0xecca(%rip), %al       # 0x14398
testb %al, %al
je 0x5a3d
movq (%r14), %rdi
callq 0x30f0
movl %eax, %ebp
movb %bpl, 0x8(%rsp)
cmpb $0x20, %bpl
je 0x56f4
movzbl %bpl, %eax
cmpl $0x9, %eax
jne 0x5701
movq (%r14), %rdi
callq 0x34e0
movq %rax, %rdi
jmp 0x56d9
movq (%r14), %r12
movq (%r12), %rax
movq -0x18(%rax), %rax
movl $0x7, %ebx
testb $0x2, 0x20(%r12,%rax)
jne 0x5a29
movsbl %bpl, %r15d
movl %r15d, %edi
callq 0x3420
cmpb $0x5f, %bpl
je 0x582a
testl %eax, %eax
jne 0x582a
addl $-0x30, %r15d
cmpl $0xa, %r15d
setae %al
cmpb $0x2d, %bpl
setne %cl
testb %al, %cl
jne 0x5860
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 0x59ae
movq (%r15), %r12
callq 0x3030
movq %rax, %rbx
movl (%rax), %ebp
movl $0x0, (%rax)
leaq 0xc0(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x3340
movq (%r13), %rax
subq %r12, %rax
je 0x5c47
movl (%rbx), %ecx
cmpl $0x22, %ecx
je 0x5c53
testl %ecx, %ecx
jne 0x57c1
movl %ebp, (%rbx)
movss %xmm0, 0x38(%r14)
movl $0x4, %ebx
cmpq 0x18(%r14), %rax
jae 0x5a29
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8968(%rip), %rsi      # 0xe152
leaq 0xc0(%rsp), %rdi
movq %r15, %rdx
callq 0x67b9
movb $0x1, %bpl
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %ebp, %ebp
movq 0xe7da(%rip), %rsi      # 0x13ff0
movq 0xe793(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
jmp 0x5e27
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 0x5a29
movq %r15, %rdi
callq 0x32e0
movl $0x1, %ebx
jmp 0x5a29
movq %r12, %rdi
callq 0x34e0
movzbl 0x8(%rsp), %eax
cmpl $0x2d, %eax
jg 0x595d
cmpl $0xa, %eax
je 0x5a03
cmpl $0x22, %eax
jne 0x5c5f
movq 0x40(%r14), %rax
cmpq %rax, 0x48(%r14)
je 0x5896
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 0x593c
leaq 0x40(%r14), %rbx
leaq 0x8(%rsp), %r15
movzbl 0x8(%rsp), %eax
cmpl $0x5c, %eax
je 0x58db
cmpl $0x22, %eax
je 0x5a0e
cmpl $0xa, %eax
jne 0x5902
jmp 0x5c15
movq (%r14), %rdi
callq 0x32c0
cmpb $0x30, %al
je 0x58fc
movzbl %al, %ecx
cmpl $0x74, %ecx
je 0x58f8
cmpl $0x6e, %ecx
jne 0x58fe
movb $0xa, %al
jmp 0x58fe
movb $0x9, %al
jmp 0x58fe
xorl %eax, %eax
movb %al, 0x8(%rsp)
movq 0x48(%r14), %rsi
cmpq 0x50(%r14), %rsi
je 0x5918
movb 0x8(%rsp), %al
movb %al, (%rsi)
incq 0x48(%r14)
jmp 0x5923
movq %rbx, %rdi
movq %r15, %rdx
callq 0x7440
movq (%r14), %rdi
movq %r15, %rsi
callq 0x3360
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x58be
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x884f(%rip), %rsi      # 0xe19f
movq %rax, %rdi
callq 0x3100
jmp 0x5c31
cmpl $0x3b, %eax
je 0x59db
cmpl $0x2e, %eax
jne 0x5c5f
movq (%r14), %rdi
callq 0x30f0
movl %eax, %edi
callq 0x3420
testl %eax, %eax
je 0x5cf7
movq (%r14), %rdi
addq $0x10, %r14
movq %r14, %rsi
callq 0x3300
leaq 0xe9c8(%rip), %rdi      # 0x14360
movq %r14, %rsi
callq 0x7406
testq %rax, %rax
je 0x5d18
movl 0x28(%rax), %ebx
jmp 0x5a29
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
cmpb $0x4c, -0x1(%rax,%rcx)
jne 0x5a15
movq %r15, %rdi
callq 0x32e0
addq $0x30, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x6841
movl $0x3, %ebx
jmp 0x5a29
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 0x5a29
incl 0x8(%r14)
movl $0x6, %ebx
jmp 0x5a29
movl $0x5, %ebx
jmp 0x5a29
addq $0x34, %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x69ab
movl $0x2, %ebx
movl %ebx, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe954(%rip), %rdi      # 0x14398
callq 0x34d0
testl %eax, %eax
je 0x56d6
leaq 0x10(%rsp), %rdx
movl $0x8, (%rdx)
leaq 0x86c0(%rip), %rsi      # 0xe123
leaq 0xc0(%rsp), %r15
movq %r15, %rdi
callq 0x670c
leaq 0xe8(%rsp), %rbx
leaq 0xa0(%rsp), %rdx
movl $0x9, (%rdx)
leaq 0x8698(%rip), %rsi      # 0xe128
movq %rbx, %rdi
callq 0x6744
leaq 0x110(%rsp), %rbx
leaq 0x60(%rsp), %rdx
movl $0xa, (%rdx)
leaq 0x867c(%rip), %rsi      # 0xe12e
movq %rbx, %rdi
callq 0x677c
leaq 0x138(%rsp), %rbx
leaq 0x40(%rsp), %rdx
movl $0xb, (%rdx)
leaq 0x8662(%rip), %rsi      # 0xe136
movq %rbx, %rdi
callq 0x677c
leaq 0x160(%rsp), %rbx
leaq 0x80(%rsp), %rdx
movl $0xc, (%rdx)
leaq 0x8645(%rip), %rsi      # 0xe13e
movq %rbx, %rdi
callq 0x677c
leaq 0x188(%rsp), %rbx
leaq 0x8(%rsp), %rdx
movl $0xd, (%rdx)
leaq 0x862b(%rip), %rsi      # 0xe146
movq %rbx, %rdi
callq 0x677c
leaq 0x1b0(%rsp), %rbx
leaq 0x3c(%rsp), %rdx
movl $0xe, (%rdx)
leaq 0x8935(%rip), %rsi      # 0xe472
movq %rbx, %rdi
callq 0x670c
leaq 0x1d8(%rsp), %rbx
leaq 0x38(%rsp), %rdx
movl $0xf, (%rdx)
leaq 0x8978(%rip), %rsi      # 0xe4d7
movq %rbx, %rdi
callq 0x670c
leaq 0x200(%rsp), %rbx
leaq 0x34(%rsp), %rdx
movl $0x10, (%rdx)
leaq 0x85cd(%rip), %rsi      # 0xe14e
movq %rbx, %rdi
callq 0x670c
leaq 0x228(%rsp), %r12
leaq 0xd(%rsp), %rax
movq %rax, (%rsp)
leaq 0xe7bf(%rip), %rdi      # 0x14360
leaq 0xc0(%rsp), %rsi
leaq 0xf(%rsp), %r8
leaq 0xe(%rsp), %r9
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x6efc
movq $-0x168, %rbx           # imm = 0xFE98
leaq 0x210(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x5be0
movq (%r15), %rsi
incq %rsi
callq 0x3260
addq $-0x28, %r15
addq $0x28, %rbx
jne 0x5bcc
leaq 0xbc3(%rip), %rdi       # 0x67b4
leaq 0xe768(%rip), %rsi      # 0x14360
leaq 0xe699(%rip), %rdx      # 0x14298
callq 0x3230
leaq 0xe78d(%rip), %rdi      # 0x14398
callq 0x31c0
jmp 0x56d6
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x855f(%rip), %rsi      # 0xe188
movq %rax, %rdi
callq 0x3100
movq 0xe3b8(%rip), %rsi      # 0x13ff0
movq 0xe371(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
leaq 0x85ac(%rip), %rdi      # 0xe1fa
callq 0x3190
leaq 0x85a0(%rip), %rdi      # 0xe1fa
callq 0x33c0
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
movsbl 0x8(%rsp), %edi
callq 0x34b0
movl %eax, %ebp
testl %eax, %eax
setne %r15b
je 0x5d6c
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x8a9a(%rip), %rsi      # 0xe72e
leaq 0x8a94(%rip), %rdx      # 0xe72f
leaq 0x60(%rsp), %rdi
callq 0x4f06
movsbl 0x8(%rsp), %edx
leaq 0xa0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x6b85
leaq 0x8a6b(%rip), %rsi      # 0xe72e
leaq 0xa0(%rsp), %rdi
callq 0x3500
leaq 0x20(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
jne 0x5db8
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
jmp 0x5dc5
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8455(%rip), %rsi      # 0xe160
movq %rax, %rdi
callq 0x3100
jmp 0x5c31
movl $0x10, %edi
callq 0x3150
movq %rax, %rbx
leaq 0x8449(%rip), %rsi      # 0xe175
leaq 0xc0(%rsp), %rdi
movq %r14, %rdx
callq 0x67b9
movb $0x1, %bpl
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %ebp, %ebp
movq 0xe298(%rip), %rsi      # 0x13ff0
movq 0xe251(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
jmp 0x5e27
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x844e(%rip), %rsi      # 0xe1ca
leaq 0x8448(%rip), %rdx      # 0xe1cb
leaq 0x40(%rsp), %rdi
callq 0x4f06
movsbl 0x8(%rsp), %esi
leaq 0x80(%rsp), %rdi
callq 0x6c8e
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x6be6
jmp 0x5ddd
movq %rsi, 0x10(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x20(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x18(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
testl %ebp, %ebp
sete %r12b
leaq 0x83cc(%rip), %rsi      # 0xe1b6
leaq 0xc0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x6b15
movb $0x1, %bpl
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdi
callq 0x3440
xorl %ebp, %ebp
movq 0xe1d8(%rip), %rsi      # 0x13ff0
movq 0xe191(%rip), %rdx      # 0x13fb0
movq %rbx, %rdi
callq 0x3480
movq %rax, %r14
leaq 0xc0(%rsp), %rsi
movq %r12, %rdi
callq 0x356a
movb $0x1, %al
jmp 0x5e51
jmp 0x5e4c
jmp 0x5e4c
jmp 0x5e4c
jmp 0x5e4c
jmp 0x5e4c
jmp 0x5e4c
jmp 0x5e4c
movq %rax, %r14
xorl %eax, %eax
cmpq %rbx, %r15
sete %cl
testb %al, %al
jne 0x5e88
testb %cl, %cl
jne 0x5e88
leaq 0xc0(%rsp), %r15
movq -0x28(%rbx), %rdi
leaq -0x18(%rbx), %rax
cmpq %rdi, %rax
je 0x5e7f
movq (%rax), %rsi
incq %rsi
callq 0x3260
addq $-0x28, %rbx
cmpq %r15, %rbx
jne 0x5e67
leaq 0xe509(%rip), %rdi      # 0x14398
callq 0x31a0
jmp 0x601b
movq %rax, %r14
xorl %eax, %eax
movq %r15, %rbx
jmp 0x5e51
movq %rax, %r14
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5ecf
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5ecf
movq %rax, %r14
movb $0x1, %bpl
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5ef8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5ef8
movq %rax, %r14
movb $0x1, %r12b
xorl %r15d, %r15d
movb $0x1, %bpl
testb %r12b, %r12b
je 0x5f37
leaq 0x90(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f37
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5f37
movq %rax, %r14
movb $0x1, %r15b
movb $0x1, %bpl
jmp 0x5f73
movq %rax, %r14
movb $0x1, %r12b
xorl %r15d, %r15d
movb $0x1, %bpl
testb %r12b, %r12b
je 0x5f70
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f70
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5f70
movq %rax, %r14
movb $0x1, %r15b
movb $0x1, %bpl
jmp 0x5f99
movq %rax, %r14
movb $0x1, %r12b
xorl %r15d, %r15d
movb $0x1, %bpl
testb %r12b, %r12b
testb %r15b, %r15b
je 0x5f99
leaq 0xb0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5f99
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x3260
testb %r15b, %r15b
je 0x5fc4
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5fc4
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5fc4
movq %rax, %r14
movb $0x1, %r15b
movb $0x1, %bpl
testb %r15b, %r15b
jmp 0x5ffb
jmp 0x5fcf
jmp 0x5ff5
jmp 0x6010
movq %rax, %r14
leaq 0xd0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5ffb
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x3260
jmp 0x5ffb
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
jne 0x6013
jmp 0x601b
movq %rax, %r14
cmpl $0x0, (%rbx)
jne 0x601b
movl %ebp, (%rbx)
jmp 0x601b
jmp 0x6010
movq %rax, %r14
movq %rbx, %rdi
callq 0x31f0
movq %r14, %rdi
callq 0x34a0
nop