// File: /workspace/github_c_makefile_star2_O0/markdryan[P]subtilis/arch/arm32/arm_reg_alloc.c
// Function: prv_link_basic_blocks
static void prv_link_basic_blocks(subtilis_arm_reg_ud_t *ud,
				  subtilis_error_t *err)
{
	subtilis_arm_subsections_t sss;
	subtilis_arm_prespilt_offsets_t offsets;
	size_t i;

	subtilis_arm_subsections_init(&sss);
	prv_arm_prespilt_offsets_init(&offsets);

	subtilis_arm_subsections_calculate(&sss, ud->arm_s, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	ud->max_ss = sss.count;
	ud->ss_terminators = calloc(sss.count, sizeof(*ud->ss_terminators));
	if (!ud->ss_terminators) {
		subtilis_error_set_oom(err);
		goto cleanup;
	}

	prv_arm_prespilt_calculate(&offsets, &sss.int_save, &sss.real_save,
				   err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;

	ud->basic_block_spill = (offsets.int_count * sizeof(int32_t)) +
				(offsets.real_count * sizeof(double));

	prv_init_sub_section_links(ud, &sss.sub_sections[0], &offsets, 0, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto cleanup;
	for (i = 1; i < sss.count; i++) {
		prv_init_sub_section(ud, &sss.sub_sections[i], &offsets, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
		prv_init_sub_section_links(ud, &sss.sub_sections[i], &offsets,
					   i, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto cleanup;
	}

cleanup:

	prv_arm_prespilt_free(&offsets);
	subtilis_arm_subsections_free(&sss);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x891b0
leaq -0x90(%rbp), %rdi
callq 0x7aa80
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x10(%rbp), %rdx
leaq -0x70(%rbp), %rdi
callq 0x89230
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7805b
jmp 0x781bc
movq -0x68(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x68(%rbp), %rdi
movl $0x8, %esi
callq 0x12130
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x38(%rax)
jne 0x780aa
movq -0x10(%rbp), %rdi
movl $0x1, %esi
leaq 0x34af8(%rip), %rdx     # 0xacb93
movl $0x741, %ecx            # imm = 0x741
callq 0x158e0
jmp 0x781bc
leaq -0x70(%rbp), %rsi
addq $0x30, %rsi
leaq -0x70(%rbp), %rdx
addq $0x48, %rdx
movq -0x10(%rbp), %rcx
leaq -0x90(%rbp), %rdi
callq 0x7aac0
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x780d8
jmp 0x781bc
movq -0x80(%rbp), %rcx
shlq $0x2, %rcx
movq -0x78(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x10(%rbp), %r8
leaq -0x90(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x7ab30
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x7811c
jmp 0x781bc
movq $0x1, -0x98(%rbp)
movq -0x98(%rbp), %rax
cmpq -0x68(%rbp), %rax
jae 0x781ba
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
imulq $0x130, -0x98(%rbp), %rax # imm = 0x130
addq %rax, %rsi
movq -0x10(%rbp), %rcx
leaq -0x90(%rbp), %rdx
callq 0x7ac60
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x78169
jmp 0x781bc
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
imulq $0x130, -0x98(%rbp), %rax # imm = 0x130
addq %rax, %rsi
movq -0x98(%rbp), %rcx
movq -0x10(%rbp), %r8
leaq -0x90(%rbp), %rdx
callq 0x7ab30
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x781a1
jmp 0x781bc
jmp 0x781a3
movq -0x98(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x98(%rbp)
jmp 0x78127
jmp 0x781bc
leaq -0x90(%rbp), %rdi
callq 0x7af60
leaq -0x70(%rbp), %rdi
callq 0x89c60
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)