diff --git a/x86/arcfour-crypt.asm b/x86/arcfour-crypt.asm
index 7056c50b588c5aa1c669e668e349dc24c18e3617..43e4f7d304efc0e09a891ac19aeb111a9e4685c0 100644
--- a/x86/arcfour-crypt.asm
+++ b/x86/arcfour-crypt.asm
@@ -59,6 +59,7 @@ C Register usage:
 	
 	movzbl  256(%ebp), %eax		C  i
 	movzbl  257(%ebp), %ebx		C  j
+	subl	%esi, %edi
 .Lloop:
 C	incb	%al
 	incl	%eax
@@ -75,9 +76,8 @@ C	addb    %cl, %bl
 					C  for indexing.
 	movb    (%ebp, %ecx), %cl
 	xorb    (%esi), %cl
+	movb    %cl, (%esi,%edi)
 	incl    %esi
-	movb    %cl, (%edi)
-	incl    %edi
 	cmpl	%esi, %edx
 	jne	.Lloop