// File: /workspace/github_c_makefile_star2_O3/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 0x69632
cmpl $0x0, (%rbx)
jne 0x67a0d
movq %rax, %r12
cmpl $0x5, (%rax)
jne 0x679bc
movq 0x8(%r12), %r15
cmpq $0x1, %r15
ja 0x67a00
movq %r12, %rdi
callq 0x6966d
movq 0x8(%r14), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xf399(%rip), %r10      # 0x76d70
leaq 0xf4f6(%rip), %rdx      # 0x76ed4
movq %rbx, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x281                  # imm = 0x281
pushq %r10
callq 0x143da
addq $0x10, %rsp
movq $-0x1, %r15
movq %r12, %rdi
callq 0x68d41
cmpl $0x0, (%rbx)
je 0x67a1c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rdi
callq 0x12ad0
movq 0x10(%r14), %rcx
cmpl $0x2, (%rcx)
jne 0x67a39
cmpb $0x2c, (%rax)
jne 0x67a39
cmpb $0x0, 0x1(%rax)
je 0x67a70
movq 0x8(%r14), %rcx
movq 0x30(%rcx), %r8
movl 0x38(%rcx), %r9d
leaq 0xf324(%rip), %r10      # 0x76d70
leaq 0xbb3f(%rip), %rdx      # 0x73592
movq %rbx, %rdi
movl $0x1d, %esi
movq %rax, %rcx
pushq $0x712                  # imm = 0x712
pushq %r10
callq 0x143da
addq $0x18, %rsp
jmp 0x67a11
movq %r14, %rdi
movq %rbx, %rsi
callq 0x69632
cmpl $0x0, (%rbx)
jne 0x67a0d
movq %rax, %r12
movl %r15d, %r13d
andl $-0x2, %r13d
movl (%rax), %eax
cmpl $0x1, %eax
je 0x67b10
cmpl $0x6, %eax
je 0x67aa8
cmpl $0x7, %eax
jne 0x67b37
cvttsd2si 0x8(%r12), %edi
jmp 0x67aad
movl 0x8(%r12), %edi
leaq 0x4(%rsp), %rsi
movl %edi, (%rsp)
callq 0x4f87d
testb %al, %al
je 0x67ae3
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 0x50d25
jmp 0x67b33
movq 0x8(%r14), %rax
movq 0x30(%rax), %r8
movl 0x38(%rax), %r9d
leaq 0xf27a(%rip), %rax      # 0x76d70
movq %rbx, %rdi
movl $0x59, %esi
movl (%rsp), %edx
xorl %ecx, %ecx
pushq $0x724                  # imm = 0x724
pushq %rax
callq 0x14486
jmp 0x67b33
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 0x50cc4
addq $0x10, %rsp
movq %r12, %rdi
callq 0x68d41
jmp 0x67a0d