fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int dividend = -42, divisor = 5, quotient, remainder;
  5.  
  6. __asm__ ( "cdq; idivl %%ebx;"
  7. : "=a" (quotient), "=d" (remainder)
  8. : "a" (dividend), "b" (divisor)
  9. : );
  10.  
  11. printf("%i / %i = %i, remainder: %i\n", dividend, divisor, quotient, remainder);
  12. return 0;
  13. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
-42 / 5 = -8, remainder: -2