// File: kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::find_first_set()
void xbytes::find_first_set()
{
	for(int i = 0; i < symbols.size(); ++i)
	{
		if(symbols[i]->type == ST_TERMINAL)
		{
			symbols[i]->first_set.push_back(symbols[i]);
		}
	}

	while(true)
	{
		int change_count = 0;
		for(int i = 0; i < rules.size(); ++i)
		{
			rule* r = rules[i];
			if(r->rights.size() == 0) continue;

			change_count += merge_symbol_set(r->left->first_set, r->rights[0]->first_set);
			for(int j = 0; j < r->rights.size() - 1; ++j)
			{
				if(!r->rights[j]->is_nullable) break;
				change_count += merge_symbol_set(r->left->first_set, r->rights[j+1]->first_set);
			}
		}

		if(!change_count) break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x30(%rbp), %rdi
movslq -0xc(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x8, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0x627f
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
cmpl $0x1, 0x48(%rax)
jne 0x626f
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc4f0
movq -0x30(%rbp), %rdi
movq (%rax), %rax
addq $0x70, %rax
movq %rax, -0x40(%rbp)
addq $0x8, %rdi
movslq -0xc(%rbp), %rsi
callq 0xc4f0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0xc690
jmp 0x6271
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x61fb
jmp 0x6281
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x30(%rbp), %rdi
movslq -0x14(%rbp), %rax
movq %rax, -0x48(%rbp)
addq $0x20, %rdi
callq 0xc510
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x63c5
movq -0x30(%rbp), %rdi
addq $0x20, %rdi
movslq -0x14(%rbp), %rsi
callq 0xc530
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
callq 0xc4d0
cmpq $0x0, %rax
jne 0x62e4
jmp 0x63b7
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x70, %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xc4f0
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq (%rax), %rdx
addq $0x70, %rdx
callq 0x8450
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
movslq -0x24(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
callq 0xc4d0
movq %rax, %rcx
movq -0x58(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x63b5
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
movslq -0x24(%rbp), %rsi
callq 0xc4f0
movq (%rax), %rax
testb $0x1, 0x68(%rax)
jne 0x6367
jmp 0x63b5
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x70, %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
movl -0x24(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rsi
callq 0xc4f0
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq (%rax), %rdx
addq $0x70, %rdx
callq 0x8450
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x6326
jmp 0x63b7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x628f
cmpl $0x0, -0x10(%rbp)
jne 0x63cd
jmp 0x63d2
jmp 0x6281
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)