Function at 0x40caf0
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
push ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x14], edx
xor ebx, ebx
mov dword [ebp - 0x2c], edi
and dword [ebp - 8], ebx
mov dword [ebp - 0x20], ebx
mov eax, dword [edi + 0xc]
mov dword [ebp - 0x18], eax
mov ecx, dword [eax + 0x44]
add ecx, 0x24
call fcn.0040629c
mov dword [ebp - 0x30], eax
test eax, eax
jle 0x40cf23
mov byte [ebp - 0xc], bl
cmp byte [ebp + 0x10], bl
je 0x40cb6b
mov ecx, dword [edi]
call fcn.004088b7
mov esi, dword [ebp + 0xc]
cmp esi, eax
ja 0x40cb6b
lea eax, [ebp - 1]
mov edx, esi
push ebx
push eax
mov ecx, edi
call fcn.0040a398
pop ecx
pop ecx
test eax, eax
jne 0x40cffa
mov eax, dword [ebp - 0xc]
cmp byte [ebp - 1], 2
push 1
movzx eax, al
pop ecx
cmove eax, ecx
mov dword [ebp - 0xc], eax
mov eax, dword [ebp + 8]
mov dword [eax], esi
mov esi, dword [ebp - 0x18]
mov ecx, dword [esi + 0x48]
call fcn.00409740
test eax, eax
jne 0x40cffa
mov ecx, dword [esi + 0x44]
mov edx, dword [ebp - 0x30]
add ecx, 0x24
dec edx
call fcn.004062bb
mov esi, ebx
mov dword [ebp - 8], esi
test esi, esi
je 0x40cb9b
mov ecx, dword [esi + 0x44]
jmp 0x40cba4
mov eax, dword [ebp - 0x18]
mov ecx, dword [eax + 0x44]
add ecx, 0x20
call fcn.0040629c
lea ecx, [ebp - 0x20]
mov dword [ebp - 0x28], eax
push 0
push ecx
mov edx, eax
mov ecx, edi
call fcn.0040abf9
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x40cf1c
mov ebx, dword [ebp - 0x20]
mov dword [ebp - 0x3c], ebx
mov eax, dword [ebx + 0x44]
mov dword [ebp - 0x24], eax
add eax, 4
mov ecx, eax
mov dword [ebp - 0x40], eax
call fcn.0040629c
mov ecx, dword [ebp - 0xc]
mov edx, eax
mov dword [ebp - 0x1c], edx
test edx, edx
jne 0x40cc22
test cl, cl
jne 0x40cc22
mov ecx, dword [ebx + 0x48]
call fcn.00409740
mov edi, eax
test edi, edi
jne 0x40cfe0
mov ecx, dword [ebp + 8]
mov eax, dword [ebp - 0x28]
mov dword [ecx], eax
mov ecx, dword [ebp - 0x18]
mov eax, dword [ebx + 0x44]
mov ecx, dword [ecx + 0x44]
mov eax, dword [eax]
mov dword [ecx + 0x20], eax
mov eax, dword [ebp - 0x14]
mov dword [eax], ebx
jmp 0x40cd39
mov esi, dword [ebp - 0x2c]
movzx eax, word [esi + 0x1e]
shr eax, 2
sub eax, 8
cmp edx, eax
jg 0x40cf14
test cl, cl
je 0x40cd43
mov eax, dword [ebp - 0x28]
cmp dword [ebp + 0xc], eax
jne 0x40cd43
mov eax, dword [ebp - 0x14]
mov byte [ebp - 0xc], 0
mov dword [eax], ebx
mov ecx, dword [ebx + 0x48]
call fcn.00409740
mov edi, eax
test edi, edi
jne 0x40cfdd
cmp dword [ebp - 0x1c], eax
jne 0x40cc8f
mov eax, dword [ebx + 0x44]
mov esi, dword [ebp - 8]
mov eax, dword [eax]
test esi, esi
jne 0x40cc85
mov ecx, dword [ebp - 0x18]
mov ecx, dword [ecx + 0x44]
mov dword [ecx + 0x20], eax
jmp 0x40cd39
mov ecx, dword [esi + 0x44]
mov dword [ecx], eax
jmp 0x40cd39
mov ecx, dword [ebx + 0x44]
add ecx, 8
call fcn.0040629c
lea ecx, [ebp - 0x34]
mov dword [ebp - 0x28], eax
push 0
push ecx
mov edx, eax
mov ecx, esi
call fcn.0040abf9
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x40cfdd
mov esi, dword [ebp - 0x34]
mov ecx, dword [esi + 0x48]
call fcn.00409740
mov edi, eax
test edi, edi
jne 0x40cf04
mov eax, dword [ebx + 0x44]
mov ecx, dword [esi + 0x44]
mov edx, dword [ebp - 0x1c]
dec edx
mov eax, dword [eax]
mov dword [ecx], eax
mov ecx, dword [esi + 0x44]
add ecx, 4
call fcn.004062bb
mov eax, edx
shl eax, 2
push eax
mov eax, dword [ebx + 0x44]
add eax, 0xc
push eax
mov eax, dword [esi + 0x44]
add eax, 8
push eax
call fcn.0044fac0
mov ecx, dword [esi + 0x48]
add esp, 0xc
call fcn.004091d9
mov esi, dword [ebp - 8]
test esi, esi
jne 0x40cd1c
mov eax, dword [ebp - 0x18]
mov ecx, dword [eax + 0x44]
add ecx, 0x20
jmp 0x40cd31
mov ecx, dword [esi + 0x48]
call fcn.00409740
mov edi, eax
test edi, edi
jne 0x40cfe0
mov ecx, dword [esi + 0x44]
mov edx, dword [ebp - 0x28]
call fcn.004062bb
xor ebx, ebx
mov dword [ebp - 0x20], ebx
jmp 0x40cee4
mov ecx, dword [ebx + 0x48]
call fcn.00409740
mov edi, eax
mov dword [ebp - 0x38], edi
test edi, edi
jne 0x40cfdd
cmp dword [ebp + 0xc], eax
jbe 0x40cddb
xor ecx, ecx
mov dword [ebp - 0x10], ecx
mov ecx, dword [ebp - 0x24]
lea ecx, [ecx + 8]
call fcn.0040629c
sub eax, dword [ebp + 0xc]
xor edx, edx
inc edx
mov ecx, edx
mov dword [ebp - 0x28], edx
cmp dword [ebp - 0x1c], edx
jle 0x40cde2
mov ebx, dword [ebp - 0x10]
mov edx, eax
mov edi, dword [ebp - 0x1c]
neg edx
test eax, eax
cmovns edx, eax
mov dword [ebp - 0x30], edx
mov eax, dword [ebp - 0x24]
lea ecx, [ecx + 2]
mov esi, edx
lea ecx, [eax + ecx*4]
call fcn.0040629c
sub eax, dword [ebp + 0xc]
mov ecx, dword [ebp - 0x28]
cdq
xor eax, edx
sub eax, edx
mov edx, dword [ebp - 0x30]
cmp eax, edx
cmovl edx, eax
cmp eax, esi
mov dword [ebp - 0x30], edx
cmovge ecx, ebx
mov ebx, ecx
mov ecx, dword [ebp - 0x28]
inc ecx
mov dword [ebp - 0x28], ecx
cmp ecx, edi
jl 0x40cd8f
mov edi, dword [ebp - 0x38]
mov esi, dword [ebp - 0x2c]
mov dword [ebp - 0x10], ebx
mov eax, dword [ebp - 0x10]
mov ebx, dword [ebp - 0x3c]
mov dword [ebp - 0x10], eax
jmp 0x40cde5
xor eax, eax
mov dword [ebp - 0x10], eax
jmp 0x40cde5
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x24]
lea ecx, [ecx + eax*4]
add ecx, 8
call fcn.0040629c
cmp byte [ebp - 0xc], 0
je 0x40ce02
cmp eax, dword [ebp + 0xc]
jne 0x40cee1
mov edi, dword [ebp + 8]
mov dword [edi], eax
mov ecx, dword [esi]
call fcn.004088b7
cmp dword [edi], eax
ja 0x40cf0c
mov eax, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x10]
lea edi, [eax - 1]
cmp ecx, edi
jge 0x40ce2e
mov edx, dword [ebp - 0x24]
mov eax, dword [edx + eax*4 + 4]
mov dword [edx + ecx*4 + 8], eax
mov ecx, dword [ebp - 0x40]
mov edx, edi
call fcn.004062bb
xor eax, eax
mov ecx, esi
inc eax
push eax
mov eax, dword [ebp + 8]
push dword [ebp - 0x14]
mov edx, dword [eax]
call fcn.0040abf9
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x40cedd
mov eax, dword [ebp - 0x14]
mov eax, dword [eax]
mov edi, dword [eax + 0x48]
mov eax, dword [edi]
mov dword [ebp - 0x40], eax
cmp byte [eax + 4], 0
je 0x40ceb9
cmp byte [edi + 0x1f], 0
jne 0x40ceb9
cmp byte [eax + 0x13], 0
jne 0x40ceb9
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 - 0x40]
inc eax
mov byte [edi + 0x1c], al
mov byte [edi + 0x20], 0
cmp byte [ecx + 9], 0
je 0x40ceb9
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 eax, dword [ebp - 0x14]
mov ecx, dword [eax]
mov ecx, dword [ecx + 0x48]
call fcn.00409740
mov edi, eax
test edi, edi
je 0x40cedd
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
test ecx, ecx
je 0x40cedd
mov ecx, dword [ecx + 0x48]
call fcn.004091d9
mov byte [ebp - 0xc], 0
mov esi, dword [ebp - 8]
test esi, esi
je 0x40cef0
mov ecx, dword [esi + 0x48]
call fcn.004091d9
xor esi, esi
cmp byte [ebp - 0xc], 0
je 0x40cfe0
mov edi, dword [ebp - 0x2c]
jmp 0x40cb8d
mov ecx, dword [esi + 0x48]
jmp 0x40cfd8
push 0xb
pop eax
jmp 0x40cffa
push 0xb
pop edi
jmp 0x40cfdd
xor ebx, ebx
jmp 0x40cfe0
mov ecx, dword [edi]
call fcn.004088b7
lea esi, [eax + 1]
mov eax, dword [ebp + 8]
mov dword [eax], esi
mov ecx, dword [edi + 0x18]
mov dword [ebp - 0x40], ecx
test ecx, ecx
je 0x40cf5d
lea esi, [ecx + 1]
xor edx, edx
mov dword [eax], esi
mov eax, 0x40000000
movzx ecx, word [edi + 0x1c]
div ecx
mov ecx, dword [ebp - 0x40]
cmp ecx, eax
jne 0x40cf5d
mov eax, dword [ebp + 8]
lea esi, [ecx + 2]
mov dword [eax], esi
mov eax, esi
cmp byte [edi + 0x16], bl
je 0x40cf9f
mov edx, esi
mov dword [ebp - 0x2c], esi
mov ecx, edi
call fcn.0040a2c5
mov ecx, dword [ebp + 8]
cmp eax, esi
jne 0x40cf9a
lea eax, [esi + 1]
xor edx, edx
mov dword [ecx], eax
movzx ecx, word [edi + 0x1c]
mov dword [ebp - 0x2c], eax
mov eax, 0x40000000
div ecx
mov ecx, dword [ebp + 8]
cmp esi, eax
jne 0x40cf9a
lea eax, [esi + 2]
mov dword [ecx], eax
jmp 0x40cfa2
mov eax, dword [ebp - 0x2c]
jmp 0x40cfa2
mov ecx, dword [ebp + 8]
cmp dword [edi + 0x18], ebx
je 0x40cfaa
mov dword [edi + 0x18], eax
mov edx, dword [ecx]
mov ecx, edi
mov esi, dword [ebp - 0x14]
push 0
push esi
call fcn.0040abf9
pop ecx
pop ecx
test eax, eax
jne 0x40cffa
mov ecx, dword [esi]
mov ecx, dword [ecx + 0x48]
call fcn.00409740
mov edi, eax
test edi, edi
je 0x40cfdd
mov ecx, dword [esi]
test ecx, ecx
je 0x40cfdd
mov ecx, dword [ecx + 0x48]
call fcn.004091d9
mov esi, dword [ebp - 8]
test ebx, ebx
je 0x40cfec
mov ecx, dword [ebx + 0x48]
call fcn.004091d9
test esi, esi
je 0x40cff8
mov ecx, dword [esi + 0x48]
call fcn.004091d9
mov eax, edi
pop edi
pop esi
pop ebx
leave
ret