Can someone show a C-like representation of the uses of cmp
/test
alongside js
/jns
/jz
/jnz
/etc.?
Thanks.
Can someone show a C-like representation of the uses of cmp
/test
alongside js
/jns
/jz
/jnz
/etc.?
Thanks.
Here are some examples:
#include <stdlib.h>
void test_with_self(int A){
if (A) abort();
}
void test_with_mask(int A, int Mask){
if (A&Mask) abort();
}
void test_js(int A){
if (A<0) abort();
}
void test_jns(int A){
if (A>=0) abort();
}
void cmp_jz(int A){
if (A==42) abort();
}
void cmp_jnz(int A){
if (A!=42) abort();
}
and what they could be rendered as (clang output):
test_with_self: # @test_with_self
test edi, edi
jne .LBB0_2
ret
.LBB0_2:
push rax
call abort@PLT
test_with_mask: # @test_with_mask
test esi, edi
jne .LBB1_2
ret
.LBB1_2:
push rax
call abort@PLT
test_js: # @test_js
test edi, edi
js .LBB2_2
ret
.LBB2_2:
push rax
call abort@PLT
test_jns: # @test_jns
test edi, edi
jns .LBB3_2
ret
.LBB3_2:
push rax
call abort@PLT
cmp_jz: # @cmp_jz
cmp edi, 42
je .LBB4_2
ret
.LBB4_2:
push rax
call abort@PLT
cmp_jnz: # @cmp_jnz
cmp edi, 42
jne .LBB5_2
ret
.LBB5_2:
push rax
call abort@PLT
Note that je
== jz
and jne
== jnz
.