Function at 0x476670
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0xb30
mov ecx, dword [esp + 0xb44]
push ebx
shl ecx, 8
mov eax, ecx
push ebp
cdq
idiv dword [esp + 0xb44]
push esi
push edi
mov ebx, eax
mov eax, ecx
cdq
idiv dword [esp + 0xb50]
mov edx, dword [esp + 0xb44]
mov dword [esp + 0x3c], ebx
lea ecx, [ebx + edx]
test ecx, ecx
mov dword [esp + 0x10], eax
jl 0x476bc5
mov ecx, dword [0x62bdbc]
sub edx, ebx
cmp edx, ecx
jge 0x476bc5
mov edx, dword [esp + 0xb48]
lea ecx, [eax + edx]
test ecx, ecx
mov dword [esp + 0x18], ecx
jl 0x476bc5
sub edx, eax
mov eax, dword [0x62bdb8]
cmp edx, eax
jge 0x476bc5
mov ecx, dword [0x5adbc0]
mov esi, dword [esp + 0xb58]
mov eax, ecx
shr eax, 2
test esi, esi
jge 0x476729
neg eax
mov dword [esp + 0x30], eax
lea eax, [ecx*4 + 0x100]
lea ebp, [ecx + 0x10]
and eax, 0x3ff
and ebp, 0xff
and ecx, 0x3ff
mov eax, dword [eax*4 + 0x4c692c]
jmp 0x476757
mov dword [esp + 0x30], eax
lea edx, [ecx + 0x100]
lea eax, [ecx*4]
mov ebp, ecx
and edx, 0x3ff
mov ecx, eax
and ebp, 0xff
and ecx, 0x3ff
mov eax, dword [edx*4 + 0x4c692c]
mov edx, dword [ecx*4 + 0x4c692c]
mov ecx, 0x40
add eax, edx
lea edi, [esp + 0x40]
cdq
and edx, 0xfff
add eax, edx
sar eax, 0xc
add eax, 0x32
mov dword [esp + 0x28], eax
xor eax, eax
test esi, esi
rep stosd dword es:[edi], eax
jge 0x4767cd
mov edi, 2
lea esi, [ebp - 2]
mov ecx, edi
sub ecx, ebp
test ecx, ecx
jg 0x476796
mov ecx, esi
and ecx, 0x7f
cmp ecx, 0x40
jle 0x4767a7
mov edx, 0x80
sub edx, ecx
mov ecx, edx
cmp ecx, 0xf
jge 0x4767c1
mov eax, 0x55555556
imul ecx
mov eax, edx
shr eax, 0x1f
add edx, eax
add dl, 0x2a
mov byte [esp + edi + 0x40], dl
inc edi
dec esi
cmp edi, 0x100
jl 0x47678c
jmp 0x47680a
mov ecx, 2
lea esi, [ebp - 2]
mov eax, ecx
sub eax, ebp
test eax, eax
jg 0x4767df
mov eax, esi
and eax, 0x7f
cmp eax, 0x40
jle 0x4767f0
mov edx, 0x80
sub edx, eax
mov eax, edx
cmp eax, 0xe
jge 0x476800
cdq
sub eax, edx
sar eax, 1
add al, 0x28
mov byte [esp + ecx + 0x40], al
inc ecx
dec esi
cmp ecx, 0x100
jl 0x4767d5
mov eax, dword [esp + 0xb44]
mov edx, ebx
neg edx
mov ebp, edx
mov dword [esp + 0x24], ebp
lea ecx, [eax + ebp]
test ecx, ecx
jge 0x47682a
mov ebp, eax
neg ebp
mov dword [esp + 0x24], ebp
mov edi, dword [esp + 0x10]
mov esi, dword [esp + 0xb48]
neg edi
lea ecx, [edi + esi]
test ecx, ecx
jge 0x476842
mov edi, esi
neg edi
lea ecx, [ebx + eax]
mov eax, dword [0x62bdbc]
cmp ecx, eax
mov dword [esp + 0x20], ebx
jl 0x47685d
sub eax, dword [esp + 0xb44]
mov dword [esp + 0x20], eax
mov ecx, dword [esp + 0x18]
mov eax, dword [esp + 0x10]
cmp ecx, dword [0x62bdb8]
mov dword [esp + 0x14], eax
jl 0x47687c
mov eax, dword [0x62bdb8]
sub eax, esi
mov dword [esp + 0x14], eax
cmp edx, ebx
jge 0x4768d0
mov esi, edx
lea ecx, [edx + ebx]
imul esi, dword [esp + 0xb4c]
shl ecx, 2
sub ebx, edx
mov eax, esi
add ecx, 4
cdq
and edx, 0xff
add eax, edx
sar eax, 8
mov edx, eax
imul edx, eax
mov dword [esp + ecx + 0x33c], edx
mov edx, dword [esp + 0xb4c]
shl eax, 6
mov dword [esp + ecx + 0x73c], eax
add esi, edx
dec ebx
jne 0x476892
mov eax, dword [esp + 0x14]
mov esi, dword [esp + 0xb48]
mov ecx, dword [esp + 0xb54]
imul ecx, ecx
mov dword [esp + 0x34], ecx
mov ecx, dword [0x62bd84]
cmp ecx, 8
jne 0x4769ff
lea ebx, [edi + esi]
mov ecx, dword [0x62bdc4]
imul ebx, dword [0x62bdc0]
mov edx, dword [esp + 0xb44]
add ebx, ecx
add ebx, ebp
add ebx, edx
cmp edi, eax
jge 0x476bc5
mov edx, edi
imul edx, dword [esp + 0xb50]
sub eax, edi
mov dword [esp + 0x10], edx
mov dword [esp + 0x1c], eax
mov eax, edx
mov edi, ebp
sar eax, 8
mov ecx, eax
imul ecx, eax
shl eax, 6
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x20]
cmp ebp, eax
mov dword [esp + 0x2c], ecx
jge 0x4769d0
mov eax, dword [esp + 0x3c]
lea esi, [eax + ebp]
mov eax, ebx
shl esi, 2
sub eax, ebp
mov dword [esp + 0x18], eax
jmp 0x476961
mov ecx, dword [esp + 0x2c]
mov eax, dword [esp + 0x34]
mov edx, dword [esp + esi + 0x340]
sub eax, edx
sub eax, ecx
js 0x4769c0
mov edx, dword [esp + 0x28]
xor ecx, ecx
mov cl, byte [eax + 0x4c792c]
mov eax, dword [esp + 0x14]
add ecx, edx
cdq
idiv ecx
mov ebp, eax
mov eax, dword [esp + 0x30]
add ebp, eax
mov eax, dword [esp + esi + 0x740]
cdq
idiv ecx
and ebp, 0x7f
xor ecx, ecx
shl ebp, 7
and eax, 0x7f
mov cl, byte [eax + ebp + 0x5ef740]
xor eax, eax
mov al, byte [esp + ecx + 0x40]
test eax, eax
je 0x4769bc
mov edx, dword [esp + 0x18]
mov byte [edx + edi], al
mov ebp, dword [esp + 0x24]
mov eax, dword [esp + 0x20]
inc edi
add esi, 4
cmp edi, eax
jl 0x47695d
mov edx, dword [esp + 0x10]
mov esi, dword [0x62bdc0]
mov ecx, dword [esp + 0xb50]
mov eax, dword [esp + 0x1c]
add ebx, esi
add edx, ecx
dec eax
mov dword [esp + 0x10], edx
mov dword [esp + 0x1c], eax
jne 0x476926
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xb30
ret
mov ecx, dword [esp + 0xb44]
lea eax, [edi + esi]
imul eax, dword [0x62bdc0]
lea edx, [ecx + ebp]
mov ecx, dword [0x62bdc4]
add ecx, eax
mov eax, 1
lea ebx, [esp + 0x140]
lea edx, [ecx + edx*2]
mov ecx, dword [0x4d1214]
mov dword [esp + 0x10], edx
mov edx, 1
shl eax, cl
mov ecx, dword [0x4d1220]
shl edx, cl
or eax, edx
xor ecx, ecx
mov dl, byte [esp + ecx + 0x40]
test dl, dl
jne 0x476a53
mov esi, eax
jmp 0x476a63
and edx, 0xff
xor esi, esi
mov si, word [edx*2 + 0x5c7b60]
mov word [ebx], si
inc ecx
add ebx, 2
cmp ecx, 0x100
jl 0x476a47
mov eax, dword [esp + 0x14]
cmp edi, eax
jge 0x476bc5
mov edx, edi
imul edx, dword [esp + 0xb50]
sub eax, edi
mov dword [esp + 0x38], edx
mov dword [esp + 0x18], eax
mov eax, edx
mov ebx, dword [esp + 0x10]
sar eax, 8
mov ecx, eax
imul ecx, eax
shl eax, 6
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x20]
cmp ebp, eax
mov dword [esp + 0x2c], ecx
jge 0x476b9a
mov edx, dword [esp + 0x3c]
lea edi, [edx + ebp]
shl edi, 2
sub eax, ebp
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x34]
mov esi, dword [esp + edi + 0x340]
sub eax, esi
sub eax, ecx
js 0x476b81
mov edx, dword [esp + 0x28]
xor ecx, ecx
mov cl, byte [eax + 0x4c792c]
mov eax, dword [esp + 0x14]
add ecx, edx
cdq
idiv ecx
mov esi, eax
mov eax, dword [esp + 0x30]
add esi, eax
mov eax, dword [esp + edi + 0x740]
cdq
idiv ecx
and esi, 0x7f
xor ecx, ecx
shl esi, 7
and eax, 0x7f
mov cl, byte [esi + eax + 0x5ef740]
mov esi, dword [0x4d1228]
mov edx, ecx
xor ecx, ecx
mov ebp, esi
mov cx, word [esp + edx*2 + 0x140]
mov dx, word [ebx]
and edx, 0xffff
and ebp, ecx
mov eax, edx
and eax, esi
add eax, ebp
cmp eax, esi
jbe 0x476b40
mov eax, esi
mov ebp, dword [0x4d121c]
mov esi, edx
and esi, ebp
and ebp, ecx
add esi, ebp
mov ebp, dword [0x4d121c]
cmp esi, ebp
jbe 0x476b5a
mov esi, ebp
mov ebp, dword [0x4d1210]
and edx, ebp
and ebp, ecx
mov ecx, dword [0x4d1210]
add edx, ebp
cmp edx, ecx
jbe 0x476b72
mov edx, ecx
mov ebp, dword [esp + 0x24]
mov ecx, dword [esp + 0x2c]
or edx, esi
or edx, eax
mov word [ebx], dx
mov eax, dword [esp + 0x1c]
add ebx, 2
add edi, 4
dec eax
mov dword [esp + 0x1c], eax
jne 0x476ac7
mov edx, dword [esp + 0x38]
mov eax, dword [0x62bdc0]
mov esi, dword [esp + 0x10]
mov ecx, dword [esp + 0xb50]
add esi, eax
mov eax, dword [esp + 0x18]
add edx, ecx
dec eax
mov dword [esp + 0x10], esi
mov dword [esp + 0x38], edx
mov dword [esp + 0x18], eax
jne 0x476a92
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xb30
ret