Function at 0x40c890
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x5fc
mov edx, dword [esp + 0x610]
cmp dword [esp + 0x614], 0x100
mov dword [esp + 0x20], 0
mov dword [esp + 0x24], 0
mov dword [esp + 0x38], 0x10
jbe 0x40c8d0
mov ecx, dword [edx + 0x400]
mov dword [esp + 0x38], ecx
cld
mov ecx, 0x11
xor eax, eax
lea edi, [esp + 0x5a0]
rep stosd dword es:[edi], eax
mov dword [esp + 0x28], edx
mov ebx, dword [esp + 0x614]
lea esi, [esi]
mov esi, dword [esp + 0x28]
mov ecx, dword [esi]
add esi, 4
mov dword [esp + 0x28], esi
inc dword [esp + ecx*4 + 0x5a0]
dec ebx
jne 0x40c8f0
mov ebx, dword [esp + 0x614]
cmp dword [esp + 0x5a0], ebx
je 0x40ce75
mov edi, 1
mov ebp, dword [esp + edi*4 + 0x5a0]
test ebp, ebp
jne 0x40c931
inc edi
cmp edi, 0x10
jbe 0x40c920
mov dword [esp + 0x2c], edi
mov ecx, dword [esp + 0x628]
mov eax, dword [ecx]
cmp eax, edi
jae 0x40c946
mov dword [ecx], edi
mov eax, edi
mov ebx, 0x10
nop
lea esi, [esi]
mov esi, dword [esp + ebx*4 + 0x5a0]
test esi, esi
jne 0x40c95e
dec ebx
jne 0x40c950
mov dword [esp + 0x34], ebx
cmp eax, ebx
jbe 0x40c96f
mov eax, dword [esp + 0x628]
mov dword [eax], ebx
mov dword [esp + 0x18], 1
mov ecx, edi
shl dword [esp + 0x18], cl
cmp edi, dword [esp + 0x34]
jae 0x40c9aa
lea esi, [esi]
lea edi, [edi]
mov ecx, dword [esp + edi*4 + 0x5a0]
sub dword [esp + 0x18], ecx
js 0x40ce6b
shl dword [esp + 0x18], 1
inc edi
cmp edi, ebx
jb 0x40c990
mov eax, dword [esp + ebx*4 + 0x5a0]
sub dword [esp + 0x18], eax
js 0x40ce6b
mov dword [esp + 0x44], 0
mov esi, dword [esp + 0x18]
xor edi, edi
lea ebp, [esp + 0x5a4]
lea ecx, [esp + 0x48]
add eax, esi
mov dword [esp + ebx*4 + 0x5a0], eax
dec ebx
mov dword [esp + 0x28], ebp
je 0x40ca08
lea esi, [esi]
lea edi, [edi]
mov ebp, dword [esp + 0x28]
mov eax, dword [ebp]
add ebp, 4
mov dword [esp + 0x28], ebp
add edi, eax
mov dword [ecx], edi
add ecx, 4
dec ebx
jne 0x40c9f0
cld
mov ecx, 0x120
xor eax, eax
lea edi, [esp + 0x90]
xor ebx, ebx
rep stosd dword es:[edi], eax
mov dword [esp + 0x28], edx
nop
mov ecx, dword [esp + 0x28]
mov edi, dword [ecx]
add ecx, 4
mov dword [esp + 0x28], ecx
test edi, edi
je 0x40ca41
mov edx, dword [esp + edi*4 + 0x40]
mov dword [esp + edx*4 + 0x90], ebx
inc edx
mov dword [esp + edi*4 + 0x40], edx
inc ebx
cmp ebx, dword [esp + 0x614]
jb 0x40ca20
mov dword [esp + 0x30], 0xffffffff
mov edx, dword [esp + 0x34]
xor esi, esi
mov dword [esp + 0x510], esi
mov edi, dword [esp + 0x34]
xor ebp, ebp
mov dword [esp + 0x1c], 0
xor ebx, ebx
xor esi, esi
cmp dword [esp + 0x2c], edi
lea ecx, [esp + 0x90]
mov dword [esp + 0x14], 0
mov eax, dword [esp + edx*4 + 0x40]
mov dword [esp + 0x28], ecx
mov dword [esp + 0x40], 0
mov dword [esp + 0x614], eax
mov dword [esp + 0x550], ebp
jg 0x40cd7a
mov ebp, dword [esp + 0x2c]
mov edi, dword [esp + ebp*4 + 0x5a0]
dec edi
mov dword [esp + 0x3c], edi
inc edi
je 0x40cd68
mov edi, dword [esp + 0x30]
mov ecx, dword [esp + 0x1c]
mov eax, dword [esp + edi*4 + 0x554]
add ecx, eax
cmp dword [esp + 0x2c], ecx
jle 0x40cc68
mov esi, dword [esp + 0x3c]
mov ebp, ecx
inc esi
mov dword [esp + 0x10], esi
lea esi, [esi]
lea edi, [edi]
inc dword [esp + 0x30]
mov edx, dword [esp + 0x34]
mov dword [esp + 0x1c], ebp
mov eax, dword [esp + 0x628]
sub edx, ebp
mov dword [esp + 0x14], edx
mov ecx, dword [eax]
cmp dword [esp + 0x14], ecx
mov esi, ecx
ja 0x40cb17
mov esi, dword [esp + 0x14]
mov dword [esp + 0x14], esi
mov edi, dword [esp + 0x2c]
mov eax, 1
sub edi, ebp
mov ecx, edi
shl eax, cl
cmp eax, dword [esp + 0x10]
jbe 0x40cb70
mov ecx, dword [esp + 0x3c]
inc edi
mov edx, dword [esp + 0x2c]
sub eax, ecx
dec eax
lea ecx, [esp + edx*4 + 0x5a0]
cmp edi, esi
jae 0x40cb70
mov esi, esi
lea edi, [edi]
add ecx, 4
add eax, eax
mov edx, dword [ecx]
cmp eax, edx
jbe 0x40cb70
inc edi
sub eax, edx
cmp edi, esi
jb 0x40cb50
lea esi, [esi]
lea edi, [edi]
lea esi, [edi + ebp]
cmp esi, dword [esp + 0x38]
jbe 0x40cb90
cmp ebp, dword [esp + 0x38]
jae 0x40cb90
mov edi, dword [esp + 0x38]
sub edi, ebp
lea esi, [esi]
lea edi, [edi]
mov ecx, edi
mov eax, 1
shl eax, cl
mov dword [esp + 0x14], eax
mov ecx, dword [esp + 0x30]
lea edx, [eax*8 + 8]
mov dword [esp + ecx*4 + 0x554], edi
mov dword [esp], edx
call sub.msvcrt.dll_malloc
test eax, eax
mov esi, eax
je 0x40ce48
mov ecx, dword [esp + 0x624]
lea eax, [eax + 8]
lea edx, [esi + 4]
mov dword [esp + 0x624], edx
mov dword [ecx], eax
mov dword [esi + 4], 0
mov esi, eax
mov eax, dword [esp + 0x30]
mov dword [esp + eax*4 + 0x510], esi
test eax, eax
je 0x40cc4d
mov dword [esp + eax*4 + 0x40], ebx
mov ecx, dword [esp + 0x20]
movzx eax, byte [esp + eax*4 + 0x550]
mov dword [esp + 0x24], esi
mov ch, al
mov eax, edi
add al, 0x20
mov edi, ecx
movzx edx, al
and edi, 0xffffff00
mov ecx, ebp
or edi, edx
mov dword [esp + 0x20], edi
mov edx, dword [esp + 0x30]
mov eax, 1
shl eax, cl
dec eax
mov ecx, ebp
mov edi, dword [esp + edx*4 + 0x550]
and eax, ebx
sub ecx, edi
shr eax, cl
mov edi, dword [esp + edx*4 + 0x50c]
mov ecx, dword [esp + 0x24]
mov edx, dword [esp + 0x20]
mov dword [edi + eax*8 + 4], ecx
mov dword [edi + eax*8], edx
mov edx, dword [esp + 0x30]
mov edi, ebp
mov ebp, dword [esp + edx*4 + 0x554]
add edi, ebp
mov ebp, edi
cmp dword [esp + 0x2c], edi
jg 0x40caf0
movzx ecx, byte [esp + 0x2c]
mov eax, dword [esp + 0x614]
mov edx, dword [esp + 0x20]
sub cl, byte [esp + 0x1c]
lea edi, [esp + eax*4 + 0x90]
cmp dword [esp + 0x28], edi
mov dh, cl
mov dword [esp + 0x20], edx
jb 0x40cdab
mov ebp, edx
and ebp, 0xffffff00
or ebp, 0x63
mov dword [esp + 0x20], ebp
mov ecx, dword [esp + 0x2c]
mov eax, 1
mov edi, ebx
mov ebp, dword [esp + 0x1c]
sub ecx, ebp
shl eax, cl
movzx ecx, byte [esp + 0x1c]
shr edi, cl
cmp edi, dword [esp + 0x14]
jae 0x40cce7
lea esi, [esi]
lea edi, [edi]
mov ecx, dword [esp + 0x20]
mov ebp, dword [esp + 0x24]
mov dword [esi + edi*8], ecx
mov dword [esi + edi*8 + 4], ebp
add edi, eax
cmp edi, dword [esp + 0x14]
jb 0x40ccd0
mov ecx, dword [esp + 0x2c]
mov edi, 1
dec ecx
shl edi, cl
test edi, ebx
je 0x40cd08
mov esi, esi
lea edi, [edi]
xor ebx, edi
shr edi, 1
test edi, ebx
jne 0x40cd00
movzx ecx, byte [esp + 0x1c]
mov edx, 1
xor ebx, edi
mov edi, dword [esp + 0x30]
shl edx, cl
dec edx
and edx, ebx
cmp edx, dword [esp + edi*4 + 0x40]
je 0x40cd59
mov edx, 1
nop
lea esi, [esi]
dec dword [esp + 0x30]
mov edi, edx
mov ebp, dword [esp + 0x30]
mov eax, dword [esp + ebp*4 + 0x554]
mov ebp, dword [esp + 0x30]
sub dword [esp + 0x1c], eax
movzx ecx, byte [esp + 0x1c]
shl edi, cl
dec edi
and edi, ebx
cmp edi, dword [esp + ebp*4 + 0x40]
jne 0x40cd30
dec dword [esp + 0x3c]
cmp dword [esp + 0x3c], 0xffffffff
jne 0x40cac0
inc dword [esp + 0x2c]
mov ecx, dword [esp + 0x34]
cmp dword [esp + 0x2c], ecx
jle 0x40caa9
mov esi, dword [esp + 0x18]
xor eax, eax
mov edx, dword [esp + 0x554]
mov ebx, dword [esp + 0x628]
test esi, esi
mov dword [ebx], edx
je 0x40cda0
cmp dword [esp + 0x34], 1
je 0x40cda0
mov eax, 1
add esp, 0x5fc
pop ebx
pop esi
pop edi
pop ebp
ret
mov edi, dword [esp + 0x28]
mov eax, dword [edi]
cmp eax, dword [esp + 0x618]
jae 0x40cdfd
cmp eax, 0xff
mov edi, dword [esp + 0x20]
mov cl, 0x20
seta al
and edi, 0xffffff00
sub cl, al
movzx ebp, cl
or edi, ebp
mov ecx, dword [esp + 0x24]
mov dword [esp + 0x20], edi
mov ebp, dword [esp + 0x28]
and ecx, 0xffff0000
movzx eax, word [ebp]
add ebp, 4
mov dword [esp + 0x28], ebp
or ecx, eax
mov dword [esp + 0x24], ecx
jmp 0x40cca2
mov edi, eax
mov edx, dword [esp + 0x620]
mov eax, dword [esp + 0x618]
mov ecx, dword [esp + 0x20]
sub edi, eax
and ecx, 0xffffff00
movzx ebp, byte [edi + edx]
mov edx, dword [esp + 0x61c]
add dword [esp + 0x28], 4
or ecx, ebp
movzx ebp, word [edx + edi*2]
mov edi, dword [esp + 0x24]
mov dword [esp + 0x20], ecx
and edi, 0xffff0000
or edi, ebp
mov dword [esp + 0x24], edi
jmp 0x40cca2
mov ebx, dword [esp + 0x30]
test ebx, ebx
jne 0x40ce5a
mov eax, 3
jmp 0x40cda0
mov ebp, dword [esp + 0x510]
mov dword [esp], ebp
call fcn.0040cea0
jmp 0x40ce50
mov eax, 2
jmp 0x40cda0
mov eax, dword [esp + 0x628]
mov edi, dword [esp + 0x624]
mov dword [eax], 0
xor eax, eax
mov dword [edi], 0
jmp 0x40cda0