Function at 0x470ba0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x10
push esi
mov esi, dword [esp + 0x20]
cmp esi, dword [esp + 0x1c]
jne 0x470bb7
mov eax, dword [esp + 0x18]
pop esi
add esp, 0x10
ret
push ebx
push ebp
test esi, esi
js 0x470f0f
mov ebx, dword [esp + 0x2c]
test ebx, ebx
js 0x470f0f
je 0x470bdf
mov eax, accept
cdq
idiv ebx
cmp esi, eax
jg 0x470f0f
mov ecx, esi
imul ecx, ebx
mov dword [esp + 0x28], ecx
test ecx, ecx
js 0x470f0f
mov ebp, dword [esp + 0x30]
test ebp, ebp
js 0x470f0f
je 0x470c0e
mov eax, accept
cdq
idiv ebp
cmp ecx, eax
jg 0x470f0f
mov eax, ecx
imul eax, ebp
push eax
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov ecx, eax
add esp, 4
mov dword [esp + 0x18], ecx
test ecx, ecx
je 0x470f0f
push edi
mov edi, dword [esp + 0x24]
test ebp, ebp
jle 0x470ef9
mov eax, dword [esp + 0x28]
lea edx, [esi - 0xa]
mov esi, edi
mov dword [esp + 0x14], edi
lea edx, [edx + eax*8]
imul eax, ebx
mov dword [esp + 0x10], edx
mov dword [esp + 0x28], eax
mov eax, ecx
mov ecx, dword [esp + 0x2c]
mov dword [esp + 0x18], eax
nop dword [eax]
cmp edx, 0x19
ja case.default.0x470c70
movzx ecx, byte [edx + 0x470f64]
jmp dword [ecx*4 + 0x470f30]
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
sub edx, 1
mov cl, byte [esi]
mov byte [eax], cl
lea esi, [esi + 1]
mov byte [eax + 1], 0xff
lea eax, [eax + 2]
jns 0x470c82
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 1]
mov byte [eax + 1], cl
lea eax, [eax + 3]
mov byte [eax - 3], cl
jns 0x470ca5
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
nop dword [eax + eax]
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 1]
mov byte [eax + 1], cl
lea eax, [eax + 4]
mov byte [eax - 4], cl
mov byte [eax - 1], 0xff
jns 0x470cd0
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
nop word [eax + eax]
sub edx, 1
mov cl, byte [esi]
mov byte [eax], cl
lea esi, [esi + 2]
lea eax, [eax + 1]
jns 0x470d00
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
nop
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 2]
mov byte [eax + 1], cl
lea eax, [eax + 3]
mov byte [eax - 3], cl
jns 0x470d20
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
sub edx, 1
mov cl, byte [esi]
mov byte [eax + 2], cl
lea esi, [esi + 2]
mov byte [eax + 1], cl
lea eax, [eax + 4]
mov byte [eax - 4], cl
movzx ecx, byte [esi - 1]
mov byte [eax - 1], cl
jns 0x470d46
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
sub edx, 1
movzx ecx, byte [esi]
mov byte [eax], cl
lea esi, [esi + 3]
movzx ecx, byte [esi - 2]
lea eax, [eax + 4]
mov byte [eax - 3], cl
movzx ecx, byte [esi - 1]
mov byte [eax - 2], cl
mov byte [eax - 1], 0xff
jns 0x470d73
jmp 0x470ece
lea edi, [ebx - 1]
test edi, edi
js case.0x470c70.3
nop word [eax + eax]
movzx ecx, byte [esi + 1]
lea esi, [esi + 3]
imul edx, ecx, 0x96
lea eax, [eax + 1]
movzx ecx, byte [esi - 1]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 3]
imul ecx, ecx, 0x4d
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 1], dl
jns 0x470db0
jmp 0x470ece
lea edi, [ebx - 1]
test edi, edi
js case.0x470c70.3
nop dword [eax]
movzx ecx, byte [esi + 1]
lea esi, [esi + 3]
imul edx, ecx, 0x96
lea eax, [eax + 2]
movzx ecx, byte [esi - 1]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 3]
imul ecx, ecx, 0x4d
mov byte [eax - 1], 0xff
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 2], dl
jns 0x470df0
jmp 0x470ece
lea edi, [ebx - 1]
test edi, edi
js case.0x470c70.3
movzx ecx, byte [esi + 1]
lea esi, [esi + 4]
imul edx, ecx, 0x96
lea eax, [eax + 1]
movzx ecx, byte [esi - 2]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 4]
imul ecx, ecx, 0x4d
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 1], dl
jns 0x470e31
jmp 0x470ece
lea edi, [ebx - 1]
test edi, edi
js case.0x470c70.3
nop word [eax + eax]
movzx ecx, byte [esi + 1]
lea esi, [esi + 4]
imul edx, ecx, 0x96
lea eax, [eax + 2]
movzx ecx, byte [esi - 2]
imul ecx, ecx, 0x1d
add edx, ecx
movzx ecx, byte [esi - 4]
imul ecx, ecx, 0x4d
add edx, ecx
shr edx, 8
sub edi, 1
mov byte [eax - 2], dl
mov cl, byte [esi - 1]
mov byte [eax - 1], cl
jns 0x470e70
jmp 0x470ece
lea edx, [ebx - 1]
test edx, edx
js 0x470ece
nop dword [eax]
sub edx, 1
movzx ecx, byte [esi]
mov byte [eax], cl
lea esi, [esi + 4]
movzx ecx, byte [esi - 3]
lea eax, [eax + 3]
mov byte [eax - 2], cl
movzx ecx, byte [esi - 2]
mov byte [eax - 1], cl
jns 0x470eb0
mov edx, dword [esp + 0x10]
mov ecx, dword [esp + 0x2c]
mov esi, dword [esp + 0x14]
mov eax, dword [esp + 0x18]
add esi, dword [esp + 0x28]
add eax, ecx
mov dword [esp + 0x14], esi
mov dword [esp + 0x18], eax
sub ebp, 1
jne 0x470c60
mov edi, dword [esp + 0x24]
push edi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov eax, dword [esp + 0x20]
add esp, 4
pop edi
pop ebp
pop ebx
pop esi
add esp, 0x10
ret
push dword [esp + 0x20]
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
mov dword [0x59f984], 0x4f00d8
xor eax, eax
pop ebp
pop ebx
pop esi
add esp, 0x10
ret