package net.runelite.asm.attributes.code.instructions;

import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.execution.Frame;
import net.runelite.asm.execution.InstructionContext;
import net.runelite.asm.execution.Stack;
import net.runelite.asm.execution.StackContext;
import net.runelite.asm.execution.Value;

public class LCmp extends Instruction
{
	public LCmp(Instructions instructions, InstructionType type, int pc)
	{
		super(instructions, type, pc);
	}

	@Override
	public InstructionContext execute(Frame frame)
	{
		InstructionContext ins = new InstructionContext(this, frame);
		Stack stack = frame.getStack();
		
		StackContext two = stack.pop();
		StackContext one = stack.pop();
		
		ins.pop(two, one);
		
		Value result = Value.NULL;
		if (!two.getValue().isNull() && !one.getValue().isNull())
		{
			long l2 = (long) two.getValue().getValue(),
				l1 = (long) one.getValue().getValue();
		
			if (l1 > l2)
				result = new Value(1);
			else if (l1 == l2)
				result = new Value(0);
			else if (l1 < l2)
				result = new Value(-1);
		}
		
		StackContext ctx = new StackContext(ins, int.class, result);
		stack.push(ctx);
		
		ins.push(ctx);
		
		return ins;
	}
}

@@ -49,16 +49,98 @@
 tions;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0Aimport net.runelite.asm.Field;%0A
 import n
@@ -295,16 +295,174 @@
 ctions;%0A
+import net.runelite.asm.attributes.code.instruction.types.GetFieldInstruction;%0Aimport net.runelite.asm.attributes.code.instruction.types.MappableInstruction;%0A
 import n
@@ -682,35 +682,204 @@
 ue;%0A
-%0Apublic class LCmp extends 
+import net.runelite.deob.deobfuscators.rename.MappingExecutorUtil;%0Aimport net.runelite.deob.deobfuscators.rename.ParallelExecutorMapping;%0A%0Apublic class LCmp extends Instruction implements Mappable
 Inst
@@ -1711,11 +1711,1097 @@
  ins;%0A%09%7D
+%0A%0A%09@Override%0A%09public void map(ParallelExecutorMapping mappings, InstructionContext ctx, InstructionContext other)%0A%09%7B%0A%09%09List%3CField%3E f1s = getComparedFields(ctx), f2s = getComparedFields(other);%0A%0A%09%09if (f1s == null %7C%7C f2s == null %7C%7C f1s.size() != f2s.size())%0A%09%09%09return;%0A%0A%09%09for (int i = 0; i %3C f1s.size(); ++i)%0A%09%09%7B%0A%09%09%09Field f1 = f1s.get(i), f2 = f2s.get(i);%0A%0A%09%09%09mappings.map(f1, f2);%0A%09%09%7D%0A%09%7D%0A%0A%09private List%3CField%3E getComparedFields(InstructionContext ctx)%0A%09%7B%0A%09%09List%3CField%3E fields = new ArrayList%3C%3E();%0A%0A%09%09for (StackContext sctx : ctx.getPops())%0A%09%09%7B%0A%09%09%09InstructionContext base = MappingExecutorUtil.resolve(sctx.getPushed(), sctx);%0A%0A%09%09%09if (base.getInstruction() instanceof GetFieldInstruction)%0A%09%09%09%7B%0A%09%09%09%09GetFieldInstruction gfi = (GetFieldInstruction) base.getInstruction();%0A%0A%09%09%09%09if (gfi.getMyField() != null)%0A%09%09%09%09%09fields.add(gfi.getMyField());%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%09return fields.isEmpty() ? null : fields;%0A%09%7D%0A%0A%09@Override%0A%09public boolean isSame(InstructionContext thisIc, InstructionContext otherIc)%0A%09%7B%0A%09%09return true;%0A%09%7D%0A%0A%09@Override%0A%09public boolean canMap(InstructionContext thisIc)%0A%09%7B%0A%09%09return true;%0A%09%7D
 %0A%7D%0A

Make lcmp mappable. When there are if statements comparing longs they always lcmp then use if*, so we can't do field mappings etc from them