// File: /workspace/github_cpp_makefile_star2_O2/exrd[P]neteruhsp/neteruhsp/neteruhsp.cc
// Function: neteruhsp::get_token(neteruhsp::tokenize_context_t&)
token_t* get_token( tokenize_context_t& c )
{
	token_t* res = reinterpret_cast<token_t*>( xmalloc( sizeof( token_t ) ) );
	res->tag_ = TOKEN_UNKNOWN;
	res->content_ = nullptr;
	res->cursor_begin_ = c.cursor_;
	res->cursor_end_ = c.cursor_;
	res->left_space_ =false;
	res->right_space_ =false;

	const auto is_space = []( char c ) { return ( c==' ' || c=='\t' ); };
	const auto is_number = []( char c ) { return ( c>='0' && c<='9' ); };
	const auto is_alpha = []( char c ) { return ( ( c>='a' && c<='z' ) || ( c>='A' && c<='Z' ) ); };
	const auto is_rest_ident = [&]( char c ) { return ( is_number(c) || is_alpha(c) || c=='_' ); };

	const auto pp = c.script_ +c.cursor_;
	const char* p = c.script_ +c.cursor_;

restart:
	const auto prev_p = p;
	const auto prev_cursor = static_cast<int>( p - c.script_ );
	res->appear_line_ = c.line_;
	switch( p[0] )
	{
			// EOF
		case '\0':	res->tag_ = TOKEN_EOF; break;

			// 行終わり
		case '\r':
		case '\f':
			++p;
			goto restart;

		case '\n':
			// この位置はマーキング
			++p;
			++c.line_;
			c.line_head_ = p;
			res->tag_ = TOKEN_EOL;
			break;

			// ステートメント終わり
		case ':':
			++p;
			res->tag_ = TOKEN_EOS;
			break;

			// プリプロセッサで使う
		case '%':	++p; res->tag_ = TOKEN_PP_ARG_INDICATOR; break;

			// 微妙な文字
		case '{':	++p; res->tag_ = TOKEN_LBRACE; break;
		case '}':	++p; res->tag_ = TOKEN_RBRACE; break;
		case '(':	++p; res->tag_ = TOKEN_LPARENTHESIS; break;
		case ')':	++p; res->tag_ = TOKEN_RPARENTHESIS; break;
		case ',':	++p; res->tag_ = TOKEN_COMMA; break;

			// 演算子
		case '|':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_BOR_ASSIGN; } else { res->tag_ = TOKEN_OP_BOR; } break;
		case '&':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_BAND_ASSIGN; } else { res->tag_ = TOKEN_OP_BAND; } break;
		case '^':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_BXOR_ASSIGN; } else { res->tag_ = TOKEN_OP_BXOR; } break;
		case '!':	++p; if ( p[0]=='=' ) { ++p; } res->tag_ = TOKEN_OP_NEQ; break;
		case '>':
			++p;
			if ( p[0] == '=' )
			{ ++p; res->tag_ = TOKEN_OP_GTOE; }
			else
			{ res->tag_ = TOKEN_OP_GT; }
			break;
		case '<':
			++p;
			if ( p[0] == '=' )
			{ ++p; res->tag_ = TOKEN_OP_LTOE; }
			else
			{ res->tag_ = TOKEN_OP_LT; }
			break;
		case '+':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_ADD_ASSIGN; } else { res->tag_ = TOKEN_OP_ADD; } break;
		case '-':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_SUB_ASSIGN; } else { res->tag_ = TOKEN_OP_SUB; } break;
		case '*':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_MUL_ASSIGN; } else { res->tag_ = TOKEN_OP_MUL; } break;
		case '/':
			++p;
			if ( p[0] == '/' )// 一行コメント
			{
				++p;
				while( p[0]!='\n' && p[0]!='\0' )
				{ ++p; }
				goto restart;
			}
			if ( p[0] == '*' )// 複数行コメント
			{
				++p;
				for( ; ; )
				{
					if ( p[0] == '\0' )
					{
						raise_error( "複数行コメントの読み取り中にEOFが検出されました@@ %d行目", c.line_ );
						break;
					}
					if ( p[0] == '\n' )
					{
						++p;
						++c.line_;
						c.line_head_ = p;
						continue;
					}
					if ( p[0]=='*' && p[1]=='/' )
					{
						p += 2;
						break;
					}
					++p;
				}
				goto restart;
			}
			if ( p[0] == '=' )
			{
				++p;
				res->tag_ = TOKEN_DIV_ASSIGN;
			}
			else
			{ 
				res->tag_ = TOKEN_OP_DIV;
			}
			break;
		case '\\':	++p; if ( p[0] == '=' ) { ++p; res->tag_ = TOKEN_MOD_ASSIGN; } else { res->tag_ = TOKEN_OP_MOD; } break;

			// 代入
		case '=':
			++p;
			if ( p[0] == '=' )
			{
				++p;
				res->tag_ = TOKEN_OP_EQ;
			}
			else
			{
				res->tag_ = TOKEN_ASSIGN;
			}
			break;

			// 文字列
		case '\"':
		{
			++p;
			const auto s = p;
			while( p[0]!='\"' )
			{
				if ( p[0] == '\0' )
				{
					raise_error( "文字列の読み取り中にEOFが検出されました@@ %d行目", c.line_ );
				}
				if ( p[0]=='\\' && p[1]=='\"' )
				{
					++p;
				}
				++p;
			}
			const auto e = p;
			res->content_ = create_token_string( s, e -s );
			res->tag_ = TOKEN_STRING;
			++p;
			break;
		}

			// コメント
		case ';':
			++p;
			while( p[0]!='\n' && p[0]!='\0' )
			{
				++p;
			}
			goto restart;

		default:
			if ( is_space( p[0] ) )
			{
				// スペース
				++p;
				res->left_space_ =true;
				while( is_space(p[0]) )
				{
					++p;
				}
				goto restart;
			}
			else if ( is_number( p[0] ) )
			{
				// 数値
				if ( p[0] == '0' )
				{
					++p;
				}
				else
				{
					while( is_number(p[0]) )
					{
						++p;
					}
				}
				if ( p[0] == '.' )
				{
					++p;
					while( is_number(p[0]) )
					{
						++p;
					}
					res->tag_ = TOKEN_REAL;
				}
				else
				{
					res->tag_ = TOKEN_INTEGER;
				}
			}
			else if ( is_alpha( p[0] ) )
			{
				// 何らかの識別子
				++p;
				while( is_rest_ident( p[0] ) )
				{
					++p;
				}
				res->tag_ = TOKEN_IDENTIFIER;
				const auto shadow =query_token_shadow( c.script_ +prev_cursor, p -prev_p );
				if ( shadow != -1 )
				{
					res->tag_ = static_cast<token_tag>( shadow );
				}
			}
			else
			{
				// もう読めない
				raise_error( "読み取れない文字[%c]@@ %d行目", p[0], c.line_ );
			}
			break;
	}

	if ( is_space( p[0] ) )
	{
		res->right_space_ = true;
	}

	c.cursor_ += static_cast<int>( p - pp );
	res->cursor_begin_ = prev_cursor;
	res->cursor_end_ = c.cursor_;

	// contentが埋まってないなら埋める
	if ( res->content_ == nullptr )
	{
		const auto len = res->cursor_end_ -res->cursor_begin_;
		res->content_ = create_string( len );
		memcpy( res->content_, c.script_ +res->cursor_begin_, len );
		res->content_[len] = '\0';
	}

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x21d0
movq %rax, %rbx
orl $-0x1, (%rax)
andq $0x0, 0x8(%rax)
movslq 0x8(%r14), %r13
movl %r13d, 0x10(%rax)
movl %r13d, 0x14(%rax)
andw $0x0, 0x1c(%rax)
movq (%r14), %rdi
addq %rdi, %r13
movl 0xc(%r14), %edx
leaq 0x865e(%rip), %rax      # 0xb370
leaq 0x85bb(%rip), %rcx      # 0xb2d4
movq %r13, %r15
movl %edx, 0x18(%rbx)
movzbl (%r15), %esi
leal -0x9(%rsi), %r8d
cmpl $0x26, %r8d
ja 0x2d4e
movslq (%rcx,%r8,4), %r8
addq %rcx, %r8
jmpq *%r8
movb $0x1, 0x1c(%rbx)
incq %r15
movzbl (%r15), %esi
cmpl $0x20, %esi
je 0x2d3b
cmpl $0x9, %esi
je 0x2d3b
jmp 0x2d1c
leal -0x3a(%rsi), %r8d
cmpl $0x4, %r8d
ja 0x2ddc
movslq (%rax,%r8,4), %rsi
addq %rax, %rsi
jmpq *%rsi
movzbl 0x1(%r15), %esi
incq %r15
testl %esi, %esi
je 0x2d1c
cmpl $0xa, %esi
jne 0x2d65
jmp 0x2d1c
movzbl 0x1(%r15), %esi
cmpl $0x2f, %esi
jne 0x2d98
addq $0x2, %r15
movzbl (%r15), %esi
testl %esi, %esi
je 0x2d1c
cmpl $0xa, %esi
je 0x2d1c
incq %r15
jmp 0x2d86
cmpl $0x2a, %esi
jne 0x2e21
addq $0x2, %r15
incq %r15
movzbl -0x1(%r15), %esi
cmpl $0x2a, %esi
je 0x2dc0
cmpl $0xa, %esi
je 0x2dc8
testl %esi, %esi
jne 0x2da5
jmp 0x324c
cmpb $0x2f, (%r15)
jne 0x2da5
jmp 0x2dd4
incl %edx
movl %edx, 0xc(%r14)
movq %r15, 0x10(%r14)
jmp 0x2da5
incq %r15
jmp 0x2d1c
testl %esi, %esi
je 0x30bf
cmpl $0x5c, %esi
je 0x300b
cmpl $0x5e, %esi
je 0x309f
cmpl $0x7b, %esi
je 0x306b
cmpl $0x7c, %esi
je 0x304b
cmpl $0x7d, %esi
jne 0x2e3f
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x5, (%rbx)
jmp 0x31dc
cmpl $0x3d, %esi
jne 0x30cd
movq %r15, %rbp
subq %rdi, %rbp
addq $0x2, %r15
movl $0x1e, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
leal -0x30(%rsi), %eax
cmpb $0x9, %al
ja 0x30e7
cmpb $0x30, %sil
jne 0x31ab
movb 0x1(%r15), %al
incq %r15
jmp 0x31bd
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x3137
addq $0x2, %r15
movl $0x21, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x8, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x6, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
incl %edx
movl %edx, 0xc(%r14)
movq %r15, 0x10(%r14)
movl $0x1, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movq %r15, %r12
movzbl (%r12), %eax
cmpl $0x5c, %eax
je 0x2ef4
cmpl $0x22, %eax
je 0x2fae
testl %eax, %eax
jne 0x2eff
jmp 0x3243
cmpb $0x22, 0x1(%r12)
jne 0x2eff
incq %r12
incq %r12
jmp 0x2ed8
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x3, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
leaq 0x2(%r15), %rax
leaq 0x1(%r15), %r15
cmoveq %rax, %r15
movl $0x10, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x7, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x3145
addq $0x2, %r15
movl $0x1c, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x3153
addq $0x2, %r15
movl $0x1d, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x315e
addq $0x2, %r15
movl $0x1b, (%rbx)
jmp 0x31dc
movq %r12, %rsi
subq %r15, %rsi
movq %r15, %rdi
callq 0x330f
movq %rax, 0x8(%rbx)
movl $0xb, (%rbx)
incq %r12
testq %rax, %rax
sete %al
movq %r12, %r15
jmp 0x31de
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x2, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x3169
addq $0x2, %r15
movl $0x14, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x3174
addq $0x2, %r15
movl $0x1f, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x317f
addq $0x2, %r15
movl $0x12, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x318a
addq $0x2, %r15
movl $0x20, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
incq %r15
movl $0x4, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x3195
addq $0x2, %r15
movl $0xf, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
cmpb $0x3d, 0x1(%r15)
jne 0x31a0
addq $0x2, %r15
movl $0x22, (%rbx)
jmp 0x31dc
movq %r15, %rbp
subq %rdi, %rbp
andl $0x0, (%rbx)
jmp 0x31dc
leaq 0x1(%r15), %rcx
subq %rdi, %r15
movl $0x18, (%rbx)
movb $0x1, %al
movq %r15, %rbp
movq %rcx, %r15
jmp 0x31de
movl %esi, %eax
andb $-0x21, %al
addb $-0x41, %al
cmpb $0x19, %al
ja 0x325c
pushq $0x1
popq %r12
movb (%r15,%r12), %al
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
jb 0x3111
cmpb $0x5f, %al
je 0x3111
andb $-0x21, %al
addb $-0x41, %al
cmpb $0x19, %al
ja 0x3116
incq %r12
jmp 0x30f9
movslq %ebp, %rax
addq %rax, %rdi
movq %r12, %rsi
callq 0x2c6d
cmpl $-0x1, %eax
pushq $0x23
popq %rcx
cmovnel %eax, %ecx
movl %ecx, (%rbx)
addq %r12, %r15
jmp 0x31dc
incq %r15
movl $0xd, (%rbx)
jmp 0x31dc
incq %r15
movl $0x16, (%rbx)
jmp 0x31dc
incq %r15
movl $0x17, (%rbx)
jmp 0x31dc
incq %r15
movl $0x15, (%rbx)
jmp 0x31dc
incq %r15
movl $0x13, (%rbx)
jmp 0x31dc
incq %r15
movl $0x19, (%rbx)
jmp 0x31dc
incq %r15
movl $0x11, (%rbx)
jmp 0x31dc
incq %r15
movl $0xc, (%rbx)
jmp 0x31dc
incq %r15
movl $0x1a, (%rbx)
jmp 0x31dc
incq %r15
movl $0xe, (%rbx)
jmp 0x31dc
decq %r15
movb 0x1(%r15), %al
incq %r15
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
jb 0x31ae
cmpb $0x2e, %al
jne 0x31d6
movb 0x1(%r15), %al
incq %r15
addb $-0x30, %al
cmpb $0xa, %al
jb 0x31c1
movl $0xa, (%rbx)
jmp 0x31dc
movl $0x9, (%rbx)
movb $0x1, %al
movzbl (%r15), %ecx
cmpl $0x20, %ecx
je 0x31ec
cmpl $0x9, %ecx
jne 0x31f0
movb $0x1, 0x1d(%rbx)
subl %r13d, %r15d
addl 0x8(%r14), %r15d
movl %r15d, 0x8(%r14)
movl %ebp, 0x10(%rbx)
movl %r15d, 0x14(%rbx)
testb %al, %al
je 0x3231
subl %ebp, %r15d
movslq %r15d, %r15
movq %r15, %rdi
callq 0x2948
movq %rax, %r12
movq %rax, 0x8(%rbx)
movslq %ebp, %rsi
addq (%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2120
movb $0x0, (%r12,%r15)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x893c(%rip), %rdi      # 0xbb86
jmp 0x3253
leaq 0x88e2(%rip), %rdi      # 0xbb35
movl %edx, %esi
xorl %eax, %eax
callq 0x326e
movsbl %sil, %esi
leaq 0x8964(%rip), %rdi      # 0xbbcb
xorl %eax, %eax
callq 0x326e