// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: prv_parse_msr
static void prv_parse_msr(subtilis_arm_ass_context_t *c,
			  subtilis_arm_ccode_type_t ccode,
			  subtilis_error_t *err)
{
	subtilis_arm_exp_val_t *val;
	subtilis_arm_reg_t dest;
	const char *tbuf;
	uint32_t encoded;
	int32_t num;
	uint32_t flags;

	dest = prv_get_dest_flagsreg(c, 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);
		return;
	}

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

	flags = dest & 0xfffffffe;

	if ((val->type == SUBTILIS_ARM_EXP_TYPE_INT) ||
	    (val->type == SUBTILIS_ARM_EXP_TYPE_REAL)) {
		if (val->type == SUBTILIS_ARM_EXP_TYPE_REAL)
			num = (int32_t)val->val.real;
		else
			num = val->val.integer;
		if (!subtilis_arm_encode_imm(num, &encoded)) {
			subtilis_error_set_ass_integer_encode(
			    err, num, c->l->stream->name, c->l->line);
			goto cleanup;
		}
		subtilis_arm_add_flags_imm(c->arm_s, SUBTILIS_ARM_INSTR_MSR,
					   ccode, dest & 1, flags, num, err);
	} else if (val->type == SUBTILIS_ARM_EXP_TYPE_REG) {
		subtilis_arm_add_flags(c->arm_s, SUBTILIS_ARM_INSTR_MSR, ccode,
				       dest & 1, flags, val->val.reg, err);
	}

cleanup:

	subtilis_arm_exp_val_free(val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9a1b0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x98152
jmp 0x982fd
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2, (%rax)
jne 0x98185
movq -0x30(%rbp), %rdi
leaq 0x1242e(%rip), %rsi     # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
je 0x981ce
movq -0x18(%rbp), %rdi
movq -0x30(%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 0x123f8(%rip), %rdx     # 0xaa5a9
leaq 0x15f68(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x712, 0x8(%rsp)       # imm = 0x712
callq 0x156d0
jmp 0x982fd
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9b4f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x981ed
jmp 0x982fd
movabsq $0xfffffffe, %rax       # imm = 0xFFFFFFFE
andq -0x28(%rbp), %rax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x6, (%rax)
je 0x98214
movq -0x20(%rbp), %rax
cmpl $0x7, (%rax)
jne 0x982b5
movq -0x20(%rbp), %rax
cmpl $0x7, (%rax)
jne 0x9822b
movq -0x20(%rbp), %rax
cvttsd2si 0x8(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0x98235
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %edi
leaq -0x34(%rbp), %rsi
callq 0x70e60
testb $0x1, %al
jne 0x98285
movq -0x18(%rbp), %rdi
movl -0x38(%rbp), %edx
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 $0x59, %esi
xorl %ecx, %ecx
leaq 0x15eae(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x724, 0x8(%rsp)       # imm = 0x724
callq 0x157b0
jmp 0x982f4
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %edx
movq -0x28(%rbp), %rax
andq $0x1, %rax
movl %eax, %ecx
movl -0x3c(%rbp), %r8d
movl -0x38(%rbp), %r9d
movq -0x18(%rbp), %rax
movl $0x1c, %esi
movq %rax, (%rsp)
callq 0x72d30
jmp 0x982f2
movq -0x20(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x982f0
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %edx
movq -0x28(%rbp), %rax
andq $0x1, %rax
movl %eax, %ecx
movl -0x3c(%rbp), %r8d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %r9
movq -0x18(%rbp), %rax
movl $0x1c, %esi
movq %rax, (%rsp)
callq 0x72ca0
jmp 0x982f2
jmp 0x982f4
movq -0x20(%rbp), %rdi
callq 0x9a4c0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)