// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_stran_instr
static void prv_encode_stran_instr(void *user_data, subtilis_arm_op_t *op,
				   subtilis_arm_instr_type_t type,
				   subtilis_arm_stran_instr_t *instr,
				   subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t *ud = user_data;
	uint32_t word = 0;

	prv_check_pool(ud, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if ((instr->base > 15) || (instr->dest > 15)) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	word |= instr->ccode << 28;
	word |= 1 << 26;
	if (instr->pre_indexed)
		word |= 1 << 24;

	if (instr->byte)
		word |= 1 << 22;
	if (instr->write_back)
		word |= 1 << 21;
	if (!instr->subtract)
		word |= 1 << 23;
	if (type == SUBTILIS_ARM_INSTR_LDR)
		word |= 1 << 20;
	word |= instr->base << 16;
	word |= instr->dest << 12;
	prv_encode_stran_op2(&instr->offset, &word, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	prv_ensure_code(ud, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;
	prv_add_word(ud, word, err);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r12
movl %edx, %ebp
movq %rdi, %r14
movq %r8, %rsi
callq 0x55e87
cmpl $0x0, (%rbx)
je 0x5413c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rcx
cmpq $0xf, %rcx
ja 0x54152
movq 0x8(%r12), %r15
cmpq $0x10, %r15
jb 0x54177
leaq 0x1bc97(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x2d9, %ecx            # imm = 0x2D9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1429e
movl (%r12), %edx
movl 0x18(%r12), %eax
shll $0x1c, %edx
movzbl 0x40(%r12), %esi
shll $0x18, %esi
orl %edx, %esi
movzbl 0x43(%r12), %edx
shll $0x16, %edx
orl %esi, %edx
movzbl 0x41(%r12), %esi
shll $0x15, %esi
orl %edx, %esi
movzbl 0x42(%r12), %edx
xorl $0x1, %edx
shll $0x17, %edx
orl %esi, %edx
xorl %esi, %esi
cmpl $0x12, %ebp
sete %sil
shll $0x14, %esi
orl %edx, %esi
shll $0x10, %ecx
shll $0xc, %r15d
orl %ecx, %r15d
orl %esi, %r15d
orl $0x4000000, %r15d       # imm = 0x4000000
cmpl $0x2, %eax
je 0x54229
cmpl $0x1, %eax
je 0x54209
testl %eax, %eax
jne 0x54298
movq 0x20(%r12), %rax
cmpq $0x10, %rax
jb 0x5428e
leaq 0x1bbf4(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x2b1, %ecx            # imm = 0x2B1
jmp 0x54246
movl 0x20(%r12), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jb 0x5424d
leaq 0x1bbd4(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x2b8, %ecx            # imm = 0x2B8
jmp 0x54246
movq 0x20(%r12), %r13
cmpq $0x10, %r13
jb 0x54255
leaq 0x1bbb5(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x2be, %ecx            # imm = 0x2BE
callq 0x1429e
jmp 0x54298
orl %r15d, %eax
movl %eax, %r15d
jmp 0x54298
movl 0x28(%r12), %edi
movl 0x30(%r12), %ebp
movq %rbx, %rsi
callq 0x56028
cmpl $0x0, (%rbx)
jne 0x5412d
andl $0x1f, %ebp
shll $0x7, %ebp
shll $0x5, %eax
orl %ebp, %r13d
orl %eax, %r13d
orl %r15d, %r13d
orl $0x2000000, %r13d       # imm = 0x2000000
movl %r13d, %r15d
jmp 0x542a1
orl %eax, %r15d
orl $0x2000000, %r15d       # imm = 0x2000000
cmpl $0x0, (%rbx)
jne 0x5412d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e8e
cmpl $0x0, (%rbx)
jne 0x5412d
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x55e99