Function at 0x497a80
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0xdd8
cmp dword [esp + 0xde0], 0
push ebx
push esi
push edi
push ebp
jne 0x497aa3
mov ax, 0x65
pop ebp
pop edi
pop esi
pop ebx
add esp, 0xdd8
ret
mov ecx, dword [esp + 0xdf0]
cmp dword [esp + 0xdec], 0
mov dword [ecx], 0
jne 0x497ac9
mov ax, 0x65
pop ebp
pop edi
pop esi
pop ebx
add esp, 0xdd8
ret
mov eax, dword [esp + 0xdec]
mov esi, dword [0x4c258c]
push eax
call esi
mov cx, word [eax + 8]
mov edi, dword [eax + 4]
mov word [esp + 0x12], cx
xor ecx, ecx
mov cx, word [eax + 0xe]
imul ecx, edi
mov word [esp + 0x14], di
lea eax, [ecx + 0x1f]
cdq
and edx, 0x1f
add eax, edx
sar eax, 5
shl eax, 2
mov dword [esp + 0x28], eax
lea eax, [edi*8 + 0x1f]
cdq
and edx, 0x1f
mov ecx, dword [esp + 0xdec]
add eax, edx
push ecx
sar eax, 5
shl eax, 2
mov dword [esp + 0x20], eax
call dword [0x4c2590]
movsx ecx, word [esp + 0x12]
mov edi, dword [esp + 0x1c]
mov dword [esp + 0x18], ecx
imul edi, ecx
lea eax, [edi + 0x428]
push eax
push 0x42
call dword [0x4c2588]
mov dword [esp + 0x20], eax
test eax, eax
jne 0x497b61
mov ax, 0x66
pop ebp
pop edi
pop esi
pop ebx
add esp, 0xdd8
ret
mov eax, dword [esp + 0xdec]
push eax
call esi
mov edx, dword [esp + 0x20]
mov dword [esp + 0x24], eax
push edx
call esi
mov dword [eax], 0x28
mov ebx, eax
movsx eax, word [esp + 0x14]
mov ecx, dword [esp + 0x18]
mov dword [ebx + 4], eax
xor eax, eax
mov dword [ebx + 8], ecx
mov word [ebx + 0xc], 1
mov word [ebx + 0xe], 8
mov ecx, 0x100
mov dword [ebx + 0x10], eax
mov dword [ebx + 0x14], edi
mov dword [ebx + 0x18], eax
mov esi, dword [esp + 0xdf4]
mov dword [ebx + 0x1c], eax
mov dword [ebx + 0x20], ecx
mov dword [ebx + 0x24], ecx
mov dword [ebx + 0x14], edi
mov edi, dword [ebx]
add edi, ebx
rep movsd dword es:[edi], dword [esi]
mov si, 0xff01
mov cx, si
lea eax, [esi + 0xff]
movsx edi, ax
movsx eax, si
inc si
add eax, 8
cdq
and edx, 0xf
mov ebp, 0xa
add eax, edx
sar eax, 4
mov byte [esp + edi + 0xbe8], al
movsx ax, al
sub cx, ax
movsx eax, cx
lea eax, [eax*2 + 5]
cdq
idiv ebp
mov ebp, 0xc
mov byte [esp + edi + 0x7e8], al
movsx ax, al
sub cx, ax
movsx edx, cx
lea eax, [edx + edx*4 + 6]
cdq
idiv ebp
sub cl, al
mov byte [esp + edi + 0x9e8], al
cmp si, 0x100
mov byte [esp + edi + 0x5e8], cl
jl 0x497bc6
xor ax, ax
xor ecx, ecx
movsx edx, ax
inc ax
mov word [esp + edx*2 + 0x30], cx
cmp ax, 0xf6
jl 0x497c3c
mov edx, dword [esp + 0x18]
mov eax, dword [esp + 0x1c]
dec edx
imul eax, edx
lea ecx, [eax + ebx + 0x428]
mov eax, dword [esp + 0x24]
mov dword [esp + 0x18], ecx
mov ecx, dword [esp + 0x28]
imul ecx, edx
lea edx, [ecx + eax + 0x28]
mov ax, word [esp + 0x12]
mov dword [esp + 0x2c], edx
dec ax
cmp ax, 0xffff
jle 0x497f11
inc ax
mov word [esp + 0x24], ax
mov eax, dword [esp + 0x28]
lea edi, [esp + 0x21c]
mov esi, dword [esp + 0x2c]
mov ecx, eax
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea esi, [esp + 0x30]
lea edi, [esp + 0x30c]
mov ecx, 0x7b
rep movsd dword es:[edi], dword [esi]
mov word [esp + 0x3a], 0
mov word [esp + 0x38], 0
mov word [esp + 0x36], 0
xor cx, cx
xor dx, dx
xor si, si
mov word [esp + 0x16], cx
mov word [esp + 0x12], cx
cmp word [esp + 0x14], cx
jle 0x497ed9
mov eax, dword [esp + 0x16]
inc word [esp + 0x16]
and eax, 0xffff
add cx, word [esp + eax*2 + 0x312]
add dx, word [esp + eax*2 + 0x314]
add si, word [esp + eax*2 + 0x316]
sar cx, 1
movzx ax, byte [esp + eax + 0x21c]
sar dx, 1
add cx, ax
mov eax, dword [esp + 0x16]
inc word [esp + 0x16]
and eax, 0xffff
sar si, 1
movzx ax, byte [esp + eax + 0x21c]
add dx, ax
mov eax, dword [esp + 0x16]
inc word [esp + 0x16]
and eax, 0xffff
movzx ax, byte [esp + eax + 0x21c]
add si, ax
test cx, cx
jge 0x497d6c
xor cx, cx
jmp 0x497d77
cmp cx, 0xff
jle 0x497d77
mov cx, 0xff
test dx, dx
jge 0x497d81
xor dx, dx
jmp 0x497d8c
cmp dx, 0xff
jle 0x497d8c
mov dx, 0xff
test si, si
jge 0x497d96
xor si, si
jmp 0x497da1
cmp si, 0xff
jle 0x497da1
mov si, 0xff
mov di, si
and di, 0xf8
shl di, 5
mov ax, dx
and ax, 0xf8
or di, ax
shl di, 2
mov ax, cx
shr ax, 3
or di, ax
mov eax, dword [esp + 0xdf8]
movzx ebx, di
movsx edi, word [esp + 0x12]
inc word [esp + 0x12]
mov al, byte [ebx + eax]
xor ebx, ebx
mov byte [esp + edi + 0x4f8], al
mov bl, al
mov eax, dword [esp + 0xdf4]
lea ebx, [eax + ebx*4]
movzx ax, byte [ebx]
sub cx, ax
mov eax, dword [esp + 0x16]
add cx, 0xff
and eax, 0xffff
movsx ebp, cx
lea edi, [eax*2]
movsx cx, byte [esp + ebp + 0x5e8]
movsx ax, byte [esp + ebp + 0x7e8]
add word [esp + edi + 0x2a], ax
movsx ax, byte [esp + ebp + 0x9e8]
add word [esp + edi + 0x30], ax
movzx ax, byte [ebx + 1]
sub dx, ax
movzx bx, byte [ebx + 2]
add dx, 0xff
movsx bp, byte [esp + ebp + 0xbe8]
sub si, bx
movsx eax, dx
add si, 0xff
movsx dx, byte [esp + eax + 0x5e8]
mov word [esp + edi + 0x36], bp
movsx ebx, si
movsx bp, byte [esp + eax + 0x7e8]
movsx si, byte [esp + ebx + 0x5e8]
add word [esp + edi + 0x2c], bp
movsx bp, byte [esp + eax + 0x9e8]
movsx ax, byte [esp + eax + 0xbe8]
add word [esp + edi + 0x32], bp
mov word [esp + edi + 0x38], ax
movsx bp, byte [esp + ebx + 0x9e8]
movsx ax, byte [esp + ebx + 0x7e8]
add word [esp + edi + 0x2e], ax
mov ax, word [esp + 0x12]
movsx bx, byte [esp + ebx + 0xbe8]
add word [esp + edi + 0x34], bp
mov word [esp + edi + 0x3a], bx
cmp ax, word [esp + 0x14]
jl 0x497cf0
mov eax, dword [esp + 0x1c]
lea esi, [esp + 0x4f8]
mov edi, dword [esp + 0x18]
mov ecx, eax
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [esp + 0x1c]
mov ecx, dword [esp + 0x28]
sub dword [esp + 0x18], eax
sub dword [esp + 0x2c], ecx
dec word [esp + 0x24]
jne 0x497c8e
mov eax, dword [esp + 0xdec]
push eax
call dword [0x4c2590]
mov edx, dword [esp + 0x20]
push edx
call dword [0x4c2590]
xor ax, ax
mov ecx, dword [esp + 0xdf0]
mov edx, dword [esp + 0x20]
pop ebp
pop edi
mov dword [ecx], edx
pop esi
pop ebx
add esp, 0xdd8
ret