Function at 0x59ca70
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xd0
mov eax, dword [0x64e2c0]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0xc8], eax
mov eax, dword [ebp + 0x10]
push ebx
mov ebx, dword [ebp + 8]
mov dword [ebp - 0xcc], eax
mov eax, dword [ebp + 0x14]
mov dword [ebp - 0xd0], eax
mov eax, dword [ebx]
mov dword [ebp - 0xc4], ebx
mov dword [eax + 8], 0
mov eax, dword [ebp + 0x18]
mov dword [ebp - 0xa4], eax
cmp eax, 4
ja 0x59d448
push esi
push ebx
call fcn.005a0d60
mov esi, dword [ebx]
add esp, 4
test eax, eax
jne 0x59caf2
push eax
push dword [esi + 8]
push ebx
call fcn.005a1370
add esp, 0xc
xor eax, eax
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.005b26e6
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0xa4]
mov ecx, dword [esi + 8]
mov dword [ebp - 0xa0], ecx
test eax, eax
jne 0x59cb18
cmp ecx, 3
setge al
lea eax, [eax*2 + 1]
mov dword [ebp - 0xa4], eax
push edi
cmp ecx, 3
jne 0x59cb45
cmp dword [ebx + 0x47ec], ecx
je 0x59cb38
cmp dword [ebx + 0x47e8], 0
jne 0x59cb45
cmp dword [ebx + 0x47e4], 0
jne 0x59cb45
mov edx, 1
mov dword [ebp - 0xac], edx
jmp 0x59cb52
xor edx, edx
mov dword [ebp - 0xac], edx
cmp ecx, 3
jne 0x59cb6e
cmp eax, 3
jge 0x59cb6e
test edx, edx
jne 0x59cb6e
xorps xmm0, xmm0
mov dword [ebp - 0xa0], 1
movups xmmword [ebp - 0x14], xmm0
jmp 0x59cb83
mov dword [ebp - 0xac], edx
xorps xmm0, xmm0
movups xmmword [ebp - 0x14], xmm0
test ecx, ecx
jle 0x59cc83
lea edi, [ebx + 0x46a0]
mov dword [ebp - 0x98], 0
lea esi, [ebp - 0x88]
mov dword [ebp - 0x9c], edi
nop
mov eax, dword [ebx]
mov eax, dword [eax]
add eax, 3
push eax
call fcn.005b7d4f
add esp, 4
mov dword [edi + 0x34], eax
test eax, eax
je 0x59d40c
mov eax, dword [ebx + 0x4684]
cdq
idiv dword [edi]
mov dword [esi + 0x10], 0
mov dword [ebp - 0xa8], eax
mov dword [esi], eax
mov eax, dword [ebx + 0x4688]
cdq
idiv dword [edi + 4]
xor edx, edx
mov edi, eax
mov eax, dword [ebp - 0xa8]
mov ecx, edi
mov dword [esi + 4], edi
sar ecx, 1
dec eax
mov dword [esi + 0xc], ecx
mov ecx, dword [ebx]
mov ecx, dword [ecx]
add eax, ecx
mov ecx, dword [ebp - 0xa8]
div ecx
mov dword [esi + 8], eax
mov eax, dword [ebp - 0x9c]
mov eax, dword [eax + 0x28]
mov dword [esi - 4], eax
mov dword [esi - 8], eax
cmp ecx, 1
jne 0x59cc2e
cmp edi, ecx
jne 0x59cc22
mov eax, 0x59d480
jmp 0x59cc51
cmp edi, 2
jne 0x59cc4c
mov eax, 0x5ab0e0
jmp 0x59cc51
cmp ecx, 2
jne 0x59cc4c
cmp edi, 1
jne 0x59cc3f
mov eax, 0x5aadd0
jmp 0x59cc51
cmp edi, 2
jne 0x59cc4c
mov eax, dword [ebx + 0x4814]
jmp 0x59cc51
mov eax, 0x5aad80
mov edi, dword [ebp - 0x9c]
mov dword [esi - 0xc], eax
add edi, 0x48
mov eax, dword [ebp - 0x98]
add esi, 0x20
inc eax
mov dword [ebp - 0x9c], edi
mov dword [ebp - 0x98], eax
cmp eax, dword [ebp - 0xa0]
jl 0x59cba0
mov esi, dword [ebx]
jmp 0x59cc8f
mov dword [ebp - 0xac], edx
mov dword [ebp - 0xa0], ecx
mov ecx, dword [ebp - 0xa4]
mov edi, dword [esi + 4]
mov esi, dword [esi]
test ecx, ecx
js 0x59d40c
test esi, esi
js 0x59d40c
je 0x59ccbc
mov eax, Ordinal_1
cdq
idiv esi
cmp ecx, eax
jg 0x59d40c
mov eax, esi
imul eax, ecx
mov dword [ebp - 0xb8], eax
test eax, eax
js 0x59d40c
test edi, edi
js 0x59d40c
je 0x59cced
mov eax, Ordinal_1
cdq
idiv edi
cmp dword [ebp - 0xb8], eax
jg 0x59d40c
imul esi, edi
imul esi, ecx
cmp esi, 0x7ffffffe
jg 0x59d40c
lea eax, [esi + 1]
push eax
call fcn.005b7d4f
mov ecx, eax
add esp, 4
mov eax, dword [ebx]
mov dword [ebp - 0xa8], ecx
test ecx, ecx
je 0x59d40e
xor edx, edx
mov dword [ebp - 0xb8], edx
cmp dword [eax + 4], edx
jbe 0x59d3b0
mov edi, dword [ebp - 0x14]
mov dword [ebp - 0xa8], ecx
jmp 0x59cd46
mov ecx, dword [ebp - 0xa8]
mov esi, dword [eax]
imul esi, edx
mov edx, dword [ebp - 0xa4]
mov dword [ebp - 0x98], 0
imul esi, edx
add esi, ecx
cmp dword [ebp - 0xa0], 0
mov dword [ebp - 0xb4], esi
jle 0x59ce5c
mov esi, dword [ebp - 0xa0]
lea eax, [ebx + 0x46bc]
mov dword [ebp - 0x9c], eax
lea edi, [ebp - 0x7c]
mov ebx, eax
jmp 0x59cd96
mov ecx, dword [ebp - 0xa8]
mov eax, dword [ebp - 0xac]
mov edx, esi
mov dword [ebp - 0xa0], eax
mov dword [ebp - 0xac], eax
mov eax, dword [edi - 8]
sar eax, 1
mov dword [ebp - 0x9c], ecx
mov dword [ebp - 0xa8], ecx
cmp dword [edi], eax
jl 0x59cde1
mov esi, dword [ebp - 0x9c]
mov eax, dword [edi - 0x10]
mov ecx, dword [edi - 0x14]
mov dword [ebp - 0xa8], esi
mov esi, dword [ebp - 0xa0]
mov dword [ebp - 0xac], esi
mov esi, edx
jmp 0x59cde7
mov eax, dword [edi - 0x14]
mov ecx, dword [edi - 0x10]
push dword [edi - 0xc]
push dword [edi - 4]
push ecx
push eax
push dword [ebx + 0x18]
call dword [edi - 0x18]
mov ecx, dword [ebp - 0x98]
add esp, 0x14
mov dword [ebp + ecx*4 - 0x14], eax
mov eax, dword [edi]
inc eax
mov dword [edi], eax
cmp eax, dword [edi - 8]
jl 0x59ce2a
inc dword [edi + 4]
mov eax, dword [edi + 4]
mov edx, dword [edi - 0x10]
mov dword [edi], 0
mov dword [edi - 0x14], edx
cmp eax, dword [ebx]
jge 0x59ce2a
mov eax, dword [ebx + 4]
add eax, edx
mov dword [edi - 0x10], eax
inc ecx
add edi, 0x20
add ebx, 0x48
mov dword [ebp - 0x98], ecx
cmp ecx, esi
jl 0x59cd90
mov ebx, dword [ebp - 0xc4]
mov edi, dword [ebp - 0x14]
mov edx, dword [ebp - 0xa4]
mov dword [ebp - 0xa0], esi
mov eax, dword [ebx]
mov esi, dword [ebp - 0xb4]
cmp edx, 3
jl 0x59d0ff
mov ecx, dword [eax + 8]
cmp ecx, 3
jne 0x59cf08
cmp dword [ebp - 0xac], 0
je 0x59ceeb
cmp dword [eax], 0
mov dword [ebp - 0xb4], 0
jbe 0x59d0f8
mov ecx, dword [ebp - 0x10]
mov eax, edi
mov edi, dword [ebp - 0xc]
sub eax, ecx
add esi, 2
mov dword [ebp - 0x9c], eax
sub edi, ecx
mov dword [ebp - 0x98], edi
mov edi, dword [ebp - 0xb4]
nop
movzx eax, byte [eax + ecx]
lea ecx, [ecx + 1]
mov byte [esi - 2], al
inc edi
movzx eax, byte [ecx - 1]
mov byte [esi - 1], al
mov eax, dword [ebp - 0x98]
movzx eax, byte [eax + ecx - 1]
mov byte [esi], al
mov byte [esi + 1], 0xff
add esi, edx
mov eax, dword [ebx]
cmp edi, dword [eax]
mov eax, dword [ebp - 0x9c]
jb 0x59ceb0
mov edi, dword [ebp - 0x14]
mov eax, dword [ebx]
jmp 0x59d39a
push edx
push dword [eax]
mov eax, dword [ebx + 0x4810]
push dword [ebp - 0xc]
push dword [ebp - 0x10]
push edi
push esi
call eax
mov eax, dword [ebx]
add esp, 0x18
jmp 0x59d39a
cmp ecx, 4
jne 0x59d0d7
mov ecx, dword [ebx + 0x47e8]
test ecx, ecx
jne 0x59d009
mov dword [ebp - 0x98], ecx
cmp dword [eax], ecx
jbe 0x59d0f8
mov edx, dword [ebp - 0x10]
add esi, 2
mov dword [ebp - 0xb4], esi
mov eax, edi
mov esi, dword [ebp - 8]
mov ecx, esi
mov edi, dword [ebp - 0xb4]
sub edx, esi
mov dword [ebp - 0xbc], edx
sub eax, esi
mov edx, dword [ebp - 0xc]
sub edx, esi
mov dword [ebp - 0x9c], esi
mov esi, dword [ebp - 0xa4]
mov dword [ebp - 0xb0], eax
mov dword [ebp - 0xc0], edx
nop dword [eax]
movzx edx, byte [ecx]
movzx ecx, byte [eax + ecx]
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
mov ecx, dword [ebp - 0xbc]
shr eax, 8
mov byte [edi - 2], al
mov eax, dword [ebp - 0x9c]
movzx ecx, byte [ecx + eax]
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
mov ecx, dword [ebp - 0xc0]
shr eax, 8
mov byte [edi - 1], al
mov eax, dword [ebp - 0x9c]
movzx ecx, byte [ecx + eax]
imul ecx, edx
mov edx, dword [ebp - 0x98]
mov byte [edi + 1], 0xff
inc edx
mov dword [ebp - 0x98], edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
mov ecx, dword [ebp - 0x9c]
shr eax, 8
inc ecx
mov byte [edi], al
add edi, esi
mov eax, dword [ebx]
mov dword [ebp - 0x9c], ecx
cmp edx, dword [eax]
mov eax, dword [ebp - 0xb0]
jb 0x59cf70
mov edi, dword [ebp - 0x14]
mov eax, dword [ebx]
jmp 0x59d39a
mov eax, dword [eax]
mov edi, dword [ebx + 0x4810]
mov dword [ebp - 0x98], edi
mov edi, dword [ebp - 0x14]
push edx
push eax
push dword [ebp - 0xc]
push dword [ebp - 0x10]
push edi
push esi
cmp ecx, 2
jne 0x59d0c7
call dword [ebp - 0x98]
mov eax, dword [ebx]
xor ecx, ecx
add esp, 0x18
mov dword [ebp - 0x98], ecx
cmp dword [eax], ecx
jbe 0x59d0f8
mov edi, dword [ebp - 0xa4]
add esi, 2
mov eax, dword [ebp - 8]
movzx edx, byte [ecx + eax]
movzx eax, byte [esi - 2]
not al
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 2], al
movzx eax, byte [esi - 1]
not al
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
shr eax, 8
mov byte [esi - 1], al
movzx eax, byte [esi]
not al
movzx ecx, al
imul ecx, edx
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
mov ecx, dword [ebp - 0x98]
shr eax, 8
inc ecx
mov byte [esi], al
add esi, edi
mov eax, dword [ebx]
mov dword [ebp - 0x98], ecx
cmp ecx, dword [eax]
jb 0x59d051
mov edi, dword [ebp - 0x14]
jmp 0x59d39a
call dword [ebp - 0x98]
mov eax, dword [ebx]
add esp, 0x18
jmp 0x59d39a
xor ecx, ecx
cmp dword [eax], ecx
jbe 0x59d0f8
inc esi
nop
mov al, byte [ecx + edi]
inc ecx
mov byte [esi + 1], al
mov byte [esi], al
mov byte [esi - 1], al
mov byte [esi + 2], 0xff
add esi, edx
mov eax, dword [ebx]
cmp ecx, dword [eax]
jb 0x59d0e0
mov eax, dword [ebx]
jmp 0x59d39a
cmp dword [ebp - 0xac], 0
je 0x59d1ed
mov ecx, dword [eax]
mov dword [ebp - 0x98], 0
cmp edx, 1
jne 0x59d185
test ecx, ecx
je 0x59d39a
mov eax, dword [ebp - 0x14]
mov edx, eax
mov ecx, dword [ebp - 0xc]
mov edi, dword [ebp - 0x10]
sub ecx, eax
sub edi, eax
mov dword [ebp - 0xb0], ecx
sub esi, eax
nop dword [eax]
movzx eax, byte [ecx + edx]
lea edx, [edx + 1]
imul ecx, eax, 0x1d
movzx eax, byte [edi + edx - 1]
imul eax, eax, 0x96
add ecx, eax
movzx eax, byte [edx - 1]
imul eax, eax, 0x4d
add ecx, eax
shr ecx, 8
mov byte [esi + edx - 1], cl
mov ecx, dword [ebp - 0x98]
mov eax, dword [ebx]
inc ecx
mov dword [ebp - 0x98], ecx
cmp ecx, dword [eax]
mov ecx, dword [ebp - 0xb0]
jb 0x59d140
jmp 0x59d397
test ecx, ecx
je 0x59d39a
mov eax, dword [ebp - 0x14]
mov edx, eax
mov edi, dword [ebp - 0x10]
mov ecx, dword [ebp - 0xc]
sub edi, eax
sub ecx, eax
mov dword [ebp - 0xb0], ecx
movzx eax, byte [edx + ecx]
lea edx, [edx + 1]
imul ecx, eax, 0x1d
lea esi, [esi + 2]
movzx eax, byte [edx + edi - 1]
imul eax, eax, 0x96
add ecx, eax
movzx eax, byte [edx - 1]
imul eax, eax, 0x4d
mov byte [esi - 1], 0xff
add ecx, eax
shr ecx, 8
mov byte [esi - 2], cl
mov ecx, dword [ebp - 0x98]
mov eax, dword [ebx]
inc ecx
mov dword [ebp - 0x98], ecx
cmp ecx, dword [eax]
mov ecx, dword [ebp - 0xb0]
jb 0x59d1a2
jmp 0x59d397
cmp dword [eax + 8], 4
jne 0x59d348
mov ecx, dword [ebx + 0x47e8]
test ecx, ecx
jne 0x59d2e8
mov dword [ebp - 0x98], ecx
cmp dword [eax], ecx
jbe 0x59d39a
mov edi, dword [ebp - 8]
mov edx, edi
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x14]
sub eax, edi
mov dword [ebp - 0xb0], eax
sub ecx, edi
mov eax, dword [ebp - 0xc]
sub eax, edi
mov dword [ebp - 0x9c], edi
mov dword [ebp - 0xbc], ecx
mov dword [ebp - 0xc0], eax
nop
movzx edi, byte [edx + ecx]
movzx eax, byte [edx]
mov ecx, dword [ebp - 0xb0]
mov ebx, dword [ebp - 0xc0]
imul edi, eax
movzx ecx, byte [edx + ecx]
movzx edx, byte [edx + ebx]
imul ecx, eax
imul edx, eax
sub edi, 0xffffff80
mov ebx, dword [ebp - 0xc4]
mov byte [esi + 1], 0xff
sub ecx, 0xffffff80
mov eax, ecx
sub edx, 0xffffff80
shr eax, 8
add eax, ecx
shr eax, 8
movzx eax, al
imul ecx, eax, 0x96
mov eax, edx
shr eax, 8
add eax, edx
mov edx, dword [ebp - 0x9c]
shr eax, 8
inc edx
movzx eax, al
imul eax, eax, 0x1d
mov dword [ebp - 0x9c], edx
add ecx, eax
mov eax, edi
shr eax, 8
add eax, edi
shr eax, 8
movzx eax, al
imul eax, eax, 0x4d
add ecx, eax
shr ecx, 8
mov byte [esi], cl
mov ecx, dword [ebp - 0x98]
mov eax, dword [ebx]
inc ecx
add esi, dword [ebp - 0xa4]
mov dword [ebp - 0x98], ecx
cmp ecx, dword [eax]
mov ecx, dword [ebp - 0xbc]
jb 0x59d240
jmp 0x59d397
cmp ecx, 2
jne 0x59d348
cmp dword [eax], 0
mov dword [ebp - 0x98], 0
jbe 0x59d39a
mov edi, dword [ebp - 0x14]
mov edx, dword [ebp - 8]
sub edi, edx
mov al, byte [edi + edx]
lea edx, [edx + 1]
not al
movzx ecx, al
movzx eax, byte [edx - 1]
imul ecx, eax
mov byte [esi + 1], 0xff
sub ecx, 0xffffff80
mov eax, ecx
shr eax, 8
add eax, ecx
mov ecx, dword [ebp - 0x98]
shr eax, 8
inc ecx
mov byte [esi], al
mov eax, dword [ebx]
add esi, dword [ebp - 0xa4]
mov dword [ebp - 0x98], ecx
cmp ecx, dword [eax]
jb 0x59d308
jmp 0x59d397
mov ecx, dword [eax]
mov dword [ebp - 0x98], ecx
xor ecx, ecx
cmp edx, 1
jne 0x59d376
cmp dword [ebp - 0x98], ecx
jbe 0x59d39a
mov edx, dword [ebp - 0x14]
sub edx, esi
mov al, byte [edx + esi]
lea esi, [esi + 1]
mov byte [esi - 1], al
inc ecx
mov eax, dword [ebx]
cmp ecx, dword [eax]
jb 0x59d364
jmp 0x59d397
cmp dword [ebp - 0x98], ecx
jbe 0x59d39a
nop
mov eax, dword [ebp - 0x14]
lea esi, [esi + 2]
mov al, byte [ecx + eax]
inc ecx
mov byte [esi - 2], al
mov byte [esi - 1], 0xff
mov eax, dword [ebx]
cmp ecx, dword [eax]
jb 0x59d380
mov edi, dword [ebp - 0x14]
mov edx, dword [ebp - 0xb8]
inc edx
mov dword [ebp - 0xb8], edx
cmp edx, dword [eax + 4]
jb 0x59cd40
push 0
push dword [eax + 8]
push ebx
call fcn.005a1370
mov eax, dword [ebx]
add esp, 0xc
mov ecx, dword [ebp - 0xc8]
mov eax, dword [eax]
mov dword [ecx], eax
mov eax, dword [ebx]
mov ecx, dword [ebp - 0xcc]
mov eax, dword [eax + 4]
mov dword [ecx], eax
mov eax, dword [ebp - 0xd0]
test eax, eax
je 0x59d3f5
mov ecx, dword [ebx]
xor edx, edx
cmp dword [ecx + 8], 3
setge dl
lea edx, [edx*2 + 1]
mov dword [eax], edx
mov eax, dword [ebp - 0xa8]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.005b26e6
mov esp, ebp
pop ebp
ret
mov eax, dword [ebx]
push 0
push dword [eax + 8]
push ebx
call fcn.005a1370
mov ecx, dword [0x655918]
add esp, 0xc
mov eax, dword fs:[0x2c]
pop edi
mov eax, dword [eax + ecx*4]
pop esi
pop ebx
mov dword [eax + 0xc], str.outofmem
xor eax, eax
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.005b26e6
mov esp, ebp
pop ebp
ret
mov ecx, dword [0x655918]
mov eax, dword fs:[0x2c]
pop ebx
mov eax, dword [eax + ecx*4]
mov ecx, dword [ebp - 4]
xor ecx, ebp
mov dword [eax + 0xc], str.bad_req_comp
xor eax, eax
call fcn.005b26e6
mov esp, ebp
pop ebp
ret