// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_assignment.c
// Function: prv_assign_array_or_vector
static void prv_assign_array_or_vector(subtilis_parser_t *p,
				       subtilis_token_t *t, size_t dims,
				       subtilis_exp_t **indices,
				       const char *var_name,
				       const subtilis_type_t *array_type,
				       bool array, subtilis_error_t *err)
{
	const char *tbuf;
	size_t i;
	subtilis_assign_type_t at;
	subtilis_ir_operand_t op1;
	const subtilis_symbol_t *s;
	subtilis_array_desc_t desc;
	subtilis_exp_t *e = NULL;
	bool new_global = false;
	bool local;
	subtilis_type_t el_type;
	char scratch[32];

	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	tbuf = subtilis_token_get_text(t);
	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, ".")) {
		prv_assign_col_field(p, t, dims, indices, var_name, array_type,
				     err);
		goto cleanup;
	}

	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, "(")) {
		/*
		 * We have a procedure call, and not an assignment.
		 */

		s = subtilis_parser_get_symbol(p, var_name, &op1.reg, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		e = subtilis_type_if_indexed_read(p, var_name, &s->t, op1.reg,
						  s->loc, indices, dims, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		(void)subtilis_parser_call_known_ptr(p, t, &e->type,
						     e->exp.ir_op.reg, err);
		goto cleanup;
	}

	at = prv_get_ass_op(p, t, err);
	if (err->type != SUBTILIS_ERROR_OK) {
		prv_missing_operator_error(p, tbuf, var_name, err);
		goto cleanup;
	}

	if ((dims == 0) && ((at == SUBTILIS_ASSIGN_TYPE_PLUS_EQUAL) ||
			    (at == SUBTILIS_ASSIGN_TYPE_MINUS_EQUAL))) {
		subtilis_error_set_expected(err, ":= or =", tbuf,
					    p->l->stream->name, p->l->line);
		goto cleanup;
	}

	subtilis_parser_lookup_assignment_var(p, t, var_name, &s, &op1.reg,
					      &new_global, err);
	if (err->type == SUBTILIS_ERROR_UNKNOWN_VARIABLE ||
	    err->type == SUBTILIS_ERROR_VARIABLE_BAD_LEVEL) {
		if (at != SUBTILIS_ASSIGN_TYPE_CREATE_EQUAL)
			goto cleanup;
		subtilis_error_init(err);
		if (dims != 0) {
			sprintf(scratch, "%zu", dims);
			subtilis_error_bad_index(
			    err, scratch, p->l->stream->name, p->l->line);
			goto cleanup;
		}
		e = subtilis_parser_expression(p, t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		subtilis_parser_create_array_ref(p, var_name, array_type, e,
						 true, err);
		return;
	} else if (err->type != SUBTILIS_ERROR_OK) {
		goto cleanup;
	}

	if (s && (array != subtilis_type_if_is_array(&s->t))) {
		if (array)
			subtilis_error_set_expected(
			    err, "{", "(", p->l->stream->name, p->l->line);
		else
			subtilis_error_set_expected(
			    err, "(", "{", p->l->stream->name, p->l->line);
		goto cleanup;
	}

	subtilis_lexer_get(p->l, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	/*
	 * Check to see whether we're resetting a structure.
	 */

	tbuf = subtilis_token_get_text(t);
	if (((array_type->type == SUBTILIS_TYPE_ARRAY_REC) ||
	     (array_type->type == SUBTILIS_TYPE_VECTOR_REC)) &&
	    (dims > 0) && !strcmp(tbuf, "(")) {
		e = subtilis_type_if_indexed_address(
		    p, var_name, &s->t, op1.reg, s->loc, indices, dims, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		subtilis_type_if_element_type(p, &s->t, &el_type, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		subtilis_parser_rec_reset(p, t, &el_type, e->exp.ir_op.reg, 0,
					  err);
		subtilis_type_free(&el_type);
		goto cleanup;
	}

	e = subtilis_parser_priority7(p, t, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (new_global) {
		if (dims != 0) {
			subtilis_error_set_unknown_variable(
			    err, var_name, p->l->stream->name, p->l->line);
			goto cleanup;
		}
		local = (at == SUBTILIS_ASSIGN_TYPE_CREATE_EQUAL);
		if (!local && p->current->proc_called) {
			subtilis_error_set_global_after_proc(
			    err, var_name, p->l->stream->name, p->l->line);
			goto cleanup;
		}
		subtilis_parser_create_array_ref(p, var_name, array_type, e,
						 local, err);
		return;
	}

	switch (at) {
	case SUBTILIS_ASSIGN_TYPE_EQUAL:
		if (dims == 0) {
			/* We're assigning an array reference */

			desc.name = s->key;
			desc.loc = s->loc;
			desc.reg = op1.reg;
			desc.t = &s->t;
			subtilis_parser_array_assign_reference(p, t, &desc, e,
							       err);
		} else {
			subtilis_type_if_indexed_write(p, var_name, &s->t,
						       op1.reg, s->loc, e,
						       indices, dims, err);
		}
		e = NULL;
		break;
	case SUBTILIS_ASSIGN_TYPE_PLUS_EQUAL:
		subtilis_type_if_indexed_add(p, var_name, &s->t, op1.reg,
					     s->loc, e, indices, dims, err);
		e = NULL;
		break;
	case SUBTILIS_ASSIGN_TYPE_MINUS_EQUAL:
		subtilis_type_if_indexed_sub(p, var_name, &s->t, op1.reg,
					     s->loc, e, indices, dims, err);
		e = NULL;
		break;
	case SUBTILIS_ASSIGN_TYPE_CREATE_EQUAL:
		subtilis_error_set_already_defined(
		    err, var_name, p->l->stream->name, p->l->line);
		break;
	default:
		subtilis_error_set_assertion_failed(err);
		break;
	}

cleanup:

	subtilis_exp_delete(e);
	for (i = 0; i < dims; i++)
		subtilis_exp_delete(indices[i]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq 0x18(%rbp), %rax
movb 0x10(%rbp), %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
movq $0x0, -0x88(%rbp)
movb $0x0, -0x89(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x133f0
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1ce23
jmp 0x1d5bc
movq -0x10(%rbp), %rdi
callq 0x12d70
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1ce78
movq -0x40(%rbp), %rdi
leaq 0x8d6d1(%rip), %rsi     # 0xaa515
callq 0x12140
cmpl $0x0, %eax
jne 0x1ce78
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movq -0x30(%rbp), %r9
movq 0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x1d610
jmp 0x1d5bc
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x1cf3a
movq -0x40(%rbp), %rdi
leaq 0x8e40c(%rip), %rsi     # 0xab29c
callq 0x12140
cmpl $0x0, %eax
jne 0x1cf3a
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq 0x18(%rbp), %rcx
leaq -0x58(%rbp), %rdx
callq 0x24480
movq %rax, -0x60(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1cec5
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq $0x8, %rdx
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
movq (%rax), %r8
movq -0x20(%rbp), %r9
movq -0x18(%rbp), %r10
movq 0x18(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x48440
movq %rax, -0x88(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1cf0f
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq -0x88(%rbp), %rax
movq 0x148(%rax), %rcx
movq 0x18(%rbp), %r8
callq 0x1fc30
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x1d840
movl %eax, -0x4c(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1cf71
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq 0x18(%rbp), %rcx
callq 0x1bf50
jmp 0x1d5bc
cmpq $0x0, -0x18(%rbp)
jne 0x1cfcb
cmpl $0x1, -0x4c(%rbp)
je 0x1cf84
cmpl $0x2, -0x4c(%rbp)
jne 0x1cfcb
movq 0x18(%rbp), %rdi
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x8d660(%rip), %rdx     # 0xaa60e
leaq 0x8d607(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x11e, 0x8(%rsp)       # imm = 0x11E
callq 0x156d0
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq 0x18(%rbp), %rax
leaq -0x60(%rbp), %rcx
leaq -0x58(%rbp), %r8
leaq -0x89(%rbp), %r9
movq %rax, (%rsp)
callq 0x1b6a0
movq 0x18(%rbp), %rax
cmpl $0x1b, (%rax)
je 0x1d009
movq 0x18(%rbp), %rax
cmpl $0x3e, (%rax)
jne 0x1d0d4
cmpl $0x3, -0x4c(%rbp)
je 0x1d014
jmp 0x1d5bc
movq 0x18(%rbp), %rdi
callq 0x15670
cmpq $0x0, -0x18(%rbp)
je 0x1d087
leaq -0x200(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x8e284(%rip), %rsi     # 0xab2ba
movb $0x0, %al
callq 0x12250
movq 0x18(%rbp), %rdi
leaq -0x200(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x39, %esi
leaq 0x8e20c(%rip), %rcx     # 0xab276
leaq 0x8d54b(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x12c, 0x8(%rsp)       # imm = 0x12C
callq 0x156d0
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x24a20
movq %rax, -0x88(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1d0ad
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x88(%rbp), %rcx
movq 0x18(%rbp), %r9
movl $0x1, %r8d
callq 0x1af80
jmp 0x1d5f9
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1d0e2
jmp 0x1d5bc
jmp 0x1d0e4
cmpq $0x0, -0x60(%rbp)
je 0x1d1b7
movb -0x31(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x204(%rbp)
movq -0x60(%rbp), %rdi
addq $0x8, %rdi
callq 0x49ff0
movb %al, %cl
movl -0x204(%rbp), %eax
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x1d1b7
testb $0x1, -0x31(%rbp)
je 0x1d16d
movq 0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x904bf(%rip), %rdx     # 0xad60b
leaq 0x8e149(%rip), %rcx     # 0xab29c
leaq 0x8d462(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x13c, 0x8(%rsp)       # imm = 0x13C
callq 0x156d0
jmp 0x1d1b2
movq 0x18(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x8e109(%rip), %rdx     # 0xab29c
leaq 0x90471(%rip), %rcx     # 0xad60b
leaq 0x8d41b(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x13f, 0x8(%rsp)       # imm = 0x13F
callq 0x156d0
jmp 0x1d5bc
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x133f0
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1d1d9
jmp 0x1d5bc
movq -0x10(%rbp), %rdi
callq 0x12d70
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xf, (%rax)
je 0x1d1fc
movq -0x30(%rbp), %rax
cmpl $0x15, (%rax)
jne 0x1d2d0
cmpq $0x0, -0x18(%rbp)
jbe 0x1d2d0
movq -0x40(%rbp), %rdi
leaq 0x8e08a(%rip), %rsi     # 0xab29c
callq 0x12140
cmpl $0x0, %eax
jne 0x1d2d0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq $0x8, %rdx
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
movq (%rax), %r8
movq -0x20(%rbp), %r9
movq -0x18(%rbp), %r10
movq 0x18(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x486c0
movq %rax, -0x88(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1d26a
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
addq $0x8, %rsi
movq 0x18(%rbp), %rcx
leaq -0x1d8(%rbp), %rdx
callq 0x47b70
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1d294
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x88(%rbp), %rax
movq 0x148(%rax), %rcx
movq 0x18(%rbp), %r9
leaq -0x1d8(%rbp), %rdx
xorl %eax, %eax
movl %eax, %r8d
callq 0x35690
leaq -0x1d8(%rbp), %rdi
callq 0x3e100
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
callq 0x24550
movq %rax, -0x88(%rbp)
movq 0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x1d2f6
jmp 0x1d5bc
testb $0x1, -0x89(%rbp)
je 0x1d3ee
cmpq $0x0, -0x18(%rbp)
je 0x1d351
movq 0x18(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1b, %esi
leaq 0x8df42(%rip), %rcx     # 0xab276
leaq 0x8d281(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x163, 0x8(%rsp)       # imm = 0x163
callq 0x156d0
jmp 0x1d5bc
cmpl $0x3, -0x4c(%rbp)
sete %al
andb $0x1, %al
movb %al, -0x8a(%rbp)
testb $0x1, -0x8a(%rbp)
jne 0x1d3c1
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
testb $0x1, 0xe0(%rax)
je 0x1d3c1
movq 0x18(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x6c, %esi
leaq 0x8ded2(%rip), %rcx     # 0xab276
leaq 0x8d211(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x169, 0x8(%rsp)       # imm = 0x169
callq 0x156d0
jmp 0x1d5bc
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x88(%rbp), %rcx
movb -0x8a(%rbp), %al
movq 0x18(%rbp), %r9
andb $0x1, %al
movzbl %al, %r8d
callq 0x1af80
jmp 0x1d5f9
movl -0x4c(%rbp), %eax
movq %rax, -0x210(%rbp)
subq $0x3, %rax
ja 0x1d5a0
movq -0x210(%rbp), %rax
leaq 0x8d19c(%rip), %rcx     # 0xaa5ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, -0x18(%rbp)
jne 0x1d46c
movq -0x60(%rbp), %rax
movq 0x298(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x60(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x60(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x88(%rbp), %rcx
movq 0x18(%rbp), %r8
leaq -0x80(%rbp), %rdx
callq 0x19710
jmp 0x1d4ad
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq $0x8, %rdx
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
movq (%rax), %r8
movq -0x88(%rbp), %r9
movq -0x20(%rbp), %r11
movq -0x18(%rbp), %r10
movq 0x18(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x48140
movq $0x0, -0x88(%rbp)
jmp 0x1d5ba
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq $0x8, %rdx
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
movq (%rax), %r8
movq -0x88(%rbp), %r9
movq -0x20(%rbp), %r11
movq -0x18(%rbp), %r10
movq 0x18(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x48240
movq $0x0, -0x88(%rbp)
jmp 0x1d5ba
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq $0x8, %rdx
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rax
movq (%rax), %r8
movq -0x88(%rbp), %r9
movq -0x20(%rbp), %r11
movq -0x18(%rbp), %r10
movq 0x18(%rbp), %rax
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x48340
movq $0x0, -0x88(%rbp)
jmp 0x1d5ba
movq 0x18(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x38(%rax), %r9d
movl $0x20, %esi
leaq 0x8dcf0(%rip), %rcx     # 0xab276
leaq 0x8d02f(%rip), %rax     # 0xaa5bc
movq %rax, (%rsp)
movl $0x18f, 0x8(%rsp)       # imm = 0x18F
callq 0x156d0
jmp 0x1d5ba
movq 0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x8d00c(%rip), %rdx     # 0xaa5bc
movl $0x192, %ecx            # imm = 0x192
callq 0x158e0
jmp 0x1d5bc
movq -0x88(%rbp), %rdi
callq 0x36ee0
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x1d5f9
movq -0x20(%rbp), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x36ee0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x1d5d0
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopw %cs:(%rax,%rax)