// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_sub_section.c
// Function: prv_finalize_sub_section
static void prv_finalize_sub_section(subtilis_arm_ss_t *ss,
				     subtilis_arm_section_t *arm_s, size_t end,
				     size_t count, subtilis_error_t *err)
{
	subtilis_arm_op_t *from;
	subtilis_arm_op_t *op;
	subtilis_regs_used_virt_t regs_used;
	size_t max_int_regs;
	size_t max_real_regs;
	size_t ptr;

	subtilis_arm_section_max_regs(arm_s, &max_int_regs, &max_real_regs);
	subtilis_regs_used_virt_init(&regs_used);

	ss->end = end;
	ss->size = count;
	from = &arm_s->op_pool->ops[ss->start];
	op = &arm_s->op_pool->ops[ss->end];

	subtilis_arm_regs_used_afterv(arm_s, from, op, max_int_regs,
				      max_real_regs, count, &regs_used, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	subtilis_bitset_claim(&ss->int_inputs, &regs_used.int_regs);
	subtilis_bitset_claim(&ss->real_inputs, &regs_used.real_regs);

	if (((op->type != SUBTILIS_ARM_OP_INSTR) ||
	     (op->op.instr.type != SUBTILIS_ARM_INSTR_B) ||
	     (op->op.instr.operands.br.ccode != SUBTILIS_ARM_CCODE_AL)) &&
	    (op->next != SIZE_MAX)) {
		ptr = op->next;
		op = &arm_s->op_pool->ops[ptr];
		if (op->type == SUBTILIS_ARM_OP_LABEL)
			prv_add_link(ss, arm_s, ptr, op->op.label, err);
	}

cleanup:

	subtilis_regs_used_virt_free(&regs_used);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x700a0
leaq -0x68(%rbp), %rdi
callq 0x76fb0
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
imulq $0x68, 0x8(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
imulq $0x68, 0x10(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x78(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0x28(%rbp), %rax
leaq -0x68(%rbp), %r10
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x79a30
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
je 0x89722
jmp 0x897bd
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
leaq -0x68(%rbp), %rsi
callq 0x88fc0
movq -0x8(%rbp), %rdi
addq $0x30, %rdi
leaq -0x68(%rbp), %rsi
addq $0x18, %rsi
callq 0x88fc0
movq -0x38(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x89765
movq -0x38(%rbp), %rax
cmpl $0x16, 0x8(%rax)
jne 0x89765
movq -0x38(%rbp), %rax
cmpl $0xe, 0x10(%rax)
je 0x897bb
movq -0x38(%rbp), %rax
cmpq $-0x1, 0x58(%rax)
je 0x897bb
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq (%rax), %rax
imulq $0x68, -0x80(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x897b9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x80(%rbp), %rdx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %r8
callq 0x898d0
jmp 0x897bb
jmp 0x897bd
leaq -0x68(%rbp), %rdi
callq 0x76fe0
addq $0x90, %rsp
popq %rbp
retq
nop