// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r12
movl %edx, %ebp
movq %rdi, %r14
xorl %esi, %esi
movq %r8, %rdx
callq 0x59d65
cmpl $0x0, (%rbx)
je 0x57b2a
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r12), %rcx
cmpq $0xf, %rcx
ja 0x57b40
movq 0x8(%r12), %r15
cmpq $0x10, %r15
jb 0x57b61
leaq 0x1e2f9(%rip), %rdx     # 0x75e40
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2d9, %ecx            # imm = 0x2D9
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x145f4
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 0x57c17
cmpl $0x1, %eax
je 0x57bf5
testl %eax, %eax
jne 0x57ca4
movq 0x20(%r12), %rax
cmpq $0x10, %rax
jb 0x57c7d
leaq 0x1e25a(%rip), %rdx     # 0x75e40
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2b1, %ecx            # imm = 0x2B1
jmp 0x57c36
movl 0x20(%r12), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jb 0x57c3d
leaq 0x1e238(%rip), %rdx     # 0x75e40
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2b8, %ecx            # imm = 0x2B8
jmp 0x57c36
movq 0x20(%r12), %rcx
cmpq $0x10, %rcx
jb 0x57c42
leaq 0x1e217(%rip), %rdx     # 0x75e40
movq %rbx, %rdi
movl $0xf, %esi
movl $0x2be, %ecx            # imm = 0x2BE
callq 0x145f4
jmp 0x57ca4
orl %r15d, %eax
jmp 0x57ca1
movl 0x28(%r12), %eax
movl 0x30(%r12), %ebp
andl $0x1f, %ebp
shll $0x7, %ebp
orl %ecx, %ebp
orl %r15d, %ebp
testl %eax, %eax
je 0x57c8f
cmpl $0x5, %eax
jne 0x57c89
leaq 0x1e1d9(%rip), %rdx     # 0x75e40
movq %rbx, %rdi
movl $0xf, %esi
movl $0x224, %ecx            # imm = 0x224
callq 0x145f4
xorl %eax, %eax
jmp 0x57c8f
orl %eax, %r15d
orl $0x2000000, %r15d       # imm = 0x2000000
jmp 0x57ca4
shll $0x5, %eax
addl $-0x20, %eax
orl $0x2000000, %ebp        # imm = 0x2000000
cmpl $0x0, (%rbx)
je 0x57c9f
movl %ebp, %r15d
jmp 0x57ca4
orl %ebp, %eax
movl %eax, %r15d
cmpl $0x0, (%rbx)
jne 0x57b21
movl $0x4, %esi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x57496
cmpl $0x0, (%rbx)
jne 0x57b21
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x59d31