// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x819a0
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7ebb5
jmp 0x7ecdb
movq -0x20(%rbp), %rax
cmpq $0xf, 0x10(%rax)
ja 0x7ebcb
movq -0x20(%rbp), %rax
cmpq $0xf, 0x8(%rax)
jbe 0x7ebea
movq -0x28(%rbp), %rdi
movl $0xf, %esi
leaq 0x2e255(%rip), %rdx     # 0xace30
movl $0x2d9, %ecx            # imm = 0x2D9
callq 0x158e0
jmp 0x7ecdb
movq -0x20(%rbp), %rax
movl (%rax), %eax
shll $0x1c, %eax
orl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
orl $0x4000000, %eax        # imm = 0x4000000
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0x7ec19
movl -0x34(%rbp), %eax
orl $0x1000000, %eax        # imm = 0x1000000
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x43(%rax)
je 0x7ec2e
movl -0x34(%rbp), %eax
orl $0x400000, %eax         # imm = 0x400000
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x41(%rax)
je 0x7ec43
movl -0x34(%rbp), %eax
orl $0x200000, %eax         # imm = 0x200000
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x42(%rax)
jne 0x7ec58
movl -0x34(%rbp), %eax
orl $0x800000, %eax         # imm = 0x800000
movl %eax, -0x34(%rbp)
cmpl $0x12, -0x14(%rbp)
jne 0x7ec69
movl -0x34(%rbp), %eax
orl $0x100000, %eax         # imm = 0x100000
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
shlq $0x10, %rcx
movl -0x34(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
shlq $0xc, %rcx
movl -0x34(%rbp), %eax
orq %rcx, %rax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
movq -0x28(%rbp), %rdx
leaq -0x34(%rbp), %rsi
callq 0x81f20
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7ecb3
jmp 0x7ecdb
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x81b90
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7eccb
jmp 0x7ecdb
movq -0x30(%rbp), %rdi
movl -0x34(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0x81bc0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)