LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_sub_section_int_links
static void prv_sub_section_int_links(subtilis_arm_reg_ud_t *ud,
				      subtilis_bitset_t *int_save,
				      subtilis_arm_ccode_type_t ccode,
				      subtilis_arm_prespilt_offsets_t *offsets,
				      subtilis_arm_op_t *op,
				      subtilis_error_t *err)
{
	int j;
	int32_t offset;
	subtilis_arm_reg_t reg;

	for (j = 0; j <= int_save->max_value; j++) {
		if (!subtilis_bitset_isset(int_save, j))
			continue;
		offset = prv_arm_presplit_int_offset(offsets, j, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		offset += ud->arm_s->locals;

		if (offset > 4095 || offset < -4095) {
			reg = subtilis_arm_acquire_new_reg(ud->arm_s);
			subtilis_arm_insert_stran_spill_imm(
			    ud->arm_s, op, SUBTILIS_ARM_INSTR_STR, ccode, j, 11,
			    reg, offset, err);
		} else {
			subtilis_arm_insert_stran_imm(
			    ud->arm_s, op, SUBTILIS_ARM_INSTR_STR, ccode, j, 11,
			    offset, err);
		}
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, 0xc(%rsp)
movq %rsi, %r12
movq %rdi, %r13
xorl %r14d, %r14d
movslq 0x8(%r12), %rax
cmpq %rax, %r14
jg 0x523cd
movq %r12, %rdi
movq %r14, %rsi
callq 0x59b05
testb %al, %al
je 0x523c5
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x524c1
cmpl $0x0, (%rbx)
jne 0x523cd
movq 0x18(%r13), %rdi
movl 0x30(%rdi), %ecx
leal (%rcx,%rax), %ebp
addl %ecx, %eax
addl $0xfffff000, %eax       # imm = 0xFFFFF000
cmpl $0xffffe000, %eax       # imm = 0xFFFFE000
ja 0x523a4
callq 0x4c202
movq 0x18(%r13), %rdi
subq $0x8, %rsp
movq 0x18(%rsp), %rsi
pushq $0x13
popq %rdx
movl 0x14(%rsp), %ecx
movq %r14, %r8
pushq $0xb
popq %r9
pushq %rbx
pushq %rbp
pushq %rax
callq 0x4d75d
addq $0x20, %rsp
jmp 0x523c0
movq 0x10(%rsp), %rsi
pushq $0x13
popq %rdx
movl 0xc(%rsp), %ecx
movq %r14, %r8
pushq $0xb
popq %r9
pushq %rbx
pushq %rbp
callq 0x4d7e4
popq %rax
popq %rcx
cmpl $0x0, (%rbx)
jne 0x523cd
incq %r14
jmp 0x5232e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_sub_section_real_links
static void prv_sub_section_real_links(subtilis_arm_reg_ud_t *ud,
				       subtilis_bitset_t *real_save,
				       subtilis_arm_ccode_type_t ccode,
				       subtilis_arm_prespilt_offsets_t *offsets,
				       subtilis_arm_op_t *op,
				       subtilis_error_t *err)
{
	int j;
	int32_t offset;
	subtilis_arm_reg_t reg;

	for (j = 0; j <= real_save->max_value; j++) {
		if (!subtilis_bitset_isset(real_save, j))
			continue;
		offset = prv_arm_presplit_real_offset(offsets, j, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		offset += ud->arm_s->locals;

		if (offset > ud->arm_s->fp_if->max_offset ||
		    offset < -(ud->arm_s->fp_if->max_offset + 1)) {
			reg = subtilis_arm_acquire_new_reg(ud->arm_s);
			ud->arm_s->fp_if->spill_imm_fn(
			    ud->arm_s, op, ud->arm_s->fp_if->store_type, ccode,
			    j, 11, reg, offset, err);
		} else {
			ud->arm_s->fp_if->stran_imm_fn(
			    ud->arm_s, op, ud->arm_s->fp_if->store_type, ccode,
			    j, 11, offset, err);
		}
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, 0x10(%rsp)
movq %rcx, %r15
movl %edx, 0xc(%rsp)
movq %rsi, %r12
movq %rdi, %r13
xorl %r14d, %r14d
movslq 0x8(%r12), %rax
cmpq %rax, %r14
jg 0x524b2
movq %r12, %rdi
movq %r14, %rsi
callq 0x59b05
testb %al, %al
je 0x524aa
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x524fb
cmpl $0x0, (%rbx)
jne 0x524b2
movq %rax, %rbp
movq 0x18(%r13), %rdi
addl 0x30(%rdi), %ebp
movq 0xc0(%rdi), %rax
movl 0x8(%rax), %ecx
cmpl %ebp, %ecx
jl 0x52472
notl %ecx
cmpl %ecx, %ebp
jl 0x52472
movl 0x18(%rax), %edx
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %ecx
movq %r14, %r8
pushq $0xb
popq %r9
pushq %rbx
pushq %rbp
callq *0x60(%rax)
addq $0x10, %rsp
jmp 0x524a5
callq 0x4c202
movq 0x18(%r13), %rdi
movq 0xc0(%rdi), %r10
movl 0x18(%r10), %edx
subq $0x8, %rsp
movq 0x18(%rsp), %rsi
movl 0x14(%rsp), %ecx
movq %r14, %r8
pushq $0xb
popq %r9
pushq %rbx
pushq %rbp
pushq %rax
callq *0x58(%r10)
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x524b2
incq %r14
jmp 0x52402
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_arm_presplit_int_offset
static size_t prv_arm_presplit_int_offset(subtilis_arm_prespilt_offsets_t *off,
					  size_t reg, subtilis_error_t *err)
{
	size_t i;

	for (i = 0; i < off->int_count; i++)
		if (off->int_offsets[i] == reg)
			return i * sizeof(int32_t);

	subtilis_error_set_assertion_failed(err);

	return 0;
}

// Assembly:
pushq %rax
movq 0x10(%rdi), %rcx
xorl %eax, %eax
subq $0x1, %rcx
jb 0x524dd
movq (%rdi), %r8
cmpq %rsi, (%r8,%rax,2)
je 0x524f9
addq $0x4, %rax
jmp 0x524c8
leaq 0x1d6c7(%rip), %rax     # 0x6fbab
pushq $0xf
popq %rsi
movq %rdx, %rdi
movq %rax, %rdx
movl $0x121, %ecx            # imm = 0x121
callq 0x1429e
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_arm_presplit_real_offset
static size_t prv_arm_presplit_real_offset(subtilis_arm_prespilt_offsets_t *off,
					   size_t reg, subtilis_error_t *err)
{
	size_t i;
	size_t offset = off->int_count * sizeof(int32_t);

	for (i = 0; i < off->real_count; i++)
		if (off->real_offsets[i] == reg)
			return offset + (i * sizeof(double));

	subtilis_error_set_assertion_failed(err);

	return 0;
}

// Assembly:
pushq %rax
movq 0x10(%rdi), %rax
movq 0x18(%rdi), %rcx
shlq $0x2, %rax
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x52523
movq 0x8(%rdi), %r9
cmpq %rsi, (%r9,%r8,8)
je 0x5253f
incq %r8
addq $0x8, %rax
jmp 0x5250b
leaq 0x1d681(%rip), %rax     # 0x6fbab
pushq $0xf
popq %rsi
movq %rdx, %rdi
movq %rax, %rdx
movl $0x130, %ecx            # imm = 0x130
callq 0x1429e
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_compute_save_sets
static void prv_compute_save_sets(subtilis_bitset_t *old_link1_save,
				  subtilis_bitset_t *old_link2_save,
				  subtilis_bitset_t *common_save,
				  subtilis_bitset_t *link1_save,
				  subtilis_bitset_t *link2_save,
				  subtilis_error_t *err)
{
	subtilis_bitset_or(common_save, old_link1_save, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_bitset_and(common_save, old_link2_save);

	subtilis_bitset_or(link1_save, old_link1_save, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_bitset_or(link2_save, old_link2_save, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	subtilis_bitset_sub(link1_save, common_save);
	subtilis_bitset_sub(link2_save, common_save);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r12
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbp
movq %rdx, %rdi
movq %rbp, %rsi
movq %r9, %rdx
callq 0x59c39
cmpl $0x0, (%r12)
jne 0x525a8
movq %r14, %rdi
movq %r13, %rsi
callq 0x59bd1
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x59c39
cmpl $0x0, (%r12)
jne 0x525a8
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x59c39
cmpl $0x0, (%r12)
je 0x525b7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
movq %r14, %rsi
callq 0x59cce
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x59cce
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_check_current_ss
static void prv_check_current_ss(subtilis_arm_reg_ud_t *ud,
				 subtilis_arm_op_t *op, subtilis_error_t *err)
{
	if (op != ud->ss_terminators[ud->current_ss])
		return;

	if (ud->current_ss == ud->max_ss) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	ud->current_ss++;
}

// Assembly:
movq 0x38(%rdi), %rcx
movq 0x40(%rdi), %rax
cmpq %rsi, (%rcx,%rax,8)
je 0x525ea
retq
cmpq 0x48(%rdi), %rax
jne 0x5260a
leaq 0x1d5b4(%rip), %rax     # 0x6fbab
pushq $0xf
popq %rsi
movq %rdx, %rdi
movq %rax, %rdx
movl $0x1b4, %ecx            # imm = 0x1B4
jmp 0x1429e
incq %rax
movq %rax, 0x40(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_ensure_op2_reg
static subtilis_arm_reg_t *prv_ensure_op2_reg(subtilis_arm_reg_ud_t *ud,
					      subtilis_arm_op_t *op,
					      int *dist_op2,
					      subtilis_arm_reg_t *reg,
					      subtilis_error_t *err)
{
	size_t vreg_op2;
	bool fixed_reg;

	vreg_op2 = *reg;
	fixed_reg = subtilis_arm_reg_alloc_ensure(ud, op, ud->int_regs,
						  ud->int_regs, reg, err);
	if (fixed_reg || (err->type != SUBTILIS_ERROR_OK))
		return NULL;

	*dist_op2 = subtilis_arm_reg_alloc_calculate_dist(
	    ud, vreg_op2, op, &ud->int_regs->dist_walker, ud->int_regs);
	if (*dist_op2 == -1)
		ud->int_regs->phys_to_virt[*reg] = INT_MAX;

	return reg;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movq (%rcx), %r13
movq 0x8(%rdi), %rcx
movq %rbx, %r8
movq %rbp, %r9
callq 0x4fc53
testb %al, %al
jne 0x5267f
cmpl $0x0, (%rbp)
je 0x52693
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r14), %r8
leaq 0x90(%r8), %rcx
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x4f9f0
movl %eax, (%r15)
cmpl $-0x1, %eax
jne 0x52681
movq 0x8(%r14), %rax
movq 0x8(%rax), %rax
movq (%rbx), %rcx
movq $0x7fffffff, (%rax,%rcx,8) # imm = 0x7FFFFFFF
jmp 0x52681
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_data_instr
static void prv_dist_data_instr(void *user_data, subtilis_arm_op_t *op,
				subtilis_arm_instr_type_t type,
				subtilis_arm_data_instr_t *instr,
				subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (instr->op1 == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	prv_dist_handle_op2(ud, &instr->op2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (instr->dest == ud->reg_num) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rbx
movq 0x10(%rcx), %rax
cmpq (%rdi), %rax
jne 0x528b9
leaq 0x1d320(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
pushq $0x46
popq %rcx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1429e
movq %rcx, %r15
movq %rdi, %r14
leaq 0x18(%rcx), %rsi
movq %rbx, %rdx
callq 0x5324c
cmpl $0x0, (%rbx)
jne 0x528f0
movq 0x8(%r15), %rax
cmpq (%r14), %rax
jne 0x528ec
orl $-0x1, 0x8(%r14)
leaq 0x1d2e1(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
pushq $0x50
jmp 0x528ab
incl 0x8(%r14)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_mul_instr
static void prv_dist_mul_instr(void *user_data, subtilis_arm_op_t *op,
			       subtilis_arm_instr_type_t type,
			       subtilis_arm_mul_instr_t *instr,
			       subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if ((instr->rm == ud->reg_num) || (instr->rs == ud->reg_num)) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if (instr->dest == ud->reg_num) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
movq (%rdi), %rax
cmpq %rax, 0x10(%rcx)
je 0x52905
cmpq %rax, 0x18(%rcx)
jne 0x5291a
leaq 0x1d2ba(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
pushq $0x5f
popq %rcx
movq %r8, %rdi
jmp 0x1429e
cmpq %rax, 0x8(%rcx)
jne 0x52932
orl $-0x1, 0x8(%rdi)
leaq 0x1d29b(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
pushq $0x65
jmp 0x52911
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_cmp_instr
static void prv_dist_cmp_instr(void *user_data, subtilis_arm_op_t *op,
			       subtilis_arm_instr_type_t type,
			       subtilis_arm_data_instr_t *instr,
			       subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (instr->op1 == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	prv_dist_handle_op2(ud, &instr->op2, err);

	ud->last_used++;
}

// Assembly:
movq 0x10(%rcx), %rax
cmpq (%rdi), %rax
jne 0x52956
leaq 0x1d280(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x127, %ecx            # imm = 0x127
jmp 0x1429e
pushq %rbx
movq %rdi, %rbx
addq $0x18, %rcx
movq %rcx, %rsi
movq %r8, %rdx
callq 0x5324c
incl 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_stran_instr
static void prv_dist_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_dist_data_t *ud = user_data;

	/*
	 * TODO: register allocator does not correctly cope with
	 * pre-index addressing or writeback.
	 */

	if (instr->base == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	prv_dist_handle_op2(ud, &instr->offset, err);
	if (err->type != SUBTILIS_ERROR_OK)
		return;

	if (type == SUBTILIS_ARM_INSTR_LDR) {
		if (instr->dest == ud->reg_num) {
			ud->last_used = -1;
			subtilis_error_set_walker_failed(err);
			return;
		}
	} else {
		if (instr->dest == ud->reg_num) {
			subtilis_error_set_walker_failed(err);
			return;
		}
	}

	ud->last_used++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movq 0x10(%rcx), %rax
cmpq (%rdi), %rax
jne 0x529f1
leaq 0x1d1ed(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
pushq $0x79
popq %rcx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1429e
movq %rcx, %r15
movl %edx, %ebp
movq %rdi, %r14
leaq 0x18(%rcx), %rsi
movq %rbx, %rdx
callq 0x5324c
cmpl $0x0, (%rbx)
jne 0x52a51
movq 0x8(%r15), %rax
movq (%r14), %rcx
cmpl $0x12, %ebp
jne 0x52a34
cmpq %rcx, %rax
jne 0x52a4d
orl $-0x1, 0x8(%r14)
leaq 0x1d19f(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %rbx, %rdi
movl $0x84, %ecx
jmp 0x529e2
cmpq %rcx, %rax
jne 0x52a4d
leaq 0x1d186(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %rbx, %rdi
movl $0x89, %ecx
jmp 0x529e2
incl 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_br_instr
static void prv_dist_br_instr(void *user_data, subtilis_arm_op_t *op,
			      subtilis_arm_instr_type_t type,
			      subtilis_arm_br_instr_t *instr,
			      subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if ((instr->indirect) && (instr->target.reg == ud->reg_num)) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if ((instr->link_type == SUBTILIS_ARM_BR_LINK_INT) &&
	    (ud->reg_num == 0)) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
cmpb $0x1, 0x6(%rcx)
jne 0x52a86
movq 0x10(%rcx), %rax
cmpq (%rdi), %rax
jne 0x52a86
leaq 0x1d150(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0xab, %ecx
jmp 0x1429e
cmpl $0x1, 0x8(%rcx)
jne 0x52a92
cmpq $0x0, (%rdi)
je 0x52a96
incl 0x8(%rdi)
retq
orl $-0x1, 0x8(%rdi)
leaq 0x1d125(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0xb2, %ecx
jmp 0x1429e
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_swi_instr
static void prv_dist_swi_instr(void *user_data, subtilis_arm_op_t *op,
			       subtilis_arm_instr_type_t type,
			       subtilis_arm_swi_instr_t *instr,
			       subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	/* SWIs can only use the first 10 regs */

	if ((ud->reg_num < 10) && (1 << ud->reg_num) & instr->reg_read_mask) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if ((ud->reg_num < 10) && (1 << ud->reg_num) & instr->reg_write_mask) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
movq %rcx, %rax
movq (%rdi), %rcx
cmpq $0x9, %rcx
ja 0x52b01
pushq $0x1
popq %rdx
shll %cl, %edx
movl 0x10(%rax), %esi
btl %ecx, %esi
jae 0x52ae1
leaq 0x1d0f5(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0xc3, %ecx
jmp 0x1429e
testl %edx, 0x14(%rax)
je 0x52b01
orl $-0x1, 0x8(%rdi)
leaq 0x1d0d5(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0xc9, %ecx
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_cmov_instr
static void prv_dist_cmov_instr(void *user_data, subtilis_arm_op_t *op,
				subtilis_arm_instr_type_t type,
				subtilis_arm_cmov_instr_t *instr,
				subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (instr->op3 == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if (instr->op2 == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if (!instr->fused && instr->op1 == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if (instr->dest == ud->reg_num) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
movq (%rdi), %rax
cmpq %rax, 0x18(%rcx)
jne 0x52b9d
leaq 0x1d039(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x108, %ecx            # imm = 0x108
jmp 0x1429e
cmpq %rax, 0x10(%rcx)
jne 0x52bba
leaq 0x1d01c(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x10d, %ecx            # imm = 0x10D
jmp 0x1429e
cmpb $0x0, 0x20(%rcx)
jne 0x52bdd
cmpq %rax, 0x8(%rcx)
jne 0x52bdd
leaq 0x1cff9(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x112, %ecx            # imm = 0x112
jmp 0x1429e
cmpq %rax, (%rcx)
jne 0x52bfd
orl $-0x1, 0x8(%rdi)
leaq 0x1cfd9(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x118, %ecx            # imm = 0x118
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_flags_instr
static void prv_dist_flags_instr(void *user_data, subtilis_arm_op_t *op,
				 subtilis_arm_instr_type_t type,
				 subtilis_arm_flags_instr_t *instr,
				 subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (type == SUBTILIS_ARM_INSTR_MRS) {
		if (instr->op.reg == ud->reg_num) {
			ud->last_used = -1;
			subtilis_error_set_walker_failed(err);
			return;
		}
	} else if ((instr->flag_reg) && (instr->op.reg == ud->reg_num)) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
cmpl $0x1d, %edx
jne 0x52c2a
movq 0x10(%rcx), %rax
cmpq (%rdi), %rax
jne 0x52c50
orl $-0x1, 0x8(%rdi)
leaq 0x1cfac(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x13a, %ecx            # imm = 0x13A
jmp 0x1429e
cmpl $0x0, 0x4(%rcx)
je 0x52c50
movq 0x10(%rcx), %rax
cmpq (%rdi), %rax
jne 0x52c50
leaq 0x1cf86(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x13e, %ecx            # imm = 0x13E
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_fpa_tran_instr
static void prv_dist_fpa_tran_instr(void *user_data, subtilis_arm_op_t *op,
				    subtilis_arm_instr_type_t type,
				    subtilis_fpa_tran_instr_t *instr,
				    subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (type == SUBTILIS_FPA_INSTR_FLT) {
		if (!instr->immediate && instr->op2.reg == ud->reg_num) {
			subtilis_error_set_walker_failed(err);
			return;
		}
	} else {
		if (instr->dest == ud->reg_num) {
			ud->last_used = -1;
			subtilis_error_set_walker_failed(err);
			return;
		}
	}

	ud->last_used++;
}

// Assembly:
cmpl $0x3e, %edx
jne 0x52cab
cmpb $0x0, 0x10(%rcx)
jne 0x52ccf
movq 0x18(%rcx), %rax
cmpq (%rdi), %rax
jne 0x52ccf
leaq 0x1cf2b(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x17b, %ecx            # imm = 0x17B
jmp 0x1429e
movq 0x8(%rcx), %rax
cmpq (%rdi), %rax
jne 0x52ccf
orl $-0x1, 0x8(%rdi)
leaq 0x1cf07(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x181, %ecx            # imm = 0x181
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_vfp_tran_dbl_instr
static void prv_dist_vfp_tran_dbl_instr(void *user_data, subtilis_arm_op_t *op,
					subtilis_arm_instr_type_t type,
					subtilis_vfp_tran_dbl_instr_t *instr,
					subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (type != SUBTILIS_VFP_INSTR_FMRRD) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	if ((instr->dest1 == ud->reg_num) || (instr->dest2 == ud->reg_num)) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
cmpl $0x7e, %edx
jne 0x52d67
movq (%rdi), %rax
cmpq %rax, 0x8(%rcx)
je 0x52d4c
cmpq %rax, 0x10(%rcx)
jne 0x52d7e
orl $-0x1, 0x8(%rdi)
leaq 0x1ce6f(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x1ef, %ecx            # imm = 0x1EF
jmp 0x1429e
leaq 0x1ce58(%rip), %rdx     # 0x6fbc6
pushq $0xf
popq %rsi
movq %r8, %rdi
movl $0x1e9, %ecx            # imm = 0x1E9
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_vfp_cptran_instr
static void prv_dist_vfp_cptran_instr(void *user_data, subtilis_arm_op_t *op,
				      subtilis_arm_instr_type_t type,
				      subtilis_vfp_cptran_instr_t *instr,
				      subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (type == SUBTILIS_VFP_INSTR_FMSR) {
		if (instr->src == ud->reg_num) {
			subtilis_error_set_walker_failed(err);
			return;
		}
	} else {
		if (instr->dest == ud->reg_num) {
			ud->last_used = -1;
			subtilis_error_set_walker_failed(err);
			return;
		}
	}

	ud->last_used++;
}

// Assembly:
movq (%rdi), %rax
cmpl $0x5d, %edx
jne 0x52da7
cmpq %rax, 0x10(%rcx)
jne 0x52dc8
leaq 0x1ce2f(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x1ff, %ecx            # imm = 0x1FF
jmp 0x1429e
cmpq %rax, 0x8(%rcx)
jne 0x52dc8
orl $-0x1, 0x8(%rdi)
leaq 0x1ce0e(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x205, %ecx            # imm = 0x205
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_vfp_sysreg_instr
static void prv_dist_vfp_sysreg_instr(void *user_data, subtilis_arm_op_t *op,
				      subtilis_arm_instr_type_t type,
				      subtilis_vfp_sysreg_instr_t *instr,
				      subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (type == SUBTILIS_VFP_INSTR_FMRX) {
		if (instr->arm_reg == ud->reg_num) {
			ud->last_used = -1;
			subtilis_error_set_walker_failed(err);
			return;
		}
	} else if (instr->arm_reg == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
movq 0x8(%rcx), %rax
movq (%rdi), %rcx
cmpl $0x7c, %edx
jne 0x52e04
cmpq %rcx, %rax
jne 0x52e20
orl $-0x1, 0x8(%rdi)
leaq 0x1cdd2(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x235, %ecx            # imm = 0x235
jmp 0x1429e
cmpq %rcx, %rax
jne 0x52e20
leaq 0x1cdb6(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x239, %ecx            # imm = 0x239
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_signx_instr
static void prv_dist_signx_instr(void *user_data, subtilis_arm_op_t *op,
				 subtilis_arm_instr_type_t type,
				 subtilis_arm_signx_instr_t *instr,
				 subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if (instr->op1 == ud->reg_num) {
		subtilis_error_set_walker_failed(err);
		return;
	}

	if (instr->dest == ud->reg_num) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
movq (%rdi), %rax
cmpq %rax, 0x10(%rcx)
jne 0x52e5b
leaq 0x1cd7b(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x250, %ecx            # imm = 0x250
jmp 0x1429e
cmpq %rax, 0x8(%rcx)
jne 0x52e7c
orl $-0x1, 0x8(%rdi)
leaq 0x1cd5a(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x256, %ecx            # imm = 0x256
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_used_swi_instr
static void prv_used_swi_instr(void *user_data, subtilis_arm_op_t *op,
			       subtilis_arm_instr_type_t type,
			       subtilis_arm_swi_instr_t *instr,
			       subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if ((ud->reg_num < 10) && (1 << ud->reg_num) & instr->reg_write_mask) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
movq (%rdi), %rax
cmpq $0x9, %rax
ja 0x5313d
movl 0x14(%rcx), %ecx
btl %eax, %ecx
jae 0x5313d
orl $-0x1, 0x8(%rdi)
leaq 0x1ca99(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x2e8, %ecx            # imm = 0x2E8
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_used_vfp_cptran_instr
static void prv_used_vfp_cptran_instr(void *user_data, subtilis_arm_op_t *op,
				      subtilis_arm_instr_type_t type,
				      subtilis_vfp_cptran_instr_t *instr,
				      subtilis_error_t *err)
{
	subtilis_dist_data_t *ud = user_data;

	if ((type != SUBTILIS_VFP_INSTR_FMSR) && (instr->dest == ud->reg_num)) {
		ud->last_used = -1;
		subtilis_error_set_walker_failed(err);
		return;
	}

	ud->last_used++;
}

// Assembly:
cmpl $0x5d, %edx
je 0x531f3
movq 0x8(%rcx), %rax
cmpq (%rdi), %rax
jne 0x531f3
orl $-0x1, 0x8(%rdi)
leaq 0x1c9e3(%rip), %rdx     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %r8, %rdi
movl $0x349, %ecx            # imm = 0x349
jmp 0x1429e
incl 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_int_dist.c
// Function: prv_dist_handle_op2
static void prv_dist_handle_op2(subtilis_dist_data_t *ud,
				subtilis_arm_op2_t *op2, subtilis_error_t *err)
{
	if (op2->type == SUBTILIS_ARM_OP2_REG) {
		if (op2->op.reg == ud->reg_num) {
			subtilis_error_set_walker_failed(err);
			return;
		}
	} else if (op2->type == SUBTILIS_ARM_OP2_SHIFTED) {
		if (op2->op.shift.reg == ud->reg_num) {
			subtilis_error_set_walker_failed(err);
			return;
		}

		if (op2->op.shift.shift_reg &&
		    op2->op.shift.shift.reg == ud->reg_num) {
			subtilis_error_set_walker_failed(err);
			return;
		}
	}
}

// Assembly:
movl (%rsi), %eax
cmpl $0x2, %eax
je 0x53264
testl %eax, %eax
jne 0x53295
movq 0x8(%rsi), %rax
cmpq (%rdi), %rax
jne 0x53295
pushq $0x19
jmp 0x5326f
movq (%rdi), %rax
cmpq %rax, 0x8(%rsi)
jne 0x53285
pushq $0x1e
popq %rcx
leaq 0x1c94f(%rip), %rax     # 0x6fbc6
pushq $0x1f
popq %rsi
movq %rdx, %rdi
movq %rax, %rdx
jmp 0x1429e
cmpb $0x1, 0x20(%rsi)
jne 0x53295
cmpq %rax, 0x18(%rsi)
jne 0x53295
pushq $0x24
jmp 0x5326f
retq
nop
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: subtilis_arm_encode
void subtilis_arm_encode(subtilis_arm_prog_t *arm_p, const char *fname,
			 subtilis_arm_encode_plat_t plat, subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t ud;

	prv_init_encode_ud(&ud, arm_p, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	prv_encode_prog(arm_p, &ud, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	if (plat) {
		plat(ud.code, ud.bytes_written, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

	prv_write_file(&ud, fname, err);

cleanup:

	prv_free_encode_ud(&ud);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movq %rsp, %rdi
movq %r12, %rsi
movq %rcx, %rdx
callq 0x533b4
cmpl $0x0, (%rbx)
jne 0x532d8
movq %rsp, %rsi
movq %r12, %rdi
movq %rbx, %rdx
callq 0x534ca
cmpl $0x0, (%rbx)
je 0x532ef
movq %rsp, %rdi
callq 0x53a5b
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
testq %r15, %r15
je 0x53309
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq *%r15
cmpl $0x0, (%rbx)
jne 0x532d8
leaq 0x1e916(%rip), %rsi     # 0x71c26
movq %r14, %rdi
callq 0x12240
testq %rax, %rax
je 0x53368
movq %rax, %r15
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rdx
pushq $0x1
popq %rsi
movq %rax, %rcx
callq 0x12290
cmpq 0x30(%rsp), %rax
jae 0x53380
leaq 0x1aa82(%rip), %rdx     # 0x6ddc5
leaq 0x1caa6(%rip), %rcx     # 0x6fdf0
pushq $0x4
popq %rsi
movq %rbx, %rdi
movl $0x20f, %r8d            # imm = 0x20F
callq 0x142e3
movq %r15, %rdi
callq 0x120e0
jmp 0x532d8
leaq 0x1ca81(%rip), %rcx     # 0x6fdf0
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl $0x20a, %r8d            # imm = 0x20A
jmp 0x533aa
movq %r15, %rdi
callq 0x120e0
testl %eax, %eax
je 0x532d8
leaq 0x1aa2e(%rip), %rdx     # 0x6ddc5
leaq 0x1ca52(%rip), %rcx     # 0x6fdf0
pushq $0x5
popq %rsi
movq %rbx, %rdi
movl $0x214, %r8d            # imm = 0x214
callq 0x142e3
jmp 0x532d8
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_init_encode_ud
static void prv_init_encode_ud(subtilis_arm_encode_ud_t *ud,
			       subtilis_arm_prog_t *arm_p,
			       subtilis_error_t *err)
{
	size_t i;
	subtilis_arm_section_t *arm_s;
	size_t max_label_offsets = 0;
	size_t constants = 0;
	size_t real_constants = 0;

	memset(ud, 0, sizeof(*ud));

	for (i = 0; i < arm_p->num_sections; i++) {
		arm_s = arm_p->sections[i];
		if (arm_s->label_counter > max_label_offsets)
			max_label_offsets = arm_s->label_counter;
		constants += arm_s->constants.ui32_count;
		real_constants += arm_s->constants.real_count;
	}

	/*
	 * This may not be enough memory if we need multiple constant pools.
	 */

	ud->label_offsets = malloc(sizeof(size_t) * max_label_offsets);
	if (!ud->label_offsets) {
		subtilis_error_set_oom(err);
		goto on_error;
	}
	ud->max_label_offsets = max_label_offsets;

	/*
	 * This may not be enough memory if we need multiple constant pools.
	 */

	ud->max_bytes = ((arm_p->op_pool->len + constants) * sizeof(uint32_t)) +
			(real_constants * 8);
	ud->code = malloc(ud->max_bytes);
	if (!ud->code) {
		subtilis_error_set_oom(err);
		goto on_error;
	}

	ud->link = subtilis_arm_link_new(arm_p->num_sections, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	ud->reverse_fpa_consts =
	    arm_p->fp_if && arm_p->fp_if->reverse_fpa_consts;

	return;

on_error:

	prv_free_encode_ud(ud);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %r15
xorl %ebx, %ebx
movl $0x98, %edx
movq %rdi, 0x10(%rsp)
xorl %esi, %esi
callq 0x12140
movq 0x8(%r15), %r12
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpq %rbx, %r12
je 0x5340d
movq (%r15), %rax
movq (%rax,%rbx,8), %rax
movq 0x10(%rax), %rcx
cmpq %r14, %rcx
cmovaq %rcx, %r14
addq 0x60(%rax), %r13
addq 0x78(%rax), %rbp
incq %rbx
jmp 0x533e9
leaq (,%r14,8), %rdi
callq 0x121d0
movq 0x10(%rsp), %rbx
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x53480
movq %r14, 0x18(%rbx)
movq 0x28(%r15), %rax
addq 0x8(%rax), %r13
shlq $0x3, %rbp
leaq (,%r13,4), %rdi
addq %rbp, %rdi
movq %rdi, 0x38(%rbx)
callq 0x121d0
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x53487
movq %r12, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x562c0
movq %rax, 0x80(%rbx)
cmpl $0x0, (%r14)
jne 0x534a0
movq 0x40(%r15), %rax
testq %rax, %rax
je 0x534b6
movb 0xc(%rax), %al
jmp 0x534b8
movl $0x8b, %ecx
jmp 0x5348c
movl $0x98, %ecx
leaq 0x1c95d(%rip), %rdx     # 0x6fdf0
pushq $0x1
popq %rsi
movq 0x8(%rsp), %rdi
callq 0x1429e
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x53a5b
xorl %eax, %eax
movb %al, 0x8(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_free_encode_ud
static void prv_free_encode_ud(subtilis_arm_encode_ud_t *ud)
{
	subtilis_arm_link_delete(ud->link);
	free(ud->back_patches);
	free(ud->constants);
	free(ud->code);
	free(ud->label_offsets);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
callq 0x56717
movq 0x68(%rbx), %rdi
callq 0x122c0
movq 0x40(%rbx), %rdi
callq 0x122c0
movq 0x28(%rbx), %rdi
callq 0x122c0
movq 0x10(%rbx), %rdi
popq %rbx
jmp 0x122c0
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: subtilis_arm_encode_buf
uint8_t *subtilis_arm_encode_buf(subtilis_arm_prog_t *arm_p,
				 size_t *bytes_written, subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t ud;
	uint8_t *retval = NULL;

	prv_init_encode_ud(&ud, arm_p, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	prv_encode_prog(arm_p, &ud, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	*bytes_written = ud.bytes_written;
	retval = ud.code;
	ud.code = NULL;

cleanup:

	prv_free_encode_ud(&ud);

	return retval;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x533b4
cmpl $0x0, (%r14)
jne 0x53ace
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x534ca
cmpl $0x0, (%r14)
je 0x53aea
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x53a5b
movq %rbx, %rax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0x38(%rsp), %rax
movq %rax, (%rbx)
movq 0x30(%rsp), %rbx
andq $0x0, 0x30(%rsp)
jmp 0x53ad0
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_ensure_code_size
static void prv_ensure_code_size(subtilis_arm_encode_ud_t *ud, size_t bytes,
				 subtilis_error_t *err)
{
	size_t new_max_bytes;
	uint8_t *new_code;

	if (ud->bytes_written + bytes < ud->max_bytes)
		return;

	if (bytes < SUBTILIS_ENCODER_CODE_GRAN)
		new_max_bytes = SUBTILIS_ENCODER_CODE_GRAN + ud->max_bytes;
	else
		new_max_bytes = bytes + ud->max_bytes;
	new_code = realloc(ud->code, new_max_bytes);
	if (!new_code) {
		subtilis_error_set_oom(err);
		return;
	}

	ud->max_bytes = new_max_bytes;
	ud->code = new_code;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x30(%rdi), %rax
addq %rsi, %rax
movq 0x38(%rdi), %r15
cmpq %r15, %rax
jb 0x53b46
movq %rdx, %rbx
movq %rdi, %r14
cmpq $0x1001, %rsi           # imm = 0x1001
movl $0x1000, %eax           # imm = 0x1000
cmovaeq %rsi, %rax
addq %rax, %r15
movq 0x28(%rdi), %rdi
movq %r15, %rsi
callq 0x12210
testq %rax, %rax
je 0x53b4c
movq %r15, 0x38(%r14)
movq %rax, 0x28(%r14)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1c29d(%rip), %rdx     # 0x6fdf0
pushq $0x1
popq %rsi
movq %rbx, %rdi
movl $0xc2, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0x1429e
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_label
static void prv_encode_label(void *user_data, subtilis_arm_op_t *op,
			     size_t label, subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t *ud = user_data;
	size_t new_max_label_offsets;
	size_t *new_label_offsets;

	if (label > ud->max_labels) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	if ((label == ud->max_labels) && (label >= ud->max_label_offsets)) {
		new_max_label_offsets = label + SUBTILIS_ENCODER_BACKPATCH_GRAN;
		new_label_offsets = realloc(
		    ud->label_offsets, sizeof(size_t) * new_max_label_offsets);
		if (!new_label_offsets) {
			subtilis_error_set_oom(err);
			return;
		}
		ud->label_offsets = new_label_offsets;
		ud->max_label_offsets = new_max_label_offsets;
	}

	ud->label_offsets[label] = ud->bytes_written;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
cmpq %rdx, 0x20(%rdi)
jae 0x53b92
leaq 0x1c273(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %r14, %rdi
movl $0xd7, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0x1429e
movq %rdx, %rbx
movq %rdi, %r15
jne 0x53bc5
cmpq %rbx, 0x18(%r15)
ja 0x53bc5
movq 0x10(%r15), %rdi
leaq 0x400(,%rbx,8), %rsi
callq 0x12210
testq %rax, %rax
je 0x53bd7
leaq 0x80(%rbx), %rcx
movq %rax, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq 0x10(%r15), %rax
movq 0x30(%r15), %rcx
movq %rcx, (%rax,%rbx,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x1c212(%rip), %rdx     # 0x6fdf0
pushq $0x1
popq %rsi
movq %r14, %rdi
movl $0xe0, %ecx
jmp 0x53b88
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_data_instr
static void prv_encode_data_instr(void *user_data, subtilis_arm_op_t *op,
				  subtilis_arm_instr_type_t type,
				  subtilis_arm_data_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->dest > 15) || (instr->op1 > 15)) {
		subtilis_error_set_assertion_failed(err);
		return;
	}

	word |= instr->ccode << 28;
	word |= type << 21;
	if (instr->status)
		word |= 1 << 20;
	word |= instr->op1 << 16;
	word |= instr->dest << 12;
	prv_encode_data_op2(&instr->op2, &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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r12
movl %edx, %r13d
movq %rdi, %r14
movq %r8, %rsi
callq 0x55e87
cmpl $0x0, (%rbx)
je 0x53df6
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x8(%r12), %r15
cmpq $0xf, %r15
ja 0x53e0c
movq 0x10(%r12), %rcx
cmpq $0x10, %rcx
jb 0x53e2c
leaq 0x1bfdd(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x263, %ecx            # imm = 0x263
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x1429e
movl (%r12), %edx
movl 0x18(%r12), %eax
shll $0x1c, %edx
shll $0x15, %r13d
orl %edx, %r13d
cmpb $0x0, 0x4(%r12)
leal 0x100000(%r13), %edx
cmovel %r13d, %edx
shll $0x10, %ecx
shll $0xc, %r15d
orl %ecx, %r15d
orl %edx, %r15d
cmpl $0x2, %eax
je 0x53eaa
cmpl $0x1, %eax
je 0x53e92
testl %eax, %eax
jne 0x53f0c
movq 0x20(%r12), %rax
cmpq $0x10, %rax
jb 0x53f09
leaq 0x1bf6b(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x232, %ecx            # imm = 0x232
jmp 0x53edb
movl 0x20(%r12), %eax
cmpl $0x1000, %eax           # imm = 0x1000
jae 0x53ec9
orl %eax, %r15d
orl $0x2000000, %r15d       # imm = 0x2000000
jmp 0x53f0c
movq 0x20(%r12), %rax
cmpq $0x10, %rax
jb 0x53ee2
leaq 0x1bf34(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x23f, %ecx            # imm = 0x23F
jmp 0x53edb
leaq 0x1bf20(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x238, %ecx            # imm = 0x238
callq 0x1429e
jmp 0x53f0c
cmpb $0x1, 0x38(%r12)
jne 0x53f40
movq 0x30(%r12), %r13
cmpq $0x10, %r13
jb 0x53f55
leaq 0x1bef4(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x244, %ecx            # imm = 0x244
jmp 0x53edb
orl %eax, %r15d
cmpl $0x0, (%rbx)
jne 0x53dec
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e8e
cmpl $0x0, (%rbx)
jne 0x53dec
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x55e99
movl 0x30(%r12), %r13d
andl $0x1f, %r13d
shll $0x7, %r13d
orl %eax, %r13d
orl %r15d, %r13d
jmp 0x53f63
shll $0x8, %r13d
orl %eax, %r13d
orl %r15d, %r13d
orl $0x10, %r13d
movl 0x28(%r12), %edi
movq %rbx, %rsi
callq 0x56028
cmpl $0x0, (%rbx)
jne 0x53dec
movl %eax, %r15d
shll $0x5, %r15d
orl %r13d, %r15d
jmp 0x53f15
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_mul_instr
static void prv_encode_mul_instr(void *user_data, subtilis_arm_op_t *op,
				 subtilis_arm_instr_type_t type,
				 subtilis_arm_mul_instr_t *instr,
				 subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t *ud = user_data;
	uint32_t word = 0x90;

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

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

	if (type == SUBTILIS_ARM_INSTR_MLA) {
		word |= 1 << 21;
		word |= instr->rn << 12;
	}

	word |= instr->ccode << 28;
	if (instr->status)
		word |= 1 << 20;
	word |= instr->dest << 16;
	word |= instr->rs << 8;
	word |= instr->rm;

	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
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r12
movl %edx, %ebp
movq %rdi, %r14
movq %r8, %rsi
callq 0x55e87
cmpl $0x0, (%rbx)
je 0x53fba
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%r12), %r13
cmpq $0xf, %r13
ja 0x53fdb
movq 0x10(%r12), %r15
cmpq $0xf, %r15
ja 0x53fdb
movq 0x18(%r12), %rax
cmpq $0x10, %rax
jb 0x54000
leaq 0x1be0e(%rip), %rdx     # 0x6fdf0
pushq $0xf
popq %rsi
movq %rbx, %rdi
movl $0x285, %ecx            # imm = 0x285
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1429e
movq %rax, 0x10(%rsp)
movl $0x90, %eax
cmpl $0x11, %ebp
jne 0x5401c
movl 0x20(%r12), %eax
shll $0xc, %eax
orl $0x200090, %eax         # imm = 0x200090
movl %eax, 0xc(%rsp)
movl (%r12), %ebp
movb 0x4(%r12), %r12b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e8e
cmpl $0x0, (%rbx)
jne 0x53fab
shll $0x1c, %ebp
orl 0xc(%rsp), %ebp
movl %ebp, %eax
orl $0x100000, %eax         # imm = 0x100000
testb %r12b, %r12b
cmovel %ebp, %eax
movq 0x10(%rsp), %rcx
shll $0x8, %ecx
shll $0x10, %r13d
orl %r13d, %r15d
orl %ecx, %r15d
orl %eax, %r15d
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x55e99
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_br_instr
static void prv_encode_br_instr(void *user_data, subtilis_arm_op_t *op,
				subtilis_arm_instr_type_t type,
				subtilis_arm_br_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;

	word |= instr->ccode << 28;
	if (instr->indirect) {
		/*
		 * We're going to do a mov pc, reg.  There's no need to do
		 * any linking stuff as the address is computed at runtime.
		 */

		word |= SUBTILIS_ARM_INSTR_MOV << 21;
		word |= 15 << 12;
		word |= instr->target.reg & 0xf;
	} else {
		word |= 0x5 << 25;
		if (instr->link)
			word |= 1 << 24;
		if (instr->link && !instr->local) {
			subtilis_arm_link_add(ud->link, ud->bytes_written, err);
			word |= instr->target.label;
		} else {
			prv_add_back_patch(
			    ud, SUBTILIS_ARM_ENCODE_BP_TYPE_BRANCH,
			    instr->target.label, ud->bytes_written, 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, %r15
movq %rdi, %r14
movq %r8, %rsi
callq 0x55e87
cmpl $0x0, (%rbx)
jne 0x5449b
movl (%r15), %r12d
shll $0x1c, %r12d
cmpb $0x1, 0x6(%r15)
jne 0x54430
movl 0x10(%r15), %eax
andl $0xf, %eax
leal (%r12,%rax), %ebp
addl $0x1a0f000, %ebp        # imm = 0x1A0F000
jmp 0x5448b
movl %r12d, %ebp
orl $0xa000000, %ebp        # imm = 0xA000000
movb 0x4(%r15), %al
orl $0xb000000, %r12d       # imm = 0xB000000
testb %al, %al
cmovnel %r12d, %ebp
cmpb $0x1, %al
jne 0x54455
cmpb $0x0, 0x5(%r15)
je 0x5446c
movq 0x10(%r15), %rdx
movq 0x30(%r14), %rcx
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %r8
callq 0x55f90
jmp 0x54486
movq 0x30(%r14), %rsi
movq 0x80(%r14), %rdi
movq %rbx, %rdx
callq 0x56335
orl 0x10(%r15), %r12d
movl %r12d, %ebp
cmpl $0x0, (%rbx)
jne 0x5449b
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e8e
cmpl $0x0, (%rbx)
je 0x544a4
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x55e99
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_swi_instr
static void prv_encode_swi_instr(void *user_data, subtilis_arm_op_t *op,
				 subtilis_arm_instr_type_t type,
				 subtilis_arm_swi_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;

	word |= instr->ccode << 28;
	word |= 0xf << 24;
	word |= 0x0fffffff & instr->code;

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

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r15
movq %rdi, %r14
movq %r8, %rsi
callq 0x55e87
cmpl $0x0, (%rbx)
jne 0x544ee
movl (%r15), %r12d
movq 0x8(%r15), %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x55e8e
cmpl $0x0, (%rbx)
je 0x544fa
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
shll $0x1c, %r12d
andl $0xffffff, %r15d        # imm = 0xFFFFFF
leal (%r12,%r15), %esi
addl $0xf000000, %esi        # imm = 0xF000000
movq %r14, %rdi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x55e99
// File: /workspace/github_c_makefile_star2_O2/markdryan[P]subtilis/arch/arm32/arm_encode.c
// Function: prv_encode_ldrp_instr
static void prv_encode_ldrp_instr(void *user_data, subtilis_arm_op_t *op,
				  subtilis_arm_instr_type_t type,
				  subtilis_arm_ldrp_instr_t *instr,
				  subtilis_error_t *err)
{
	subtilis_arm_encode_ud_t *ud = user_data;
	subtilis_arm_stran_instr_t stran;

	/*
	 * We need to make sure we have enough room for one PC relative load and
	 * an add and the constant.
	 */

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

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

	ud->constants[ud->const_count - 1].section_label = instr->section_label;

	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
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %r8, %rbx
movq %rcx, %r15
movq %rdi, %r14
pushq $0xc
popq %rsi
movq %r8, %rdx
callq 0x55ecb
cmpl $0x0, (%rbx)
jne 0x54658
movq 0x18(%r15), %rsi
movq 0x30(%r14), %rdx
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %ecx
movq %rbx, %r8
callq 0x56057
cmpl $0x0, (%rbx)
jne 0x54658
movq 0x10(%r15), %rax
movq 0x40(%r14), %rcx
movq 0x48(%r14), %rdx
shlq $0x5, %rdx
movq %rax, -0x18(%rcx,%rdx)
cmpq $-0x1, 0x90(%r14)
jne 0x54628
movq 0x30(%r14), %rax
movq %rax, 0x90(%r14)
movl (%r15), %eax
movq %rsp, %rcx
movl %eax, (%rcx)
movq 0x8(%r15), %rax
movq %rax, 0x8(%rcx)
movq $0xf, 0x10(%rcx)
movl %ebp, 0x18(%rcx)
andl $0x0, 0x20(%rcx)
movl %ebp, 0x40(%rcx)
pushq $0x12
popq %rdx
movq %r14, %rdi
movq %rbx, %r8
callq 0x5410a
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq