Function at 0x40c840
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x3c
mov dword [esp + 0x24], eax
mov ebp, dword [esp + 0x50]
test ecx, ecx
js 0x40c890
test ebp, ebp
js 0x40c890
mov ebx, edx
mov esi, ecx
je 0x40c8c8
mov eax, 0x7fffffff
xor edx, edx
idiv ebp
cmp ecx, eax
jg 0x40c890
mov edx, dword [esp + 0x54]
test edx, edx
js 0x40c890
je 0x40c967
mov eax, 0x7fffffff
xor edx, edx
mov ecx, ebp
idiv dword [esp + 0x54]
imul ecx, esi
cmp ecx, eax
jle 0x40c997
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sym._free
mov dword [esp], 0x4e9010
call sym.___emutls_get_address
mov dword [eax], str.Out_of_memory
mov dword [esp + 0x20], 0
mov eax, dword [esp + 0x20]
add esp, 0x3c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ecx, dword [esp + 0x54]
test ecx, ecx
js 0x40c890
mov dword [esp], 0
call sym._malloc
mov dword [esp + 0x20], eax
test eax, eax
je 0x40c890
mov eax, dword [esp + 0x54]
test eax, eax
je 0x40c97f
mov eax, esi
mov edx, dword [esp + 0x20]
lea ecx, [ebp + ebp]
imul eax, ebp
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x18], eax
lea eax, [edx + ebp]
mov dword [esp + 0x10], eax
mov eax, ebx
lea ebx, [esi + ebx*8 - 0xa]
imul eax, ebp
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x24]
mov dword [esp + 0x28], eax
lea edi, [eax + ebp]
cmp ebx, 0x19
ja case.0x40c92d.13
jmp dword [ebx*4 + 0x4ea7d4]
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sym._free
mov eax, dword [esp + 0x20]
mov dword [esp], eax
call sym._free
mov dword [esp], 0x4e9010
call sym.___emutls_get_address
mov dword [eax], str.Unsupported_format_conversion
jmp 0x40c8ae
mov dword [esp], 0
call sym._malloc
mov dword [esp + 0x20], eax
test eax, eax
je 0x40c890
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sym._free
mov eax, dword [esp + 0x20]
add esp, 0x3c
pop ebx
pop esi
pop edi
pop ebp
ret
imul ecx, dword [esp + 0x54]
mov dword [esp], ecx
call sym._malloc
mov dword [esp + 0x20], eax
test eax, eax
jne 0x40c8f0
jmp 0x40c890
mov esi, dword [esp + 0x18]
mov ebx, dword [esp + 0x10]
xor ecx, ecx
lea esi, [esi]
test ebp, ebp
je 0x40ca10
mov dword [esp + 0x10], ecx
movzx ecx, byte [eax]
add eax, 1
mov byte [edx + 1], 0xff
add edx, 2
mov byte [edx - 2], cl
cmp eax, edi
jne 0x40c9d0
mov ecx, dword [esp + 0x10]
mov edi, dword [esp + 0x14]
add ebx, esi
add ecx, 1
add edi, eax
cmp dword [esp + 0x54], ecx
je 0x40c97f
mov eax, edi
mov edx, ebx
sub eax, ebp
sub edx, ebp
jmp 0x40c9c8
add ecx, 1
cmp dword [esp + 0x54], ecx
jne 0x40ca10
jmp 0x40c97f
mov ebx, edi
mov edi, dword [esp + 0x28]
xor esi, esi
lea esi, [esi]
lea esi, [esi]
test ebp, ebp
je 0x40ca90
mov dword [esp + 0x28], ebx
add edi, ecx
lea esi, [esi]
movzx ebx, byte [eax]
movzx ecx, word [0x4ece60]
add eax, 2
add edx, 3
mov cl, bl
mov byte [edx - 1], bl
mov ch, bl
mov word [edx - 3], cx
cmp eax, edi
jne 0x40ca40
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x28]
add esi, 1
add dword [esp + 0x10], eax
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x10]
add ebx, eax
cmp dword [esp + 0x54], esi
je 0x40c97f
mov edi, ebx
mov ecx, dword [esp + 0x1c]
sub edx, ebp
sub edi, ebp
mov eax, edi
jmp 0x40ca30
add esi, 1
cmp dword [esp + 0x54], esi
jne 0x40ca90
jmp 0x40c97f
movzx esi, word [0x4ece60]
mov ecx, dword [esp + 0x10]
xor ebx, ebx
lea esi, [esi]
nop
test ebp, ebp
je 0x40cb08
mov dword [esp + 0x10], ecx
mov dword [esp + 0x1c], ebx
lea esi, [esi]
movzx ebx, byte [eax]
mov ecx, esi
add eax, 1
add edx, 3
mov cl, bl
mov byte [edx - 1], bl
mov ch, bl
mov word [edx - 3], cx
cmp eax, edi
jne 0x40cac0
mov edi, dword [esp + 0x18]
mov ecx, dword [esp + 0x10]
mov ebx, dword [esp + 0x1c]
add ecx, edi
mov edi, dword [esp + 0x14]
add ebx, 1
add edi, eax
cmp dword [esp + 0x54], ebx
je 0x40c97f
mov eax, edi
mov edx, ecx
sub eax, ebp
sub edx, ebp
jmp 0x40cab0
add ebx, 1
cmp dword [esp + 0x54], ebx
jne 0x40cb08
jmp 0x40c97f
movzx esi, word [0x4ece60]
mov ecx, dword [esp + 0x10]
xor ebx, ebx
lea esi, [esi]
nop
test ebp, ebp
je 0x40cb88
mov dword [esp + 0x10], ecx
mov dword [esp + 0x1c], ebx
lea esi, [esi]
movzx ebx, byte [eax]
mov ecx, esi
add eax, 1
mov byte [edx + 3], 0xff
add edx, 4
mov cl, bl
mov byte [edx - 2], bl
mov ch, bl
mov word [edx - 4], cx
cmp eax, edi
jne 0x40cb38
mov edi, dword [esp + 0x18]
mov ecx, dword [esp + 0x10]
mov ebx, dword [esp + 0x1c]
add ecx, edi
mov edi, dword [esp + 0x14]
add ebx, 1
add edi, eax
cmp dword [esp + 0x54], ebx
je 0x40c97f
mov eax, edi
mov edx, ecx
sub eax, ebp
sub edx, ebp
jmp 0x40cb28
add ebx, 1
cmp dword [esp + 0x54], ebx
jne 0x40cb88
jmp 0x40c97f
mov esi, dword [esp + 0x28]
xor ebx, ebx
lea esi, [esi]
test ebp, ebp
je 0x40cbf8
add ecx, esi
mov esi, ebx
lea esi, [esi]
nop
movzx ebx, byte [eax]
add eax, 2
add edx, 1
mov byte [edx - 1], bl
cmp eax, ecx
jne 0x40cbb0
mov eax, dword [esp + 0x18]
add dword [esp + 0x10], eax
mov ebx, esi
mov eax, dword [esp + 0x14]
mov ecx, dword [esp + 0x10]
add ebx, 1
add edi, eax
cmp dword [esp + 0x54], ebx
je 0x40c97f
mov esi, edi
mov edx, ecx
mov ecx, dword [esp + 0x1c]
sub esi, ebp
sub edx, ebp
mov eax, esi
jmp 0x40cba0
add ebx, 1
cmp dword [esp + 0x54], ebx
jne 0x40cbf8
jmp 0x40c97f
mov ebx, dword [esp + 0x28]
xor esi, esi
lea esi, [esi]
test ebp, ebp
je 0x40cc70
add ebx, ecx
lea esi, [esi]
lea esi, [esi]
movzx ecx, byte [eax]
add eax, 2
add edx, 4
mov byte [edx - 2], cl
mov byte [edx - 3], cl
mov byte [edx - 4], cl
movzx ecx, byte [eax - 1]
mov byte [edx - 1], cl
cmp eax, ebx
jne 0x40cc20
mov eax, dword [esp + 0x18]
add dword [esp + 0x10], eax
add esi, 1
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x10]
add edi, eax
cmp dword [esp + 0x54], esi
je 0x40c97f
mov ebx, edi
mov ecx, dword [esp + 0x1c]
sub edx, ebp
sub ebx, ebp
mov eax, ebx
jmp 0x40cc10
add esi, 1
cmp dword [esp + 0x54], esi
jne 0x40cc70
jmp 0x40c97f
mov dword [esp + 0x50], ebp
mov ebx, dword [esp + 0x10]
mov ebp, ecx
xor esi, esi
mov ecx, dword [esp + 0x50]
nop
test ecx, ecx
je 0x40cd00
mov dword [esp + 0x10], ebx
add ebp, edi
mov dword [esp + 0x28], edi
nop
movzx ebx, byte [eax]
movzx edi, byte [eax + 1]
add eax, 3
add edx, 1
imul edi, edi, 0x96
imul ebx, ebx, 0x4d
add ebx, edi
movzx edi, byte [eax - 1]
imul edi, edi, 0x1d
add ebx, edi
mov byte [edx - 1], bh
cmp eax, ebp
jne 0x40cca0
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x10]
add esi, 1
mov edi, dword [esp + 0x28]
add ebx, eax
mov eax, dword [esp + 0x14]
add edi, eax
cmp dword [esp + 0x54], esi
je 0x40c97f
mov eax, edi
mov edx, ebx
mov ebp, dword [esp + 0x1c]
sub eax, ecx
sub edx, ecx
jmp 0x40cc90
add esi, 1
cmp dword [esp + 0x54], esi
jne 0x40cd00
jmp 0x40c97f
xor esi, esi
mov ebx, dword [esp + 0x10]
mov dword [esp + 0x10], esi
mov esi, ecx
xor ecx, ecx
lea esi, [esi]
test ebp, ebp
je 0x40cfa0
mov dword [esp + 0x10], ebx
add esi, edi
mov dword [esp + 0x28], edi
lea esi, [esi]
movzx ebx, byte [eax]
movzx edi, byte [eax + 1]
add eax, 3
mov byte [edx + 1], 0xff
add edx, 2
imul edi, edi, 0x96
imul ebx, ebx, 0x4d
add ebx, edi
movzx edi, byte [eax - 1]
imul edi, edi, 0x1d
add ebx, edi
mov byte [edx - 2], bh
cmp eax, esi
jne 0x40cd38
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x10]
add ecx, 1
mov edi, dword [esp + 0x28]
add ebx, eax
mov eax, dword [esp + 0x14]
add edi, eax
cmp dword [esp + 0x54], ecx
je 0x40c97f
mov eax, edi
mov edx, ebx
mov esi, dword [esp + 0x1c]
sub eax, ebp
sub edx, ebp
jmp 0x40cd20
mov esi, dword [esp + 0x10]
xor ebx, ebx
lea esi, [esi]
test ebp, ebp
je 0x40ce00
mov dword [esp + 0x10], ebx
add ecx, edi
lea esi, [esi]
movzx ebx, word [eax]
add eax, 3
mov byte [edx + 3], 0xff
add edx, 4
mov word [edx - 4], bx
movzx ebx, byte [eax - 1]
mov byte [edx - 2], bl
cmp eax, ecx
jne 0x40cdb0
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x10]
add esi, eax
mov eax, dword [esp + 0x14]
add ebx, 1
add edi, eax
cmp dword [esp + 0x54], ebx
je 0x40c97f
mov eax, edi
mov edx, esi
mov ecx, dword [esp + 0x1c]
sub eax, ebp
sub edx, ebp
jmp 0x40cda0
add ebx, 1
cmp dword [esp + 0x54], ebx
jne 0x40ce00
jmp 0x40c97f
mov esi, dword [esp + 0x10]
xor ebx, ebx
lea esi, [esi]
test ebp, ebp
je 0x40ce70
mov dword [esp + 0x10], ebx
add ecx, esi
lea esi, [esi]
movzx ebx, word [eax]
add edx, 3
add eax, 4
mov word [edx - 3], bx
movzx ebx, byte [eax - 2]
mov byte [edx - 1], bl
cmp edx, ecx
jne 0x40ce28
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x10]
add esi, eax
mov eax, dword [esp + 0x14]
add ebx, 1
add edi, eax
cmp dword [esp + 0x54], ebx
je 0x40c97f
mov eax, edi
mov edx, esi
mov ecx, dword [esp + 0x1c]
sub eax, ebp
sub edx, ebp
jmp 0x40ce18
add ebx, 1
cmp dword [esp + 0x54], ebx
jne 0x40ce70
jmp 0x40c97f
xor ebx, ebx
mov esi, ebp
mov ebp, ebx
mov ebx, edi
mov edi, dword [esp + 0x2c]
lea esi, [esi]
test esi, esi
je 0x40cf90
mov dword [esp + 0x28], ebx
add edi, ecx
mov dword [esp + 0x2c], ebp
lea esi, [esi]
movzx ecx, byte [eax]
movzx ebp, byte [eax + 1]
add edx, 2
add eax, 4
movzx ebx, word [0x4ece60]
imul ebp, ebp, 0x96
imul ecx, ecx, 0x4d
add ecx, ebp
movzx ebp, byte [eax - 2]
imul ebp, ebp, 0x1d
add ecx, ebp
sar ecx, 8
mov bl, cl
mov bh, byte [eax - 1]
mov word [edx - 2], bx
cmp edx, edi
jne 0x40cea8
mov eax, dword [esp + 0x18]
mov ebx, dword [esp + 0x28]
add dword [esp + 0x10], eax
mov ebp, dword [esp + 0x2c]
mov eax, dword [esp + 0x14]
mov edi, dword [esp + 0x10]
add ebp, 1
add ebx, eax
cmp dword [esp + 0x54], ebp
je 0x40c97f
mov eax, ebx
sub edi, esi
mov ecx, dword [esp + 0x1c]
sub eax, esi
mov edx, edi
jmp 0x40ce90
mov ecx, edi
mov edi, dword [esp + 0x10]
xor esi, esi
test ebp, ebp
je 0x40cf80
mov dword [esp + 0x10], ecx
lea esi, [esi]
nop
movzx ecx, byte [eax]
movzx ebx, byte [eax + 1]
add edx, 1
add eax, 4
imul ebx, ebx, 0x96
imul ecx, ecx, 0x4d
add ecx, ebx
movzx ebx, byte [eax - 2]
imul ebx, ebx, 0x1d
add ecx, ebx
mov byte [edx - 1], ch
cmp edx, edi
jne 0x40cf30
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x10]
add esi, 1
lea edi, [edx + eax]
mov eax, dword [esp + 0x14]
add ecx, eax
cmp dword [esp + 0x54], esi
je 0x40c97f
mov eax, ecx
mov edx, edi
sub eax, ebp
sub edx, ebp
jmp 0x40cf20
add esi, 1
cmp dword [esp + 0x54], esi
jne 0x40cf80
jmp 0x40c97f
mov ebx, ebp
add ebx, 1
cmp dword [esp + 0x54], ebx
jne 0x40cf92
jmp 0x40c97f
mov esi, ecx
add esi, 1
cmp dword [esp + 0x54], esi
jne 0x40cfa2
jmp 0x40c97f