Function at 0x40cb87
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
push ebx
push esi
mov esi, ecx
mov dword [ebp - 0xc], edx
push edi
xor ebx, ebx
mov dword [ebp - 0x2c], esi
and dword [ebp - 0x14], ebx
mov edi, dword [esi + 0xc]
mov dword [ebp - 0x28], ebx
mov dword [ebp - 0x1c], edi
mov ecx, dword [edi + 0x44]
add ecx, 0x24
call fcn.0040640d
mov dword [ebp - 0x34], eax
test eax, eax
jle 0x40cfb0
mov byte [ebp - 8], bl
cmp byte [ebp + 0x10], bl
je 0x40cc05
mov ecx, dword [esi]
call fcn.00408a39
mov edi, dword [ebp + 0xc]
cmp edi, eax
ja 0x40cc02
lea eax, [ebp - 1]
mov edx, edi
push ebx
push eax
mov ecx, esi
call fcn.0040a4ad
pop ecx
pop ecx
test eax, eax
jne 0x40d06a
mov eax, dword [ebp - 8]
cmp byte [ebp - 1], 2
push 1
movzx eax, al
pop ecx
cmove eax, ecx
mov dword [ebp - 8], eax
mov eax, dword [ebp + 8]
mov dword [eax], edi
mov edi, dword [ebp - 0x1c]
mov ecx, dword [edi + 0x48]
call fcn.00409875
test eax, eax
jne 0x40d06a
mov ecx, dword [edi + 0x44]
mov edx, dword [ebp - 0x34]
add ecx, 0x24
dec edx
call fcn.0040642c
mov eax, ebx
mov dword [ebp - 0x14], eax
test eax, eax
je 0x40cc32
mov ecx, dword [ebx + 0x44]
jmp 0x40cc38
mov ecx, dword [edi + 0x44]
add ecx, 0x20
call fcn.0040640d
lea ecx, [ebp - 0x28]
mov dword [ebp - 0x30], eax
push 0
push ecx
mov edx, eax
mov ecx, esi
call fcn.0040ad15
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x40cfa9
mov ebx, dword [ebp - 0x28]
mov dword [ebp - 0x3c], ebx
mov eax, dword [ebx + 0x44]
mov dword [ebp - 0x18], eax
lea ecx, [eax + 4]
call fcn.0040640d
mov ecx, dword [ebp - 8]
mov edx, eax
mov dword [ebp - 0x24], edx
test edx, edx
jne 0x40ccb1
test cl, cl
jne 0x40ccb1
mov ecx, dword [ebx + 0x48]
call fcn.00409875
mov edi, eax
test edi, edi
jne 0x40d059
mov eax, dword [ebp + 8]
mov ecx, dword [ebp - 0x30]
mov dword [eax], ecx
mov ecx, dword [ebp - 0x1c]
mov eax, dword [ebx + 0x44]
mov ecx, dword [ecx + 0x44]
mov eax, dword [eax]
mov dword [ecx + 0x20], eax
mov eax, dword [ebp - 0xc]
mov dword [eax], ebx
jmp 0x40cdd0
movzx eax, word [esi + 0x1e]
shr eax, 2
sub eax, 8
cmp edx, eax
jg 0x40cfa1
test cl, cl
je 0x40cdda
mov ecx, dword [ebp - 0x30]
cmp dword [ebp + 0xc], ecx
jne 0x40cdda
mov eax, dword [ebp - 0xc]
mov byte [ebp - 8], 0
mov dword [eax], ebx
mov ecx, dword [ebx + 0x48]
call fcn.00409875
mov edi, eax
test edi, edi
jne 0x40d059
mov edx, dword [ebx + 0x44]
cmp dword [ebp - 0x24], eax
jne 0x40cd1d
mov eax, dword [ebp - 0x14]
test eax, eax
jne 0x40cd11
mov ecx, dword [ebp - 0x1c]
mov eax, dword [edx]
mov ecx, dword [ecx + 0x44]
mov dword [ecx + 0x20], eax
jmp 0x40cdd0
mov ecx, dword [eax + 0x44]
mov eax, dword [edx]
mov dword [ecx], eax
jmp 0x40cdd0
lea ecx, [edx + 8]
call fcn.0040640d
lea ecx, [ebp - 0x20]
mov dword [ebp - 0x30], eax
push 0
push ecx
mov edx, eax
mov ecx, esi
call fcn.0040ad15
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x40d059
mov eax, dword [ebp - 0x20]
mov ecx, dword [eax + 0x48]
call fcn.00409875
mov ecx, dword [ebp - 0x20]
mov edi, eax
test edi, edi
jne 0x40d054
mov eax, dword [ebx + 0x44]
mov ecx, dword [ecx + 0x44]
mov edx, dword [ebp - 0x24]
dec edx
mov eax, dword [eax]
mov dword [ecx], eax
mov eax, dword [ebp - 0x20]
mov ecx, dword [eax + 0x44]
add ecx, 4
call fcn.0040642c
mov eax, edx
shl eax, 2
push eax
mov eax, dword [ebx + 0x44]
add eax, 0xc
push eax
mov eax, dword [ebp - 0x20]
mov eax, dword [eax + 0x44]
add eax, 8
push eax
call fcn.00451310
mov ecx, dword [ebp - 0x20]
add esp, 0xc
call fcn.0040ad99
mov eax, dword [ebp - 0x14]
test eax, eax
jne 0x40cdb0
mov ecx, dword [ebp - 0x1c]
mov ecx, dword [ecx + 0x44]
add ecx, 0x20
jmp 0x40cdc8
mov ecx, dword [eax + 0x48]
call fcn.00409875
mov edi, eax
test edi, edi
jne 0x40d059
mov ecx, dword [ebp - 0x14]
mov ecx, dword [ecx + 0x44]
mov edx, dword [ebp - 0x30]
call fcn.0040642c
xor ebx, ebx
mov dword [ebp - 0x28], ebx
jmp 0x40cf7b
mov ecx, dword [ebx + 0x48]
call fcn.00409875
mov edi, eax
mov dword [ebp - 0x38], edi
test edi, edi
jne 0x40d059
cmp dword [ebp + 0xc], eax
jbe 0x40ce72
mov ecx, dword [ebp - 0x18]
xor edx, edx
mov dword [ebp - 0x10], edx
lea ecx, [ecx + 8]
call fcn.0040640d
sub eax, dword [ebp + 0xc]
xor edx, edx
inc edx
mov ecx, edx
mov dword [ebp - 0x30], edx
cmp dword [ebp - 0x24], edx
jle 0x40ce79
mov ebx, dword [ebp - 0x24]
mov edx, eax
mov edi, dword [ebp - 0x10]
neg edx
test eax, eax
cmovns edx, eax
mov dword [ebp - 0x34], edx
mov eax, dword [ebp - 0x18]
lea ecx, [ecx + 2]
mov esi, edx
lea ecx, [eax + ecx*4]
call fcn.0040640d
sub eax, dword [ebp + 0xc]
mov ecx, dword [ebp - 0x30]
cdq
xor eax, edx
sub eax, edx
mov edx, dword [ebp - 0x34]
cmp eax, edx
cmovl edx, eax
cmp eax, esi
mov dword [ebp - 0x34], edx
cmovge ecx, edi
mov edi, ecx
mov ecx, dword [ebp - 0x30]
inc ecx
mov dword [ebp - 0x30], ecx
cmp ecx, ebx
jl 0x40ce26
mov ebx, dword [ebp - 0x3c]
mov esi, dword [ebp - 0x2c]
mov dword [ebp - 0x10], edi
mov eax, dword [ebp - 0x10]
mov edi, dword [ebp - 0x38]
mov dword [ebp - 0x10], eax
jmp 0x40ce7c
xor eax, eax
mov dword [ebp - 0x10], eax
jmp 0x40ce7c
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x18]
lea ecx, [ecx + eax*4]
add ecx, 8
call fcn.0040640d
cmp byte [ebp - 8], 0
je 0x40ce99
cmp eax, dword [ebp + 0xc]
jne 0x40cf7b
mov edi, dword [ebp + 8]
mov dword [edi], eax
mov ecx, dword [esi]
call fcn.00408a39
cmp dword [edi], eax
ja 0x40cf99
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp - 0x10]
lea eax, [ecx - 1]
cmp edx, eax
jge 0x40cecb
mov eax, dword [ebp - 0x18]
mov esi, dword [ebp - 0x18]
mov eax, dword [eax + ecx*4 + 4]
mov dword [esi + edx*4 + 8], eax
mov esi, dword [ebp - 0x2c]
lea edx, [ecx - 1]
mov ecx, dword [ebp - 0x18]
lea ecx, [ecx + 4]
call fcn.0040642c
mov edx, dword [edi]
xor eax, eax
inc eax
mov ecx, esi
push eax
push dword [ebp - 0xc]
call fcn.0040ad15
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x40cf77
mov eax, dword [ebp - 0xc]
mov eax, dword [eax]
mov edi, dword [eax + 0x48]
mov eax, dword [edi]
mov dword [ebp - 0x3c], eax
cmp byte [eax + 4], 0
je 0x40cf5a
cmp byte [edi + 0x1f], 0
jne 0x40cf5a
cmp byte [eax + 0x13], 0
jne 0x40cf5a
mov ecx, dword [eax + 0x54]
mov esi, dword [edi + 4]
mov edx, esi
shr edx, 3
and esi, 7
movzx eax, byte [edx + ecx]
bts eax, esi
mov byte [edx + ecx], al
xor eax, eax
mov ecx, dword [ebp - 0x3c]
inc eax
mov byte [edi + 0x1c], al
mov byte [edi + 0x20], 0
cmp byte [ecx + 9], 0
je 0x40cf57
mov esi, dword [edi + 4]
mov edx, esi
mov ecx, dword [ecx + 0x58]
and esi, 7
shr edx, 3
movzx eax, byte [edx + ecx]
bts eax, esi
mov byte [edx + ecx], al
mov esi, dword [ebp - 0x2c]
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax]
mov ecx, dword [ecx + 0x48]
call fcn.00409875
mov edi, eax
test edi, edi
je 0x40cf77
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax]
call fcn.0040ad99
mov byte [ebp - 8], 0
mov ecx, dword [ebp - 0x14]
call fcn.0040ad99
and dword [ebp - 0x14], 0
cmp byte [ebp - 8], 0
je 0x40d059
mov edi, dword [ebp - 0x1c]
jmp 0x40cc24
push 0xb
pop eax
jmp 0x40d06a
push 0xb
pop edi
jmp 0x40d059
xor ebx, ebx
jmp 0x40d059
mov ecx, dword [esi]
call fcn.00408a39
lea edi, [eax + 1]
mov eax, dword [ebp + 8]
mov dword [eax], edi
mov ecx, dword [esi + 0x18]
test ecx, ecx
je 0x40cfe3
lea edi, [ecx + 1]
xor edx, edx
mov dword [eax], edi
mov eax, 0x40000000
movzx ecx, word [esi + 0x1c]
div ecx
inc eax
cmp edi, eax
jne 0x40cfe3
mov eax, dword [ebp + 8]
inc edi
mov dword [eax], edi
mov dword [ebp - 0x30], edi
cmp byte [esi + 0x16], bl
je 0x40d01b
mov edx, edi
mov dword [ebp - 0x30], edi
mov ecx, esi
call fcn.0040a3e2
cmp eax, edi
mov eax, dword [ebp + 8]
jne 0x40d01e
inc edi
xor edx, edx
mov dword [eax], edi
mov eax, 0x40000000
movzx ecx, word [esi + 0x1c]
div ecx
inc eax
cmp edi, eax
mov eax, dword [ebp + 8]
jne 0x40d021
inc edi
mov dword [eax], edi
jmp 0x40d021
mov eax, dword [ebp + 8]
mov edi, dword [ebp - 0x30]
cmp dword [esi + 0x18], ebx
je 0x40d02b
mov dword [esi + 0x18], edi
mov edi, dword [eax]
push 0
push dword [ebp - 0xc]
mov edx, edi
mov ecx, esi
call fcn.0040ad15
pop ecx
pop ecx
test eax, eax
jne 0x40d06a
mov esi, dword [ebp - 0xc]
mov ecx, dword [esi]
mov ecx, dword [ecx + 0x48]
call fcn.00409875
mov edi, eax
test edi, edi
je 0x40d059
mov ecx, dword [esi]
call fcn.0040ad99
mov ecx, ebx
call fcn.0040ad99
mov ecx, dword [ebp - 0x14]
call fcn.0040ad99
mov eax, edi
pop edi
pop esi
pop ebx
leave
ret