// File: /workspace/github_c_makefile_star2_O2/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 0x35655
testb %al, %al
je 0x1da51
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2de8a
cmpl $0x0, (%rbx)
jne 0x1db56
movq (%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x1db56
cmpb $0x0, 0x50(%rsp)
je 0x1dae0
movq 0x40(%rsp), %rax
movq %r15, (%rax)
movb $0x1, %al
jmp 0x1db58
movl (%r12), %eax
cmpl $0x7, %eax
je 0x1da07
cmpl $0x16, %eax
je 0x1da96
cmpl $0x9, %eax
je 0x1da07
movq %r12, %rdi
callq 0x357cc
testb %al, %al
je 0x1dafc
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq (%rsp), %r9
pushq %rbx
pushq 0x50(%rsp)
callq 0x159a0
jmp 0x1db25
movq (%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12e0e
cmpl $0x0, (%rbx)
jne 0x1db56
movq %r13, %rdi
callq 0x12a25
cmpl $0x2, (%r13)
jne 0x1dacb
cmpb $0x2e, (%rax)
jne 0x1dacb
cmpb $0x0, 0x1(%rax)
je 0x1db67
movq 0x48(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2de8a
cmpl $0x0, (%rbx)
jne 0x1db56
movq %r14, %rdi
movq (%rsp), %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x4ab28
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x1db56
movq %r12, %rdi
callq 0x357ea
testb %al, %al
je 0x1db3f
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq (%rsp), %r9
pushq %rbx
pushq 0x50(%rsp)
callq 0x15e4b
popq %rcx
popq %rdx
movq 0x40(%rsp), %rcx
movq %rax, (%rcx)
movq (%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x12e0e
jmp 0x1db56
leaq 0x4fd56(%rip), %rdx     # 0x6d89c
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0xd7, %ecx
callq 0x1429e
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 0x28331
popq %rcx
popq %rdx
jmp 0x1daf2