// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_rec.c
// Function: subtilis_parser_rec_field_lvalue
size_t subtilis_parser_rec_field_lvalue(subtilis_parser_t *p,
					subtilis_token_t *t,
					const subtilis_type_t *type,
					size_t mem_reg, size_t loc,
					subtilis_type_t *dst_type,
					subtilis_error_t *err)
{
	size_t id;
	const subtilis_type_t *field_type;
	const subtilis_type_rec_t *rec;
	const char *tbuf;
	const char *obkt = NULL;
	const char *cbkt = NULL;

	do {
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return SIZE_MAX;

		tbuf = subtilis_token_get_text(t);
		if ((t->type != SUBTILIS_TOKEN_IDENTIFIER)) {
			subtilis_error_set_id_expected(
			    err, tbuf, p->l->stream->name, p->l->line);
			return SIZE_MAX;
		}

		rec = &type->params.rec;
		id = subtilis_type_rec_find_field(rec, tbuf);
		if (id == SIZE_MAX) {
			subtilis_error_set_unknown_field(
			    err, tbuf, p->l->stream->name, p->l->line);
			return SIZE_MAX;
		}

		loc += (size_t)subtilis_type_rec_field_offset_id(rec, id);
		field_type = &rec->field_types[id];
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return SIZE_MAX;
		tbuf = subtilis_token_get_text(t);
		if (field_type->type != SUBTILIS_TYPE_REC)
			break;
		type = field_type;
	} while ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, "."));

	if (subtilis_type_if_is_array(field_type)) {
		obkt = "(";
		cbkt = ")";
	} else if (subtilis_type_if_is_vector(field_type)) {
		obkt = "{";
		cbkt = "}";
	}

	if (obkt) {
		tbuf = subtilis_token_get_text(t);
		if ((t->type != SUBTILIS_TOKEN_OPERATOR) ||
		    strcmp(tbuf, obkt)) {
			subtilis_error_set_exp_expected(
			    err, obkt, p->l->stream->name, p->l->line);
			return SIZE_MAX;
		}
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return SIZE_MAX;
		tbuf = subtilis_token_get_text(t);
		if ((t->type != SUBTILIS_TOKEN_OPERATOR) ||
		    strcmp(tbuf, cbkt)) {
			subtilis_error_set_exp_expected(
			    err, cbkt, p->l->stream->name, p->l->line);
			return SIZE_MAX;
		}
		subtilis_lexer_get(p->l, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return SIZE_MAX;
	}

	subtilis_type_copy(dst_type, field_type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return SIZE_MAX;

	return subtilis_reference_get_pointer(p, mem_reg, loc, err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x133f0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x34631
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x6, (%rax)
je 0x34696
movq 0x10(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x12, %esi
leaq 0x76c05(%rip), %rcx     # 0xab276
leaq 0x764be(%rip), %rax     # 0xaab36
movq %rax, (%rsp)
movl $0x120, 0x8(%rsp)       # imm = 0x120
callq 0x156d0
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x3ec80
movq %rax, -0x40(%rbp)
cmpq $-0x1, -0x40(%rbp)
jne 0x34709
movq 0x10(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x69, %esi
leaq 0x76b92(%rip), %rcx     # 0xab276
leaq 0x7644b(%rip), %rax     # 0xaab36
movq %rax, (%rsp)
movl $0x128, 0x8(%rsp)       # imm = 0x128
callq 0x156d0
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x50(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3efb0
movl %eax, %eax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x148, -0x40(%rbp), %rcx # imm = 0x148
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x133f0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x34761
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
cmpl $0x16, (%rax)
je 0x34779
jmp 0x347b5
movq -0x48(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpl $0x2, (%rcx)
movb %al, -0x69(%rbp)
jne 0x347aa
movq -0x58(%rbp), %rdi
leaq 0x75d7b(%rip), %rsi     # 0xaa515
callq 0x12140
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x34607
movq -0x48(%rbp), %rdi
callq 0x49ff0
testb $0x1, %al
jne 0x347c4
jmp 0x347dc
leaq 0x76ad1(%rip), %rax     # 0xab29c
movq %rax, -0x60(%rbp)
leaq 0x7637b(%rip), %rax     # 0xaab51
movq %rax, -0x68(%rbp)
jmp 0x34803
movq -0x48(%rbp), %rdi
callq 0x4a040
testb $0x1, %al
jne 0x347eb
jmp 0x34801
leaq 0x78e19(%rip), %rax     # 0xad60b
movq %rax, -0x60(%rbp)
leaq 0x75e2e(%rip), %rax     # 0xaa62b
movq %rax, -0x68(%rbp)
jmp 0x34803
cmpq $0x0, -0x60(%rbp)
je 0x3494c
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x34836
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x12140
cmpl $0x0, %eax
je 0x34885
movq 0x10(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x15, %esi
leaq 0x76a16(%rip), %rcx     # 0xab276
leaq 0x762cf(%rip), %rax     # 0xaab36
movq %rax, (%rsp)
movl $0x144, 0x8(%rsp)       # imm = 0x144
callq 0x156d0
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x133f0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x348af
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x18(%rbp), %rdi
callq 0x12d70
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x348d7
movq -0x58(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x12140
cmpl $0x0, %eax
je 0x34923
movq 0x10(%rbp), %rdi
movq -0x68(%rbp), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x15, %esi
leaq 0x76975(%rip), %rcx     # 0xab276
leaq 0x7622e(%rip), %rax     # 0xaab36
movq %rax, (%rsp)
movl $0x14e, 0x8(%rsp)       # imm = 0x14E
callq 0x156d0
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x133f0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x3494a
movq $-0x1, -0x8(%rbp)
jmp 0x34989
jmp 0x3494c
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq 0x10(%rbp), %rdx
callq 0x3e4f0
movq 0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x34970
movq $-0x1, -0x8(%rbp)
jmp 0x34989
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x6d920
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)