Function at 0x402005
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x2c
push ebx
push ebp
mov ebp, ecx
xor ebx, ebx
push esi
push edi
inc ebx
mov dword [esp + 0x18], ebp
cmp dword [ebp + 4], 0
push 0x20
jne 0x40205c
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, ebp
jmp 0x4021c1
pop edx
cmp dword [ebp + 4], ebx
jne 0x4020b7
mov esi, dword [ebp]
cmp word [esi + 0x14], dx
jne 0x4020b7
mov edi, dword [esp + 0x40]
cmp edi, dword [esi]
jne 0x402084
mov ecx, dword [esp + 0x44]
mov dword [esi + 0x10], ecx
mov dword [esi + 0xc], ecx
mov al, bl
jmp 0x4021c8
mov eax, dword [esi]
xor eax, edi
push 0x1f
pop edx
mov ecx, edx
js 0x40209a
mov eax, dword [esi]
dec ecx
xor eax, edi
shr eax, cl
test bl, al
je 0x40208f
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 0x4021c6
mov ebp, dword [ebp]
movzx edi, word [ebp + 0x14]
mov ecx, dword [ebp]
sub edx, edi
push edi
call fcn.00401f50
mov ecx, dword [esp + 0x40]
mov esi, eax
push edi
call fcn.00401f50
cmp eax, esi
jne 0x40212c
mov dword [esp + 0x14], ebp
mov esi, dword [esp + 0x40]
dec edx
mov edi, esi
mov dword [esp + 0x20], edx
mov ecx, edx
shr edi, cl
and edi, ebx
mov dword [esp + 0x1c], edi
cmp byte [edi + ebp + 0x16], 0
lea eax, [edi*4]
jne 0x4021d2
imul ebp, dword [eax + ebp + 4], 0x18
add ebp, dword [esp + 0x14]
movzx edi, word [ebp + 0x14]
mov ecx, dword [ebp]
sub edx, edi
push edi
call fcn.00401f50
mov ecx, dword [esp + 0x40]
mov esi, eax
push edi
call fcn.00401f50
cmp eax, esi
je 0x4020dd
movzx edi, word [ebp + 0x14]
mov eax, dword [ebp]
dec edi
mov esi, dword [esp + 0x40]
xor eax, esi
mov dword [esp + 0x14], edi
lea ecx, [edi + edx]
shr eax, cl
test bl, al
jne 0x402158
mov eax, dword [ebp]
dec edi
dec ecx
xor eax, esi
shr eax, cl
test bl, al
je 0x402147
mov dword [esp + 0x14], edi
push 6
pop ecx
mov esi, ebp
lea edi, [esp + 0x24]
rep movsd dword es:[edi], dword [esi]
mov cx, word [ebp + 0x14]
mov esi, dword [esp + 0x14]
movzx eax, si
sub cx, ax
mov word [esp + 0x38], ax
mov eax, dword [esp + 0x44]
dec cx
mov word [ebp + 0x14], cx
lea ecx, [esi + edx]
mov edx, dword [esp + 0x40]
mov esi, edx
shr esi, cl
and esi, ebx
push 2
mov dword [ebp + esi*4 + 0xc], eax
mov eax, ebp
sub eax, esi
mov byte [esi + ebp + 0x16], bl
mov ebx, dword [esp + 0x1c]
mov byte [eax + 0x17], 0
mov dword [ebp + esi*4 + 4], edx
mov eax, dword [ebx + 4]
pop edx
sub edx, esi
mov dword [ebp + 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 + ebp + 4]
mov dword [esp + 0x10], eax
cmp esi, eax
jne 0x4021eb
mov eax, dword [esp + 0x44]
mov dword [ebp + edi*4 + 0xc], eax
jmp 0x40207d
lea ecx, [edx - 1]
xor eax, esi
shr eax, cl
mov dword [esp + 0x14], ecx
test bl, al
jne 0x402215
mov edi, dword [esp + 0x10]
mov dword [esp + 0x10], edi
mov eax, edi
dec ecx
xor eax, esi
shr eax, cl
test bl, al
je 0x402202
mov edi, dword [esp + 0x1c]
mov dword [esp + 0x14], ecx
mov eax, dword [esp + 0x44]
shr esi, cl
lea ecx, [esp + 0x34]
and esi, ebx
mov edx, esi
shl edx, 2
sub ecx, edx
mov dword [esp + edx + 0x30], eax
mov eax, dword [ebp + edi*4 + 0xc]
mov dword [ecx], eax
lea eax, [esp + 0x3b]
mov ecx, dword [esp + 0x10]
sub eax, esi
mov byte [edi + ebp + 0x16], 0
mov byte [eax], bl
mov eax, dword [esp + 0x40]
mov byte [esp + esi + 0x3a], bl
mov ebx, dword [esp + 0x18]
mov dword [esp + edx + 0x28], eax
lea eax, [esp + 0x2c]
sub eax, edx
mov dword [esp + 0x24], ecx
mov dword [eax], ecx
mov eax, dword [esp + 0x20]
sub eax, dword [esp + 0x14]
dec eax
mov word [esp + 0x38], ax
mov eax, dword [ebx + 4]
mov dword [ebp + edi*4 + 4], eax
jmp 0x4021b1