cmp arg2, arg1
Performs a comparison operation between arg1 and arg2. The comparison is performed by a (signed) subtraction of arg2 from arg1, the results of which can be called Temp. Temp is then discarded.
This is factually incorrect for x86. It is not a subtraction of arg2 from arg1, but the other way round!
Many of the x86 instructions have 2 operands. Intel calls the leftmost operand the destination and the rightmost operand the source. Both these types of operands can refer to a register or memory, but only the source operand can additionally be an 'immediate', so a simple number.
What cmp does is actually the same as sub: calculating temp = destination - source, setting flags (OF, SF, ZF, AF, PF, CF), but not storing the result into the destination.
What does it mean "Temp is then discarded"? Where is it stored?
"Temp is then discarded" is just another way of saying the result is not stored at all.
How can I access this result of the comparison?
The only result is in the many flags, and most of the time you would perform some conditional branching following a cmp.
The wiki that you mention talks about Intel and GAS, and how they differ in the order of the arguments. I suggest you immediately forget about arg1 and arg2, but use the terminology destination (dest) and source (src). Then it is easy to remember for both Intel syntax and AT&T syntax what cmp invisibly calculates:
DESTINATION - SOURCE
je. But je needs to know if condition was true or false.jedoesn't need to know if condition was true or false,jeis alias ofjz, andjzis "jump if zero flag is set". So whatever last instruction did modify the ZF, that one will foretold whether nextjewill take a jump (ZF=1) or not (ZF=0). One of the funny consequences of new asm programmers not getting it, is writing code likesub ax,1cmp ax,0jne myLoop... thatcmpis not needed there, as previoussubwill already set ZF in a sufficient way for thatjnework (but more logical would be to usejnz myLoopalias, i.e. reads as "jump not zero loop" - almost English.jz/jeandjnz/jnedon't care about whether a comparison was signed or unsigned, either. However, other x86 comparison conditional branches do need to be specified as signed or unsigned. Signed ones are called "jump if (not) less/less-or-equal/greater/greater-or-equal", giving the instructionsjl,jg, etc. Unsigned comparison conditionals are called "jump if (not) below/above/etc",jb,ja, etc.