// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/flow.c
// Function: pack_basic_blocks
void pack_basic_blocks(struct entrypoint *ep)
{
	struct basic_block *bb;

	/* See if we can merge a bb into another one.. */
	FOR_EACH_PTR(ep->bbs, bb) {
		struct instruction *first;
		struct basic_block *parent, *child, *last;

		if (!bb_reachable(bb))
			continue;

		/*
		 * Just a branch?
		 */
		FOR_EACH_PTR(bb->insns, first) {
			if (!first->bb)
				continue;
			switch (first->opcode) {
			case OP_NOP:
			case OP_INLINED_CALL:
				continue;
			case OP_CBR:
			case OP_BR: {
				struct basic_block *replace;
				replace = rewrite_branch_bb(bb, first);
				if (replace) {
					kill_bb(bb);
					goto no_merge;
				}
			}
			/* fallthrough */
			default:
				goto out;
			}
		} END_FOR_EACH_PTR(first);

out:
		/*
		 * See if we only have one parent..
		 */
		last = NULL;
		FOR_EACH_PTR(bb->parents, parent) {
			if (last) {
				if (last != parent)
					goto no_merge;
				continue;
			}
			last = parent;
		} END_FOR_EACH_PTR(parent);

		parent = last;
		if (!parent || parent == bb)
			continue;

		/*
		 * Goodie. See if the parent can merge..
		 */
		FOR_EACH_PTR(parent->children, child) {
			if (child != bb)
				goto no_merge;
		} END_FOR_EACH_PTR(child);

		repeat_phase |= merge_bb(parent, bb);

	no_merge:
		/* nothing to do */;
	} END_FOR_EACH_PTR(bb);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x5aa47
jmp 0x5addc
jmp 0x5aa49
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5adc4
movq -0x20(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5aa9b
cmpq $0x0, -0x10(%rbp)
jne 0x5aa9b
jmp 0x5adb6
movq -0x10(%rbp), %rdi
callq 0x5adf0
cmpl $0x0, %eax
jne 0x5aaae
jmp 0x5adb6
jmp 0x5aab0
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x5aad8
jmp 0x5abb1
jmp 0x5aada
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x60(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5ab99
movq -0x60(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5ab29
cmpq $0x0, -0x38(%rbp)
jne 0x5ab29
jmp 0x5ab8b
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5ab36
jmp 0x5ab8b
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
movl %eax, -0xb8(%rbp)
addl $-0x3, %eax
subl $0x2, %eax
jb 0x5ab61
jmp 0x5ab4f
movl -0xb8(%rbp), %eax
addl $-0x4b, %eax
subl $0x1, %eax
ja 0x5ab89
jmp 0x5ab5f
jmp 0x5ab8b
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x5ae10
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x5ab87
movq -0x10(%rbp), %rdi
callq 0x59900
jmp 0x5adb4
jmp 0x5ab89
jmp 0x5abb3
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x5aae1
jmp 0x5ab9b
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
cmpq -0x58(%rbp), %rax
jne 0x5aada
jmp 0x5abb3
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, -0x80(%rbp)
jne 0x5abe9
jmp 0x5ac9a
jmp 0x5abeb
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
movq -0x88(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5ac7c
movq -0x88(%rbp), %rax
movslq -0x94(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x88(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5ac48
cmpq $0x0, -0x40(%rbp)
jne 0x5ac48
jmp 0x5ac68
cmpq $0x0, -0x50(%rbp)
je 0x5ac60
movq -0x50(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x5ac5e
jmp 0x5adb4
jmp 0x5ac68
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x5abf5
jmp 0x5ac7e
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
cmpq -0x80(%rbp), %rax
jne 0x5abeb
movq -0x50(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x5acb3
movq -0x40(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x5acb8
jmp 0x5adb6
jmp 0x5acba
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xa0(%rbp)
jne 0x5acf4
jmp 0x5ad93
jmp 0x5acf6
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movq -0xa8(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5ad72
movq -0xa8(%rbp), %rax
movslq -0xb4(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq -0xa8(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5ad53
cmpq $0x0, -0x48(%rbp)
jne 0x5ad53
jmp 0x5ad61
movq -0x48(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0x5ad5f
jmp 0x5adb4
jmp 0x5ad61
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x5ad00
jmp 0x5ad74
movq -0xa8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
cmpq -0xa0(%rbp), %rax
jne 0x5acf6
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x5a6e0
movl %eax, %ecx
leaq 0x323ab(%rip), %rax     # 0x8d154
orl (%rax), %ecx
leaq 0x323a2(%rip), %rax     # 0x8d154
movl %ecx, (%rax)
jmp 0x5adb6
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5aa50
jmp 0x5adc6
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq -0x18(%rbp), %rax
jne 0x5aa49
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)