// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq %rsi, %r13
movq %rdi, %r15
leaq 0x90(%rsp), %rdx
movl $0x8, (%rdx)
movq %r8, %rcx
callq 0x18243
cmpl $0x0, (%r14)
jne 0x21cf1
movq %rax, %rbx
movq %r13, %rdi
callq 0x12ad0
cmpl $0x2, (%r13)
jne 0x219e8
movzbl (%rax), %ecx
cmpl $0x7b, %ecx
je 0x21a72
cmpl $0x3a, %ecx
je 0x21a21
cmpl $0x28, %ecx
jne 0x21a7c
cmpb $0x0, 0x1(%rax)
jne 0x21a7c
leaq 0x7(%rsp), %r9
movb $0x0, (%r9)
subq $0x8, %rsp
leaq 0x10(%rsp), %rcx
leaq 0x18(%rsp), %r8
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
pushq %r14
callq 0x1830a
addq $0x10, %rsp
cmpl $0x0, (%r14)
jne 0x21c6f
cmpb $0x1, 0x7(%rsp)
jne 0x21e4c
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51fc0(%rip), %rax     # 0x7398c
leaq 0x52442(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x1b, %esi
movq %rbx, %rdx
pushq $0x118                  # imm = 0x118
jmp 0x21c04
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x51f92(%rip), %r10     # 0x7398c
leaq 0x52414(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x14, %esi
movq %rax, %rdx
pushq $0x17b                  # imm = 0x17B
pushq %r10
callq 0x143da
addq $0x10, %rsp
jmp 0x21c6f
cmpb $0x3d, 0x1(%rax)
jne 0x21a7c
cmpb $0x0, 0x2(%rax)
jne 0x21a7c
testb %bpl, %bpl
je 0x21dbf
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x51f44(%rip), %r10     # 0x7398c
leaq 0x51ba7(%rip), %rdx     # 0x735f6
movq %r14, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x18c                  # imm = 0x18C
pushq %r10
callq 0x143da
addq $0x10, %rsp
movb $0x1, %bpl
jmp 0x21c6f
cmpb $0x0, 0x1(%rax)
je 0x21b9b
movb $0x0, 0x8(%rsp)
testb %bpl, %bpl
je 0x21acf
movq 0x68(%r15), %rdi
movq %rbx, %rsi
callq 0x2ebbc
testq %rax, %rax
je 0x21b03
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51ee3(%rip), %rax     # 0x7398c
leaq 0x52365(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x20, %esi
movq %rbx, %rdx
pushq $0x15d                  # imm = 0x15D
pushq %rax
callq 0x143da
addq $0x10, %rsp
jmp 0x21c66
subq $0x8, %rsp
leaq 0x18(%rsp), %rcx
leaq 0x48(%rsp), %r8
leaq 0x10(%rsp), %r9
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
pushq %r14
callq 0x1830a
addq $0x10, %rsp
cmpl $0x0, (%r14)
je 0x21b47
xorl %ebp, %ebp
jmp 0x21c6f
movb $0x1, (%r12)
leaq 0x18(%r12), %rbp
leaq 0x90(%rsp), %rsi
movl $0x148, %edx            # imm = 0x148
movq %rbp, %rdi
callq 0x121b0
movq %rbp, %rdi
callq 0x379a7
movq 0x48(%r15), %rcx
testl %eax, %eax
je 0x21c55
movq 0x20(%rcx), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x20(%rcx)
jmp 0x21c61
cmpb $0x0, 0x8(%rsp)
je 0x21c10
movq 0x48(%r15), %rax
cmpb $0x1, 0xe0(%rax)
jne 0x21d91
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51e17(%rip), %rax     # 0x7398c
leaq 0x52299(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x6c, %esi
movq %rbx, %rdx
pushq $0x149                  # imm = 0x149
pushq %rax
callq 0x143da
addq $0x10, %rsp
jmp 0x21c51
leaq 0x7(%rsp), %r9
movb $0x0, (%r9)
subq $0x8, %rsp
leaq 0x10(%rsp), %rcx
leaq 0x18(%rsp), %r8
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
pushq %r14
callq 0x1830a
addq $0x10, %rsp
cmpl $0x0, (%r14)
jne 0x21c6f
cmpb $0x1, 0x7(%rsp)
jne 0x21dc9
movq (%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0x51d9f(%rip), %rax     # 0x7398c
leaq 0x52221(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x1b, %esi
movq %rbx, %rdx
pushq $0x12e                  # imm = 0x12E
pushq %rax
callq 0x143da
addq $0x10, %rsp
jmp 0x21c69
movq 0x10(%rsp), %rsi
movb 0x2a8(%rsi), %al
movb %al, (%r12)
leaq 0x18(%r12), %rdi
addq $0x8, %rsi
movq %r14, %rdx
callq 0x2f78a
cmpl $0x0, (%r14)
jne 0x21afc
movq 0x40(%rsp), %rax
movq %rax, 0x8(%r12)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%r12)
xorl %ebp, %ebp
jmp 0x21c69
movq 0x18(%rcx), %rax
leaq 0x1(%rax), %rdx
movq %rdx, 0x18(%rcx)
movq %rax, 0x10(%r12)
movb $0x1, %bpl
cmpl $0x0, (%r14)
je 0x21c8c
leaq 0x90(%rsp), %rdi
callq 0x2f56e
movq %rbx, %rdi
callq 0x122c0
cmpl $0x0, (%r14)
jne 0x21cf1
xorl %ebx, %ebx
movq %r13, %rdi
callq 0x12ad0
movzbl (%rax), %ecx
cmpl $0x3a, %ecx
je 0x21ca9
cmpl $0x3d, %ecx
jne 0x21cb5
cmpb $0x0, 0x1(%rax)
jne 0x21cb5
jmp 0x21d03
cmpb $0x3d, 0x1(%rax)
jne 0x21cb5
cmpb $0x0, 0x2(%rax)
je 0x21d03
movq (%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x51cc5(%rip), %r10     # 0x7398c
leaq 0x52147(%rip), %rcx     # 0x73e15
movq %r14, %rdi
movl $0x14, %esi
movq %rax, %rdx
pushq $0x1b0                  # imm = 0x1B0
pushq %r10
callq 0x143da
addq $0x10, %rsp
movq %rbx, %rdi
callq 0x122c0
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1ec4c
cmpl $0x0, (%r14)
jne 0x21ce9
leaq 0x18(%r12), %r13
movq %r15, %rdi
movq %rax, %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x37860
cmpl $0x0, (%r14)
jne 0x21ce9
testb %bpl, %bpl
je 0x21ef9
incq 0x78(%r15)
movq (%r15), %rsi
movq 0x68(%r15), %rdi
movq %r14, %rdx
movq %rax, %rbp
callq 0x2e306
cmpl $0x0, (%r14)
jne 0x21ce9
movq %rbp, %rdx
movq 0x10(%r12), %rsi
movq %r15, %rdi
movq %r14, %rcx
callq 0x36292
cmpl $0x0, (%r14)
jne 0x21ce9
movq 0x68(%r15), %rdi
movq 0x10(%r12), %rcx
movq %rbx, %rsi
movq %r13, %rdx
movq %r14, %r8
callq 0x2e922
jmp 0x21ce9
movq 0x60(%r15), %rdi
leaq 0x90(%rsp), %rdx
movq %rbx, %rsi
movq %r14, %rcx
callq 0x2e3cd
movq %rax, 0x10(%rsp)
cmpl $0x0, (%r14)
jne 0x21afc
movq %rax, %rsi
jmp 0x21c15
movb $0x0, 0x8(%rsp)
jmp 0x21a86
movq 0x8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1f564
movq %rax, 0x40(%rsp)
cmpl $0x0, (%r14)
jne 0x21c69
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12edc
cmpl $0x0, (%r14)
jne 0x21e36
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %rsi
leaq 0x18(%r12), %rdx
movq %r15, %rdi
movq %rsi, 0x28(%rsp)
movq %r14, %rcx
callq 0x360be
cmpl $0x0, (%r14)
je 0x21f45
xorl %edi, %edi
callq 0x2b166
movq 0x40(%rsp), %rdi
callq 0x2b166
jmp 0x21c69
movq %r12, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x10(%rsp), %r12
leaq 0x40(%rsp), %rdx
movl $0xa, %ecx
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %r8
callq 0x1f0d1
cmpl $0x0, (%r14)
jne 0x21eef
movq %rax, 0x18(%rsp)
movq (%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x12edc
cmpl $0x0, (%r14)
jne 0x21ec9
movq %r12, 0x38(%rsp)
movq 0x28(%rsp), %r12
leaq 0x8(%r12), %rsi
movq 0x20(%rsp), %rax
leaq 0x18(%rax), %rdx
movq %r15, %rdi
movq %rsi, 0x30(%rsp)
movq %r14, %rcx
callq 0x360be
cmpl $0x0, (%r14)
je 0x21f9b
xorl %edi, %edi
callq 0x2b166
cmpq $0x0, 0x18(%rsp)
je 0x21eef
xorl %r12d, %r12d
movq 0x40(%rsp,%r12,8), %rdi
callq 0x2b166
incq %r12
cmpq %r12, 0x18(%rsp)
jne 0x21edb
movq 0x20(%rsp), %r12
jmp 0x21c69
cmpb $0x1, (%r12)
jne 0x21f15
movq 0x10(%r12), %rsi
movq %r15, %rdi
movq %rax, %rdx
movq %r14, %rcx
callq 0x36292
jmp 0x21f2d
movq 0x8(%r12), %rsi
movq 0x10(%r12), %rdx
movq %r15, %rdi
movq %rax, %rcx
movq %r14, %r8
callq 0x362c6
incq 0x78(%r15)
movq (%r15), %rsi
movq 0x68(%r15), %rdi
movq %r14, %rdx
callq 0x2e306
jmp 0x21ce9
movq 0x18(%rsp), %rax
movq (%rax), %r8
leaq 0x40(%rsp), %r9
movq %r15, %rdi
movq %rbx, %rsi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
pushq %r14
pushq $0x1
callq 0x43706
addq $0x10, %rsp
movq %rax, %rdi
cmpl $0x0, (%r14)
jne 0x21e38
movb $0x0, (%r12)
movq 0x148(%rdi), %rax
movq %rax, 0x8(%r12)
movq $0x0, 0x10(%r12)
jmp 0x21e38
movq (%r12), %r8
leaq 0x40(%rsp), %r9
movq %r15, %rdi
movq %rbx, %rsi
movq 0x30(%rsp), %rdx
movq 0x38(%rsp), %rcx
pushq %r14
pushq 0x20(%rsp)
callq 0x43706
addq $0x10, %rsp
movq %rax, %rdi
cmpl $0x0, (%r14)
jne 0x21ecb
movq 0x20(%rsp), %rcx
movb $0x0, (%rcx)
movq 0x148(%rdi), %rax
movq %rax, 0x8(%rcx)
movq $0x0, 0x10(%rcx)
jmp 0x21ecb