// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x20, %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 0x4883
movq %rdi, %rbx
leaq 0x208(%rdi), %r14
movl 0xb0(%rdi), %eax
cmpq $0xd, %rax
ja 0x4855
leaq 0x8c18(%rip), %rcx      # 0xd04c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
jne 0x47c5
movsbl %r15b, %eax
cmpl $0x1f, %eax
jle 0x4a0f
cmpl $0x20, %eax
je 0x4883
cmpl $0x23, %eax
je 0x4a7a
cmpl $0x25, %eax
jne 0x4a21
movl $0xa, 0xb0(%rbx)
jmp 0x4855
movsbl %r15b, %esi
cmpl $0x7b, %esi
je 0x48ea
cmpl $0x7d, %esi
jne 0x48f0
decl 0x610(%rbx)
jne 0x48f0
leaq 0x618(%rbx), %r12
leaq 0x8f56(%rip), %rsi      # 0xd40a
movq %r12, %rdi
callq 0x30a0
testl %eax, %eax
je 0x4abf
leaq 0x8f47(%rip), %rsi      # 0xd412
movq %r12, %rdi
callq 0x30a0
testl %eax, %eax
je 0x4ac6
leaq 0x8f36(%rip), %rsi      # 0xd418
movq %r12, %rdi
callq 0x30a0
testl %eax, %eax
jne 0x4ada
movl $0x90, %edi
jmp 0x4acb
cmpb $0x3e, %r15b
je 0x4835
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8f78(%rip), %rsi      # 0xd48d
leaq 0x8f79(%rip), %rdx      # 0xd495
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
je 0x47ed
leaq 0x658(%rbx), %rdi
jmp 0x4798
leaq 0x1c0(%rbx), %rdi
movsbl %r15b, %r12d
movl %r12d, %esi
callq 0x31f0
cmpl $0xa, %r12d
je 0x485b
cmpl $0x7b, %r12d
je 0x48fc
cmpl $0x7d, %r12d
jne 0x4883
decl 0x610(%rbx)
jne 0x4855
leaq 0x160(%rbx), %rsi
movq %rbx, %rdi
callq 0x7a12
jmp 0x4afc
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
jne 0x4626
cmpb $0x29, %r15b
je 0x47e1
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8ea7(%rip), %rsi      # 0xd473
leaq 0x8eb0(%rip), %rdx      # 0xd483
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
movsbl %r15b, %eax
cmpl $0x20, %eax
je 0x4883
cmpl $0x2d, %eax
jne 0x4b0b
movl $0x4, 0xb0(%rbx)
jmp 0x4855
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
je 0x482b
leaq 0xe0(%rbx), %rdi
jmp 0x4798
movl %r15d, %edi
callq 0x3350
cmpb $0x5f, %r15b
je 0x4791
testl %eax, %eax
jne 0x4791
movl %r15d, %eax
addl $-0x30, %eax
cmpl $0xa, %eax
setae %al
cmpb $0x2d, %r15b
setne %cl
testb %al, %cl
je 0x4791
movsbl %r15b, %eax
cmpl $0x20, %eax
je 0x47e1
cmpl $0x28, %eax
jne 0x4bdb
movl $0x2, 0xb0(%rbx)
jmp 0x4855
cmpb $0x2e, %r15b
jne 0x473f
movl $0x8, 0xb0(%rbx)
jmp 0x4855
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
je 0x4890
leaq 0x678(%rbx), %rdi
jmp 0x4798
cmpb $0x2e, %r15b
jne 0x4764
movl $0x8, 0xb0(%rbx)
jmp 0x483f
movl %r15d, %edi
callq 0x3350
cmpb $0x5f, %r15b
je 0x475b
testl %eax, %eax
jne 0x475b
movsbl %r15b, %eax
cmpl $0x1f, %eax
jg 0x4907
cmpl $0xa, %eax
je 0x485b
cmpl $0xd, %eax
je 0x4883
jmp 0x4c0f
cmpb $0x7b, %r15b
jne 0x47a6
incl 0x610(%rbx)
leaq 0x1c0(%rbx), %rdi
movsbl %r15b, %esi
callq 0x31f0
movl $0x9, 0xb0(%rbx)
jmp 0x4855
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
je 0x497e
movl $0x6, 0xb0(%rbx)
jmp 0x4791
leaq 0x618(%rbx), %rdi
jmp 0x4798
movl %r15d, %edi
callq 0x3350
cmpb $0x5f, %r15b
je 0x4791
testl %eax, %eax
jne 0x4791
movl %r15d, %eax
addl $-0x30, %eax
cmpl $0xa, %eax
setae %al
cmpb $0x2d, %r15b
setne %cl
testb %al, %cl
jne 0x4a55
leaq 0xc0(%rbx), %rdi
movsbl %r15b, %esi
callq 0x31f0
jmp 0x4855
movl %r15d, %edi
callq 0x3350
testl %eax, %eax
je 0x49bc
leaq 0x160(%rbx), %rsi
movq %rbx, %rdi
callq 0x7a12
leaq 0xc0(%rbx), %rdi
movsbl %r15b, %esi
callq 0x31f0
movl $0x1, 0xb0(%rbx)
jmp 0x4855
movl $0x3, 0xb0(%rbx)
jmp 0x4855
cmpb $0x20, %r15b
jne 0x4b3f
leaq 0x658(%rbx), %rdi
leaq 0x8c20(%rip), %rsi      # 0xd425
callq 0x30a0
cmpl $0x1, %eax
movl $0x2, %eax
sbbl $0x0, %eax
movq 0x6a0(%rbx), %rcx
movl %eax, -0x20(%rcx)
movl $0xd, 0xb0(%rbx)
jmp 0x4855
cmpb $0x29, %r15b
jne 0x4b73
movl $0x5, 0xb0(%rbx)
leaq 0x160(%rbx), %rsi
leaq 0xb8(%rbx), %rdx
movq %rbx, %rdi
callq 0x7876
cmpb $0xa, %r15b
jne 0x4883
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x3130
cmpl $0x0, 0x608(%rbx)
je 0x4879
incl 0x60c(%rbx)
movl $0x0, 0x608(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movsbl %r15b, %eax
cmpl $0xa, %eax
je 0x492e
cmpl $0xd, %eax
je 0x492e
cmpl $0x20, %eax
jne 0x4ba7
cmpq $0x0, 0x680(%rbx)
je 0x4855
leaq 0x678(%rbx), %rsi
movq 0x6a0(%rbx), %rdi
addq $-0x18, %rdi
callq 0xa320
movq $0x0, 0x680(%rbx)
movq 0x678(%rbx), %rax
movb $0x0, (%rax)
jmp 0x4855
incl 0x610(%rbx)
leaq 0x638(%rbx), %rdi
jmp 0x479c
incl 0x610(%rbx)
jmp 0x4855
cmpl $0x20, %eax
je 0x4883
cmpl $0x7b, %eax
jne 0x4c0f
incl 0x610(%rbx)
movl $0xb, 0xb0(%rbx)
jmp 0x4855
cmpq $0x0, 0x680(%rbx)
je 0x4964
leaq 0x678(%rbx), %rsi
movq 0x6a0(%rbx), %rdi
addq $-0x18, %rdi
callq 0xa320
movq $0x0, 0x680(%rbx)
movq 0x678(%rbx), %rax
movb $0x0, (%rax)
movq $0x0, 0x660(%rbx)
movq 0x658(%rbx), %rax
movb $0x0, (%rax)
jmp 0x4afc
cmpb $0x20, %r15b
je 0x4883
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8aff(%rip), %rsi      # 0xd496
leaq 0x8b0b(%rip), %rdx      # 0xd4a9
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
movsbl %r15b, %eax
cmpl $0xa, %eax
je 0x485b
cmpl $0xd, %eax
je 0x4883
cmpl $0x20, %eax
je 0x4883
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8ae7(%rip), %rsi      # 0xd4d1
leaq 0x8af7(%rip), %rdx      # 0xd4e8
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
cmpl $0xa, %eax
je 0x485b
cmpl $0xd, %eax
je 0x4883
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x89ab(%rip), %rsi      # 0xd3db
leaq 0x89b5(%rip), %rdx      # 0xd3ec
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
movsbl %r15b, %eax
cmpl $0x20, %eax
je 0x4835
cmpl $0x28, %eax
jne 0x4c43
movl $0x7, 0xb0(%rbx)
jmp 0x4855
leaq -0x38(%rbp), %r12
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq $0x0, 0x10(%r12)
movl $0x0, -0x8(%r12)
leaq 0x698(%rbx), %rdi
leaq -0x40(%rbp), %rsi
callq 0xa2d8
movl $0xc, 0xb0(%rbx)
movq %r12, %rdi
callq 0xa58c
jmp 0x4855
movl $0x50, %edi
jmp 0x4acb
movl $0x70, %edi
leaq 0x638(%rbx), %rsi
addq %rbx, %rdi
callq 0x3120
xorl %eax, %eax
movq %rax, 0x640(%rbx)
movq 0x638(%rbx), %rcx
movb %al, (%rcx)
movq %rax, 0x620(%rbx)
movq 0x618(%rbx), %rcx
movb %al, (%rcx)
movl $0x0, 0xb0(%rbx)
jmp 0x4855
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x896a(%rip), %rsi      # 0xd484
leaq 0x896b(%rip), %rdx      # 0xd48c
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x88dc(%rip), %rsi      # 0xd42a
leaq 0x88e9(%rip), %rdx      # 0xd43e
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x893e(%rip), %rsi      # 0xd4c0
leaq 0x8947(%rip), %rdx      # 0xd4d0
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8889(%rip), %rsi      # 0xd43f
leaq 0x889f(%rip), %rdx      # 0xd45c
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8873(%rip), %rsi      # 0xd45d
leaq 0x8881(%rip), %rdx      # 0xd472
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x87cf(%rip), %rsi      # 0xd3ed
leaq 0x87e4(%rip), %rdx      # 0xd409
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x8858(%rip), %rsi      # 0xd4aa
leaq 0x8866(%rip), %rdx      # 0xd4bf
leaq -0x40(%rbp), %rdi
callq 0x376a
movl 0x608(%rbx), %ecx
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4cd6
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
movq %rax, %rbx
movq %r12, %rdi
callq 0xa58c
jmp 0x4ccd
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
jmp 0x4cb0
jmp 0x4cca
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x4ccd
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x3260
jmp 0x4ccd
movq %rax, %rbx
movq %rbx, %rdi
callq 0x33d0
nop