// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/frontend/parser_compound.c
// Function: subtilis_parser_local
void subtilis_parser_local(subtilis_parser_t *p, subtilis_token_t *t,
			   subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_type_t type;
	bool value_present;
	const subtilis_symbol_t *s;
	subtilis_exp_t *e = NULL;
	char *var_name = NULL;

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

	tbuf = subtilis_token_get_text(t);
	if ((t->type == SUBTILIS_TOKEN_KEYWORD) &&
	    (t->tok.keyword.type == SUBTILIS_KEYWORD_DIM)) {
		subtilis_parser_create_array(p, t, true, err);
		return;
	} else if (t->type != SUBTILIS_TOKEN_IDENTIFIER) {
		subtilis_error_set_id_expected(err, tbuf, p->l->stream->name,
					       p->l->line);
		return;
	}

	if ((p->current == p->main) && (p->level == 0)) {
		s = subtilis_symbol_table_lookup(p->st, tbuf);
		if (s) {
			subtilis_error_set_local_obscures_global(
			    err, tbuf, p->l->stream->name, p->l->line);
			return;
		}
	}

	if (subtilis_symbol_table_lookup(p->local_st, tbuf)) {
		subtilis_error_set_already_defined(
		    err, tbuf, p->l->stream->name, p->l->line);
		return;
	}

	var_name = malloc(strlen(tbuf) + 1);
	if (!var_name) {
		subtilis_error_set_oom(err);
		return;
	}
	strcpy(var_name, tbuf);
	subtilis_type_init_copy(&type, &t->tok.id_type, err);
	if (err->type != SUBTILIS_ERROR_OK) {
		free(var_name);
		return;
	}

	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_local_array_ref(p, t, var_name, &type, err);
		subtilis_type_free(&type);
		free(var_name);
		return;
	}

	if ((t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, "{")) {
		prv_local_vector_ref(p, t, var_name, &type, err);
		subtilis_type_free(&type);
		free(var_name);
		return;
	}

	value_present =
	    (t->type == SUBTILIS_TOKEN_OPERATOR) && !strcmp(tbuf, "=");
	if (subtilis_type_if_is_numeric(&type)) {
		if (!value_present) {
			e = subtilis_type_if_zero(p, &type, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;
		} else {
			e = subtilis_parser_assign_local_num(p, t, var_name,
							     &type, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;
		}
		(void)subtilis_symbol_table_insert_reg(
		    p->local_st, var_name, &type, e->exp.ir_op.reg, err);
	} else if (type.type == SUBTILIS_TYPE_FN) {
		if (!value_present)
			subtilis_parser_zero_local_fn(p, t, var_name, &type,
						      err);
		else
			subtilis_parser_assign_local_fn(p, t, var_name, &type,
							err);
	} else if (subtilis_type_if_is_reference(&type)) {
		s = subtilis_symbol_table_insert(p->local_st, var_name, &type,
						 err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		if (!value_present) {
			subtilis_type_if_zero_ref(
			    p, &type, SUBTILIS_IR_REG_LOCAL, s->loc, true, err);
		} else {
			e = subtilis_parser_expression(p, t, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;
			subtilis_type_if_new_ref(
			    p, &type, SUBTILIS_IR_REG_LOCAL, s->loc, e, err);
			e = NULL;
		}
	} else if (type.type == SUBTILIS_TYPE_REC) {
		subtilis_complete_custom_type(p, var_name, &type, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;

		if (value_present) {
			subtilis_parser_rec_init(p, t, &type, var_name, true,
						 true, err);
		} else {
			s = subtilis_symbol_table_insert(p->local_st, var_name,
							 &type, err);
			if (err->type != SUBTILIS_ERROR_OK)
				goto cleanup;

			subtilis_rec_type_zero(p, &type, SUBTILIS_IR_REG_LOCAL,
					       s->loc, true, err);
		}
	} else {
		subtilis_error_set_assertion_failed(err);
	}

cleanup:

	subtilis_type_free(&type);
	subtilis_exp_delete(e);
	free(var_name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x180(%rbp)
movq $0x0, -0x188(%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 0x2304f
jmp 0x2365d
movq -0x10(%rbp), %rdi
callq 0x12d70
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x2308a
movq -0x10(%rbp), %rax
cmpl $0x1f, 0x8(%rax)
jne 0x2308a
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rcx
movl $0x1, %edx
callq 0x19790
jmp 0x2365d
movq -0x10(%rbp), %rax
cmpl $0x6, (%rax)
je 0x230da
movq -0x18(%rbp), %rdi
movq -0x20(%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 $0x12, %esi
leaq 0x881b9(%rip), %rcx     # 0xab276
leaq 0x8759a(%rip), %rax     # 0xaa65e
movq %rax, (%rsp)
movl $0x8f, 0x8(%rsp)
callq 0x156d0
jmp 0x2365d
jmp 0x230dc
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jne 0x23164
movq -0x8(%rbp), %rax
cmpq $0x0, 0x78(%rax)
jne 0x23164
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x3cff0
movq %rax, -0x178(%rbp)
cmpq $0x0, -0x178(%rbp)
je 0x23162
movq -0x18(%rbp), %rdi
movq -0x20(%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 $0x52, %esi
leaq 0x88131(%rip), %rcx     # 0xab276
leaq 0x87512(%rip), %rax     # 0xaa65e
movq %rax, (%rsp)
movl $0x97, 0x8(%rsp)
callq 0x156d0
jmp 0x2365d
jmp 0x23164
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0x3cff0
cmpq $0x0, %rax
je 0x231c2
movq -0x18(%rbp), %rdi
movq -0x20(%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 0x880d1(%rip), %rcx     # 0xab276
leaq 0x874b2(%rip), %rax     # 0xaa65e
movq %rax, (%rsp)
movl $0x9e, 0x8(%rsp)
callq 0x156d0
jmp 0x2365d
movq -0x20(%rbp), %rdi
callq 0x120d0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x121b0
movq %rax, -0x188(%rbp)
cmpq $0x0, -0x188(%rbp)
jne 0x23207
movq -0x18(%rbp), %rdi
movl $0x1, %esi
leaq 0x87466(%rip), %rdx     # 0xaa65e
movl $0xa4, %ecx
callq 0x158e0
jmp 0x2365d
movq -0x188(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x12060
movq -0x10(%rbp), %rsi
addq $0x8, %rsi
movq -0x18(%rbp), %rdx
leaq -0x168(%rbp), %rdi
callq 0x3dec0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x23249
movq -0x188(%rbp), %rdi
callq 0x12290
jmp 0x2365d
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 0x2326b
jmp 0x23639
movq -0x10(%rbp), %rdi
callq 0x12d70
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x232d2
movq -0x20(%rbp), %rdi
leaq 0x88010(%rip), %rsi     # 0xab29c
callq 0x12140
cmpl $0x0, %eax
jne 0x232d2
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x18(%rbp), %r8
leaq -0x168(%rbp), %rcx
callq 0x23670
leaq -0x168(%rbp), %rdi
callq 0x3e100
movq -0x188(%rbp), %rdi
callq 0x12290
jmp 0x2365d
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x2332c
movq -0x20(%rbp), %rdi
leaq 0x8a325(%rip), %rsi     # 0xad60b
callq 0x12140
cmpl $0x0, %eax
jne 0x2332c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x18(%rbp), %r8
leaq -0x168(%rbp), %rcx
callq 0x23830
leaq -0x168(%rbp), %rdi
callq 0x3e100
movq -0x188(%rbp), %rdi
callq 0x12290
jmp 0x2365d
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpl $0x2, (%rcx)
movb %al, -0x189(%rbp)
jne 0x2335b
movq -0x20(%rbp), %rdi
leaq 0x872cc(%rip), %rsi     # 0xaa614
callq 0x12140
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x189(%rbp)
movb -0x189(%rbp), %al
andb $0x1, %al
movb %al, -0x169(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x49d10
testb $0x1, %al
jne 0x2337e
jmp 0x2341a
testb $0x1, -0x169(%rbp)
jne 0x233b2
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x168(%rbp), %rsi
callq 0x47580
movq %rax, -0x180(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x233b0
jmp 0x23639
jmp 0x233e8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x18(%rbp), %r8
leaq -0x168(%rbp), %rcx
callq 0x1b110
movq %rax, -0x180(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x233e6
jmp 0x23639
jmp 0x233e8
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rax
movq 0x148(%rax), %rcx
movq -0x18(%rbp), %r8
leaq -0x168(%rbp), %rdx
callq 0x3cc20
jmp 0x23637
cmpl $0x9, -0x168(%rbp)
jne 0x23471
testb $0x1, -0x169(%rbp)
jne 0x2344d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x18(%rbp), %r8
leaq -0x168(%rbp), %rcx
callq 0x1b260
jmp 0x2346c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x188(%rbp), %rdx
movq -0x18(%rbp), %r8
leaq -0x168(%rbp), %rcx
callq 0x1b340
jmp 0x23635
leaq -0x168(%rbp), %rdi
callq 0x4a090
testb $0x1, %al
jne 0x23486
jmp 0x2354e
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x188(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq -0x168(%rbp), %rdx
callq 0x3c480
movq %rax, -0x178(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x234ba
jmp 0x23639
testb $0x1, -0x169(%rbp)
jne 0x234ee
movq -0x8(%rbp), %rdi
movq -0x178(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %r9
leaq -0x168(%rbp), %rsi
movl $0x2, %edx
movl $0x1, %r8d
callq 0x47600
jmp 0x23549
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x24a20
movq %rax, -0x180(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x23514
jmp 0x23639
movq -0x8(%rbp), %rdi
movq -0x178(%rbp), %rax
movq (%rax), %rcx
movq -0x180(%rbp), %r8
movq -0x18(%rbp), %r9
leaq -0x168(%rbp), %rsi
movl $0x2, %edx
callq 0x47710
movq $0x0, -0x180(%rbp)
jmp 0x23633
cmpl $0x16, -0x168(%rbp)
jne 0x23617
movq -0x8(%rbp), %rdi
movq -0x188(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq -0x168(%rbp), %rdx
callq 0x25e50
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x23584
jmp 0x23639
testb $0x1, -0x169(%rbp)
je 0x235bb
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x188(%rbp), %rcx
movq -0x18(%rbp), %rax
leaq -0x168(%rbp), %rdx
movl $0x1, %r9d
movl %r9d, %r8d
movq %rax, (%rsp)
callq 0x34e20
jmp 0x23615
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x188(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq -0x168(%rbp), %rdx
callq 0x3c480
movq %rax, -0x178(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x235ec
jmp 0x23639
movq -0x8(%rbp), %rdi
movq -0x178(%rbp), %rax
movq (%rax), %rcx
movq -0x18(%rbp), %r9
leaq -0x168(%rbp), %rsi
movl $0x2, %edx
movl $0x1, %r8d
callq 0x62290
jmp 0x23631
movq -0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x87037(%rip), %rdx     # 0xaa65e
movl $0xfa, %ecx
callq 0x158e0
jmp 0x23633
jmp 0x23635
jmp 0x23637
jmp 0x23639
leaq -0x168(%rbp), %rdi
callq 0x3e100
movq -0x180(%rbp), %rdi
callq 0x36ee0
movq -0x188(%rbp), %rdi
callq 0x12290
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
nopw %cs:(%rax,%rax)