// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfp/src/lr.c
// Function: check_conflict
bool
check_conflict(cfg_t const* cfg, lr1_state_t* state,
									trans_list_t** reduce_list, int kind) {

	trans_list_t* target_action = (kind == SHIFT_REDUCE)
								? state->shift_lst : state->reduces;
	bool several = false;
	if (state->accept)
		{ several = handle_accept_conflict(cfg, reduce_list); }

	while (target_action) {
		trans_list_t* reset_list = (*reduce_list);
		while (reset_list) {
			if (kind == SHIFT_REDUCE) {
				symbol_t* shift_sym = (symbol_t*)AT_VECTOR(cfg->terminal,
												reset_list->input);

				if ((_SHIFT ^ target_action->input) == reset_list->input) {
					production_t* crt_prod = (production_t*)
												AT_VECTOR(cfg->productions,
												_REDUCE ^ reset_list->state);
					symbol_t* last_sym;
					if (crt_prod->mimic_sym)
						{ last_sym = crt_prod->mimic_sym; }
					else
						{ last_sym = last_symbol_in_prod(crt_prod); }

					if (last_sym && PRECEDENCE(last_sym) != NOT_PREC
							&& PRECEDENCE(shift_sym) != NOT_PREC) {
						if (PRECEDENCE(last_sym) > PRECEDENCE(shift_sym)) {
							del_node_trans_list(&state->shift_lst,
															target_action);
						}
						else if (PRECEDENCE(last_sym) < PRECEDENCE(shift_sym))
							{ del_node_trans_list(reduce_list, reset_list); }
						else {
							if (LEFT(shift_sym)) {
								del_node_trans_list(&state->shift_lst,
															target_action);
							}
							if (RIGHT(shift_sym)) 
							{ del_node_trans_list(reduce_list, reset_list); }
						}
						return (check_conflict(cfg, state, reduce_list, kind));
					}
					else {
						// Favor of shifting
						del_node_trans_list(reduce_list, reset_list);
						several = true; break;
					}
				}
			}
			else if ((kind == REDUCE_REDUCE)
					&& (target_action->input == reset_list->input)) {
				// Favor of reducing by the rule that appear earlier

				trans_list_t const* tnode =
					(target_action->state > reset_list->state) ?
						target_action : reset_list ;

				trans_list_t** list_src =
					(target_action->state > reset_list->state) ?
						&state->reduces : reduce_list ;

				del_node_trans_list(list_src, tnode);
				return (true);
			}
			reset_list = reset_list->next;
		}
		target_action = target_action->next;
	}
	return (several);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpl $0x1, -0x24(%rbp)
jne 0x99ce
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0x99da
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x30(%rbp)
movb $0x0, -0x31(%rbp)
movq -0x18(%rbp), %rax
testb $0x1, 0x29(%rax)
je 0x9a02
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x9d70
andb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x9a04
cmpq $0x0, -0x30(%rbp)
je 0x9d56
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x9d46
cmpl $0x1, -0x24(%rbp)
jne 0x9c9d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
xorl $0x1000, %eax           # imm = 0x1000
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x9c98
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movl 0xc(%rcx), %ecx
xorl $0x4000, %ecx           # imm = 0x4000
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x9a9e
movq -0x50(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x9aab
movq -0x50(%rbp), %rdi
callq 0x6b40
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x9c82
movq -0x58(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9acb
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x74(%rbp)
jmp 0x9ad8
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %eax
cmpl $-0x1, %eax
je 0x9c82
movq -0x48(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9af9
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x78(%rbp)
jmp 0x9b06
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpl $-0x1, %eax
je 0x9c82
movq -0x58(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9b27
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x7c(%rbp)
jmp 0x9b34
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x80(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9b52
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x84(%rbp)
jmp 0x9b62
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x80(%rbp), %eax
movl -0x84(%rbp), %ecx
cmpl %ecx, %eax
jle 0x9b85
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movq -0x30(%rbp), %rsi
callq 0x3b40
jmp 0x9c64
movq -0x58(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9b9d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x88(%rbp)
jmp 0x9bad
movq -0x58(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x88(%rbp)
movl -0x88(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x48(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9bd1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x90(%rbp)
jmp 0x9be1
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
movl (%rax), %eax
movl %eax, -0x90(%rbp)
movl -0x8c(%rbp), %eax
movl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jge 0x9c00
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3b40
jmp 0x9c62
movq -0x48(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9c13
xorl %eax, %eax
testb $0x1, %al
jne 0x9c21
jmp 0x9c32
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0x4(%rax)
je 0x9c32
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movq -0x30(%rbp), %rsi
callq 0x3b40
movq -0x48(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x9c45
xorl %eax, %eax
testb $0x1, %al
jne 0x9c53
jmp 0x9c60
movq -0x48(%rbp), %rax
movq 0x20(%rax), %rax
testb $0x1, 0x5(%rax)
je 0x9c60
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3b40
jmp 0x9c62
jmp 0x9c64
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x99a0
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x9d5e
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3b40
movb $0x1, -0x31(%rbp)
jmp 0x9d46
jmp 0x9d36
cmpl $0x2, -0x24(%rbp)
jne 0x9d34
movq -0x30(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x9d34
movq -0x30(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x40(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jle 0x9cd4
movq -0x30(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x9cdf
movq -0x40(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x40(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jle 0x9d0b
movq -0x18(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xa0(%rbp)
jmp 0x9d16
movq -0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x3b40
movb $0x1, -0x1(%rbp)
jmp 0x9d5e
jmp 0x9d36
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x9a1a
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x9a04
movb -0x31(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)