// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/frontend/parser_loops.c
// Function: prv_for_assignment
static void prv_for_assignment(subtilis_parser_t *p, subtilis_token_t *t,
			       subtilis_for_context_t *for_ctx, bool new_local,
			       subtilis_error_t *err)
{
	char *var_name;
	const char *tbuf;
	subtilis_exp_t *e = NULL;

	var_name = prv_init_for_var(p, t, for_ctx, &new_local, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	tbuf = subtilis_token_get_text(t);
	if (strcmp(tbuf, "=") && strcmp(tbuf, ":=")) {
		subtilis_error_set_assignment_op_expected(
		    err, tbuf, p->l->stream->name, p->l->line);
		goto cleanup;
	}

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

	/* Ownership of e is passed to the following functions. */

	e = subtilis_type_if_coerce_type(p, e, &for_ctx->type, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (new_local) {
		p->level++;
		subtilis_symbol_table_level_up(p->local_st, p->l, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		subtilis_type_if_assign_to_reg(p, for_ctx->loc, e, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		(void)subtilis_symbol_table_insert_reg(
		    p->local_st, var_name, &for_ctx->type, for_ctx->loc, err);
	} else {
		if (for_ctx->is_reg) {
			subtilis_type_if_assign_to_reg(p, for_ctx->loc, e, err);
		} else {
			subtilis_type_if_assign_to_mem(p, for_ctx->reg,
						       for_ctx->loc, e, err);
		}
		p->level++;
		subtilis_symbol_table_level_up(p->local_st, p->l, err);
	}

cleanup:

	free(var_name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %r8, %r14
movl %ecx, %ebp
movq %rdx, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, %r15
leaq 0x90(%rsp), %rdx
movl $0x8, (%rdx)
movq %r8, %rcx
callq 0x18343
cmpl $0x0, (%r14)
jne 0x21e60
movq %rax, %rbx
movq %r13, %rdi
callq 0x12ad0
movq %rax, %r12
cmpl $0x2, (%r13)
jne 0x21a8a
leaq 0x52806(%rip), %rsi     # 0x74212
movq %r12, %rdi
callq 0x12160
testl %eax, %eax
je 0x21ac2
leaq 0x54c2e(%rip), %rsi     # 0x76651
movq %r12, %rdi
callq 0x12160
testl %eax, %eax
je 0x21b30
leaq 0x51f4d(%rip), %rsi     # 0x73987
movq %r12, %rdi
callq 0x12160
testl %eax, %eax
sete %cl
movzbl %bpl, %edx
movl $0x1, %eax
cmovnel %edx, %eax
andb %bpl, %cl
cmpb $0x1, %cl
jne 0x21b9b
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51ef9(%rip), %rax     # 0x7396a
leaq 0x51b8c(%rip), %rdx     # 0x73604
movq %r14, %rdi
movl $0x1d, %esi
movq %r12, %rcx
pushq $0x18c                  # imm = 0x18C
jmp 0x21ab3
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51ece(%rip), %rax     # 0x7396a
leaq 0x52352(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x14, %esi
movq %r12, %rdx
pushq $0x17b                  # imm = 0x17B
pushq %rax
callq 0x1442a
addq $0x10, %rsp
jmp 0x21e4b
leaq 0x7(%rsp), %r9
movb $0x0, (%r9)
subq $0x8, %rsp
leaq 0x20(%rsp), %rcx
leaq 0x18(%rsp), %r8
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
pushq %r14
callq 0x1840a
addq $0x10, %rsp
cmpl $0x0, (%r14)
jne 0x21e45
cmpb $0x1, 0x7(%rsp)
jne 0x21c6e
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51e56(%rip), %rax     # 0x7396a
leaq 0x522da(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x1b, %esi
movq %rbx, %rdx
pushq $0x118                  # imm = 0x118
jmp 0x21be4
leaq 0x7(%rsp), %r9
movb $0x0, (%r9)
subq $0x8, %rsp
leaq 0x20(%rsp), %rcx
leaq 0x18(%rsp), %r8
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
pushq %r14
callq 0x1840a
addq $0x10, %rsp
cmpl $0x0, (%r14)
jne 0x21e45
cmpb $0x1, 0x7(%rsp)
jne 0x21d19
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51de8(%rip), %rax     # 0x7396a
leaq 0x5226c(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x1b, %esi
movq %rbx, %rdx
pushq $0x12e                  # imm = 0x12E
jmp 0x21be4
movl %eax, %ebp
movb $0x0, 0x18(%rsp)
testb %al, %al
je 0x21bf3
movq 0x68(%r15), %rdi
movq %rbx, %rsi
callq 0x2eec8
testq %rax, %rax
je 0x21da1
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51d9d(%rip), %rax     # 0x7396a
leaq 0x52221(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x20, %esi
movq %rbx, %rdx
pushq $0x15d                  # imm = 0x15D
pushq %rax
callq 0x1442a
addq $0x10, %rsp
jmp 0x21e45
subq $0x8, %rsp
leaq 0x18(%rsp), %rcx
leaq 0x48(%rsp), %r8
leaq 0x20(%rsp), %r9
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
pushq %r14
callq 0x1840a
addq $0x10, %rsp
cmpl $0x0, (%r14)
jne 0x21e45
cmpb $0x1, 0x18(%rsp)
jne 0x21e19
movq 0x48(%r15), %rax
cmpb $0x1, 0xe0(%rax)
jne 0x21df7
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51d18(%rip), %rax     # 0x7396a
leaq 0x5219c(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x6c, %esi
movq %rbx, %rdx
pushq $0x149                  # imm = 0x149
jmp 0x21be4
movq 0x18(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x10(%rsp), %r12
leaq 0x40(%rsp), %rdx
movl $0xa, %ecx
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %r8
callq 0x1f017
cmpl $0x0, (%r14)
jne 0x21e45
movq %r12, 0x28(%rsp)
movq %rax, 0x20(%rsp)
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12eda
cmpl $0x0, (%r14)
jne 0x21cea
movq 0x30(%rsp), %r12
leaq 0x8(%r12), %rsi
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %rdx
movq %r15, %rdi
movq %rsi, 0x38(%rsp)
movq %r14, %rcx
callq 0x3620e
cmpl $0x0, (%r14)
je 0x21fec
xorl %edi, %edi
callq 0x2b4c3
cmpq $0x0, 0x20(%rsp)
je 0x21e45
xorl %r12d, %r12d
movq 0x40(%rsp,%r12,8), %rdi
callq 0x2b4c3
incq %r12
cmpq %r12, 0x20(%rsp)
jne 0x21d00
jmp 0x21e45
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %r12
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1f50f
movq %rax, 0x40(%rsp)
cmpl $0x0, (%r14)
jne 0x21e45
movq %r12, 0x30(%rsp)
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12eda
cmpl $0x0, (%r14)
jne 0x21d8b
movq 0x20(%rsp), %r12
leaq 0x8(%r12), %rsi
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %rdx
movq %r15, %rdi
movq %rsi, 0x28(%rsp)
movq %r14, %rcx
callq 0x3620e
cmpl $0x0, (%r14)
je 0x22041
xorl %edi, %edi
callq 0x2b4c3
movq 0x40(%rsp), %rdi
callq 0x2b4c3
jmp 0x21e45
movq 0x8(%rsp), %rax
movb $0x1, (%rax)
leaq 0x18(%rax), %r12
leaq 0x90(%rsp), %rsi
movl $0x148, %edx            # imm = 0x148
movq %r12, %rdi
callq 0x121b0
movq %r12, %rdi
callq 0x37b0a
movq 0x48(%r15), %rcx
testl %eax, %eax
je 0x21de0
movq 0x20(%rcx), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x20(%rcx)
jmp 0x21dec
movq 0x18(%rcx), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%rcx)
movq 0x8(%rsp), %rcx
movq %rax, 0x10(%rcx)
jmp 0x21e45
movq 0x60(%r15), %rdi
leaq 0x90(%rsp), %rdx
movq %rbx, %rsi
movq %r14, %rcx
callq 0x2e6e8
movq %rax, 0x10(%rsp)
cmpl $0x0, (%r14)
jne 0x21e45
movq 0x10(%rsp), %rsi
movb 0x2a8(%rsi), %al
movq 0x8(%rsp), %rcx
movb %al, (%rcx)
leaq 0x18(%rcx), %rdi
addq $0x8, %rsi
movq %r14, %rdx
callq 0x2fa5f
cmpl $0x0, (%r14)
je 0x21fd1
cmpl $0x0, (%r14)
je 0x21e62
leaq 0x90(%rsp), %rdi
callq 0x2f843
movq %rbx, %rdi
callq 0x122c0
xorl %ebx, %ebx
cmpl $0x0, (%r14)
jne 0x21fbf
movq %r13, %rdi
callq 0x12ad0
movq %rax, %r12
leaq 0x51786(%rip), %rsi     # 0x73604
movq %rax, %rdi
callq 0x12160
testl %eax, %eax
je 0x21ed5
leaq 0x51af6(%rip), %rsi     # 0x73987
movq %r12, %rdi
callq 0x12160
testl %eax, %eax
je 0x21ed5
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51abb(%rip), %rax     # 0x7396a
leaq 0x51f3f(%rip), %rcx     # 0x73df5
movq %r14, %rdi
movl $0x14, %esi
movq %r12, %rdx
pushq $0x1b0                  # imm = 0x1B0
pushq %rax
callq 0x1442a
addq $0x10, %rsp
jmp 0x21fb7
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1eb88
cmpl $0x0, (%r14)
jne 0x21fb7
movq 0x8(%rsp), %rcx
leaq 0x18(%rcx), %r12
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x379c3
cmpl $0x0, (%r14)
jne 0x21fb7
movq %rax, %r13
testb %bpl, %bpl
je 0x21f70
incq 0x78(%r15)
movq (%r15), %rsi
movq 0x68(%r15), %rdi
movq %r14, %rdx
callq 0x2e62b
cmpl $0x0, (%r14)
jne 0x21fb7
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0x363e2
cmpl $0x0, (%r14)
jne 0x21fb7
movq 0x68(%r15), %rdi
movq 0x8(%rsp), %rax
movq 0x10(%rax), %rcx
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %r8
callq 0x2ec2e
jmp 0x21fb7
movq 0x8(%rsp), %rax
cmpb $0x1, (%rax)
jne 0x21f8e
movq 0x10(%rax), %rsi
movq %r15, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0x363e2
jmp 0x21fa4
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
movq %r15, %rdi
movq %r13, %rcx
movq %r14, %r8
callq 0x36416
incq 0x78(%r15)
movq (%r15), %rsi
movq 0x68(%r15), %rdi
movq %r14, %rdx
callq 0x2e62b
movq %rbx, %rdi
callq 0x122c0
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rsp), %rax
movq (%rax), %rax
jmp 0x21df1
movq (%r12), %r8
leaq 0x40(%rsp), %r9
movq %r15, %rdi
movq %rbx, %rsi
movq 0x38(%rsp), %rdx
movq 0x28(%rsp), %rcx
pushq %r14
pushq 0x28(%rsp)
callq 0x437b3
addq $0x10, %rsp
movq %rax, %rdi
cmpl $0x0, (%r14)
jne 0x21cec
movq 0x8(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x148(%rdi), %rax
movq %rax, 0x8(%rcx)
movq $0x0, 0x10(%rcx)
jmp 0x21cec
movq (%r12), %r8
leaq 0x40(%rsp), %r9
movq %r15, %rdi
movq %rbx, %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
pushq %r14
pushq $0x1
callq 0x437b3
addq $0x10, %rsp
movq %rax, %rdi
cmpl $0x0, (%r14)
jne 0x21d8d
movq 0x8(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x148(%rdi), %rax
movq %rax, 0x8(%rcx)
movq $0x0, 0x10(%rcx)
jmp 0x21d8d