// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_ldrc_instr
static void prv_encode_ldrc_instr(void *user_data, subtilis_arm_op_t *op,
				  subtilis_arm_instr_type_t type,
				  subtilis_arm_ldrc_instr_t *instr,
				  subtilis_error_t *err)
{
	subtilis_arm_stran_instr_t stran;
	subtilis_arm_encode_ud_t *ud = user_data;

	/*
	 * So this is a little tricky.  If we're just loading a normal
	 * compile time constant we want to ensure that a constant pool
	 * does not get flushed after we write the constant but before
	 * we write the LDR instruction.  Loading constants with lca
	 * involves two instructions, an LDR and an ADD, both of which
	 * use R15 as a source.  It's important that they are not split
	 * up by a constant pool.  So here we use a prv_check_pool_adj
	 * to force a pool flush if there's not enough space for the
	 * constant and all the instructions neeeded to load it.
	 */

	/*
	 * adj is the number of additional bytes that can be written
	 * without causing a pool flush. 4 bytes for the constant,
	 * 4 bytes for the ldr and optionally four bytes for the add
	 * if we're doing an lca.
	 */

	size_t adj = 8;

	if (instr->link_time)
		adj += 4;

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

	prv_add_const(ud, instr->label, ud->bytes_written,
		      SUBTILIS_ARM_ENCODE_BP_LDR, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (ud->ldrc_int == SIZE_MAX)
		ud->ldrc_int = ud->bytes_written;

	stran.ccode = instr->ccode;
	stran.dest = instr->dest;
	stran.base = 15;
	stran.offset.type = SUBTILIS_ARM_OP2_I32;
	stran.offset.op.integer = 0;
	stran.pre_indexed = true;
	stran.write_back = false;
	stran.subtract = false;
	stran.byte = false;
	prv_encode_stran_instr(user_data, op, SUBTILIS_ARM_INSTR_LDR, &stran,
			       err);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %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, -0x78(%rbp)
movq $0x8, -0x80(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x18(%rax)
je 0x7f134
movq -0x80(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x81c40
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7f153
jmp 0x7f1f3
movq -0x78(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x78(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x28(%rbp), %r8
xorl %ecx, %ecx
callq 0x82080
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7f17d
jmp 0x7f1f3
movq -0x78(%rbp), %rax
cmpq $-0x1, 0x90(%rax)
jne 0x7f19e
movq -0x78(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x78(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq $0xf, -0x60(%rbp)
movl $0x1, -0x58(%rbp)
movl $0x0, -0x50(%rbp)
movb $0x1, -0x30(%rbp)
movb $0x0, -0x2f(%rbp)
movb $0x0, -0x2e(%rbp)
movb $0x0, -0x2d(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %r8
movl $0x12, %edx
leaq -0x70(%rbp), %rcx
callq 0x7eb70
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)