// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/flow.c
// Function: simplify_cfg_early
int simplify_cfg_early(struct entrypoint *ep)
{
	struct basic_block *bb;
	int changed = 0;

	FOR_EACH_PTR_REVERSE(ep->bbs, bb) {
		struct instruction *insn;
		struct basic_block *tgt;

		if (!bb->ep) {
			DELETE_CURRENT_PTR(bb);
			changed = REPEAT_CFG_CLEANUP;
			continue;
		}

		insn = last_instruction(bb->insns);
		if (!insn)
			continue;
		switch (insn->opcode) {
		case OP_BR:
			tgt = insn->bb_true;
			if (bb_is_forwarder(bb))
				changed |= retarget_parents(bb, tgt);
			else if (bb_list_size(tgt->parents) == 1)
				changed |= merge_bb(bb, tgt);
			break;
		}
	} END_FOR_EACH_PTR_REVERSE(bb);
	return changed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x5a36f
jmp 0x5a52f
jmp 0x5a371
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movw (%rax), %ax
shlw $0x8, %ax
sarw $0x8, %ax
cwtl
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
jl 0x5a51f
movq -0x28(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5a3cd
cmpq $0x0, -0x10(%rbp)
jne 0x5a3cd
jmp 0x5a390
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x5a494
jmp 0x5a3de
movq -0x28(%rbp), %rax
addq $0x18, %rax
movslq -0x34(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
addq $0x18, %rax
movq -0x28(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
addq $-0x8, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x5a448
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x50(%rbp)
jmp 0x5a421
movq -0x50(%rbp), %rax
movl $0xf0f0f0f0, %ecx       # imm = 0xF0F0F0F0
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movw (%rax), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
addl $-0x1, %ecx
movw %cx, %dx
movw (%rax), %cx
andw $0xff, %dx
andw $0xff00, %cx            # imm = 0xFF00
orw %dx, %cx
movw %cx, (%rax)
movl -0x34(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x34(%rbp)
movl $0x4, -0x14(%rbp)
jmp 0x5a390
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x5a540
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x5a4b1
jmp 0x5a390
movq -0x40(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
subl $0x3, %eax
jne 0x5a51a
jmp 0x5a4c1
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5a560
testb $0x1, %al
jne 0x5a4dc
jmp 0x5a4f1
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x5a650
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x5a518
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x5a6c0
cmpl $0x1, %eax
jne 0x5a516
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x5a6e0
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x5a518
jmp 0x5a51a
jmp 0x5a390
jmp 0x5a521
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x5a371
movl -0x14(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)