// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/memops.c
// Function: simplify_loads
static void simplify_loads(struct basic_block *bb)
{
	struct instruction *insn;

	FOR_EACH_PTR_REVERSE(bb->insns, insn) {
		if (!insn->bb)
			continue;
		if (insn->opcode == OP_LOAD) {
			struct instruction *dom;
			pseudo_t pseudo = insn->src;
			int local = local_pseudo(pseudo);
			struct pseudo_list *dominators;

			if (insn->is_volatile)
				continue;

			if (!has_users(insn->target)) {
				kill_instruction(insn);
				continue;
			}

			RECURSE_PTR_REVERSE(insn, dom) {
				int dominance;
				if (!dom->bb)
					continue;
				dominance = dominates(insn, dom, local);
				if (dominance) {
					/* possible partial dominance? */
					if (dominance < 0)  {
						if (dom->opcode == OP_LOAD)
							continue;
						goto next_load;
					}
					if (!compatible_loads(insn, dom))
						goto next_load;
					/* Yeehaa! Found one! */
					replace_with_pseudo(insn, dom->target);
					goto next_load;
				}
			} END_FOR_EACH_PTR_REVERSE(dom);

			/* OK, go find the parents */
			bb->generation = ++bb_generation;
			dominators = NULL;
			if (find_dominating_parents(insn, bb, &dominators, local)) {
				/* This happens with initial assignments to structures etc.. */
				if (!dominators) {
					if (local) {
						assert(pseudo->type != PSEUDO_ARG);
						replace_with_pseudo(insn, value_pseudo(0));
					}
					goto next_load;
				}
				rewrite_load_instruction(insn, dominators);
			} else {	// cleanup pending phi-sources
				int repeat = repeat_phase;
				pseudo_t phi;
				FOR_EACH_PTR(dominators, phi) {
					kill_instruction(phi->def);
				} END_FOR_EACH_PTR(phi);
				repeat_phase = repeat;
			}
		}
next_load:
		/* Do the next one */;
	} END_FOR_EACH_PTR_REVERSE(insn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0x5f58b
jmp 0x5f902
jmp 0x5f58d
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movw (%rax), %ax
shlw $0x8, %ax
sarw $0x8, %ax
cwtl
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
jl 0x5f8f2
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 0x5f5e9
cmpq $0x0, -0x10(%rbp)
jne 0x5f5e9
jmp 0x5f5ac
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5f5f6
jmp 0x5f5ac
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
cmpl $0x43, %eax
jne 0x5f8eb
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x5fca0
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movb 0x40(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x5f636
jmp 0x5f5ac
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x5fd00
cmpl $0x0, %eax
jne 0x5f656
movq -0x10(%rbp), %rdi
callq 0x5fd30
jmp 0x5f5ac
jmp 0x5f658
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x5f69f
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movw (%rax), %ax
shlw $0x8, %ax
sarw $0x8, %ax
cwtl
movl %eax, -0x6c(%rbp)
jmp 0x5f6a1
movl -0x6c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x6c(%rbp)
cmpl $0x0, %eax
jl 0x5f73a
movq -0x60(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
andq $-0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x5f6d5
jmp 0x5f6a1
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x44(%rbp), %edx
callq 0x59060
movl %eax, -0x70(%rbp)
cmpl $0x0, -0x70(%rbp)
je 0x5f735
cmpl $0x0, -0x70(%rbp)
jge 0x5f709
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
cmpl $0x43, %eax
jne 0x5f704
jmp 0x5f6a1
jmp 0x5f8ed
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x5fd50
testb $0x1, %al
jne 0x5f71f
jmp 0x5f8ed
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x357e0
jmp 0x5f8ed
jmp 0x5f6a1
jmp 0x5f73c
movq -0x60(%rbp), %rax
cmpq -0x58(%rbp), %rax
jne 0x5f680
leaq 0x56c07(%rip), %rax     # 0xb6358
movq (%rax), %rcx
addq $0x1, %rcx
leaq 0x56bf9(%rip), %rax     # 0xb6358
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl -0x44(%rbp), %ecx
leaq -0x50(%rbp), %rdx
callq 0x5fdd0
cmpl $0x0, %eax
je 0x5f7fd
cmpq $0x0, -0x50(%rbp)
jne 0x5f7eb
cmpl $0x0, -0x44(%rbp)
je 0x5f7e6
movq -0x40(%rbp), %rax
cmpl $0x4, 0x4(%rax)
je 0x5f7a4
jmp 0x5f7c3
leaq 0xdc65(%rip), %rdi      # 0x6d410
leaq 0xdc79(%rip), %rsi      # 0x6d42b
movl $0xb4, %edx
leaq 0xdc76(%rip), %rcx      # 0x6d434
callq 0x11120
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x1a390
movq -0xa8(%rbp), %rdi
movq %rax, %rsi
callq 0x357e0
jmp 0x5f8ed
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x600c0
jmp 0x5f8e9
leaq 0x2d950(%rip), %rax     # 0x8d154
movl (%rax), %eax
movl %eax, -0x74(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, -0x88(%rbp)
jne 0x5f83f
jmp 0x5f8dd
jmp 0x5f841
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
movq -0x90(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5f8bc
movq -0x90(%rbp), %rax
movslq -0x9c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x80(%rbp)
movq -0x90(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5f89e
cmpq $0x0, -0x80(%rbp)
jne 0x5f89e
jmp 0x5f8ab
movq -0x80(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x5fd30
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x5f84b
jmp 0x5f8be
movq -0x90(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
cmpq -0x88(%rbp), %rax
jne 0x5f841
movl -0x74(%rbp), %ecx
leaq 0x2d86d(%rip), %rax     # 0x8d154
movl %ecx, (%rax)
jmp 0x5f8eb
jmp 0x5f8ed
jmp 0x5f5ac
jmp 0x5f8f4
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x5f58d
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)