// File: /workspace/github_c_makefile_star2_O0/lucvoo[P]sparse-dev/simplify.c
// Function: eval_op
static pseudo_t eval_op(int op, unsigned size, pseudo_t src1, pseudo_t src2)
{
	/* FIXME! Verify signs and sizes!! */
	long long left = src1->value;
	long long right = src2->value;
	unsigned long long ul, ur;
	long long res, mask, bits;

	mask = 1ULL << (size-1);
	bits = mask | (mask-1);

	if (left & mask)
		left |= ~bits;
	if (right & mask)
		right |= ~bits;
	ul = left & bits;
	ur = right & bits;

	switch (op) {
	case OP_NEG:
		res = -left;
		break;
	case OP_NOT:
		res = ~ul;
		break;

	case OP_ADD:
		res = left + right;
		break;
	case OP_SUB:
		res = left - right;
		break;
	case OP_MUL:
		res = ul * ur;
		break;
	case OP_DIVU:
		if (!ur)
			goto undef;
		res = ul / ur;
		break;
	case OP_DIVS:
		if (!right)
			goto undef;
		if (left == mask && right == -1)
			goto undef;
		res = left / right;
		break;
	case OP_MODU:
		if (!ur)
			goto undef;
		res = ul % ur;
		break;
	case OP_MODS:
		if (!right)
			goto undef;
		if (left == mask && right == -1)
			goto undef;
		res = left % right;
		break;
	case OP_SHL:
		if (ur >= size)
			goto undef;
		res = left << right;
		break;
	case OP_LSR:
		if (ur >= size)
			goto undef;
		res = ul >> ur;
		break;
	case OP_ASR:
		if (ur >= size)
			goto undef;
		res = left >> right;
		break;
       /* Logical */
	case OP_AND:
		res = left & right;
		break;
	case OP_OR:
		res = left | right;
		break;
	case OP_XOR:
		res = left ^ right;
		break;

	/* Binary comparison */
	case OP_SET_EQ:
		res = left == right;
		break;
	case OP_SET_NE:
		res = left != right;
		break;
	case OP_SET_LE:
		res = left <= right;
		break;
	case OP_SET_GE:
		res = left >= right;
		break;
	case OP_SET_LT:
		res = left < right;
		break;
	case OP_SET_GT:
		res = left > right;
		break;
	case OP_SET_B:
		res = ul < ur;
		break;
	case OP_SET_A:
		res = ul > ur;
		break;
	case OP_SET_BE:
		res = ul <= ur;
		break;
	case OP_SET_AE:
		res = ul >= ur;
		break;
	default:
		return NULL;
	}

	// Warning: this should be done with the output size which may
	// be different than the input size used here. But it differs
	// only for compares which are not concerned since only returning
	// 0 or 1 and for casts which are not handled here.
	res &= bits;

	return value_pseudo(res);

undef:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x10(%rbp), %eax
subl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
orq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
andq -0x50(%rbp), %rax
cmpq $0x0, %rax
je 0x38875
movq -0x58(%rbp), %rax
xorq $-0x1, %rax
orq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
andq -0x50(%rbp), %rax
cmpq $0x0, %rax
je 0x38893
movq -0x58(%rbp), %rax
xorq $-0x1, %rax
orq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq -0x58(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq -0x58(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0xc(%rbp), %eax
addl $-0x8, %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x2a, %eax
ja 0x38b7b
movq -0x60(%rbp), %rax
leaq 0x303f3(%rip), %rcx     # 0x68cc4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
subq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x38(%rbp), %rax
xorq $-0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x38(%rbp), %rax
imulq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
cmpq $0x0, -0x40(%rbp)
jne 0x3893a
jmp 0x38ba0
movq -0x38(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x40(%rbp)
movq %rax, -0x48(%rbp)
jmp 0x38b85
cmpq $0x0, -0x30(%rbp)
jne 0x3895b
jmp 0x38ba0
movq -0x28(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x38971
cmpq $-0x1, -0x30(%rbp)
jne 0x38971
jmp 0x38ba0
movq -0x28(%rbp), %rax
cqto
idivq -0x30(%rbp)
movq %rax, -0x48(%rbp)
jmp 0x38b85
cmpq $0x0, -0x40(%rbp)
jne 0x38990
jmp 0x38ba0
movq -0x38(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x40(%rbp)
movq %rdx, -0x48(%rbp)
jmp 0x38b85
cmpq $0x0, -0x30(%rbp)
jne 0x389b1
jmp 0x38ba0
movq -0x28(%rbp), %rax
cmpq -0x50(%rbp), %rax
jne 0x389c7
cmpq $-0x1, -0x30(%rbp)
jne 0x389c7
jmp 0x38ba0
movq -0x28(%rbp), %rax
cqto
idivq -0x30(%rbp)
movq %rdx, -0x48(%rbp)
jmp 0x38b85
movq -0x40(%rbp), %rax
movl -0x10(%rbp), %ecx
cmpq %rcx, %rax
jb 0x389eb
jmp 0x38ba0
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq %cl, %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x40(%rbp), %rax
movl -0x10(%rbp), %ecx
cmpq %rcx, %rax
jb 0x38a10
jmp 0x38ba0
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
shrq %cl, %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x40(%rbp), %rax
movl -0x10(%rbp), %ecx
cmpq %rcx, %rax
jb 0x38a35
jmp 0x38ba0
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
sarq %cl, %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
andq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
orq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
xorq -0x30(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setle %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setge %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setl %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
setg %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
setb %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
seta %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
setae %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x48(%rbp)
jmp 0x38b85
movq $0x0, -0x8(%rbp)
jmp 0x38ba8
movq -0x58(%rbp), %rax
andq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x1a390
movq %rax, -0x8(%rbp)
jmp 0x38ba8
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)