// File: /workspace/github_c_makefile_star2_O1/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: prv_parse_adr
static void prv_parse_adr(subtilis_arm_ass_context_t *c,
			  subtilis_arm_ccode_type_t ccode,
			  subtilis_error_t *err)
{
	subtilis_arm_exp_val_t *val;
	const char *str;
	size_t index;
	subtilis_arm_reg_t dest;
	const char *tbuf;
	const char *bad_reg = "R15";

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

	if (val->type != SUBTILIS_ARM_EXP_TYPE_REG) {
		subtilis_error_set_expected(err, "register",
					    subtilis_arm_exp_type_name(val),
					    c->l->stream->name, c->l->line);
		goto cleanup;
	}

	dest = val->val.reg;
	if (dest == 15) {
		subtilis_error_set_ass_bad_reg(err, bad_reg, c->l->stream->name,
					       c->l->line);
		goto cleanup;
	}

	subtilis_arm_exp_val_free(val);
	val = NULL;

	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;
	}

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

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

	str = subtilis_buffer_get_string(&val->val.buf);
	if (!subtilis_string_pool_find(c->label_pool, str, &index)) {
		index = subtilis_string_pool_register(c->label_pool, str, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		subtilis_bitset_set(&c->pending_labels, index, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	subtilis_add_adr(c->arm_s, ccode, dest, index, err);

cleanup:

	subtilis_arm_exp_val_free(val);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movq %rdx, %rsi
callq 0x69a84
cmpl $0x0, (%r14)
jne 0x67aef
movq %rax, %rbx
cmpl $0x1, (%rax)
jne 0x67a42
movq 0x8(%rbx), %r12
cmpq $0xf, %r12
jne 0x67a81
movq 0x8(%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xf2ec(%rip), %rax      # 0x76d10
leaq 0xf375(%rip), %rdx      # 0x76da0
leaq 0xc3c3(%rip), %rcx      # 0x73df5
movq %r14, %rdi
movl $0x58, %esi
pushq $0x6d6                  # imm = 0x6D6
pushq %rax
jmp 0x67a76
movq %rbx, %rdi
callq 0x69abf
movq 0x8(%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xf2b3(%rip), %r10      # 0x76d10
leaq 0xf355(%rip), %rdx      # 0x76db9
movq %r14, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x6cf                  # imm = 0x6CF
pushq %r10
callq 0x1442a
addq $0x10, %rsp
jmp 0x67ae7
movq %rbx, %rdi
callq 0x69167
movq 0x10(%r15), %rdi
callq 0x12ad0
movq %rax, %rbx
movq 0x10(%r15), %rax
cmpl $0x2, (%rax)
jne 0x67ab1
leaq 0xbaf3(%rip), %rsi      # 0x73598
movq %rbx, %rdi
callq 0x12160
testl %eax, %eax
je 0x67afe
movq 0x8(%r15), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xf24c(%rip), %rax      # 0x76d10
leaq 0xbacd(%rip), %rdx      # 0x73598
movq %r14, %rdi
movl $0x1d, %esi
movq %rbx, %rcx
pushq $0x6e0                  # imm = 0x6E0
pushq %rax
callq 0x1442a
addq $0x10, %rsp
xorl %ebx, %ebx
movq %rbx, %rdi
callq 0x69167
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r14, %rsi
callq 0x69a84
cmpl $0x0, (%r14)
jne 0x67aef
movq %rax, %rbx
cmpl $0x9, (%rax)
jne 0x67b4f
movq %rbx, %rdi
addq $0x8, %rdi
callq 0x14dfb
movq %rax, %r13
movq 0x30(%r15), %rdi
movq %rsp, %rdx
movq %rax, %rsi
callq 0x2f216
testb %al, %al
je 0x67b86
movq (%r15), %rdi
movq (%rsp), %rcx
movl %ebp, %esi
movq %r12, %rdx
movq %r14, %r8
callq 0x4fb8c
jmp 0x67ae7
movq %rbx, %rdi
callq 0x69abf
movq 0x8(%r15), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xf1a6(%rip), %r10      # 0x76d10
leaq 0xf269(%rip), %rdx      # 0x76dda
movq %r14, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x6eb                  # imm = 0x6EB
jmp 0x67a74
movq 0x30(%r15), %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x2f26d
movq %rax, (%rsp)
cmpl $0x0, (%r14)
jne 0x67ae7
leaq 0x38(%r15), %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x5db60
cmpl $0x0, (%r14)
jne 0x67ae7
jmp 0x67b39