// File: /workspace/github_cpp_makefile_star2_O2/kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::lexical_rule(char)
void xbytes::lexical_rule(char cc)
{
	line[char_index_in_line++] = cc;

	if(cc == '\0') return;

	switch(state)
	{
	case LS_START:
	{
		if(isalpha(cc))
		{
			s.name.push_back(cc);
			state = LS_LEFT_SYMBOL;
		}
		else if(cc == '%')
		{
			state = LS_CODE_DECLARE;
		}
		else if(cc == '#')
		{
			assoc_prec ap;
			ap.associativity = AT_NONE;
			assoc_precs.push_back(ap);
			state = LS_ASSOCIATIVITY_DECLARE;
		}
		else if(cc != ' ' && cc != '\n' && cc != '\r')
		{
			error_on_line(line, "expect char/SPACE", char_index_in_line);
		}	
		break;
	}
	case LS_CODE_DECLARE:
	{
		if(isalpha(cc) || cc == '_')
		{
			declare_code_name.push_back(cc);
		}
		else if(cc == '{')
		{
			++bracket_count;
			state = LS_CODE;
		}
		else if(cc != ' ' && cc != '\r' && cc != '\n')
		{
			error_on_line(line, "expect char OR { OR \\r OR \\n", char_index_in_line);
		}
		break;
	}
	case LS_CODE:
	{
		if(cc == '}')
		{
			--bracket_count;
			if(bracket_count == 0)
			{
				if(declare_code_name == "include")
				{
					include_code = declare_code;
				}
				else if(declare_code_name == "token")
				{
					token_code = declare_code;
				}
				else if(declare_code_name == "syntax_error")
				{
					syntax_error_code = declare_code;
				}

				declare_code.clear();
				declare_code_name.clear();

				state = LS_START;				
			}
			else
			{
				declare_code.push_back(cc);
			}
		}
		else if(cc == '{')
		{
			++bracket_count;
			declare_code.push_back(cc);
		}
		else
		{
			declare_code.push_back(cc);
		}
		break;
	}
	case LS_ASSOCIATIVITY_DECLARE:
	{
		if(isalpha(cc))
		{
			declare_associativity_name.push_back(cc);
		}
		else if(cc == ' ')
		{
			int ass = declare_associativity_name == "left" ? AT_LEFT : AT_RIGHT;
			assoc_precs[assoc_precs.size() - 1].associativity = ass;
			state = LS_ASSOCIATIVITY;
		}
		else 
		{
			error_on_line(line, "expect char OR space", char_index_in_line);
		}
		break;
	}
	case LS_ASSOCIATIVITY:
	{
		if(isalpha(cc))
		{
			associativity_symbol_name.push_back(cc);
		}
		else if(cc == ' ')
		{
			if(associativity_symbol_name.size() != 0)
			{
				assoc_precs[assoc_precs.size() - 1].symbol_names.push_back(associativity_symbol_name);
				associativity_symbol_name.clear();
			}
		}
		else if(cc == '\r' || cc == '\n')
		{
			if(associativity_symbol_name.size() != 0)
			{
				assoc_precs[assoc_precs.size() - 1].symbol_names.push_back(associativity_symbol_name); 
				associativity_symbol_name.clear();
			}
			declare_associativity_name.clear();
			state = LS_START;
		}
		else
		{
			error_on_line(line, "expect char, space, \\r, OR \\n", char_index_in_line);
		}
		break;
	}
	case LS_LEFT_SYMBOL:
	{
		if(isalpha(cc) || cc == '_' || isdigit(cc) || cc == '-')
		{
			s.name.push_back(cc);
		}
		else if(cc == '(')
		{
			state = LS_LEFT_ALIAS;
		}
		else if(cc == '-')
		{
			state = LS_ARROW;
		}
		else if(cc == ' ')
		{
			state = LS_LEFT_WAIT_ARROW;
		}
		else
		{
			error_on_line(line, "expect char/(/-/SPACE", char_index_in_line);
		}

		break;
	}
	case LS_LEFT_ALIAS:
	{
		if(isalpha(cc))
		{
			s.alias.push_back(cc);
		}
		else if(cc == ')')
		{
			state = LS_LEFT_WAIT_ARROW;
		}
		else
		{
			error_on_line(line, "expect char or )", char_index_in_line);
		}

		break;
	}
	case LS_LEFT_WAIT_ARROW:
	{
		if(cc == '-')
		{
			state = LS_ARROW;				
		}
		else if(cc != ' ')
		{
			error_on_line(line, "expect -", char_index_in_line);
		}

		break;
	}
	case LS_ARROW:
	{
		if(cc == '>')
		{
			state = LS_RIGHT_WARIT_SYMBOL;
			make_symbol(r, s);			
		}
		else
		{
			error_on_line(line, "expect >", char_index_in_line);
		}

		break;
	}
	case LS_RIGHT_WARIT_SYMBOL:
	{
		if(cc == '.')
		{
			state = LS_WAIT_RULE_CODE;
		}
		else if(isalpha(cc))
		{
			state = LS_RIGHT_SYMBOL;
			s.name.push_back(cc);
		}
		else if(cc != ' ')
		{
			error_on_line(line, "expect char/./SPACE", char_index_in_line);
		}

		break;
	}
	case LS_RIGHT_SYMBOL:
	{
		if(cc == '.')
		{
			state = LS_WAIT_RULE_CODE;
			make_symbol(r, s);
		}
		else if(isalpha(cc) || cc == '_' || isdigit(cc) || cc == '-')
		{
			s.name.push_back(cc);
		}
		else if(cc == '(')
		{
			state = LS_RIGHT_ALIAS;
		}
		else if(cc == ' ')
		{
			state = LS_RIGHT_WARIT_SYMBOL;
			make_symbol(r, s);
		}
		else
		{
			error_on_line(line, "expect char/./(/SPACE", char_index_in_line);
		}
		break;
	}
	case LS_RIGHT_ALIAS:
	{
		if(isalpha(cc))
		{
			s.alias.push_back(cc);
		}
		else if(cc == ')')
		{
			state = LS_RIGHT_WARIT_SYMBOL;
			make_symbol(r, s);
		}
		else
		{
			error_on_line(line, "expect ) or char", char_index_in_line);
		}
		break;
	}
	case LS_WAIT_RULE_CODE:
	{
		if(cc == '{')
		{
			bracket_count++;
			r.code.push_back(cc);
			state = LS_RULE_CODE;
		}
		else if(isalpha(cc))
		{
			add_rule(r);
			s.name.push_back(cc);
			state = LS_LEFT_SYMBOL;
		}
		else if(cc != ' ' && cc != '\r' && cc != '\n')
		{
			error_on_line(line, "expect \r\n or { or SPACE", char_index_in_line);
		}
		break;
	}
	case LS_RULE_CODE:
	{
		if(cc == '}')
		{
			r.code.push_back(cc);
			
			if(--bracket_count == 0) 
			{
				add_rule(r);
				state = LS_START;
			}
		}
		else
		{
			r.code.push_back(cc);
			if(cc == '{') bracket_count++;
		}
		break;
	}
	}

	if(cc == '\n')
	{
		for(int m = 0; m < MAX_LINE_SIZE; ++m) line[m] = 0;
		if(char_index_in_line) line_count++;
		char_index_in_line = 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %esi, %r15d
movslq 0x608(%rdi), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x608(%rdi)
movb %r15b, 0x208(%rdi,%rax)
testb %r15b, %r15b
je 0x30bf
movq %rdi, %rbx
leaq 0x208(%rdi), %r14
movl 0xb0(%rdi), %eax
cmpq $0xd, %rax
ja 0x308f
leaq 0x7304(%rip), %rcx      # 0xa04c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
jne 0x30e9
movsbl %r15b, %eax
cmpl $0xa, %eax
je 0x3095
cmpl $0xd, %eax
je 0x30bf
cmpl $0x20, %eax
je 0x30bf
cmpl $0x23, %eax
je 0x3313
cmpl $0x25, %eax
jne 0x34b4
movl $0xa, 0xb0(%rbx)
jmp 0x30bf
movsbl %r15b, %esi
cmpl $0x7b, %esi
je 0x31d6
cmpl $0x7d, %esi
jne 0x31f8
decl 0x610(%rbx)
je 0x32d0
addq $0x638, %rbx            # imm = 0x638
pushq $0x7d
jmp 0x31e5
cmpb $0x3e, %r15b
je 0x3159
leaq 0x76ab(%rip), %rsi      # 0xa48d
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
je 0x3111
leaq 0x658(%rbx), %rdi
jmp 0x3086
leaq 0x1c0(%rbx), %rdi
cmpb $0x7d, %r15b
jne 0x3006
pushq $0x7d
popq %rsi
callq 0x21e0
decl 0x610(%rbx)
jne 0x30bf
leaq 0x160(%rbx), %rsi
movq %rbx, %rdi
callq 0x55b2
jmp 0x3398
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
jne 0x2ecd
cmpb $0x29, %r15b
je 0x3105
leaq 0x75fd(%rip), %rsi      # 0xa473
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
movsbl %r15b, %eax
cmpl $0x20, %eax
je 0x30bf
cmpl $0x2d, %eax
jne 0x33be
movl $0x4, 0xb0(%rbx)
jmp 0x30bf
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
je 0x314f
leaq 0xe0(%rbx), %rdi
jmp 0x3086
movl %r15d, %edi
callq 0x2320
cmpb $0x5f, %r15b
je 0x307f
testl %eax, %eax
jne 0x307f
movl %r15d, %eax
addl $-0x30, %eax
cmpl $0xa, %eax
setae %al
cmpb $0x2d, %r15b
setne %cl
testb %al, %cl
je 0x307f
movsbl %r15b, %eax
cmpl $0x20, %eax
je 0x3105
cmpl $0x28, %eax
jne 0x348b
movl $0x2, 0xb0(%rbx)
jmp 0x30bf
cmpb $0x2e, %r15b
jne 0x302d
movl $0x8, 0xb0(%rbx)
jmp 0x30bf
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
je 0x3183
leaq 0x678(%rbx), %rdi
jmp 0x3086
cmpb $0x2e, %r15b
jne 0x3052
movl $0x8, 0xb0(%rbx)
jmp 0x3163
movl %r15d, %edi
callq 0x2320
cmpb $0x5f, %r15b
je 0x3049
testl %eax, %eax
jne 0x3049
movsbl %r15b, %eax
cmpl $0xa, %eax
je 0x3095
cmpl $0xd, %eax
je 0x30bf
cmpl $0x20, %eax
je 0x30bf
cmpl $0x7b, %eax
jne 0x3462
incl 0x610(%rbx)
movl $0xb, 0xb0(%rbx)
jmp 0x30bf
cmpb $0x7b, %r15b
jne 0x30ca
incl 0x610(%rbx)
leaq 0x1c0(%rbx), %rdi
pushq $0x7b
popq %rsi
callq 0x21e0
movl $0x9, 0xb0(%rbx)
jmp 0x30bf
movsbl %r15b, %r15d
movl %r15d, %esi
callq 0x21e0
cmpl $0xa, %r15d
je 0x3095
cmpl $0x7b, %r15d
jne 0x30bf
incl 0x610(%rbx)
jmp 0x30bf
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
je 0x3255
movl $0x6, 0xb0(%rbx)
jmp 0x307f
leaq 0x618(%rbx), %rdi
jmp 0x3086
movl %r15d, %edi
callq 0x2320
cmpb $0x5f, %r15b
je 0x307f
testl %eax, %eax
jne 0x307f
movl %r15d, %eax
addl $-0x30, %eax
cmpl $0xa, %eax
setae %al
cmpb $0x2d, %r15b
setne %cl
testb %al, %cl
jne 0x32ee
leaq 0xc0(%rbx), %rdi
movsbl %r15b, %esi
callq 0x21e0
cmpb $0xa, %r15b
jne 0x30bf
xorl %eax, %eax
cmpq $0x400, %rax            # imm = 0x400
je 0x30a9
movb $0x0, (%r14,%rax)
incq %rax
jmp 0x3097
cmpl $0x0, 0x608(%rbx)
je 0x30b8
incl 0x60c(%rbx)
andl $0x0, 0x608(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r15d, %edi
callq 0x2320
testl %eax, %eax
je 0x3288
leaq 0x160(%rbx), %rsi
movq %rbx, %rdi
callq 0x55b2
leaq 0xc0(%rbx), %rdi
movsbl %r15b, %esi
callq 0x21e0
movl $0x1, 0xb0(%rbx)
jmp 0x308f
movl $0x3, 0xb0(%rbx)
jmp 0x30bf
cmpb $0x20, %r15b
jne 0x33e7
leaq 0x658(%rbx), %rdi
leaq 0x72fc(%rip), %rsi      # 0xa425
callq 0x7074
movzbl %al, %eax
pushq $0x2
popq %rcx
subl %eax, %ecx
movq 0x6a0(%rbx), %rax
movl %ecx, -0x20(%rax)
movl $0xd, 0xb0(%rbx)
jmp 0x30bf
cmpb $0x29, %r15b
jne 0x3410
movl $0x5, 0xb0(%rbx)
leaq 0x160(%rbx), %rsi
leaq 0xb8(%rbx), %rdx
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5472
movsbl %r15b, %eax
cmpl $0xa, %eax
je 0x3204
cmpl $0xd, %eax
je 0x3204
cmpl $0x20, %eax
jne 0x3439
cmpq $0x0, 0x680(%rbx)
je 0x30bf
leaq 0x678(%rbx), %rsi
movq 0x6a0(%rbx), %rdi
addq $-0x18, %rdi
callq 0x733e
andq $0x0, 0x680(%rbx)
movq 0x678(%rbx), %rax
movb $0x0, (%rax)
jmp 0x30bf
incl 0x610(%rbx)
addq $0x638, %rbx            # imm = 0x638
pushq $0x7b
popq %rsi
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21e0
leaq 0x638(%rbx), %rdi
jmp 0x308a
cmpq $0x0, 0x680(%rbx)
je 0x3237
leaq 0x678(%rbx), %rsi
movq 0x6a0(%rbx), %rdi
addq $-0x18, %rdi
callq 0x733e
andq $0x0, 0x680(%rbx)
movq 0x678(%rbx), %rax
movb $0x0, (%rax)
andq $0x0, 0x660(%rbx)
movq 0x658(%rbx), %rax
movb $0x0, (%rax)
andl $0x0, 0xb0(%rbx)
jmp 0x308f
cmpb $0x20, %r15b
je 0x30bf
leaq 0x7230(%rip), %rsi      # 0xa496
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
movsbl %r15b, %eax
cmpl $0xa, %eax
je 0x3095
cmpl $0xd, %eax
je 0x30bf
cmpl $0x20, %eax
je 0x30bf
leaq 0x7223(%rip), %rsi      # 0xa4d1
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x618(%rbx), %r14
leaq 0x712c(%rip), %rsi      # 0xa40a
movq %r14, %rdi
callq 0x7074
testb %al, %al
je 0x334f
pushq $0x50
jmp 0x3364
movsbl %r15b, %eax
cmpl $0x20, %eax
je 0x3159
cmpl $0x28, %eax
jne 0x34dd
movl $0x7, 0xb0(%rbx)
jmp 0x30bf
leaq -0x38(%rbp), %r14
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andq $0x0, 0x10(%r14)
andl $0x0, -0x8(%r14)
leaq 0x698(%rbx), %rdi
leaq -0x40(%rbp), %rsi
callq 0x7302
movl $0xc, 0xb0(%rbx)
movq %r14, %rdi
callq 0x7582
jmp 0x30bf
leaq 0x70bc(%rip), %rsi      # 0xa412
movq %r14, %rdi
callq 0x7074
testb %al, %al
je 0x33a4
pushq $0x70
popq %rdi
leaq 0x638(%rbx), %rsi
addq %rbx, %rdi
callq 0x2130
andq $0x0, 0x640(%rbx)
movq 0x638(%rbx), %rax
xorl %ecx, %ecx
movb %cl, (%rax)
andq $0x0, 0x620(%rbx)
movq 0x618(%rbx), %rax
movb %cl, (%rax)
andl $0x0, 0xb0(%rbx)
jmp 0x30bf
leaq 0x706d(%rip), %rsi      # 0xa418
movq %r14, %rdi
callq 0x7074
movl $0x90, %edi
testb %al, %al
je 0x3374
jmp 0x3365
leaq 0x70bf(%rip), %rsi      # 0xa484
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x703c(%rip), %rsi      # 0xa42a
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x70a9(%rip), %rsi      # 0xa4c0
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x6fff(%rip), %rsi      # 0xa43f
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x6f84(%rip), %rsi      # 0xa3ed
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x6fcb(%rip), %rsi      # 0xa45d
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x6f20(%rip), %rsi      # 0xa3db
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
leaq 0x6fc6(%rip), %rsi      # 0xa4aa
leaq -0x40(%rbp), %rdi
leaq -0x19(%rbp), %rdx
callq 0x25f4
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3558
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
movq %rax, %rbx
movq %r14, %rdi
callq 0x7582
jmp 0x3550
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
jmp 0x353f
jmp 0x354d
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x2100
jmp 0x3550
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2380