Function at 0x5d8810
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x10
cmp dword [esp + 0x14], 0
push ebx
push ebp
push esi
push edi
mov esi, ecx
mov dword [esp + 0x1c], 0
jbe 0x5d9430
lea esp, [esp]
movzx eax, byte [esi + 0x3b8]
xor bl, bl
lea ebp, [eax*4 + 0x27]
add ebp, eax
cmp byte [esi + ebp*8 + 0x24], bl
lea ebp, [esi + ebp*8]
jbe 0x5d8881
jmp 0x5d8850
movzx eax, bl
mov ecx, esi
lea edi, [eax*2]
movzx eax, byte [ebp + eax*2 + 5]
push eax
movzx eax, byte [edi + ebp + 4]
push eax
call fcn.005da110
movzx eax, byte [edi + ebp + 4]
inc bl
mov byte [eax + esi + 0x3b9], 0xff
cmp bl, byte [ebp + 0x24]
jb 0x5d8850
mov byte [ebp + 0x24], 0
movzx eax, byte [esi + 0x3b8]
inc al
and al, 0xf
mov byte [esi + 0x3b8], al
cmp dword [esi + 0x25fe4], 2
movzx eax, byte [esi + 0x25fd6]
mov byte [esi + 0x25fd5], al
mov byte [esi + 0x25fd6], 0
jae 0x5d8fe7
cmp byte [esi + 0x25fe0], 0
je 0x5d8f91
test byte [esi + 0x25fcc], 3
jne 0x5d8f91
mov ecx, dword [esi + 0x25fdc]
xor edx, edx
mov ebp, dword [esi + 0x25fc8]
cmp ecx, 0xf
movzx eax, cl
cmovbe edx, eax
cmp byte [esi + 0x510], 0
mov dword [esp + 0x18], edx
je 0x5d89fb
cmp dl, byte [esi + 0x520]
jne 0x5d890d
mov byte [esi + 0x510], 0
jmp 0x5d89fb
test ebp, ebp
jne 0x5d89f2
cmp byte [esi + 0x532], 0
je 0x5d892b
cmp byte [esi + 0x531], 0
jne 0x5d89f0
mov dl, byte [esi + 0x524]
test dl, dl
je 0x5d8956
cmp byte [esi + 0x526], 0
jl 0x5d8956
cmp byte [esi + 0x51c], 0
mov byte [esi + 0x525], 1
je 0x5d895d
mov eax, dword [esi + 0x518]
jmp 0x5d8963
mov byte [esi + 0x525], 0
mov eax, dword [esi + 0x514]
mov bl, byte [esi + 0x521]
mov dword [esi + 0x50c], eax
mov eax, dword [esi + 0x528]
movzx ecx, bl
cmp byte [eax + ecx], 0
je 0x5d89a0
cmp byte [esi + 0x51f], 0
jne 0x5d89a0
mov byte [esi + 0x524], 1
mov byte [esi + 0x526], 0xfc
mov al, byte [eax + ecx]
mov byte [esi + 0x527], al
jmp 0x5d89d8
test dl, dl
je 0x5d89d8
mov dl, byte [esi + 0x526]
cmp dl, 0xff
jne 0x5d89bb
mov al, byte [esi + 0x522]
mov byte [esi + 0x523], al
movzx ecx, byte [esi + 0x523]
inc dl
movsx eax, dl
mov byte [esi + 0x526], dl
cmp eax, ecx
jl 0x5d89d8
mov byte [esi + 0x524], 0
mov edx, dword [esp + 0x18]
inc bl
mov byte [esi + 0x521], bl
cmp bl, 0xa0
jb 0x5d89f0
mov byte [esi + 0x521], 0
test ebp, ebp
setne al
mov byte [esi + 0x531], al
cmp byte [esi + 0x540], 0
je 0x5d8b1d
cmp dl, byte [esi + 0x550]
jne 0x5d8a1c
mov byte [esi + 0x540], 0
jmp 0x5d8b1d
test ebp, ebp
jne 0x5d8b14
cmp byte [esi + 0x562], 0
je 0x5d8a3a
cmp byte [esi + 0x561], 0
jne 0x5d8b12
mov dl, byte [esi + 0x554]
test dl, dl
je 0x5d8a65
cmp byte [esi + 0x556], 0
jl 0x5d8a65
cmp byte [esi + 0x54c], 0
mov byte [esi + 0x555], 1
je 0x5d8a6c
mov eax, dword [esi + 0x548]
jmp 0x5d8a72
mov byte [esi + 0x555], 0
mov eax, dword [esi + 0x544]
mov bl, byte [esi + 0x551]
mov dword [esi + 0x53c], eax
mov eax, dword [esi + 0x558]
movzx ecx, bl
cmp byte [eax + ecx], 0
je 0x5d8aaf
cmp byte [esi + 0x54f], 0
jne 0x5d8aaf
mov byte [esi + 0x554], 1
mov byte [esi + 0x556], 0xfc
mov al, byte [eax + ecx]
mov byte [esi + 0x557], al
jmp 0x5d8afa
test dl, dl
je 0x5d8afa
mov dl, byte [esi + 0x556]
cmp dl, 0xff
jne 0x5d8aca
mov al, byte [esi + 0x552]
mov byte [esi + 0x553], al
cmp byte [esi + 0x540], 0
je 0x5d8adb
mov al, byte [esi + 0x553]
jmp 0x5d8ae1
mov al, byte [esi + 0x552]
inc dl
movzx ecx, al
movsx eax, dl
mov byte [esi + 0x556], dl
cmp eax, ecx
jl 0x5d8afa
mov byte [esi + 0x554], 0
mov edx, dword [esp + 0x18]
inc bl
mov byte [esi + 0x551], bl
cmp bl, 0xa0
jb 0x5d8b12
mov byte [esi + 0x551], 0
test ebp, ebp
setne al
mov byte [esi + 0x561], al
cmp byte [esi + 0x570], 0
je 0x5d8c80
cmp dl, byte [esi + 0x581]
jne 0x5d8b3e
mov byte [esi + 0x570], 0
jmp 0x5d8c80
test ebp, ebp
jne 0x5d8c77
cmp byte [esi + 0x597], 0
je 0x5d8b5c
cmp byte [esi + 0x596], 0
jne 0x5d8c75
mov dl, byte [esi + 0x583]
test dl, dl
je 0x5d8b91
mov al, byte [esi + 0x584]
cmp al, byte [esi + 0x585]
jl 0x5d8b91
mov cl, byte [esi + 0x589]
mov eax, 1
shl eax, cl
test byte [esi + 0x593], al
je 0x5d8b91
mov eax, dword [esi + 0x578]
jmp 0x5d8b97
mov eax, dword [esi + 0x574]
mov dword [esi + 0x56c], eax
movzx ecx, byte [esi + 0x582]
mov eax, dword [esi + 0x58c]
cmp byte [ecx + eax], 0
je 0x5d8bce
mov word [esi + 0x583], 0xfb01
mov byte [esi + 0x589], 0
mov al, byte [ecx + eax]
mov byte [esi + 0x586], al
jmp 0x5d8c58
test dl, dl
je 0x5d8c58
mov cl, byte [esi + 0x584]
movzx edi, byte [esi + 0x587]
inc cl
mov eax, edi
mov byte [esi + 0x584], cl
sub eax, 1
je 0x5d8c0e
cmp cl, 1
jle 0x5d8c08
movsx eax, cl
dec eax
cdq
idiv edi
test edx, edx
jne 0x5d8c08
inc byte [esi + 0x589]
test cl, cl
jle 0x5d8c48
jmp 0x5d8c1c
test cl, cl
jle 0x5d8c1a
inc byte [esi + 0x589]
test cl, cl
js 0x5d8c48
mov cl, byte [esi + 0x58a]
test cl, cl
js 0x5d8c48
lea eax, [ecx - 1]
mov byte [esi + 0x58a], al
jne 0x5d8c48
mov al, byte [esi + 0x588]
cmp al, 1
mov byte [esi + 0x587], al
setne al
mov byte [esi + 0x585], al
cmp byte [esi + 0x589], 7
jbe 0x5d8c58
mov byte [esi + 0x583], 0
mov al, byte [esi + 0x582]
mov edx, dword [esp + 0x18]
inc al
mov byte [esi + 0x582], al
cmp al, 0xa0
jb 0x5d8c75
mov byte [esi + 0x582], 0
test ebp, ebp
setne al
mov byte [esi + 0x596], al
cmp byte [esi + 0x5a4], 0
je 0x5d8de3
cmp dl, byte [esi + 0x5b5]
jne 0x5d8ca1
mov byte [esi + 0x5a4], 0
jmp 0x5d8de3
test ebp, ebp
jne 0x5d8dda
cmp byte [esi + 0x5cb], 0
je 0x5d8cbf
cmp byte [esi + 0x5ca], 0
jne 0x5d8dd8
mov dl, byte [esi + 0x5b7]
test dl, dl
je 0x5d8cf4
mov al, byte [esi + 0x5b8]
cmp al, byte [esi + 0x5b9]
jl 0x5d8cf4
mov cl, byte [esi + 0x5bd]
mov eax, 1
shl eax, cl
test byte [esi + 0x5c7], al
je 0x5d8cf4
mov eax, dword [esi + 0x5ac]
jmp 0x5d8cfa
mov eax, dword [esi + 0x5a8]
mov dword [esi + 0x5a0], eax
movzx ecx, byte [esi + 0x5b6]
mov eax, dword [esi + 0x5c0]
cmp byte [ecx + eax], 0
je 0x5d8d31
mov word [esi + 0x5b7], 0xfb01
mov byte [esi + 0x5bd], 0
mov al, byte [ecx + eax]
mov byte [esi + 0x5ba], al
jmp 0x5d8dbb
test dl, dl
je 0x5d8dbb
mov cl, byte [esi + 0x5b8]
movzx edi, byte [esi + 0x5bb]
inc cl
mov eax, edi
mov byte [esi + 0x5b8], cl
sub eax, 1
je 0x5d8d71
cmp cl, 1
jle 0x5d8d6b
movsx eax, cl
dec eax
cdq
idiv edi
test edx, edx
jne 0x5d8d6b
inc byte [esi + 0x5bd]
test cl, cl
jle 0x5d8dab
jmp 0x5d8d7f
test cl, cl
jle 0x5d8d7d
inc byte [esi + 0x5bd]
test cl, cl
js 0x5d8dab
mov cl, byte [esi + 0x5be]
test cl, cl
js 0x5d8dab
lea eax, [ecx - 1]
mov byte [esi + 0x5be], al
jne 0x5d8dab
mov al, byte [esi + 0x5bc]
cmp al, 1
mov byte [esi + 0x5bb], al
setne al
mov byte [esi + 0x5b9], al
cmp byte [esi + 0x5bd], 7
jbe 0x5d8dbb
mov byte [esi + 0x5b7], 0
mov al, byte [esi + 0x5b6]
mov edx, dword [esp + 0x18]
inc al
mov byte [esi + 0x5b6], al
cmp al, 0xa0
jb 0x5d8dd8
mov byte [esi + 0x5b6], 0
test ebp, ebp
setne al
mov byte [esi + 0x5ca], al
cmp byte [esi + 0x5d8], 0
mov al, byte [esi + 0x5ef]
mov byte [esi + 0x5f2], al
je 0x5d8f3d
cmp dl, byte [esi + 0x5ee]
jne 0x5d8e10
mov byte [esi + 0x5d8], 0
jmp 0x5d8f3d
test ebp, ebp
jne 0x5d8f34
cmp byte [esi + 0x5f6], 0
je 0x5d8e2e
cmp byte [esi + 0x5f5], 0
jne 0x5d8f32
mov cl, byte [esi + 0x5f3]
test cl, cl
je 0x5d8e59
cmp byte [esi + 0x5f4], 0
jl 0x5d8e59
cmp byte [esi + 0x5ea], 0
mov byte [esi + 0x5ed], 1
je 0x5d8e60
mov eax, dword [esi + 0x5e0]
jmp 0x5d8e66
mov byte [esi + 0x5ed], 0
mov eax, dword [esi + 0x5dc]
mov dl, byte [esi + 0x5ef]
mov dword [esi + 0x5d4], eax
cmp dl, 0x9c
jne 0x5d8efb
movzx eax, byte [esi + 0x5f2]
movzx ecx, dl
sub ecx, eax
mov word [esi + 0x5f3], 0xfc01
add ecx, 0xa0
and ecx, reloc.WS2_32.dll_closesocket
jns 0x5d8ea3
dec ecx
or ecx, 0xfffffffc
inc ecx
movzx eax, cl
sub eax, 2
je 0x5d8ee9
sub eax, 1
je 0x5d8ec6
mov cl, byte [esi + 0x5f0]
inc dl
mov byte [esi + 0x5f1], cl
mov byte [esi + 0x5ef], dl
jmp 0x5d8f32
mov al, byte [esi + 0x5f0]
cmp al, 1
movzx ecx, al
mov eax, 2
cmove ecx, eax
inc dl
mov byte [esi + 0x5f1], cl
mov byte [esi + 0x5ef], dl
jmp 0x5d8f32
xor cl, cl
inc dl
mov byte [esi + 0x5f1], cl
mov byte [esi + 0x5ef], dl
jmp 0x5d8f32
test cl, cl
je 0x5d8f1e
inc byte [esi + 0x5f4]
movzx ecx, byte [esi + 0x5f0]
movsx eax, byte [esi + 0x5f4]
cmp eax, ecx
jl 0x5d8f1e
mov byte [esi + 0x5f3], 0
inc dl
mov byte [esi + 0x5ef], dl
cmp dl, 0xa0
jb 0x5d8f32
mov byte [esi + 0x5ef], 0
test ebp, ebp
setne al
mov byte [esi + 0x5f5], al
cmp byte [esi + 0x510], 0
jne 0x5d8f6e
cmp byte [esi + 0x540], 0
jne 0x5d8f6e
cmp byte [esi + 0x570], 0
jne 0x5d8f6e
cmp byte [esi + 0x5a4], 0
jne 0x5d8f6e
cmp byte [esi + 0x5d8], 0
jne 0x5d8f6e
xor al, al
jmp 0x5d8f70
mov al, 1
cmp byte [esi + 0x25fd5], 0
mov byte [esi + 0x25fe0], al
jne 0x5d8f83
test al, al
je 0x5d8f85
mov al, 1
inc dword [esi + 0x25fdc]
mov byte [esi + 0x25fd5], al
cmp dword [esi + 0x25fc8], 0
mov ecx, esi
jne 0x5d8fa3
call fcn.005d94e0
jmp 0x5d8fa8
call fcn.005d95d0
cmp byte [esi + 0x25fd5], 0
je 0x5d8fe7
mov eax, dword [esi + 0x4c0]
cmp byte [eax + 6], 0
jne 0x5d8fe7
mov eax, dword [esi + 0x5d4]
and eax, dword [esi + 0x5a0]
and eax, dword [esi + 0x56c]
and eax, dword [esi + 0x53c]
and eax, dword [esi + 0x50c]
and eax, dword [esi + 0x4d8]
or dword [esi + 0x25fd8], eax
inc byte [esi + 0x25fcc]
cmp byte [esi + 0x25fcc], 0xe4
jb 0x5d93c4
cmp dword [esi + 0x25fe4], 2
mov byte [esp + 0x17], 0
jb 0x5d9014
mov ecx, esi
call fcn.005d9f90
mov byte [esp + 0x17], 1
cmp byte [esi + 0x25fe0], 0
mov byte [esi + 0x25fcc], 0
jne 0x5d9036
mov eax, dword [esi + 0x25fe4]
cmp eax, 2
jae 0x5d9036
inc eax
mov dword [esi + 0x25fe4], eax
mov ecx, dword [esi + 0x4c0]
mov dword [esi + 0x25fc8], 0
mov dword [esi + 0x25fd0], 0
mov eax, dword [ecx]
inc dword [ecx + 8]
call dword [eax + 0x5c]
cmp byte [esi + 0x524], 0
je 0x5d9082
cmp byte [esi + 0x526], 0
jl 0x5d9082
cmp byte [esi + 0x51c], 0
mov byte [esi + 0x525], 1
je 0x5d9089
mov eax, dword [esi + 0x518]
jmp 0x5d908f
mov byte [esi + 0x525], 0
mov eax, dword [esi + 0x514]
mov dword [esi + 0x50c], eax
cmp byte [esi + 0x554], 0
je 0x5d90bf
cmp byte [esi + 0x556], 0
jl 0x5d90bf
cmp byte [esi + 0x54c], 0
mov byte [esi + 0x555], 1
je 0x5d90c6
mov eax, dword [esi + 0x548]
jmp 0x5d90cc
mov byte [esi + 0x555], 0
mov eax, dword [esi + 0x544]
mov dword [esi + 0x53c], eax
cmp byte [esi + 0x583], 0
je 0x5d9106
mov al, byte [esi + 0x584]
cmp al, byte [esi + 0x585]
jl 0x5d9106
mov cl, byte [esi + 0x589]
mov eax, 1
shl eax, cl
test byte [esi + 0x593], al
je 0x5d9106
mov eax, dword [esi + 0x578]
jmp 0x5d910c
mov eax, dword [esi + 0x574]
mov edx, 0x56c
mov ecx, esi
mov dword [ecx + edx], eax
cmp byte [esi + 0x5b7], 0
je 0x5d914a
mov al, byte [esi + 0x5b8]
cmp al, byte [esi + 0x5b9]
jl 0x5d914a
mov cl, byte [esi + 0x5bd]
mov eax, 1
shl eax, cl
test byte [esi + 0x5c7], al
je 0x5d914a
mov eax, dword [esi + 0x5ac]
jmp 0x5d9150
mov eax, dword [esi + 0x5a8]
mov edx, 0x5a0
mov ecx, esi
mov dword [edx + ecx], eax
cmp byte [esi + 0x5f3], 0
je 0x5d9184
cmp byte [esi + 0x5f4], 0
jl 0x5d9184
cmp byte [esi + 0x5ea], 0
mov byte [esi + 0x5ed], 1
je 0x5d918b
mov eax, dword [esi + 0x5e0]
jmp 0x5d9191
mov byte [esi + 0x5ed], 0
mov eax, dword [esi + 0x5dc]
mov dword [esi + 0x5d4], eax
mov eax, dword [esi + 0x4dc]
mov dword [esi + 0x4d8], eax
mov ecx, dword [esi + 0x4c0]
cmp byte [ecx + 4], 0
je 0x5d93ba
mov eax, dword [ecx]
call dword [eax + 0x2c]
test eax, eax
jne 0x5d91c3
mov ecx, esi
call fcn.005da0b0
cmp byte [esi + 0x26053], 0
je 0x5d93ba
mov ecx, dword [esi + 0x4c0]
mov eax, dword [ecx]
call dword [eax + 0x2c]
mov ecx, dword [esi + 0x598]
mov ebx, eax
mov ebp, 0xa0
mov dl, byte [ecx + 0x25fcc]
lea edi, [ebx + ebx*4]
sub dl, byte [ecx + 0x25fd0]
xor ecx, ecx
cmp dl, 0x44
lea eax, [edx - 0x44]
movzx eax, al
cmovae ecx, eax
movzx eax, cl
movzx ecx, byte [esi + 0x582]
sub eax, ecx
xor ecx, ecx
cmp byte [esi + 0x587], 1
setne cl
add ecx, 0x142
add eax, ecx
xor ecx, ecx
cdq
idiv ebp
mov eax, dword [esi + 0x29898]
add eax, edi
mov byte [eax + esi + 0x26056], dl
mov eax, dword [esi + 0x5cc]
mov dl, byte [eax + 0x25fcc]
sub dl, byte [eax + 0x25fd0]
cmp dl, 0x44
lea eax, [edx - 0x44]
movzx eax, al
cmovae ecx, eax
movzx eax, cl
xor ecx, ecx
cmp byte [esi + 0x5bb], 1
setne cl
add eax, ecx
movzx ecx, byte [esi + 0x5b6]
sub eax, ecx
lea ecx, [edi + esi]
add eax, 0x142
cdq
idiv ebp
mov eax, dword [esi + 0x29898]
mov byte [ecx + eax + 0x26696], dl
mov eax, dword [esi + 0x50c]
shr eax, 0xf
test al, 1
je 0x5d92da
mov eax, dword [esi + 0x534]
xor ecx, ecx
mov dl, byte [eax + 0x25fcc]
sub dl, byte [eax + 0x25fd0]
cmp dl, 0x44
lea eax, [edx - 0x44]
movzx eax, al
cmovae ecx, eax
movzx eax, cl
movzx ecx, byte [esi + 0x521]
sub eax, ecx
lea ecx, [edi + esi]
add eax, 0x141
cdq
idiv ebp
mov eax, dword [esi + 0x29898]
mov byte [ecx + eax + 0x26cd6], dl
mov eax, dword [esi + 0x53c]
shr eax, 0xf
test al, 1
je 0x5d932d
mov eax, dword [esi + 0x564]
xor ecx, ecx
mov dl, byte [eax + 0x25fcc]
sub dl, byte [eax + 0x25fd0]
cmp dl, 0x44
lea eax, [edx - 0x44]
movzx eax, al
cmovae ecx, eax
movzx eax, cl
movzx ecx, byte [esi + 0x551]
sub eax, ecx
lea ecx, [esi + ebx*4]
add eax, 0x141
cdq
idiv ebp
mov eax, dword [esi + 0x29898]
add ecx, ebx
mov byte [ecx + eax + 0x27316], dl
mov eax, dword [esi + 0x5d4]
shr eax, 0xf
test al, 1
je 0x5d937e
mov eax, dword [esi + 0x5f8]
xor ecx, ecx
mov dl, byte [eax + 0x25fcc]
sub dl, byte [eax + 0x25fd0]
cmp dl, 0x44
lea eax, [edx - 0x44]
movzx eax, al
cmovae ecx, eax
movzx eax, cl
movzx ecx, byte [esi + 0x5ef]
sub eax, ecx
add eax, 0x141
cdq
idiv ebp
lea eax, [ebx + ebx*4]
add eax, dword [esi + 0x29898]
mov byte [eax + esi + 0x27956], dl
movzx edi, byte [esi + 0x2601e]
movzx eax, byte [esi + 0x2601f]
shl edi, 8
or edi, eax
movzx eax, byte [esi + 0x26020]
shl edi, 8
or edi, eax
lea eax, [ebx + ebx*4]
add eax, dword [esi + 0x29898]
cmp byte [esp + 0x17], 0
mov dword [esi + eax*4 + 0x27f98], edi
jne 0x5d93ba
mov dword [esi + 0x298a0], ebx
mov eax, dword [esi + 4]
mov eax, dword [eax + 8]
mov byte [eax + 0x78], 0
movzx eax, byte [esi + 0x608]
lea edi, [esi + 0x5fc]
add eax, 0xfffffff7
cmp eax, 0x8c
ja case.0x5d93e2.10
movzx eax, byte [eax + 0x5d9448]
jmp dword [eax*4 + 0x5d943c]
lea ecx, [edi + 0x10]
call fcn.005d1c30
lea ecx, [edi + 0x20]
call fcn.005d1c30
jmp case.0x5d93e2.10
mov ecx, edi
call fcn.005d18b0
inc byte [edi + 0xc]
cmp byte [edi + 0xc], 0xe4
jne 0x5d940f
mov byte [edi + 0xc], 0
add dword [esi + 0x26000], 1
mov ecx, dword [esp + 0x1c]
adc dword [esi + 0x26004], 0
inc ecx
mov dword [esp + 0x1c], ecx
cmp ecx, dword [esp + 0x24]
jb 0x5d8830
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret 4