Function at 0x500090
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x10
mov eax, dword [esp + 0x14]
push ebp
push esi
mov esi, dword [esp + 0x20]
xor ebp, ebp
mov ecx, dword [eax]
push edi
lea edi, [eax + 0xbc]
mov dword [esp + 0x14], ecx
mov eax, dword [esp + 0x28]
cmp esi, dword [eax + 0x1c]
jne 0x5002c1
test esi, esi
jns 0x5000c6
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x10
ret
mov ecx, dword [edi]
push ebx
lea ebx, [edi + 8]
test ecx, ecx
je 0x5000d7
mov eax, dword [ebx]
cmp eax, dword [edi + 0xc]
jb 0x5000ee
mov eax, dword [ebx]
inc eax
push eax
push edi
call fcn.00500c60
mov ecx, dword [edi]
add esp, 8
test ecx, ecx
jne 0x5000ee
xor edi, edi
jmp 0x500112
mov eax, esi
xor edx, edx
ror eax, 2
add eax, esi
div dword [edi + 4]
lea edi, [ecx + edx*4]
mov ecx, dword [edi]
test ecx, ecx
je 0x500112
cmp dword [ecx + 4], esi
je 0x500112
mov eax, dword [ecx]
mov edi, ecx
mov ecx, eax
test eax, eax
jne 0x500103
mov eax, dword [edi]
test eax, eax
jne 0x50014a
mov eax, dword [esp + 0x18]
mov eax, dword [eax + 0x20]
add eax, 0x14
push eax
push 1
call fcn.004ef2c0
add esp, 8
test eax, eax
je 0x5002b6
xor ecx, ecx
mov dword [eax + 4], esi
mov dword [eax + 8], ebp
mov dword [eax + 0xc], ecx
mov word [eax + 0x10], cx
mov dword [eax], ecx
mov dword [edi], eax
inc dword [ebx]
movzx ecx, word [eax + 0xc]
lea edi, [eax + 8]
movzx eax, word [edi + 8]
movzx ebx, word [edi + 6]
mov dword [esp + 0x28], eax
mov dword [esp + 0x10], ecx
neg ecx
mov dword [esp + 0x14], ebx
sbb eax, eax
and eax, 2
mov ecx, eax
or eax, 4
movzx edx, ax
test ebx, ebx
mov ebx, dword [esp + 0x2c]
mov eax, ecx
cmove edx, eax
movzx ecx, dx
mov eax, ecx
or eax, 0x80
cmp dword [esp + 0x28], ebp
movzx edx, ax
mov eax, ecx
movzx ecx, word [ebx + 0x34]
cmove edx, eax
movzx eax, dx
mov dword [esp + 0x1c], eax
test cl, 2
je 0x5001b9
mov eax, dword [esp + 0x10]
mov edx, 2
inc eax
cmp eax, 1
mov dword [esp + 0x10], eax
cmove ebp, edx
mov eax, dword [esp + 0x14]
test cl, 4
je 0x5001cf
inc eax
mov dword [esp + 0x14], eax
cmp eax, 1
jne 0x5001cf
or ebp, 4
mov edx, dword [esp + 0x28]
test cl, cl
jns 0x5001e7
inc edx
mov dword [esp + 0x28], edx
cmp edx, 1
jne 0x5001e7
or ebp, 0x80
cmp dword [esp + 0x10], 0xffff
ja 0x5002a8
cmp eax, 0xffff
ja 0x5002a8
cmp edx, 0xffff
ja 0x5002a8
cmp dword [0x644ce4], 0
je 0x50023d
mov eax, dword [edi]
test eax, eax
je 0x50023d
mov al, byte [eax + 0x34]
xor al, cl
test al, 0x20
je 0x50023d
push esi
push str.Tried_to_mix_edge_triggered_and_non_edge_triggered_events_on_fd__d
call fcn.004fdc50
add esp, 8
or eax, 0xffffffff
pop ebx
pop edi
pop esi
pop ebp
add esp, 0x10
ret
test bp, bp
je 0x500273
lea eax, [edi + 0xc]
and ecx, 0x20
push eax
mov eax, dword [esp + 0x1c]
or ecx, ebp
push ecx
push dword [esp + 0x24]
push dword [ebx + 0x1c]
mov eax, dword [eax + 8]
push dword [esp + 0x34]
call eax
add esp, 0x14
cmp eax, 0xffffffff
je 0x5002b6
mov edx, dword [esp + 0x28]
mov ebp, 1
jmp 0x500275
xor ebp, ebp
mov eax, dword [esp + 0x10]
mov ecx, dword [edi]
mov word [edi + 4], ax
mov eax, dword [esp + 0x14]
mov word [edi + 8], dx
lea edx, [ebx + 0x24]
mov word [edi + 6], ax
mov dword [edx], ecx
test ecx, ecx
je 0x500299
mov ecx, dword [edi]
mov dword [ecx + 0x28], edx
mov dword [edi], ebx
mov eax, ebp
mov dword [ebx + 0x28], edi
pop ebx
pop edi
pop esi
pop ebp
add esp, 0x10
ret
push esi
push str.Too_many_events_reading_or_writing_on_fd__d
call fcn.004fdc50
add esp, 8
pop ebx
pop edi
pop esi
or eax, 0xffffffff
pop ebp
add esp, 0x10
ret
push 0x62de9c
push 0x62dea4
push 0x11a
push 0x62deb4
push 0x62debc
push 0xdeaddead
call fcn.004fdc30
add esp, 0x18
push 0x62dee0
push 0x62dee8
push 0x11a
push 0x62def8
push 0x62df00
push 2
call fcn.00559d7d
add esp, 4
push eax
call fcn.004212e0
add esp, 0x18
call fcn.0055d4ee
int3