// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/parser_exp.c
// Function: subtilis_exp_get_lvalue_with_sym
bool subtilis_exp_get_lvalue_with_sym(subtilis_parser_t *p, subtilis_token_t *t,
				      const subtilis_type_t *stype,
				      const char *var_name, size_t mem_reg,
				      size_t loc, subtilis_ir_operand_t *op,
				      subtilis_type_t *type, bool is_reg,
				      subtilis_error_t *err)
{
	const char *tbuf;

	if (subtilis_type_if_is_numeric(stype) ||
	    (stype->type == SUBTILIS_TYPE_FN) ||
	    (stype->type == SUBTILIS_TYPE_STRING)) {
		subtilis_type_copy(type, stype, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;

		if (is_reg) {
			op->reg = loc;
			return true;
		}
		op->reg = subtilis_reference_get_pointer(p, mem_reg, loc, err);

		return false;
	}

	if (stype->type == SUBTILIS_TYPE_REC) {
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;

		tbuf = subtilis_token_get_text(t);
		if ((t->type != SUBTILIS_TOKEN_OPERATOR) || strcmp(tbuf, ".")) {
			subtilis_type_copy(type, stype, err);
			if (err->type != SUBTILIS_ERROR_OK)
				return false;
			op->reg = subtilis_reference_get_pointer(p, mem_reg,
								 loc, err);
			return false;
		}

		/*
		 * Otherwise we have a record field.  We'll recursively call
		 * into this function via subtilis_parser_rec_field_lvalue.
		 */

		op->reg = subtilis_parser_rec_field_lvalue(p, t, stype, mem_reg,
							   loc, type, err);
		return false;
	}

	/*
	 * Need special handling for arrays and vectors
	 */

	if (subtilis_type_if_is_array(stype)) {
		op->reg = subtils_parser_array_lvalue(
		    p, t, stype, loc, var_name, mem_reg, type, err);
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		return false;
	}

	if (subtilis_type_if_is_vector(stype)) {
		op->reg = subtils_parser_vector_lvalue(
		    p, t, stype, loc, var_name, mem_reg, type, err);
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return false;
		return false;
	}

	subtilis_error_set_assertion_failed(err);
	return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r15
movq %r8, (%rsp)
movq %rcx, %rbp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movq 0x58(%rsp), %rbx
movq %rdx, %rdi
callq 0x37534
testb %al, %al
je 0x1e6a5
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2f78a
cmpl $0x0, (%rbx)
jne 0x1e7ae
movq (%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
jne 0x1e7ae
cmpb $0x0, 0x50(%rsp)
je 0x1e734
movq 0x40(%rsp), %rax
movq %r15, (%rax)
movb $0x1, %al
jmp 0x1e7b0
movl (%r12), %eax
cmpl $0x7, %eax
je 0x1e65b
cmpl $0x16, %eax
je 0x1e6ea
cmpl $0x9, %eax
je 0x1e65b
movq %r12, %rdi
callq 0x376b5
testb %al, %al
je 0x1e750
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq (%rsp), %r9
pushq %rbx
pushq 0x50(%rsp)
callq 0x15dd0
jmp 0x1e779
movq (%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12edc
cmpl $0x0, (%rbx)
jne 0x1e7ae
movq %r13, %rdi
callq 0x12ad0
cmpl $0x2, (%r13)
jne 0x1e71f
cmpb $0x2e, (%rax)
jne 0x1e71f
cmpb $0x0, 0x1(%rax)
je 0x1e7bf
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2f78a
cmpl $0x0, (%rbx)
jne 0x1e7ae
movq %r14, %rdi
movq (%rsp), %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x4d71f
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x1e7ae
movq %r12, %rdi
callq 0x376d3
testb %al, %al
je 0x1e795
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq (%rsp), %r9
pushq %rbx
pushq 0x50(%rsp)
callq 0x162c9
addq $0x10, %rsp
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
movq (%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12edc
jmp 0x1e7ae
leaq 0x55144(%rip), %rdx     # 0x738e0
movq %rbx, %rdi
movl $0xf, %esi
movl $0xd7, %ecx
callq 0x145a4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
subq $0x8, %rsp
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq 0x8(%rsp), %rcx
movq %r15, %r8
movq 0x50(%rsp), %r9
pushq %rbx
callq 0x29648
addq $0x10, %rsp
jmp 0x1e746