// File: /workspace/github_c_makefile_star2_O0/MaoKo[P]FGFX/fgfp/src/cfg.c
// Function: alias_literal_list
static int
alias_literal_list(cfg_t* cfg, symbol_t* alias_ter) {
	if (peek_token(cfg->lex) != T_LITERAL) {
		errorf(CURRENT_LINE(cfg->lex),
			"Missing a literal after the => in the $ALIAS section.");
		return (ERROR);
	}

	size_t index_alias = alias_ter->index;
	while (peek_token(cfg->lex) == T_LITERAL) {
		advance_token(cfg->lex);
		symbol_t* literal = add_symbol_cfg(cfg, T_LITERAL, C_LEXEME(cfg->lex));

		if (literal->terminal_alias != -1) {
			errorf(CURRENT_LINE(cfg->lex),
						"Redefinning literal %s.", C_LEXEME(cfg->lex));
			return (ERROR);
		}
		else if ((alias_ter->prec && literal->prec)
					&& (alias_ter->prec != literal->prec)) {
			errorf(CURRENT_LINE(cfg->lex),
						"Several precedence for the terminal %s.",
						alias_ter->name);
			return (ERROR);
		}

		literal->is_defined = true;
		literal->terminal_alias = index_alias;
	
		if (literal->prec) {
			literal->share_prec = true;
			alias_ter->prec = literal->prec;
		}

		if (peek_token(cfg->lex) == T_COMMA)
			{ advance_token(cfg->lex); }
	}
	return (DONE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x32e0
cmpl $0x28, %eax
je 0x58a8
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq 0x28(%rax), %rdi
leaq 0x6d7f(%rip), %rsi      # 0xc614
movb $0x0, %al
callq 0x4210
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x59ee
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x32e0
cmpl $0x28, %eax
jne 0x59e7
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2ca0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdx
movl $0x28, %esi
callq 0x4b70
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $-0x1, 0x18(%rax)
je 0x5936
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq 0x28(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdx
leaq 0x6d27(%rip), %rsi      # 0xc64a
movb $0x0, %al
callq 0x4210
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x59ee
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x5989
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x5989
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rcx
cmpq 0x20(%rcx), %rax
je 0x5989
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq 0x28(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
leaq 0x6ce9(%rip), %rsi      # 0xc662
movb $0x0, %al
callq 0x4210
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x59ee
jmp 0x598b
movq -0x28(%rbp), %rax
movb $0x1, 0xc(%rax)
movq -0x20(%rbp), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x59c3
movq -0x28(%rbp), %rax
movb $0x1, 0x1c(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x32e0
cmpl $0x31, %eax
jne 0x59e2
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2ca0
jmp 0x58b3
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)