Skip to content

Instantly share code, notes, and snippets.

@rygorous
Last active May 13, 2016 19:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rygorous/2af6cd9a3f403842a250 to your computer and use it in GitHub Desktop.
Save rygorous/2af6cd9a3f403842a250 to your computer and use it in GitHub Desktop.
Sigh.
c90: ba 04 00 00 00 mov edx,0x4
c95: 48 29 ca sub rdx,rcx
c98: 41 8a 14 13 mov dl,BYTE PTR [r11+rdx*1]
c9c: 41 88 53 04 mov BYTE PTR [r11+0x4],dl
ca0: ba 05 00 00 00 mov edx,0x5
ca5: 48 29 ca sub rdx,rcx
ca8: 41 8a 14 13 mov dl,BYTE PTR [r11+rdx*1]
cac: 41 88 53 05 mov BYTE PTR [r11+0x5],dl
cb0: ba 06 00 00 00 mov edx,0x6
cb5: 48 29 ca sub rdx,rcx
cb8: 41 8a 14 13 mov dl,BYTE PTR [r11+rdx*1]
cbc: 41 88 53 06 mov BYTE PTR [r11+0x6],dl
cc0: ba 07 00 00 00 mov edx,0x7
cc5: 48 29 ca sub rdx,rcx
cc8: 41 8a 14 13 mov dl,BYTE PTR [r11+rdx*1]
ccc: 41 88 53 07 mov BYTE PTR [r11+0x7],dl
this is compiled from code
to[4] = from[4];
to[5] = from[5];
to[6] = from[6];
to[7] = from[7];
What we need to improve this is clearly... to add a comment! Well, not a
normal comment. An inline-assembly comment. Yes, that will do nicely.
+ __asm__("#%0" : "+r"(from)); // FG TEST: are we doing this again?
Look, it's *magic*!
b08: 4c 89 d9 mov rcx,r11
b0b: 48 29 c1 sub rcx,rax
[..]
b5e: 8a 51 04 mov dl,BYTE PTR [rcx+0x4]
b61: 41 88 53 04 mov BYTE PTR [r11+0x4],dl
b65: 8a 51 05 mov dl,BYTE PTR [rcx+0x5]
b68: 41 88 53 05 mov BYTE PTR [r11+0x5],dl
b6c: 8a 51 06 mov dl,BYTE PTR [rcx+0x6]
b6f: 41 88 53 06 mov BYTE PTR [r11+0x6],dl
b73: 8a 51 07 mov dl,BYTE PTR [rcx+0x7]
b76: 41 88 53 07 mov BYTE PTR [r11+0x7],dl
@bmharper
Copy link

Can you explain what that comment does?

@delfigamer
Copy link

Someone forgot to enable optimizations. Everyone can go home now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment