// File: /workspace/github_cpp_makefile_star2_O1/kiven-li[P]xbytes/xbytes.cpp
// Function: xbytes::xbytes::add_rule(xbytes::rule&)
void xbytes::add_rule(rule& r)
{
	//create new rule
	rule* rr = new rule();
	rr->index = rules.size();
	rr->left = r.left;
	rr->left_alias = r.left_alias;
	rr->rights = r.rights;
	rr->right_alias = r.right_alias;
	rr->code = r.code;
	make_string_rule(*rr);
	rules.push_back(rr);

	//attach rule with left symbol
	rr->left->rules.push_back(rr);

	//set start rule
	if(rr->left->name == "program")
	{
		start = rr;

		symbol* s = new symbol();
		s->index = symbols.size();
		s->name = ACCEPT_TERMINAL;
		s->type = ST_TERMINAL;
		s->associativity = AT_NONE;
		s->precedence = -1;
		symbols.push_back(s);
		rr->rights.push_back(s);
		rr->right_alias.push_back("");
	}
	
	//clear global rule
	r.left = NULL;
	r.left_alias.clear();
	r.rights.clear();	
	r.right_alias.clear();
	r.code.clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r15
movl $0xa8, %edi
callq 0x3250
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
leaq 0x10(%rax), %rdi
leaq 0x20(%rax), %rdx
movq %rdx, 0x10(%rax)
movq %rcx, 0x18(%rax)
movb %cl, 0x20(%rax)
leaq 0x70(%rax), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq %rdx, 0x60(%rax)
movq %rcx, 0x68(%rax)
movb %cl, 0x70(%rax)
leaq 0x90(%rax), %rdx
movq %rdx, 0x80(%rax)
movq %rcx, 0x88(%rax)
movb %cl, 0x90(%rax)
movq %rax, -0x30(%rbp)
movq 0x28(%r15), %rcx
subq 0x20(%r15), %rcx
shrq $0x3, %rcx
movl %ecx, (%rax)
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
leaq 0x10(%rbx), %rsi
callq 0x3120
leaq 0x30(%rbx), %rsi
movq -0x30(%rbp), %rdi
addq $0x30, %rdi
callq 0xa1b4
leaq 0x48(%rbx), %r14
movq -0x30(%rbp), %rdi
addq $0x48, %rdi
movq %r14, %rsi
callq 0xa36c
leaq 0x60(%rbx), %rsi
movq -0x30(%rbp), %rdi
addq $0x60, %rdi
callq 0x3120
movq -0x30(%rbp), %rsi
callq 0x7d60
movq 0x28(%r15), %rsi
cmpq 0x30(%r15), %rsi
je 0x7aff
movq -0x30(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%r15)
jmp 0x7b0c
leaq 0x20(%r15), %rdi
leaq -0x30(%rbp), %rdx
callq 0xbf82
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x58(%rdi), %rsi
cmpq 0x60(%rdi), %rsi
je 0x7b28
movq %rax, (%rsi)
addq $0x8, 0x58(%rdi)
jmp 0x7b35
addq $0x50, %rdi
leaq -0x30(%rbp), %rdx
callq 0xbf82
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
addq $0x8, %rdi
leaq 0x59df(%rip), %rsi      # 0xd527
callq 0x30a0
testl %eax, %eax
jne 0x7c82
movq -0x30(%rbp), %rax
movq %rax, (%r15)
movl $0xa8, %edi
callq 0x3250
leaq 0x18(%rax), %rcx
movq %rcx, 0x8(%rax)
xorl %ecx, %ecx
movq %rcx, 0x10(%rax)
movb %cl, 0x18(%rax)
leaq 0x38(%rax), %rdx
movq %rdx, 0x28(%rax)
movq %rcx, 0x30(%rax)
movb %cl, 0x38(%rax)
movl $0x0, 0x48(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rax)
movq %rcx, 0x60(%rax)
movups %xmm0, 0x70(%rax)
movups %xmm0, 0x80(%rax)
movups %xmm0, 0x90(%rax)
movq %rax, -0x38(%rbp)
movq 0x10(%r15), %rcx
subq 0x8(%r15), %rcx
leaq 0x8(%rax), %rdi
shrq $0x3, %rcx
movl %ecx, (%rax)
movq 0x10(%rax), %rdx
leaq 0x55ce(%rip), %rcx      # 0xd199
movl $0x1, %r8d
xorl %esi, %esi
callq 0x3320
movq -0x38(%rbp), %rax
movl $0x1, 0x48(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rcx, 0xa0(%rax)
movq 0x10(%r15), %rsi
cmpq 0x18(%r15), %rsi
je 0x7c03
movq %rax, (%rsi)
addq $0x8, 0x10(%r15)
jmp 0x7c13
addq $0x8, %r15
leaq -0x38(%rbp), %rdx
movq %r15, %rdi
callq 0xb024
movq -0x30(%rbp), %rdi
movq 0x38(%rdi), %rsi
cmpq 0x40(%rdi), %rsi
je 0x7c2f
movq -0x38(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x38(%rdi)
jmp 0x7c3c
addq $0x30, %rdi
leaq -0x38(%rbp), %rdx
callq 0xb024
movq -0x30(%rbp), %r15
leaq -0x48(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x5a01(%rip), %rdx      # 0xd650
leaq -0x58(%rbp), %r12
movq %r12, %rdi
movq %rdx, %rsi
callq 0x376a
addq $0x48, %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0xc0c2
movq -0x58(%rbp), %rdi
cmpq %r13, %rdi
je 0x7c82
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3260
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rax, 0x18(%rbx)
movq 0x10(%rbx), %rax
movb $0x0, (%rax)
movq 0x30(%rbx), %rax
cmpq %rax, 0x38(%rbx)
je 0x7ca1
movq %rax, 0x38(%rbx)
movq 0x48(%rbx), %rsi
movq %r14, %rdi
callq 0xc2dc
movq $0x0, 0x68(%rbx)
movq 0x60(%rbx), %rax
movb $0x0, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r13, %rdi
je 0x7ce3
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3260
movq %rbx, %rdi
callq 0x33d0
nop