Function at 0x597590
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x14
push ebx
mov ebx, dword [esp + 0x20]
push ebp
push esi
mov esi, dword [esp + 0x24]
mov eax, dword [esi]
xor ebp, ebp
add esi, 0xbc
cmp ebx, ebp
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], ebp
mov dword [esp + 0x14], ebp
mov dword [esp + 0xc], ebp
jge 0x5975c5
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x14
ret
cmp dword [esi], ebp
je 0x5975d1
mov ecx, dword [esi + 8]
cmp ecx, dword [esi + 0xc]
jb 0x5975df
mov edx, dword [esi + 8]
inc edx
push edx
push esi
call fcn.00597220
add esp, 8
mov ecx, dword [esi]
push edi
cmp ecx, ebp
jne 0x5975ea
xor edi, edi
jmp 0x59760f
mov eax, ebx
ror eax, 2
add eax, ebx
xor edx, edx
div dword [esi + 4]
mov eax, dword [ecx + edx*4]
lea ecx, [ecx + edx*4]
cmp eax, ebp
je 0x59760d
cmp dword [eax + 4], ebx
je 0x59760d
mov ecx, eax
mov eax, dword [ecx]
cmp eax, ebp
jne 0x597600
mov edi, ecx
mov eax, dword [edi]
cmp eax, ebp
jne 0x59764f
mov eax, dword [esp + 0x1c]
mov ecx, dword [eax + 0x20]
add ecx, 0x14
push ecx
push 1
call fcn.005811a0
add esp, 8
cmp eax, ebp
je 0x597797
mov dword [eax + 4], ebx
xor edx, edx
xor ecx, ecx
mov dword [eax + 8], ebp
mov word [eax + 0xc], dx
mov word [eax + 0xe], cx
mov word [eax + 0x10], dx
mov dword [eax], ebp
mov dword [edi], eax
inc dword [esi + 8]
movzx ebx, word [eax + 0xc]
movzx ecx, word [eax + 0xe]
movzx ebp, word [eax + 0x10]
lea esi, [eax + 8]
mov dword [esp + 0x14], ecx
test ebx, ebx
je 0x59766e
mov dword [esp + 0x10], 2
test ecx, ecx
je 0x597677
or dword [esp + 0x10], 4
test ebp, ebp
je 0x597683
or dword [esp + 0x10], 0x80
mov edi, dword [esp + 0x30]
movzx eax, word [edi + 0x34]
test al, 2
je 0x59769a
inc ebx
mov edx, 2
cmp ebx, 1
je 0x59769e
mov edx, dword [esp + 0x18]
test al, 4
je 0x5976af
inc ecx
mov dword [esp + 0x14], ecx
cmp ecx, 1
jne 0x5976af
or edx, 4
test al, al
jns 0x5976bf
inc ebp
cmp ebp, 1
jne 0x5976bf
or edx, 0x80
cmp ebx, 0xffff
jg 0x597785
cmp ecx, 0xffff
jg 0x597785
cmp ebp, 0xffff
jg 0x597785
cmp dword [0x62a1ec], 0
je 0x59771d
mov ecx, dword [esi]
test ecx, ecx
je 0x597719
mov cl, byte [ecx + 0x34]
xor cl, al
test cl, 0x20
je 0x597719
mov edx, dword [esp + 0x2c]
push edx
push str.Tried_to_mix_edge_triggered_and_non_edge_triggered_events_on_fd__d
call fcn.00596cb0
add esp, 8
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x14
ret
mov ecx, dword [esp + 0x14]
test dx, dx
je 0x597756
and eax, 0x20
or eax, edx
mov edx, dword [esp + 0x10]
lea ecx, [esi + 0xc]
push ecx
mov ecx, dword [esp + 0x2c]
push eax
mov eax, dword [edi + 0x1c]
push edx
mov edx, dword [esp + 0x28]
push eax
mov eax, dword [edx + 8]
push ecx
call eax
add esp, 0x14
cmp eax, 0xffffffff
je 0x597797
mov ecx, dword [esp + 0x14]
mov edx, 1
jmp 0x59775a
mov edx, dword [esp + 0x20]
mov eax, dword [esi]
mov word [esi + 6], cx
lea ecx, [edi + 0x24]
mov word [esi + 4], bx
mov word [esi + 8], bp
mov dword [ecx], eax
test eax, eax
je 0x597776
mov eax, dword [esi]
mov dword [eax + 0x28], ecx
mov dword [esi], edi
mov dword [edi + 0x28], esi
pop edi
pop esi
pop ebp
mov eax, edx
pop ebx
add esp, 0x14
ret
mov ecx, dword [esp + 0x2c]
push ecx
push str.Too_many_events_reading_or_writing_on_fd__d
call fcn.00596cb0
add esp, 8
pop edi
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0x14
ret