// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/simplify.c
// Function: simplify_one_memop
static int simplify_one_memop(struct instruction *insn, pseudo_t orig)
{
	pseudo_t addr = insn->src;
	pseudo_t new, off;

	if (addr->type == PSEUDO_REG) {
		struct instruction *def = addr->def;
		if (def->opcode == OP_SYMADDR && def->src) {
			kill_use(&insn->src);
			use_pseudo(insn, def->src, &insn->src);
			return REPEAT_CSE;
		}
		if (def->opcode == OP_ADD) {
			new = def->src1;
			off = def->src2;
			if (constant(off))
				goto offset;
			new = off;
			off = def->src1;
			if (constant(off))
				goto offset;
			return 0;
		}
	}
	return 0;

offset:
	/* Invalid code */
	if (new == orig || new == addr) {
		if (new == VOID)
			return 0;
		/*
		 * If some BB have been removed it is possible that this
		 * memop is in fact part of a dead BB. In this case
		 * we must not warn since nothing is wrong.
		 * If not part of a dead BB this will be redone after
		 * the BBs have been cleaned up.
		 */
		if (repeat_phase & REPEAT_CFG_CLEANUP)
			return 0;
		warning(insn->pos, "crazy programmer");
		replace_pseudo(insn, &insn->src, VOID);
		return 0;
	}
	insn->offset += off->value;
	replace_pseudo(insn, &insn->src, new);
	return REPEAT_CSE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x3, 0x4(%rax)
jne 0x3c8c9
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
cmpl $0x3f, %eax
jne 0x3c861
movq -0x38(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x3c861
movq -0x10(%rbp), %rdi
addq $0x30, %rdi
callq 0x35160
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rsi
movq -0x10(%rbp), %rdx
addq $0x30, %rdx
callq 0x381b0
movl $0x1, -0x4(%rbp)
jmp 0x3c983
movq -0x38(%rbp), %rax
movl (%rax), %eax
andl $0x7f, %eax
cmpl $0x8, %eax
jne 0x3c8c7
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x382a0
cmpl $0x0, %eax
je 0x3c897
jmp 0x3c8d5
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x382a0
cmpl $0x0, %eax
je 0x3c8bb
jmp 0x3c8d5
movl $0x0, -0x4(%rbp)
jmp 0x3c983
jmp 0x3c8c9
movl $0x0, -0x4(%rbp)
jmp 0x3c983
movq -0x28(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x3c8e9
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x3c953
leaq 0x4f4c0(%rip), %rax     # 0x8bdb0
cmpq %rax, -0x28(%rbp)
jne 0x3c902
movl $0x0, -0x4(%rbp)
jmp 0x3c983
leaq 0x5084b(%rip), %rax     # 0x8d154
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x3c91c
movl $0x0, -0x4(%rbp)
jmp 0x3c983
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x2c94a(%rip), %rsi     # 0x69275
movb $0x0, %al
callq 0x16d80
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
leaq 0x4f46b(%rip), %rdx     # 0x8bdb0
callq 0x38d50
movl $0x0, -0x4(%rbp)
jmp 0x3c983
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x10(%rbp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x30, %rsi
movq -0x28(%rbp), %rdx
callq 0x38d50
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)