// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq %rdx, %rsi
callq 0x69a84
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
cmpl $0x0, (%rbx)
jne 0x67d76
movq %rax, %r12
cmpl $0x5, (%rax)
jne 0x67d2a
movq 0x8(%r12), %r15
cmpq $0x1, %r15
ja 0x67d6e
movq %r12, %rdi
callq 0x69abf
movq 0x8(%r14), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xefcb(%rip), %r10      # 0x76d10
leaq 0xf126(%rip), %rdx      # 0x76e72
movq %rbx, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x281                  # imm = 0x281
pushq %r10
callq 0x1442a
addq $0x10, %rsp
movq $-0x1, %r15
movq %r12, %rdi
callq 0x69167
cmpl $0x0, (%rbx)
je 0x67d81
addq $0x8, %rsp
jmp 0x67ddd
movq 0x10(%r14), %rdi
callq 0x12ad0
movq %rax, %r12
movq 0x10(%r14), %rax
cmpl $0x2, (%rax)
jne 0x67da9
leaq 0xb7fb(%rip), %rsi      # 0x73598
movq %r12, %rdi
callq 0x12160
testl %eax, %eax
je 0x67de8
movq 0x8(%r14), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xef54(%rip), %rax      # 0x76d10
leaq 0xb7d5(%rip), %rdx      # 0x73598
movq %rbx, %rdi
movl $0x1d, %esi
movq %r12, %rcx
pushq $0x712                  # imm = 0x712
pushq %rax
callq 0x1442a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x69a84
cmpl $0x0, (%rbx)
jne 0x67d7b
movq %rax, %r12
movl %r15d, %r13d
andl $-0x2, %r13d
movl (%rax), %eax
cmpl $0x1, %eax
je 0x67e88
cmpl $0x6, %eax
je 0x67e20
cmpl $0x7, %eax
jne 0x67eaf
cvttsd2si 0x8(%r12), %edi
jmp 0x67e25
movl 0x8(%r12), %edi
leaq 0x4(%rsp), %rsi
movl %edi, (%rsp)
callq 0x4f8d1
testb %al, %al
je 0x67e5b
movq (%r14), %rdi
andl $0x1, %r15d
subq $0x8, %rsp
movl $0x1c, %esi
movl %ebp, %edx
movl %r15d, %ecx
movl %r13d, %r8d
movl 0x8(%rsp), %r9d
pushq %rbx
callq 0x50efe
jmp 0x67eab
movq 0x8(%r14), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xeea2(%rip), %rax      # 0x76d10
movq %rbx, %rdi
movl $0x59, %esi
movl (%rsp), %edx
xorl %ecx, %ecx
pushq $0x724                  # imm = 0x724
pushq %rax
callq 0x144d6
jmp 0x67eab
movq (%r14), %rdi
andl $0x1, %r15d
movq 0x8(%r12), %r9
subq $0x8, %rsp
movl $0x1c, %esi
movl %ebp, %edx
movl %r15d, %ecx
movl %r13d, %r8d
pushq %rbx
callq 0x50e92
addq $0x10, %rsp
movq %r12, %rdi
callq 0x69167
jmp 0x67d7b