Function at 0x507880
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x24
push ebx
push ebp
mov ebp, dword [esp + 0x3c]
mov edx, 1
mov ecx, ebp
shl edx, cl
mov ecx, dword [esp + 0x30]
push esi
mov esi, 1
mov dword [esp + 0x10], edx
lea ebx, [edx - 1]
lea eax, [ecx + 4]
mov dword [esp + 0x14], ebx
mov dword [esp + 0x24], eax
mov eax, edx
shr eax, 1
test ebp, ebp
mov ebp, edx
cmove eax, esi
shr ebp, 3
xor esi, esi
push edi
mov edi, ebx
lea eax, [ecx + eax*4]
mov dword [esp + 0x20], edi
mov dword [esp + 0x30], eax
mov ecx, edx
mov eax, dword [esp + 0x40]
xor edx, edx
shr ecx, 1
inc eax
add ecx, 3
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x44]
add ebp, ecx
xor ecx, ecx
mov dword [esp + 0x10], ebp
bts ecx, eax
cmp eax, 0x20
cmovae edx, ecx
xor ecx, edx
cmp eax, 0x40
mov eax, dword [esp + 0x40]
cmovae edx, ecx
add eax, 2
add eax, ecx
adc esi, edx
shrd eax, esi, 1
shr esi, 1
add eax, 2
adc esi, 0
shld esi, eax, 2
shl eax, 2
test esi, esi
jb 0x507932
ja 0x507925
cmp eax, dword [esp + 0x4c]
jbe 0x507932
pop edi
pop esi
pop ebp
mov eax, 0xffffffd4
pop ebx
add esp, 0x24
ret
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x44]
mov esi, dword [esp + 0x1c]
mov word [eax], cx
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x40]
mov word [eax - 2], cx
xor ecx, ecx
mov eax, dword [esp + 0x48]
lea edx, [ecx + 1]
mov word [eax], cx
cmp esi, edx
jb 0x5079bf
mov ebp, dword [esp + 0x3c]
mov ecx, eax
sub ebp, eax
mov ebx, esi
mov dword [esp + 0x4c], ebp
nop dword [eax + eax]
movzx esi, word [ecx + ebp]
movzx eax, word [ecx]
add ecx, 2
mov dword [esp + 0x38], ecx
cmp si, 0xffff
jne 0x5079a9
mov ebp, dword [esp + 0x4c]
inc eax
mov word [ecx], ax
lea eax, [edx - 1]
mov ecx, dword [esp + 0x40]
lea esi, [ecx*2]
mov ecx, dword [esp + 0x38]
add esi, dword [esp + 0x48]
mov byte [edi + esi + 4], al
dec edi
jmp 0x5079ae
add eax, esi
mov word [ecx], ax
inc edx
cmp edx, ebx
jbe 0x507970
mov ebx, dword [esp + 0x18]
mov esi, dword [esp + 0x1c]
mov dword [esp + 0x20], edi
mov ecx, dword [esp + 0x14]
movzx eax, cx
mov ecx, dword [esp + 0x40]
mov dword [esp + 0x2c], eax
inc eax
lea edx, [ecx*2 + 2]
mov ecx, dword [esp + 0x14]
add edx, dword [esp + 0x48]
mov word [edx], ax
cmp edi, ebx
jne 0x507ad7
lea edi, [ecx + 2]
xorps xmm0, xmm0
add edi, edx
movlpd qword [esp + 0x20], xmm0
xor eax, eax
mov dword [esp + 0x38], edi
test esi, esi
je 0x507a6b
mov edx, dword [esp + 0x24]
xor ebx, ebx
mov ebp, dword [esp + 0x20]
nop dword [eax + eax]
mov ecx, dword [esp + 0x3c]
movsx ecx, word [ecx + eax*2]
mov dword [esp + 0x4c], ecx
mov dword [ebx + edi], ebp
mov dword [ebx + edi + 4], edx
cmp ecx, 8
jle 0x507a50
add edi, ebx
add ecx, 0xfffffff7
shr ecx, 2
and ecx, 0x3ffffffe
mov dword [edi + 8], ebp
lea esi, [edi + 8]
mov dword [edi + 0xc], edx
add edi, 0x10
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [esp + 0x4c]
mov edi, dword [esp + 0x38]
mov esi, dword [esp + 0x1c]
add ebx, ecx
inc eax
add ebp, 0x1010101
adc edx, 0x1010101
cmp eax, esi
jb 0x507a10
mov ebx, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
xor edx, edx
xor esi, esi
test ecx, ecx
je 0x507b29
nop word [eax + eax]
movzx eax, byte [esi + edi]
mov ecx, edx
mov edi, dword [esp + 0x40]
and ecx, ebx
mov ebx, dword [esp + 0x48]
lea ebp, [ebx + edi*2]
mov edi, dword [esp + 0x38]
mov byte [ecx + ebp + 4], al
mov ebp, dword [esp + 0x40]
mov ecx, dword [esp + 0x10]
movzx eax, byte [esi + edi + 1]
add ecx, edx
and ecx, dword [esp + 0x18]
add esi, 2
lea edi, [ebx + ebp*2]
mov ebp, dword [esp + 0x10]
mov ebx, dword [esp + 0x18]
mov byte [ecx + edi + 4], al
mov edi, dword [esp + 0x38]
lea edx, [edx + ebp*2]
and edx, ebx
cmp esi, dword [esp + 0x14]
jb 0x507a80
mov ebp, dword [esp + 0x14]
xor esi, esi
jmp 0x507b33
xor eax, eax
xor edx, edx
test esi, esi
je 0x507b29
nop
mov ecx, dword [esp + 0x3c]
movsx ecx, word [ecx + edx*2]
test ecx, ecx
jle 0x507b24
nop dword [eax]
mov edi, dword [esp + 0x40]
mov ebp, dword [esp + 0x10]
lea ebx, [edi*2]
mov edi, dword [esp + 0x20]
add ebx, dword [esp + 0x48]
mov byte [eax + ebx + 4], dl
add eax, ebp
mov ebx, dword [esp + 0x18]
and eax, ebx
cmp eax, edi
jbe 0x507b1f
add eax, ebp
and eax, ebx
cmp eax, edi
ja 0x507b17
sub ecx, 1
jne 0x507af0
inc edx
cmp edx, esi
jb 0x507ae0
mov ebp, dword [esp + 0x14]
xor esi, esi
test ebp, ebp
je 0x507b65
mov edi, dword [esp + 0x2c]
mov ebx, dword [esp + 0x28]
nop dword [eax + eax]
mov ecx, dword [esp + 0x48]
mov edx, dword [esp + 0x40]
lea eax, [ecx + edx*2]
movzx eax, byte [esi + eax + 4]
lea edx, [ecx + eax*2]
movzx eax, word [edx]
lea ecx, [edi + esi]
inc esi
mov word [ebx + eax*2], cx
inc word [edx]
cmp esi, ebp
jb 0x507b40
mov esi, dword [esp + 0x30]
xor edi, edi
mov edx, dword [esp + 0x3c]
xor ebx, ebx
add esi, 8
movsx edx, word [edx + ebx*2]
cmp edx, 0xffffffff
je 0x507bc0
test edx, edx
je 0x507bb2
cmp edx, 1
je 0x507bc0
mov ecx, dword [esp + 0x44]
lea eax, [edx - 1]
bsr eax, eax
sub ecx, eax
shl edx, cl
shl ecx, 0x10
sub ecx, edx
mov edx, dword [esp + 0x3c]
mov dword [esi], ecx
mov ecx, edi
movsx eax, word [edx + ebx*2]
sub ecx, eax
mov dword [esi - 4], ecx
movsx eax, word [edx + ebx*2]
add edi, eax
jmp 0x507bd6
mov eax, dword [esp + 0x44]
inc eax
shl eax, 0x10
sub eax, ebp
mov dword [esi], eax
jmp 0x507bd2
mov eax, dword [esp + 0x44]
shl eax, 0x10
sub eax, ebp
mov dword [esi], eax
lea eax, [edi - 1]
mov dword [esi - 4], eax
inc edi
mov edx, dword [esp + 0x3c]
inc ebx
add esi, 8
cmp ebx, dword [esp + 0x40]
jbe 0x507b74
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x24
ret