// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x1642d(%rip), %rax     # 0xae1b7
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9b4f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x97dad
jmp 0x9800d
movq -0x20(%rbp), %rax
cmpl $0x1, (%rax)
je 0x97e0f
movq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9b550
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x163de(%rip), %rdx     # 0xae1d0
leaq 0x16327(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x6cf, 0x8(%rsp)       # imm = 0x6CF
callq 0x156d0
jmp 0x98004
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0xf, -0x38(%rbp)
jne 0x97e6b
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rdx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x58, %esi
leaq 0x13428(%rip), %rcx     # 0xab276
leaq 0x162cb(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x6d6, 0x8(%rsp)       # imm = 0x6D6
callq 0x156d0
jmp 0x98004
movq -0x20(%rbp), %rdi
callq 0x9a4c0
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2, (%rax)
jne 0x97eaf
movq -0x40(%rbp), %rdi
leaq 0x12704(%rip), %rsi     # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
je 0x97ef8
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x126ce(%rip), %rdx     # 0xaa5a9
leaq 0x1623e(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x6e0, 0x8(%rsp)       # imm = 0x6E0
callq 0x156d0
jmp 0x98004
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9b4f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x97f17
jmp 0x9800d
movq -0x20(%rbp), %rax
cmpl $0x9, (%rax)
je 0x97f79
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
callq 0x9b550
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x30(%rax), %r8
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %r9d
movl $0x1d, %esi
leaq 0x16295(%rip), %rdx     # 0xae1f1
leaq 0x161bd(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x6eb, 0x8(%rsp)       # imm = 0x6EB
callq 0x156d0
jmp 0x98004
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
callq 0x16760
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x3d5a0
testb $0x1, %al
jne 0x97fe9
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x3d630
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x97fc7
jmp 0x98004
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x88810
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x97fe7
jmp 0x98004
jmp 0x97fe9
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %r8
callq 0x71300
movq -0x20(%rbp), %rdi
callq 0x9a4c0
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)