See LZ4_decompress_generic We can exclude operatorswhen llll < 15 and mmmm < 15. We need to separate the seldom cases when llll == 15 or mmmm == 15. This is a schema in asm:Code:length = token >> 4; length = token & 15;What do you think about it?Code:xor ecx,ecx xor ebx,ebx mov cl,[esi] ; cl = token (llllmmmm) mov bx,[esi+1] neg ebx ; ebx = -offset add esi,3 shl ecx,4 ; cl = mmmm*16, ch = llll cmp ch,$0F je .too_many_literals === ; Copying literals, ch == count of literals ... === cmp cl,$F0 je .too_big_matchlen ; To copy by 4 bytes offset must be greater than 3 cmp ebx,-4 jg .1 ; Copying matched bytes, cl == (count-4)*16 of matched bytes mov eax,[esi+ebx] mov [edi],eax ; copying 4 bytes add esi,4 add edi,4 .while cl >= 4*16 mov eax,[esi+ebx] mov [edi],eax ; copying by 4 bytes add esi,4 add edi,4 sub cl,4*16 ; sub cl, works also fast as dec cl .endwhile jmp .2 .1: add cl,4*16 .2: .while cl mov al,[esi+ebx] mov [edi],al ; copying by 1 byte inc esi inc edi sub cl,16 .endwhile![]()