Function at 0x402008
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x2c
push ebx
push ebp
mov edx, ecx
xor ebx, ebx
push esi
push edi
inc ebx
mov dword [esp + 0x20], edx
cmp dword [edx + 4], 0
push 0x20
jne 0x40205f
mov eax, dword [esp + 0x44]
lea esi, [esp + 0x28]
mov dword [esp + 0x30], eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x48]
mov dword [esp + 0x38], eax
mov dword [esp + 0x34], eax
pop eax
sub esp, 0x18
mov byte [esp + 0x53], bl
mov byte [esp + 0x52], bl
mov word [esp + 0x50], ax
push 6
pop ecx
mov edi, esp
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
jmp 0x4021e6
pop ebp
cmp dword [edx + 4], ebx
jne 0x4020b9
mov esi, dword [edx]
cmp word [esi + 0x14], bp
jne 0x4020b9
mov edi, dword [esp + 0x40]
cmp edi, dword [esi]
jne 0x402086
mov ecx, dword [esp + 0x44]
mov dword [esi + 0x10], ecx
mov dword [esi + 0xc], ecx
mov al, bl
jmp 0x4021ed
mov eax, dword [esi]
xor eax, edi
push 0x1f
pop edx
mov ecx, edx
js 0x40209c
mov eax, dword [esi]
dec ecx
xor eax, edi
shr eax, cl
test bl, al
je 0x402091
mov eax, dword [esp + 0x44]
sub edx, ecx
mov word [esi + 0x14], dx
mov edx, edi
shr edx, cl
and edx, ebx
mov dword [esi + edx*4 + 0xc], eax
mov dword [esi + edx*4 + 4], edi
jmp 0x4021eb
mov ecx, dword [edx]
mov dword [esp + 0x10], ecx
movzx edi, word [ecx + 0x14]
mov eax, dword [ecx]
sub ebp, edi
mov ecx, dword [esp + 0x40]
mov edx, ebp
push edi
mov dword [esp + 0x18], eax
call fcn.00401f50
mov ecx, dword [esp + 0x14]
mov esi, eax
push edi
call fcn.00401f50
cmp esi, eax
jne 0x402144
mov edi, dword [esp + 0x10]
mov dword [esp + 0x18], edi
mov esi, dword [esp + 0x40]
dec ebp
mov edx, esi
mov ecx, ebp
shr edx, cl
and edx, ebx
mov dword [esp + 0x1c], edx
cmp byte [edx + edi + 0x16], 0
lea eax, [edi + edx*4]
jne 0x4021f7
imul ecx, dword [eax + 4], 0x18
add ecx, dword [esp + 0x18]
mov dword [esp + 0x10], ecx
movzx edi, word [ecx + 0x14]
mov eax, dword [ecx]
sub ebp, edi
push edi
mov edx, ebp
mov dword [esp + 0x18], eax
mov ecx, eax
call fcn.00401f50
mov ecx, dword [esp + 0x40]
mov esi, eax
push edi
call fcn.00401f50
mov edi, dword [esp + 0x10]
cmp eax, esi
je 0x4020ef
mov edx, dword [esp + 0x10]
mov esi, dword [esp + 0x40]
movzx edi, word [edx + 0x14]
mov eax, dword [edx]
dec edi
xor eax, esi
mov dword [esp + 0x1c], edi
lea ecx, [edi + ebp]
shr eax, cl
test bl, al
jne 0x40217a
mov edx, dword [esp + 0x14]
dec edi
mov eax, edx
dec ecx
xor eax, esi
shr eax, cl
test bl, al
je 0x402166
mov edx, dword [esp + 0x10]
mov dword [esp + 0x1c], edi
push 6
pop ecx
mov esi, edx
lea edi, [esp + 0x24]
rep movsd dword es:[edi], dword [esi]
mov cx, word [edx + 0x14]
mov esi, dword [esp + 0x1c]
movzx eax, si
sub cx, ax
mov word [esp + 0x38], ax
mov eax, dword [esp + 0x44]
dec cx
mov word [edx + 0x14], cx
lea ecx, [esi + ebp]
mov ebp, dword [esp + 0x40]
mov esi, ebp
shr esi, cl
mov ecx, dword [esp + 0x10]
and esi, ebx
push 2
mov dword [edx + esi*4 + 0xc], eax
mov eax, edx
mov byte [esi + edx + 0x16], bl
sub eax, esi
mov ebx, dword [esp + 0x24]
mov byte [eax + 0x17], 0
mov dword [edx + esi*4 + 4], ebp
mov eax, dword [ebx + 4]
pop edx
sub edx, esi
mov dword [ecx + edx*4], eax
sub esp, 0x18
lea esi, [esp + 0x3c]
push 6
pop ecx
mov edi, esp
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
call fcn.00401e78
xor al, al
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x2c
ret 8
mov eax, dword [eax + 4]
mov dword [esp + 0x14], eax
cmp esi, eax
jne 0x40220f
mov eax, dword [esp + 0x44]
mov dword [edi + edx*4 + 0xc], eax
jmp 0x40207f
lea ecx, [ebp - 1]
xor eax, esi
shr eax, cl
mov dword [esp + 0x18], ecx
test bl, al
jne 0x402239
mov edi, dword [esp + 0x14]
mov dword [esp + 0x14], edi
mov eax, edi
dec ecx
xor eax, esi
shr eax, cl
test bl, al
je 0x402226
mov edi, dword [esp + 0x10]
mov dword [esp + 0x18], ecx
mov eax, dword [esp + 0x44]
shr esi, cl
lea ecx, [esp + 0x34]
and esi, ebx
sub ebp, dword [esp + 0x18]
mov edx, esi
shl edx, 2
sub ecx, edx
mov dword [esp + edx + 0x30], eax
mov eax, dword [esp + 0x1c]
mov eax, dword [edi + eax*4 + 0xc]
mov dword [ecx], eax
lea eax, [esp + 0x3b]
mov ecx, dword [esp + 0x14]
sub eax, esi
mov byte [eax], bl
mov eax, dword [esp + 0x40]
mov byte [esp + esi + 0x3a], bl
mov ebx, dword [esp + 0x20]
mov dword [esp + edx + 0x28], eax
lea eax, [esp + 0x2c]
sub eax, edx
mov dword [esp + 0x24], ecx
dec ebp
mov dword [eax], ecx
mov ecx, dword [esp + 0x1c]
mov word [esp + 0x38], bp
mov byte [ecx + edi + 0x16], 0
mov eax, dword [ebx + 4]
mov dword [edi + ecx*4 + 4], eax
jmp 0x4021d6