// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/assembler.c
// Function: prv_parse_signx
static void prv_parse_signx(subtilis_arm_ass_context_t *c,
			    subtilis_arm_instr_type_t itype,
			    subtilis_arm_ccode_type_t ccode,
			    subtilis_error_t *err)
{
	subtilis_arm_reg_t dest;
	subtilis_arm_reg_t op1;
	const char *tbuf;
	subtilis_arm_exp_val_t *val = NULL;
	subtilis_arm_signx_rotate_t rotate = SUBTILIS_ARM_SIGNX_ROR_NONE;

	dest = prv_get_reg(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;
	}

	op1 = prv_get_reg(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_lexer_get(c->l, c->t, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		tbuf = subtilis_token_get_text(c->t);
		if (c->t->type != SUBTILIS_TOKEN_KEYWORD ||
		    (c->t->tok.keyword.type != SUBTILIS_ARM_KEYWORD_ROR)) {
			subtilis_error_set_expected(
			    err, "ROR", tbuf, c->l->stream->name, c->l->line);
			return;
		}

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

		if (val->type != SUBTILIS_ARM_EXP_TYPE_INT) {
			subtilis_error_set_expected(err, "0, 8, 16 or 24", tbuf,
						    c->l->stream->name,
						    c->l->line);
			goto cleanup;
		}

		switch (val->val.integer) {
		case 0:
			break;
		case 8:
			rotate = SUBTILIS_ARM_SIGNX_ROR_8;
			break;
		case 16:
			rotate = SUBTILIS_ARM_SIGNX_ROR_16;
			break;
		case 24:
			rotate = SUBTILIS_ARM_SIGNX_ROR_24;
			break;
		default:
			subtilis_error_set_expected(err, "0, 8, 16 or 24", tbuf,
						    c->l->stream->name,
						    c->l->line);
			goto cleanup;
		}
	}

	subtilis_arm_add_signx(c->arm_s, itype, ccode, dest, op1, rotate, err);

cleanup:

	subtilis_arm_exp_val_free(val);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x94690
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x984f4
jmp 0x98790
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 0x98527
movq -0x30(%rbp), %rdi
leaq 0x1208c(%rip), %rsi     # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
je 0x98570
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 0x12056(%rip), %rdx     # 0xaa5a9
leaq 0x15bc6(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x787, 0x8(%rsp)       # imm = 0x787
callq 0x156d0
jmp 0x98790
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x94690
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x9858f
jmp 0x98790
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 0x98761
movq -0x30(%rbp), %rdi
leaq 0x11fed(%rip), %rsi     # 0xaa5a9
callq 0x12140
cmpl $0x0, %eax
jne 0x98761
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x133f0
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x985f1
jmp 0x98790
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x12d70
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x1, (%rax)
jne 0x9861d
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2a, 0x8(%rax)
je 0x98666
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 0x119c5(%rip), %rdx     # 0xaa00e
leaq 0x15ad0(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x799, 0x8(%rsp)       # imm = 0x799
callq 0x156d0
jmp 0x98790
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9b4f0
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x98685
jmp 0x98790
movq -0x38(%rbp), %rax
cmpl $0x6, (%rax)
je 0x986d7
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 0x15bea(%rip), %rdx     # 0xae2a4
leaq 0x15a5f(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x7a4, 0x8(%rsp)       # imm = 0x7A4
callq 0x156d0
jmp 0x98787
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x48(%rbp)
subq $0x18, %rax
ja 0x98719
movq -0x48(%rbp), %rax
leaq 0x159a1(%rip), %rcx     # 0xae094
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x9875f
movl $0x1, -0x3c(%rbp)
jmp 0x9875f
movl $0x2, -0x3c(%rbp)
jmp 0x9875f
movl $0x3, -0x3c(%rbp)
jmp 0x9875f
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 0x15b5f(%rip), %rdx     # 0xae2a4
leaq 0x159d4(%rip), %rax     # 0xae120
movq %rax, (%rsp)
movl $0x7b7, 0x8(%rsp)       # imm = 0x7B7
callq 0x156d0
jmp 0x98787
jmp 0x98761
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %r8
movl -0x3c(%rbp), %r9d
movq -0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x72ea0
movq -0x38(%rbp), %rdi
callq 0x9a4c0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)