Function at 0x580840
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x3c
mov dword [esp + 0xc], edx
mov dword [esp], ecx
mov ebp, dword [esp + 0x5c]
mov ebx, dword [esp + 0x58]
mov eax, dword [esp + 0x68]
xor edi, edi
test eax, eax
cmovle eax, edi
mov dword [esp + 0x14], eax
mov edx, dword [esp + 0x6c]
mov al, 1
mov dword [esp + 4], eax
test dl, 0x40
jne 0x580892
test ebp, ebp
js 0x58089c
test dl, 2
jne 0x5808b9
mov ecx, edx
and ecx, 4
sete al
mov dword [esp + 4], eax
shl ecx, 3
mov dword [esp + 8], ecx
jmp 0x5808c9
mov dword [esp + 8], 0
jmp 0x5808c9
mov dword [esp + 4], 0
neg ebx
mov eax, 0
sbb eax, ebp
mov dword [esp + 8], 0x2d
mov ebp, eax
jmp 0x5808c9
mov dword [esp + 8], 0x2b
mov dword [esp + 4], 0
mov esi, dword [esp + 0x60]
cmp esi, 8
mov eax, 0x9f2390
mov ecx, 0x9f238f
cmove ecx, eax
cmp esi, 0x10
mov eax, 0x9f2392
cmovne eax, ecx
mov dword [esp + 0x10], eax
test dl, 0x20
mov eax, str.0123456789abcdef
mov ecx, 0x9f2395
cmove ecx, eax
mov dword [esp + 0x18], ecx
mov edx, ebp
nop word cs:[eax + eax]
mov dword [esp + 0x1c], edi
push 0
mov ebp, dword [esp + 0x64]
push ebp
push edx
push ebx
mov edi, edx
call fcn.0078a290
add esp, 0x10
mov ecx, eax
imul ecx, ebp
mov esi, ebx
sub esi, ecx
cmp ebx, ebp
mov ebp, dword [esp + 0x1c]
mov ecx, dword [esp + 0x18]
movzx ecx, byte [ecx + esi]
mov byte [esp + ebp + 0x22], cl
sbb edi, 0
lea ecx, [ebp + 1]
jb 0x580953
mov ebx, eax
cmp ebp, 0x19
mov edi, ecx
jb 0x580910
mov eax, dword [esp + 0x6c]
test al, 8
mov eax, 0x9f238f
mov edx, dword [esp + 0x10]
cmove edx, eax
lea ebp, [ecx - 1]
cmp ecx, 0x1a
cmovne ebp, ecx
mov byte [esp + ebp + 0x22], 0
mov edi, dword [esp + 0x14]
mov esi, edi
sub esi, ebp
cmovle edi, ebp
mov eax, dword [esp + 4]
mov ebx, eax
xor bl, 1
mov dword [esp + 0x10], edx
push edx
call sub.api_ms_win_crt_string_l1_1_0.dll_strlen
add esp, 4
movzx ecx, bl
mov edx, dword [esp + 0x64]
sub edx, ecx
add eax, edi
sub edx, eax
xor eax, eax
test esi, esi
cmovle esi, eax
test edx, edx
cmovle edx, eax
cmp esi, edx
mov edi, edx
cmova edi, esi
mov ecx, dword [esp + 0x6c]
test cl, 0x10
cmovne edx, eax
cmove edi, esi
mov esi, edx
neg esi
test cl, 1
cmove esi, edx
test esi, esi
jle 0x580a10
inc esi
mov ebx, dword [esp + 0xc]
nop word cs:[eax + eax]
mov ecx, dword [esp]
mov edx, ebx
push 0x20
push dword [esp + 0x58]
push dword [esp + 0x58]
call fcn.00580740
add esp, 0xc
test eax, eax
je 0x580b0e
dec esi
cmp esi, 1
jg 0x5809e0
xor esi, esi
cmp byte [esp + 4], 0
je 0x580a1b
jmp 0x580a3c
mov ebx, dword [esp + 0xc]
cmp byte [esp + 4], 0
jne 0x580a3c
mov ecx, dword [esp]
mov edx, ebx
push dword [esp + 8]
push dword [esp + 0x58]
push dword [esp + 0x58]
call fcn.00580740
add esp, 0xc
test eax, eax
je 0x580b0e
mov ebx, dword [esp + 0x10]
movzx eax, byte [ebx]
test al, al
je 0x580a7b
inc ebx
nop dword [eax + eax]
movsx eax, al
mov ecx, dword [esp]
mov edx, dword [esp + 0xc]
push eax
push dword [esp + 0x58]
push dword [esp + 0x58]
call fcn.00580740
add esp, 0xc
test eax, eax
je 0x580b0e
movzx eax, byte [ebx]
inc ebx
test al, al
jne 0x580a50
test edi, edi
mov ebx, dword [esp + 0xc]
je 0x580ae0
inc edi
nop word cs:[eax + eax]
mov ecx, dword [esp]
mov edx, ebx
push 0x30
push dword [esp + 0x58]
push dword [esp + 0x58]
call fcn.00580740
add esp, 0xc
test eax, eax
je 0x580b0e
dec edi
cmp edi, 1
jg 0x580a90
jmp 0x580ae0
movsx eax, byte [esp + ebp + 0x21]
dec ebp
mov ecx, dword [esp]
mov edx, ebx
push eax
push dword [esp + 0x58]
push dword [esp + 0x58]
call fcn.00580740
add esp, 0xc
test eax, eax
je 0x580b0e
test ebp, ebp
jg 0x580ac0
mov eax, 1
test esi, esi
jns 0x580b10
jmp 0x580af3
inc esi
je 0x580b18
mov ecx, dword [esp]
mov edx, ebx
push 0x20
push dword [esp + 0x58]
push dword [esp + 0x58]
call fcn.00580740
add esp, 0xc
test eax, eax
jne 0x580af0
xor eax, eax
add esp, 0x3c
pop esi
pop edi
pop ebx
pop ebp
ret
mov eax, 1
jmp 0x580b10