Function at 0x409640
Capabilities:
Encode data using xor
Encrypt data using rc4 prga

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x20
mov ecx, dword [esp + 0x48]
mov edi, dword [esp + 0x3c]
mov edx, 1
shl edx, cl
mov esi, dword [esp + 0x34]
mov eax, 1
lea ebp, [edx - 1]
cmp edi, 0xffffffff
mov dword [esp + 8], edx
je 0x409710
dec cl
mov edx, 0x10000
shl edx, cl
sar edx, 0x10
mov dword [esp], edx
lea edx, [edi + 1]
test edi, edi
mov dword [esp + 4], edx
je 0x409727
and edx, 0xfffffffe
mov ebx, ebp
xor ecx, ecx
jmp 0x4096c0
lea edi, [ecx + 1]
mov esi, dword [esp + 0x34]
mov dword [esi + ebx*8 + 0xc], edi
dec ebx
mov di, 1
mov esi, dword [esp + 0x4c]
mov word [esi + ecx*2 + 2], di
add ecx, 2
cmp edx, ecx
je 0x40972b
mov esi, dword [esp + 0x38]
movsx edi, word [esi + ecx*2]
cmp edi, 0xffffffff
je 0x4096e0
cmp dword [esp], edi
mov esi, 0
cmovle eax, esi
jmp 0x4096ed
mov esi, dword [esp + 0x34]
mov dword [esi + ebx*8 + 0xc], ecx
dec ebx
mov di, 1
mov esi, dword [esp + 0x4c]
mov word [esi + ecx*2], di
mov esi, dword [esp + 0x38]
movsx edi, word [esi + ecx*2 + 2]
cmp edi, 0xffffffff
je 0x4096a0
cmp dword [esp], edi
mov esi, 0
cmovle eax, esi
jmp 0x4096b0
mov dword [esi], 1
mov dword [esi + 4], ecx
mov eax, edx
shr eax, 1
mov ecx, edx
shr ecx, 3
jmp 0x409914
xor ecx, ecx
mov ebx, ebp
test byte [esp + 4], 1
mov edi, dword [esp + 0x34]
je 0x40975e
mov edx, dword [esp + 0x38]
movsx edx, word [edx + ecx*2]
cmp edx, 0xffffffff
je 0x40974d
xor esi, esi
cmp dword [esp], edx
cmovle eax, esi
jmp 0x409756
mov dword [edi + ebx*8 + 0xc], ecx
dec ebx
mov dx, 1
mov esi, dword [esp + 0x4c]
mov word [esi + ecx*2], dx
mov dword [edi], eax
mov eax, dword [esp + 0x48]
mov dword [edi + 4], eax
mov eax, dword [esp + 8]
mov ecx, eax
shr ecx, 3
cmp ebx, ebp
jne 0x409883
mov dword [esp + 0x10], ecx
mov eax, dword [esp + 0x4c]
lea ecx, [eax + 0x6a]
mov dword [esp + 4], ecx
add eax, 0x82
mov dword [esp + 0x14], eax
xor esi, esi
xor edi, edi
xor edx, edx
xor ebx, ebx
jmp 0x4097c2
mov esi, dword [esp]
add esi, ecx
mov edi, eax
lea eax, [ebx + 1]
add edi, 0x1010101
adc edx, 0x1010101
cmp ebx, dword [esp + 0x3c]
mov ebx, eax
je 0x40990a
mov eax, dword [esp + 0x38]
movsx ecx, word [eax + ebx*2]
mov eax, dword [esp + 4]
mov dword [eax + esi + 4], edx
mov dword [esp], esi
mov dword [eax + esi], edi
cmp ecx, 9
mov eax, edi
jl 0x4097a0
lea esi, [ecx - 9]
mov edi, 8
cmp esi, 0x18
mov dword [esp + 0xc], ebx
jb 0x409854
shr esi, 3
inc esi
mov dword [esp + 0x18], esi
and esi, 0xfffffffc
lea edi, [esi*8 + 8]
mov dword [esp + 0x1c], eax
movd xmm0, eax
movd xmm1, edx
punpckldq xmm0, xmm1
pshufd xmm0, xmm0, 0x44
mov eax, dword [esp + 0x14]
mov ebx, dword [esp]
add ebx, eax
xor eax, eax
nop word cs:[eax + eax]
movdqu xmmword [ebx + eax*8 - 0x10], xmm0
movdqu xmmword [ebx + eax*8], xmm0
add eax, 4
cmp esi, eax
jne 0x409830
cmp dword [esp + 0x18], esi
mov eax, dword [esp + 0x1c]
mov ebx, dword [esp + 0xc]
je 0x4097a0
mov ebx, eax
mov eax, dword [esp + 4]
mov esi, dword [esp]
add esi, eax
mov eax, ebx
mov ebx, dword [esp + 0xc]
nop word cs:[eax + eax]
mov dword [esi + edi], eax
mov dword [esi + edi + 4], edx
add edi, 8
cmp edi, ecx
jl 0x409870
jmp 0x4097a0
shr eax, 1
add eax, ecx
add eax, 3
xor ecx, ecx
xor edx, edx
jmp 0x40989f
lea esi, [edx + 1]
cmp edx, dword [esp + 0x3c]
mov edx, esi
je 0x409969
mov esi, dword [esp + 0x38]
movsx esi, word [esi + edx*2]
test esi, esi
jle 0x409890
cmp si, 1
mov dword [esp + 4], esi
je 0x4098f0
and esi, 0xfffffffe
mov dword [esp], esi
xor esi, esi
nop dword [eax]
mov dword [edi + ecx*8 + 0xc], edx
nop word cs:[eax + eax]
add ecx, eax
and ecx, ebp
cmp ecx, ebx
ja 0x4098d0
mov dword [edi + ecx*8 + 0xc], edx
nop dword [eax]
add ecx, eax
and ecx, ebp
cmp ecx, ebx
ja 0x4098e0
add esi, 2
cmp esi, dword [esp]
jne 0x4098c0
test byte [esp + 4], 1
je 0x409890
mov dword [edi + ecx*8 + 0xc], edx
nop dword [eax + eax]
add ecx, eax
and ecx, ebp
cmp ecx, ebx
ja 0x409900
jmp 0x409890
mov eax, dword [esp + 8]
shr eax, 1
mov ecx, dword [esp + 0x10]
add eax, ecx
add eax, 3
mov dword [esp], eax
mov eax, dword [esp]
add eax, eax
mov dword [esp + 4], eax
xor edx, edx
xor esi, esi
nop dword [eax]
mov edi, esi
and edi, ebp
mov ecx, dword [esp + 0x4c]
movzx ebx, byte [ecx + edx + 0x6a]
mov eax, dword [esp + 0x34]
mov dword [eax + edi*8 + 0xc], ebx
mov eax, dword [esp]
lea edi, [esi + eax]
and edi, ebp
movzx ebx, byte [ecx + edx + 0x6b]
mov eax, dword [esp + 0x34]
mov dword [eax + edi*8 + 0xc], ebx
add esi, dword [esp + 4]
and esi, ebp
add edx, 2
cmp edx, dword [esp + 8]
jb 0x409930
xor esi, esi
mov ebp, dword [esp + 0x4c]
mov eax, dword [esp + 8]
nop word cs:[eax + eax]
mov ecx, dword [esp + 0x34]
mov edi, dword [ecx + esi*8 + 0xc]
movzx ebx, word [ebp + edi*2]
lea ecx, [ebx + 1]
mov word [ebp + edi*2], cx
bsr ecx, ebx
xor ecx, 0x1f
add ecx, 0xffffffe1
test ebx, ebx
cmove ecx, ebx
add ecx, dword [esp + 0x48]
mov edx, dword [esp + 0x34]
mov byte [edx + esi*8 + 0xb], cl
shl ebx, cl
sub ebx, eax
mov ecx, dword [esp + 0x34]
mov word [ecx + esi*8 + 8], bx
mov ecx, dword [esp + 0x44]
movzx ecx, byte [ecx + edi*4]
mov byte [edx + esi*8 + 0xa], cl
mov ecx, dword [esp + 0x40]
mov ecx, dword [ecx + edi*4]
mov dword [edx + esi*8 + 0xc], ecx
inc esi
cmp eax, esi
jne 0x409980
add esp, 0x20
pop esi
pop edi
pop ebx
pop ebp
ret