I have a piece of code which uses JNZ. When I assemble and link the binary, I see my JNZ is replaces with a JNE. I understand that both of them fundamentally are the same. But then why does NASM change it?
Also, is there any config option available to stop this change from happening while assembling?
JNEandJNZhave the same opcodes (0x75for short jumps and0x0f 0x85for near jumps), so the assembler will create the same machine code for both of them.When disassembling, the disassembler does not known anymore which one was used in the source and it has to take one of them.
No, because it is not a real “replacement” –
JNEandJNZare simply different mnemonics for the same opcodes.