fork(2) download
  1. .data
  2. x:
  3. .long 0
  4. s:
  5. .string "%d\n\0"
  6.  
  7. .text
  8. .global main
  9. main: # int main()
  10. # {
  11. pushl $x # scanf("%d", &x);
  12. pushl $s
  13. call scanf
  14. addl $8, %esp
  15.  
  16. movl x, %eax # x = signum(x);
  17. addl %eax, %eax
  18. sbbl %ebx, %ebx
  19. negl %eax
  20. adcl %ebx, %ebx
  21. movl %ebx, x
  22.  
  23.  
  24. pushl x # printf("%d\n", x);
  25. pushl $s
  26. call printf
  27. addl $8, %esp
  28.  
  29. xor %eax, %eax # return 0;
  30. ret
  31. # }
  32.  
Success #stdin #stdout 0s 1732KB
stdin
-122
stdout
-1