Function at 0x413940
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x28
push ebx
push ebp
mov ebp, ecx
push esi
push edi
mov al, byte [ebp + 0x473a]
mov cx, word [ebp + 0x4734]
mov dl, byte [ebp + 0x473b]
mov bx, word [ebp + 0x4736]
mov si, word [ebp + 0x4738]
mov byte [esp + 0x20], al
mov al, byte [ebp + 0x473c]
mov word [esp + 0x24], cx
mov byte [esp + 0x18], al
mov al, byte [esp + 0x4c]
test al, 2
mov byte [esp + 0x1c], dl
mov dword [esp + 0x28], ebx
mov dword [esp + 0x2c], esi
je 0x413a32
lea ecx, [esp + 0x30]
push 1
push ecx
mov ecx, ebp
call fcn.0040bbc0
mov edi, dword [esp + 0x30]
mov cl, byte [esp + 0x18]
mov eax, dword [esp + 0x24]
and edi, 0xff
mov edx, edi
and esi, 0xffff
shr edx, cl
and eax, 0xffff
mov cl, byte [esp + 0x1c]
mov dword [esp + 0x14], eax
and ebx, 0xffff
and edx, esi
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv esi
mov edx, edi
shr edx, cl
mov cl, byte [esp + 0x20]
shr edi, cl
mov ecx, dword [esp + 0x14]
and edx, ebx
and edi, ecx
mov esi, eax
mov eax, edx
shl eax, 8
sub eax, edx
and esi, 0xff
cdq
idiv ebx
or esi, 0x200
mov ebx, dword [esp + 0x28]
shl esi, 8
and eax, 0xff
or esi, eax
mov eax, edi
shl eax, 8
sub eax, edi
cdq
idiv ecx
shl esi, 8
and eax, 0xff
or esi, eax
mov dword [0x44a2b0], esi
jmp 0x413a38
mov esi, dword [0x44a2b0]
mov edx, dword [esp + 0x48]
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x40]
push esi
push edx
mov edx, dword [esp + 0x44]
push eax
push ecx
push edx
mov ecx, ebp
call fcn.0040cc40
test byte [esp + 0x4c], 4
je 0x413afe
lea eax, [esp + 0x34]
push 1
push eax
mov ecx, ebp
call fcn.0040bbc0
mov esi, dword [esp + 0x34]
mov cl, byte [esp + 0x18]
mov edi, dword [esp + 0x2c]
mov eax, dword [esp + 0x24]
and esi, 0xff
and edi, 0xffff
mov edx, esi
and eax, 0xffff
shr edx, cl
mov dword [esp + 0x14], eax
mov cl, byte [esp + 0x1c]
and ebx, 0xffff
and edx, edi
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv edi
mov edx, esi
shr edx, cl
mov cl, byte [esp + 0x20]
shr esi, cl
mov ecx, dword [esp + 0x14]
and edx, ebx
and esi, ecx
mov edi, eax
mov eax, edx
shl eax, 8
sub eax, edx
and edi, 0xff
cdq
idiv ebx
or edi, 0x200
mov ebx, dword [esp + 0x28]
shl edi, 8
and eax, 0xff
or edi, eax
mov eax, esi
shl eax, 8
sub eax, esi
cdq
idiv ecx
shl edi, 8
and eax, 0xff
or edi, eax
mov dword [0x44a2b4], edi
test byte [esp + 0x4c], 8
je 0x413cdb
lea ecx, [esp + 0x10]
push 1
push ecx
mov ecx, ebp
call fcn.0040bbc0
mov al, byte [esp + 0x4c]
mov edi, dword [ebp + 0x4dc]
test al, 0x10
mov eax, dword [esp + 0x10]
je 0x413c6f
and eax, 0xff
mov ecx, ebp
lea edx, [eax + eax*2]
push edx
push edi
call fcn.0040bbc0
mov al, byte [esp + 0x10]
mov dword [esp + 0x4c], 0
test al, al
jbe 0x413cdb
mov eax, dword [esp + 0x1c]
mov esi, dword [esp + 0x2c]
mov ecx, dword [esp + 0x18]
and eax, 0xff
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x20]
and eax, 0xff
and ecx, 0xff
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x24]
and esi, 0xffff
and ebx, 0xffff
and eax, 0xffff
mov dword [esp + 0x48], ecx
mov dword [esp + 0x44], esi
mov dword [esp + 0x28], ebx
mov dword [esp + 0x14], eax
jmp 0x413ba9
mov ecx, dword [esp + 0x48]
mov esi, dword [esp + 0x44]
xor ebx, ebx
mov bl, byte [edi]
mov edx, ebx
shr edx, cl
mov ecx, dword [esp + 0x2c]
and edx, esi
mov eax, edx
shl eax, 8
sub eax, edx
cdq
idiv esi
mov edx, ebx
shr edx, cl
mov ecx, dword [esp + 0x28]
and edx, ecx
mov esi, eax
mov eax, edx
shl eax, 8
sub eax, edx
and esi, 0xff
cdq
idiv ecx
mov ecx, dword [esp + 0x20]
or esi, 0x200
shr ebx, cl
mov ecx, dword [esp + 0x14]
shl esi, 8
and ebx, ecx
and eax, 0xff
or esi, eax
mov eax, ebx
shl eax, 8
sub eax, ebx
cdq
idiv ecx
shl esi, 8
and eax, 0xff
or esi, eax
inc edi
xor eax, eax
mov dword [0x44a2b4], esi
mov al, byte [edi]
push esi
mov edx, eax
and eax, 0xf
shr edx, 4
mov ebx, eax
inc edi
xor eax, eax
mov al, byte [edi]
mov ecx, eax
and eax, 0xf
shr ecx, 4
inc ecx
inc eax
push eax
mov eax, dword [esp + 0x48]
push ecx
mov ecx, dword [esp + 0x48]
add ebx, eax
add edx, ecx
push ebx
push edx
mov ecx, ebp
inc edi
call fcn.0040cc40
mov eax, dword [esp + 0x4c]
mov edx, dword [esp + 0x10]
inc eax
and edx, 0xff
cmp eax, edx
mov dword [esp + 0x4c], eax
jl 0x413ba1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x28
ret 0x14
and eax, 0xff
mov ecx, ebp
shl eax, 1
push eax
push edi
call fcn.0040bbc0
mov al, byte [esp + 0x10]
xor esi, esi
test al, al
jbe 0x413cdb
xor eax, eax
mov al, byte [edi]
mov edx, eax
and eax, 0xf
shr edx, 4
mov ebx, eax
inc edi
xor eax, eax
mov al, byte [edi]
mov ecx, eax
and eax, 0xf
shr ecx, 4
inc ecx
inc eax
mov dword [esp + 0x4c], eax
mov eax, dword [0x44a2b4]
push eax
mov eax, dword [esp + 0x50]
push eax
mov eax, dword [esp + 0x44]
push ecx
mov ecx, dword [esp + 0x4c]
add ebx, ecx
add edx, eax
push ebx
push edx
mov ecx, ebp
inc edi
call fcn.0040cc40
mov ecx, dword [esp + 0x10]
inc esi
and ecx, 0xff
cmp esi, ecx
jl 0x413c89
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x28
ret 0x14