Function at 0x406a36
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x320
mov eax, dword [0x4261a4]
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.004037f2
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 0x406a95
cmp word [esp + 0xa4], bp
jne 0x406ac3
xor eax, eax
mov dword [edi], eax
mov dword [ebx], eax
jmp 0x406f9a
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 0x406aee
inc edi
mov si, di
mov dword [esp + 0x10], edi
cmp si, dx
jbe 0x406ad4
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 0x406b17
add edx, 0xffff
test dx, dx
jne 0x406aff
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 0x406b6b
movzx eax, si
movzx eax, word [esp + eax*2 + 0xa4]
sub ebx, eax
js 0x406b7b
inc edi
add ebx, ebx
mov si, di
mov dword [esp + 0x10], edi
cmp si, dx
jb 0x406b49
mov eax, dword [esp + 0x34]
movzx esi, word [esp + eax*2 + 0xa4]
sub ebx, esi
mov dword [esp + 0x58], ebx
jns 0x406b83
push 2
pop eax
jmp 0x406f9a
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 0x406bcb
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 0x406bb1
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 0x406c0a
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 0x406bd3
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 0x406f8c
lea eax, [esp + 0xa4]
lea eax, [eax + edx*2]
mov dword [esp + 0x18], eax
movzx eax, word [eax]
jmp 0x406f32
add eax, 0xffff
add esi, ecx
mov dword [esp + 0x3c], eax
cmp edx, esi
jle 0x406dc9
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 0x406d1c
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 0x406d12
mov ebp, esi
lea eax, [eax + 2]
add ecx, ecx
movzx esi, word [eax]
cmp cx, si
jbe 0x406d0f
sub ecx, esi
inc edx
mov dword [esp + 0x10], edx
cmp dx, bp
jb 0x406cf6
xor ebp, ebp
inc ebp
mov cl, byte [esp + 0x10]
mov byte [esp + 0x17], cl
jmp 0x406d20
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 0x406f56
mov edx, dword [esp + 0x4c]
lea ecx, [esi + 1]
add word [0x42942c], 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 0x406db3
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 0x406c87
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 0x406df1
mov byte [esp + 0x1c], 0x63
jmp 0x406e47
movzx ecx, word [esi]
add esi, 2
mov ax, word [esp + 0x33c]
mov dword [esp + 0x40], esi
cmp cx, ax
jae 0x406e20
mov eax, 0x100
mov word [esp + 0x1e], cx
cmp cx, ax
setb al
add al, 0xf
mov byte [esp + 0x1c], al
jmp 0x406e47
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 0x406eae
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 0x406e83
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 0x406ee4
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 0x406ecd
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 0x406f26
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 0x406f08
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 0x406c6c
add dword [esp + 0x18], 2
inc edx
mov eax, dword [esp + 0x34]
mov dword [esp + 0x28], edx
cmp edx, eax
jg 0x406f8c
mov eax, dword [esp + 0x18]
jmp 0x406c64
test edi, edi
je 0x406f75
mov eax, dword [esp + 0x64]
test eax, eax
je 0x406f75
mov esi, dword [eax - 4]
sub eax, 6
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov eax, esi
test esi, esi
jne 0x406f62
push 0x7d3
call fcn.00403820
push eax
call fcn.004020c6
push 3
jmp 0x406b7d
test ebx, ebx
je 0x406f94
cmp eax, ebp
jne 0x406f98
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.0040886f
add esp, 0x320
ret