Why did the compiler put a 15-byte number in the middle of this function?

I am working on a decompiler, and one of my friends sent me a small program that he wrote. One function had a funny conclusion, and while checking the disassembly, I found that it was pretty boring, except that in the middle of it was a 15-byte nop:

0000000100001300 <_strhash>:
   100001300:   55                      push   rbp
   100001301:   48 89 e5                mov    rbp,rsp
   100001304:   8a 0f                   mov    cl,BYTE PTR [rdi]
   100001306:   31 c0                   xor    eax,eax
   100001308:   84 c9                   test   cl,cl
   10000130a:   74 2b                   je     100001337 <_strhash+0x37>
   10000130c:   48 ff c7                inc    rdi
   10000130f:   31 d2                   xor    edx,edx
   100001311:   66 66 66 66 66 66 2e    data16 data16 data16 data16 data16 nop WORD PTR cs:[rax+rax*1+0x0]
   100001318:   0f 1f 84 00 00 00 00 
   10000131f:   00 
   100001320:   0f b6 c9                movzx  ecx,cl
   100001323:   89 d0                   mov    eax,edx
   100001325:   c1 e0 05                shl    eax,0x5
   100001328:   29 d0                   sub    eax,edx
   10000132a:   01 c8                   add    eax,ecx
   10000132c:   8a 0f                   mov    cl,BYTE PTR [rdi]
   10000132e:   48 ff c7                inc    rdi
   100001331:   84 c9                   test   cl,cl
   100001333:   89 c2                   mov    edx,eax
   100001335:   75 e9                   jne    100001320 <_strhash+0x20>
   100001337:   5d                      pop    rbp
   100001338:   c3                      ret

I did not even know that x86 instructions can go up to 15 bytes.

What is the advantage of this big nop?

+4
source share

Source: https://habr.com/ru/post/1663483/


All Articles