Cooler_

JUMP LESS inline ASM

Apr 3rd, 2012
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.  int a = 3;
  6.  int b = 51;
  7.  int resposta;
  8. //cmp A and B ,jle jump if less
  9.  asm(
  10.   "cmp %1, %2\n\t"
  11.   "jl greater\n\t"
  12.   "movl %1, %0\n\t"
  13.   "jmp end\n"
  14.   "greater:\n\t"
  15.   "movl %2, %0\n"
  16.   "end:"
  17.   :"=r"(resposta)
  18.   :"r"(a), "r"(b)
  19.  );
  20.  fprintf(stdout,"valor menor é %d\n", resposta);
  21.  return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment