// File: /workspace/github_c_makefile_star2_O3/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
xorl %esi, %esi
movq %r8, %rdx
callq 0x59e32
cmpl $0x0, (%rbx)
je 0x57c27
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rcx
cmpq $0xf, %rcx
ja 0x57c3d
movq 0x8(%r12), %r15
cmpq $0x10, %r15
jb 0x57c64
leaq 0x1e23c(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2d9, %ecx            # imm = 0x2D9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x145a4
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 0x57d1a
cmpl $0x1, %eax
je 0x57cf8
testl %eax, %eax
jne 0x57d8b
movq 0x20(%r12), %rax
cmpq $0x10, %rax
jb 0x57d81
leaq 0x1e197(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2b1, %ecx            # imm = 0x2B1
jmp 0x57d39
movl 0x20(%r12), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jb 0x57d40
leaq 0x1e175(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2b8, %ecx            # imm = 0x2B8
jmp 0x57d39
movq 0x20(%r12), %r13
cmpq $0x10, %r13
jb 0x57d48
leaq 0x1e154(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2be, %ecx            # imm = 0x2BE
callq 0x145a4
jmp 0x57d8b
orl %r15d, %eax
movl %eax, %r15d
jmp 0x57d8b
movl 0x28(%r12), %eax
movl 0x30(%r12), %ebp
testl %eax, %eax
je 0x57d9c
cmpl $0x5, %eax
jne 0x57d96
leaq 0x1e11e(%rip), %rdx     # 0x75e80
movq %rbx, %rdi
movl $0xf, %esi
movl $0x224, %ecx            # imm = 0x224
callq 0x145a4
cmpl $0x0, (%rbx)
jne 0x57c18
xorl %eax, %eax
jmp 0x57d9c
orl %eax, %r15d
orl $0x2000000, %r15d       # imm = 0x2000000
cmpl $0x0, (%rbx)
jne 0x57c18
jmp 0x57db3
shll $0x5, %eax
addl $-0x20, %eax
andl $0x1f, %ebp
shll $0x7, %ebp
orl %r13d, %ebp
orl %eax, %ebp
orl %r15d, %ebp
orl $0x2000000, %ebp        # imm = 0x2000000
movl %ebp, %r15d
movl $0x4, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x5758f
cmpl $0x0, (%rbx)
jne 0x57c18
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 0x59dfe