fork download
  1. #include <time.h>
  2. #include <stdio.h>
  3.  
  4. int main(void) {
  5. int x;
  6. int n = 32768;
  7. //for(; scanf("%d",&x) > 0 && x != 42; printf("%d\n", x));
  8. printf("Wait for %d lines with 32768 pixels each...\n", n);
  9. time_t start = time(0);
  10. for(x = 0; x < n; ++ x) {
  11. __asm(
  12. " movl $0x7FFF0000,%eax;"
  13. " movl $0x00007FFF,%ecx;"
  14. " addw %ax,%ax;"
  15. " subl %eax,%ecx;"
  16. " sbbl %ebx,%ebx;"
  17. " subw %ax,%cx;"
  18. " sbbw %bx,%bx;"
  19. " xorl %ebx,%ecx;"
  20. " addw %bx,%cx;"
  21. " subl %ebx,%ecx;"
  22. " orl $0x000010001,%ebx;"
  23. " andl $0x07FFF7FFF,%ebx;"
  24. " movl %ecx,%edx;"
  25. " rorl $16,%edx;"
  26. " movl %edx,%edi;"
  27. " addw %cx,%dx;"
  28. " subl %ecx,%edx;"
  29. " sbbl %esi,%esi;"
  30. " subw %cx,%dx;"
  31. " sbbw %si,%si;"
  32. " movswl %si,%esi;"
  33. " andl %esi,%ecx;"
  34. " notl %esi;"
  35. " andl %esi,%edi;"
  36. " orl %edi,%ecx;"
  37. " movl %ecx,%edx;"
  38. " shll $16,%ecx;"
  39. " movw %dx,%cx;"
  40. " shrw $1,%dx;"
  41. " notw %si;"
  42. "Step:;"
  43. //" movl %edx,%edi;"
  44. " shldl $16,%edx,%edi;"
  45. " addw %di,%dx;"
  46. " cmpw %dx,%cx;"
  47. " sbbl %edi,%edi;"
  48. " andw %cx,%di;"
  49. " subw %di,%dx;"
  50. " sarl $16,%edi;"
  51. " orl %esi,%edi;"
  52. " andl %ebx,%edi;"
  53. " addl %edi,%eax;"
  54. " andl $0x7FFF7FFF,%eax;"
  55. " subl $0x00010000,%ecx;"
  56. " jns Step;");
  57. }
  58. time_t finish = time(0) - start;
  59. struct tm tstruct;
  60. char buf[80];
  61. tstruct = *localtime(&finish);
  62. strftime(buf, sizeof(buf), "Elapsed time is %S seconds", &tstruct);
  63. printf("%s\n", buf);
  64. return 0;
  65. }
Success #stdin #stdout 3.3s 5456KB
stdin
Standard input is empty
stdout
Wait for 32768 lines with 32768 pixels each...
Elapsed time is 03 seconds