Function at 0x406a23
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x320
mov eax, dword [0x4241a4]
xor eax, esp
mov dword [esp + 0x31c], eax
push ebx
mov ebx, dword [esp + 0x340]
xor eax, eax
push ebp
movzx ebp, word [esp + 0x330]
push esi
mov esi, dword [esp + 0x330]
push edi
mov edi, dword [esp + 0x348]
push 0x22
push eax
lea eax, [esp + 0xac]
mov dword [esp + 0x20], esi
push eax
mov dword [esp + 0x60], ebp
mov dword [esp + 0x58], edi
mov dword [esp + 0x48], ebx
call fcn.00403817
add esp, 0xc
movzx edx, bp
mov ecx, esi
movzx eax, word [ecx]
add edx, 0xffff
lea ecx, [ecx + 2]
inc word [esp + eax*2 + 0xa4]
test dx, dx
jne 0x406a82
cmp word [esp + 0xa4], bp
jne 0x406ab0
xor eax, eax
mov dword [edi], eax
mov dword [ebx], eax
jmp 0x406f87
xor ebp, ebp
xor ecx, ecx
push 0x10
pop edx
lea edi, [ebp + 1]
mov dword [esp + 0x10], edi
mov si, di
movzx eax, si
cmp word [esp + eax*2 + 0xa4], cx
jne 0x406adb
inc edi
mov si, di
mov dword [esp + 0x10], edi
cmp si, dx
jbe 0x406ac1
cmp word [ebx], si
movzx eax, si
mov ecx, eax
mov dword [esp + 0x28], eax
cmovae ecx, dword [ebx]
xor ebx, ebx
movzx eax, dx
cmp word [esp + eax*2 + 0xa4], bx
jne 0x406b04
add edx, 0xffff
test dx, dx
jne 0x406aec
mov ebx, dword [esp + 0x3c]
cmp cx, dx
movzx eax, dx
mov dword [esp + 0x5c], eax
movzx eax, dx
mov ebp, eax
mov dword [esp + 0x34], eax
cmovbe ebp, ecx
mov ecx, ebp
mov dword [esp + 0x24], ebp
xor ebp, ebp
mov dword [ebx], ecx
mov ecx, dword [esp + 0x28]
inc ebp
mov ebx, ebp
shl ebx, cl
cmp si, dx
jae 0x406b58
movzx eax, si
movzx eax, word [esp + eax*2 + 0xa4]
sub ebx, eax
js 0x406b68
inc edi
add ebx, ebx
mov si, di
mov dword [esp + 0x10], edi
cmp si, dx
jb 0x406b36
mov eax, dword [esp + 0x34]
movzx esi, word [esp + eax*2 + 0xa4]
sub ebx, esi
mov dword [esp + 0x58], ebx
jns 0x406b70
push 2
pop eax
jmp 0x406f87
mov ecx, dword [esp + 0x34]
lea eax, [esi + ebx]
mov edi, 0xffff
xor esi, esi
add edx, edi
mov dword [esp + 0x10], esi
mov word [esp + ecx*2 + 0xa4], ax
xor eax, eax
mov word [esp + 0xca], ax
test dx, dx
je 0x406bb8
mov cx, si
add cx, word [esp + eax + 0xa6]
lea eax, [eax + 2]
add edx, edi
mov word [esp + eax + 0xca], cx
test dx, dx
jne 0x406b9e
mov ecx, dword [esp + 0x18]
mov edi, dword [esp + 0x54]
movzx eax, word [ecx]
add ecx, 2
mov dword [esp + 0x10], eax
mov dword [esp + 0x18], ecx
test ax, ax
je 0x406bf7
movzx edx, ax
movzx ecx, word [esp + edx*2 + 0xc8]
mov eax, ecx
mov word [esp + eax*2 + 0xec], si
lea eax, [ecx + 1]
mov ecx, dword [esp + 0x18]
mov word [esp + edx*2 + 0xc8], ax
inc esi
cmp si, di
jb 0x406bc0
mov esi, dword [esp + 0x24]
xor eax, eax
xor edx, edx
mov word [esp + 0xc8], ax
lea eax, [esp + 0xec]
mov dword [esp + 0x30], edx
mov ecx, esi
mov dword [esp + 0x40], eax
mov eax, dword [esp + 0x34]
neg ecx
mov dword [esp + 0x64], edx
or edi, 0xffffffff
mov dword [esp + 0x38], edx
mov dword [esp + 0x44], edx
mov edx, dword [esp + 0x28]
mov dword [esp + 0x2c], ecx
cmp edx, eax
ja 0x406f79
lea eax, [esp + 0xa4]
lea eax, [eax + edx*2]
mov dword [esp + 0x18], eax
movzx eax, word [eax]
jmp 0x406f1f
add eax, 0xffff
add esi, ecx
mov dword [esp + 0x3c], eax
cmp edx, esi
jle 0x406db6
movzx eax, ax
inc eax
mov dword [esp + 0x60], eax
mov eax, dword [esp + 0x5c]
inc edi
movzx ecx, si
sub eax, ecx
mov dword [esp + 0x2c], esi
movzx esi, ax
mov eax, dword [esp + 0x24]
mov edx, esi
mov dword [esp + 0x50], ecx
movzx ecx, ax
cmp si, cx
mov eax, ecx
mov dword [esp + 0x48], eax
cmova edx, eax
mov eax, dword [esp + 0x28]
sub eax, dword [esp + 0x50]
movzx esi, dx
movzx edx, ax
mov eax, ebp
mov cl, dl
mov dword [esp + 0x38], esi
shl ax, cl
mov byte [esp + 0x17], cl
movzx ecx, ax
mov dword [esp + 0x10], edx
cmp ecx, dword [esp + 0x60]
jbe 0x406d09
mov eax, 0xffff
sub eax, dword [esp + 0x3c]
add ecx, eax
mov eax, dword [esp + 0x18]
inc edx
mov dword [esp + 0x10], edx
cmp dx, si
jae 0x406cff
mov ebp, esi
lea eax, [eax + 2]
add ecx, ecx
movzx esi, word [eax]
cmp cx, si
jbe 0x406cfc
sub ecx, esi
inc edx
mov dword [esp + 0x10], edx
cmp dx, bp
jb 0x406ce3
xor ebp, ebp
inc ebp
mov cl, byte [esp + 0x10]
mov byte [esp + 0x17], cl
jmp 0x406d0d
mov cl, byte [esp + 0x17]
mov eax, ebp
shl ax, cl
movzx esi, ax
movzx eax, si
inc eax
mov dword [esp + 0x44], esi
imul eax, eax, 6
push eax
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
test eax, eax
je 0x406f43
mov edx, dword [esp + 0x4c]
lea ecx, [esi + 1]
add word [0x42743c], cx
lea ecx, [eax + 6]
add eax, 2
mov dword [esp + 0x38], ecx
mov dword [esp + 0x4c], eax
mov dword [edx], ecx
xor edx, edx
mov dword [esp + edi*4 + 0x64], ecx
mov dword [eax], edx
test edi, edi
je 0x406da0
mov eax, dword [esp + 0x24]
mov edx, dword [esp + 0x30]
mov byte [esp + 0x1d], al
mov al, byte [esp + 0x17]
add al, 0x10
mov dword [esp + 0x1e], ecx
mov cl, byte [esp + 0x50]
sub cl, byte [esp + 0x48]
mov byte [esp + 0x1c], al
movzx eax, dx
shr eax, cl
imul ecx, eax, 6
mov eax, dword [esp + 0x1c]
mov word [esp + edi*2 + 0xc8], dx
add ecx, dword [esp + edi*4 + 0x60]
mov dword [ecx], eax
mov ax, word [esp + 0x20]
mov word [ecx + 4], ax
mov esi, dword [esp + 0x24]
mov ecx, dword [esp + 0x2c]
add esi, ecx
mov edx, dword [esp + 0x28]
cmp edx, esi
jg 0x406c74
mov al, dl
lea esi, [esp + 0xec]
sub al, cl
mov byte [esp + 0x1d], al
mov eax, dword [esp + 0x54]
movzx eax, ax
lea eax, [esi + eax*2]
mov esi, dword [esp + 0x40]
cmp esi, eax
jb 0x406dde
mov byte [esp + 0x1c], 0x63
jmp 0x406e34
movzx ecx, word [esi]
add esi, 2
mov ax, word [esp + 0x33c]
mov dword [esp + 0x40], esi
cmp cx, ax
jae 0x406e0d
mov eax, 0x100
mov word [esp + 0x1e], cx
cmp cx, ax
setb al
add al, 0xf
mov byte [esp + 0x1c], al
jmp 0x406e34
movzx eax, ax
sub ecx, eax
mov dword [esp + 0x40], esi
mov eax, dword [esp + 0x344]
mov al, byte [eax + ecx*2]
mov byte [esp + 0x1c], al
mov eax, dword [esp + 0x340]
mov ax, word [eax + ecx*2]
mov word [esp + 0x1e], ax
mov esi, dword [esp + 0x2c]
mov ecx, edx
sub ecx, esi
mov eax, ebp
shl ax, cl
mov cx, si
movzx eax, ax
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x30]
shr ax, cl
movzx ecx, ax
mov ax, cx
mov dword [esp + 0x10], ecx
cmp ax, word [esp + 0x44]
jae 0x406e9b
mov esi, dword [esp + 0x1c]
mov edx, dword [esp + 0x48]
mov bx, word [esp + 0x20]
movzx eax, ax
add ecx, edx
imul eax, eax, 6
mov dword [esp + 0x10], ecx
add eax, dword [esp + 0x38]
mov dword [eax], esi
mov word [eax + 4], bx
mov ax, cx
cmp ax, word [esp + 0x44]
jb 0x406e70
mov ebx, dword [esp + 0x58]
xor ebp, ebp
mov edx, dword [esp + 0x28]
inc ebp
mov esi, dword [esp + 0x30]
lea ecx, [edx - 1]
mov eax, ebp
shl ax, cl
movzx ecx, ax
mov eax, ecx
mov dword [esp + 0x10], ecx
and eax, esi
test ax, ax
je 0x406ed1
mov dx, cx
shr dx, 1
xor esi, ecx
mov word [esp + 0x10], dx
mov ecx, dword [esp + 0x10]
mov eax, ecx
and eax, esi
test ax, ax
jne 0x406eba
movzx eax, word [esp + edi*2 + 0xc8]
xor esi, ecx
mov ecx, dword [esp + 0x2c]
mov edx, ebp
shl edx, cl
mov dword [esp + 0x30], esi
dec edx
movzx esi, si
and edx, esi
cmp edx, eax
je 0x406f13
mov ebx, dword [esp + 0x24]
movzx eax, word [esp + edi*2 + 0xc6]
sub ecx, ebx
dec edi
mov edx, ebp
shl edx, cl
dec edx
and edx, esi
cmp edx, eax
jne 0x406ef5
mov ebx, dword [esp + 0x58]
mov dword [esp + 0x2c], ecx
mov eax, dword [esp + 0x3c]
mov edx, dword [esp + 0x28]
mov esi, dword [esp + 0x24]
test ax, ax
jne 0x406c59
add dword [esp + 0x18], 2
inc edx
mov eax, dword [esp + 0x34]
mov dword [esp + 0x28], edx
cmp edx, eax
jg 0x406f79
mov eax, dword [esp + 0x18]
jmp 0x406c51
test edi, edi
je 0x406f62
mov eax, dword [esp + 0x64]
test eax, eax
je 0x406f62
mov esi, dword [eax - 4]
sub eax, 6
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov eax, esi
test esi, esi
jne 0x406f4f
push 0x7d3
call fcn.00403845
push eax
call fcn.004020eb
push 3
jmp 0x406b6a
test ebx, ebx
je 0x406f81
cmp eax, ebp
jne 0x406f85
xor eax, eax
mov ebp, eax
mov eax, ebp
mov ecx, dword [esp + 0x32c]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.0040886e
add esp, 0x320
ret