// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_data_op2
static void prv_encode_data_op2(subtilis_arm_op2_t *op2, uint32_t *word,
				subtilis_error_t *err)
{
	uint32_t shift;

	if (op2->type == SUBTILIS_ARM_OP2_REG) {
		if (op2->op.reg > 15) {
			subtilis_error_set_assertion_failed(err);
			return;
		}
		*word |= op2->op.reg;
	} else if (op2->type == SUBTILIS_ARM_OP2_I32) {
		if (op2->op.integer & 0xfffff000) {
			subtilis_error_set_assertion_failed(err);
			return;
		}
		*word |= op2->op.integer;
		*word |= 1 << 25;
	} else if (op2->type == SUBTILIS_ARM_OP2_SHIFTED) {
		if (op2->op.shift.reg > 15) {
			subtilis_error_set_assertion_failed(err);
			return;
		}

		if (op2->op.shift.shift_reg && op2->op.shift.shift.reg > 15) {
			subtilis_error_set_assertion_failed(err);
			return;
		}

		*word |= op2->op.shift.reg;
		if (op2->op.shift.shift_reg) {
			*word |= 1 << 4;
			*word |= (op2->op.shift.shift.reg & 15) << 8;
		} else {
			*word |= (op2->op.shift.shift.integer & 31) << 7;
		}
		shift = prv_convert_shift(op2->op.shift.type, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		*word |= shift << 5;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x81a2f
movq -0x8(%rbp), %rax
cmpq $0xf, 0x8(%rax)
jbe 0x81a17
movq -0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x2b428(%rip), %rdx     # 0xace30
movl $0x232, %ecx            # imm = 0x232
callq 0x158e0
jmp 0x81b7f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
orq %rdx, %rcx
movl %ecx, (%rax)
jmp 0x81b7f
movq -0x8(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x81a8a
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
andl $0xfffff000, %eax       # imm = 0xFFFFF000
cmpl $0x0, %eax
je 0x81a68
movq -0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x2b3d7(%rip), %rdx     # 0xace30
movl $0x238, %ecx            # imm = 0x238
callq 0x158e0
jmp 0x81b7f
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
orl $0x2000000, %ecx        # imm = 0x2000000
movl %ecx, (%rax)
jmp 0x81b7d
movq -0x8(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x81b7b
movq -0x8(%rbp), %rax
cmpq $0xf, 0x8(%rax)
jbe 0x81ac1
movq -0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x2b37e(%rip), %rdx     # 0xace30
movl $0x23f, %ecx            # imm = 0x23F
callq 0x158e0
jmp 0x81b7f
movq -0x8(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x81af5
movq -0x8(%rbp), %rax
cmpq $0xf, 0x18(%rax)
jbe 0x81af5
movq -0x18(%rbp), %rdi
movl $0xf, %esi
leaq 0x2b34a(%rip), %rdx     # 0xace30
movl $0x244, %ecx            # imm = 0x244
callq 0x158e0
jmp 0x81b7f
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
orq %rdx, %rcx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x81b3a
movq -0x10(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdx
andq $0xf, %rdx
shlq $0x8, %rdx
movq -0x10(%rbp), %rax
movl (%rax), %ecx
orq %rdx, %rcx
movl %ecx, (%rax)
jmp 0x81b4f
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x1f, %ecx
shll $0x7, %ecx
movq -0x10(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %edi
movq -0x18(%rbp), %rsi
callq 0x81eb0
movl %eax, -0x1c(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
je 0x81b6d
jmp 0x81b7f
movl -0x1c(%rbp), %ecx
shll $0x5, %ecx
movq -0x10(%rbp), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
jmp 0x81b7d
jmp 0x81b7f
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)