// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: prv_parse_def
static void prv_parse_def(subtilis_arm_ass_context_t *c, subtilis_error_t *err)
{
	const char *tbuf;
	subtilis_arm_ass_def_t *new_defs;
	size_t new_max_defs;
	const char *id_name;
	subtilis_arm_exp_val_t *val1 = NULL;
	subtilis_arm_exp_val_t *val2 = NULL;

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

	tbuf = subtilis_token_get_text(c->t);
	if (c->t->type != SUBTILIS_TOKEN_IDENTIFIER) {
		subtilis_error_set_expected(err, "identifier", tbuf,
					    c->l->stream->name, c->l->line);
		goto cleanup;
	}

	tbuf = subtilis_token_get_text(c->t);
	val1 = subtilis_arm_exp_process_id(c, tbuf, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (val1->type != SUBTILIS_ARM_EXP_TYPE_ID) {
		subtilis_error_set_expected(err, "identifier",
					    subtilis_arm_exp_type_name(val1),
					    c->l->stream->name, c->l->line);
		goto cleanup;
	}

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

	tbuf = subtilis_token_get_text(c->t);
	if (c->t->type != SUBTILIS_TOKEN_OPERATOR || strcmp(tbuf, "=")) {
		subtilis_error_set_expected(err, "=", tbuf, c->l->stream->name,
					    c->l->line);
		goto cleanup;
	}

	val2 = subtilis_arm_exp_val_get(c, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (c->def_count == c->max_defs) {
		new_max_defs = c->max_defs + SUBTILIS_CONFIG_CONSTANT_POOL_GRAN;
		new_defs = realloc(c->defs, sizeof(*new_defs) * new_max_defs);
		if (!new_defs) {
			subtilis_error_set_oom(err);
			goto cleanup;
		}
		c->defs = new_defs;
		c->max_defs = new_max_defs;
	}

	id_name = subtilis_buffer_get_string(&val1->val.buf);
	c->defs[c->def_count].name =
	    malloc(subtilis_buffer_get_size(&val1->val.buf));
	if (!c->defs[c->def_count].name) {
		subtilis_error_set_oom(err);
		goto cleanup;
	}
	strcpy(c->defs[c->def_count].name, id_name);
	c->defs[c->def_count++].val = val2;
	val2 = NULL;

cleanup:

	subtilis_arm_exp_val_free(val2);
	subtilis_arm_exp_val_free(val1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rdi
movq 0x10(%r15), %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
je 0x6081c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r15), %rdi
callq 0x12a25
movq 0x10(%r15), %rdi
cmpl $0x6, (%rdi)
jne 0x608b8
callq 0x12a25
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x6451e
cmpl $0x0, (%r14)
jne 0x6080d
movq %rax, %rbx
cmpl $0x9, (%rax)
jne 0x608ed
movq 0x8(%r15), %rdi
movq 0x10(%r15), %rsi
movq %r14, %rdx
callq 0x12e0e
cmpl $0x0, (%r14)
jne 0x6080d
movq 0x10(%r15), %rdi
callq 0x12a25
movq 0x10(%r15), %rcx
cmpl $0x2, (%rcx)
jne 0x6088e
cmpb $0x3d, (%rax)
jne 0x6088e
cmpb $0x0, 0x1(%rax)
je 0x60947
movq 0x8(%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x1043f(%rip), %r10     # 0x70ce0
leaq 0xcd4e(%rip), %rdx      # 0x6d5f6
pushq $0x1d
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
pushq $0xfa7                  # imm = 0xFA7
jmp 0x6091d
movq 0x8(%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x10415(%rip), %r10     # 0x70ce0
leaq 0x10430(%rip), %rdx     # 0x70d02
pushq $0x1d
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
pushq $0xf90                  # imm = 0xF90
pushq %r10
callq 0x140cd
popq %rax
popq %rcx
xorl %ebx, %ebx
jmp 0x60926
movq %rbx, %rdi
callq 0x647dd
movq 0x8(%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0x103d8(%rip), %r10     # 0x70ce0
leaq 0x103f3(%rip), %rdx     # 0x70d02
pushq $0x1d
popq %rsi
movq %r14, %rdi
movq %rax, %rcx
pushq $0xf9c                  # imm = 0xF9C
pushq %r10
callq 0x140cd
popq %rax
popq %rcx
xorl %r12d, %r12d
movq %r12, %rdi
callq 0x63ee7
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x63ee7
movq %r15, %rdi
movq %r14, %rsi
callq 0x647a2
cmpl $0x0, (%r14)
jne 0x6080d
movq %rax, %r12
movq 0x58(%r15), %r13
cmpq 0x60(%r15), %r13
jne 0x6098a
addq $0x20, %r13
movq 0x50(%r15), %rdi
movq %r13, %rsi
shlq $0x4, %rsi
callq 0x12210
testq %rax, %rax
je 0x609f9
movq %rax, 0x50(%r15)
movq %r13, 0x60(%r15)
movq %rbx, %rbp
addq $0x8, %rbp
movq %rbp, %rdi
callq 0x14a53
movq %rax, (%rsp)
movq %rbp, %rdi
callq 0x14804
movq %rax, %rdi
callq 0x121d0
movq 0x50(%r15), %rcx
movq 0x58(%r15), %rbp
movq %rbp, %r13
shlq $0x4, %r13
movq %rax, (%rcx,%r13)
testq %rax, %rax
je 0x609e5
movq %rax, %rdi
movq (%rsp), %rsi
movq %rcx, %r14
callq 0x12070
incq %rbp
movq %rbp, 0x58(%r15)
movq %r12, 0x8(%r14,%r13)
jmp 0x60926
leaq 0x102f4(%rip), %rdx     # 0x70ce0
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0xfbe, %ecx            # imm = 0xFBE
jmp 0x60a0b
leaq 0x102e0(%rip), %rdx     # 0x70ce0
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0xfb3, %ecx            # imm = 0xFB3
callq 0x1429e
jmp 0x60929