fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int gcd(int var1, int var2) {
  5. int result = 0;
  6. __asm__ __volatile__ (
  7. "movl %1, %%eax;"
  8. "movl %2, %%ebx;"
  9. "CONTD: cmpl $0, %%ebx;"
  10. "je DONE;"
  11. "xorl %%edx, %%edx;"
  12. "idivl %%ebx;"
  13. "movl %%ebx, %%eax;"
  14. "movl %%edx, %%ebx;"
  15. "jmp CONTD;"
  16. "DONE: movl %%eax, %0;"
  17. :"=r"(result)
  18. :"r"(var1), "r"(var2)
  19. );
  20. return result;
  21. }
  22.  
  23. int main(void) {
  24.  
  25. int first = 0, second = 0;
  26. cin >> first >> second;
  27. cout << "GCD is: " << gcd(first, second) << endl;
  28.  
  29. return 0;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
5 15
compilation info
prog.cpp: Assembler messages:
prog.cpp:19: Error: symbol `CONTD' is already defined
prog.cpp:19: Error: symbol `DONE' is already defined
stdout
Standard output is empty