Function at 0x406587
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
push ebx
push esi
push edi
and dword [ebp - 0x14], 0
cmp dword [ebp + 8], 0
jne 0x4065a4
mov eax, 0xffffff9a
jmp 0x40684a
mov ebx, dword [ebp + 8]
cmp dword [ebx + 0x38], 0
jne 0x4065b7
mov eax, 0xffffff9a
jmp 0x40684a
cmp dword [ebx + 0x9c], 0
je 0x4065c9
push dword [ebp + 8]
call fcn.00406c64
pop ecx
lea eax, [ebp - 0x20]
push eax
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x18]
push eax
push ebx
call fcn.0040639b
add esp, 0x10
or eax, eax
je 0x4065ec
mov eax, 0xffffff99
jmp 0x40684a
push 0x90
call fcn.0040ac90
pop ecx
mov dword [ebp - 4], eax
test eax, eax
jne 0x406608
mov eax, 0xffffff98
jmp 0x40684a
push 0x4000
call fcn.0040ac90
pop ecx
mov edi, dword [ebp - 4]
mov dword [edi], eax
mov eax, edi
mov edx, dword [ebp - 0x1c]
mov dword [eax + 0x44], edx
mov eax, edi
mov edx, dword [ebp - 0x20]
mov dword [eax + 0x48], edx
mov eax, edi
and dword [eax + 0x4c], 0
mov eax, edi
mov edx, dword [ebp + 0x14]
mov dword [eax + 0x8c], edx
mov eax, edi
cmp dword [eax], 0
jne 0x406655
test edi, edi
je 0x40664b
push edi
call fcn.0040a2b0
pop ecx
mov eax, 0xffffff98
jmp 0x40684a
mov eax, dword [ebp - 4]
and dword [eax + 0x40], 0
cmp dword [ebp + 0xc], 0
je 0x40666a
mov eax, dword [ebp + 0xc]
mov edx, dword [ebx + 0x54]
mov dword [eax], edx
cmp dword [ebp + 0x10], 0
je 0x4066ad
mov eax, dword [ebp + 0x10]
mov dword [eax], 6
mov eax, dword [ebx + 0x50]
and eax, 6
cmp eax, 2
je 0x4066a4
cmp eax, 4
je 0x406699
cmp eax, 6
jne 0x4066ad
mov eax, dword [ebp + 0x10]
mov dword [eax], 1
jmp 0x4066ad
mov eax, dword [ebp + 0x10]
mov dword [eax], 2
jmp 0x4066ad
mov eax, dword [ebp + 0x10]
mov dword [eax], 9
mov eax, dword [ebx + 0x54]
or eax, eax
je 0x4066c0
cmp eax, 8
je 0x4066c0
mov dword [ebp - 0x14], 0xffffff99
mov eax, dword [ebp - 4]
mov edx, dword [ebx + 0x5c]
mov dword [eax + 0x54], edx
and dword [eax + 0x50], 0
mov edx, dword [ebx + 0x54]
mov dword [eax + 0x84], edx
mov edx, dword [ebx + 0x20]
mov dword [eax + 0x80], edx
mov edi, eax
add edi, 0x60
mov esi, ebx
mov ecx, 8
rep movsd dword es:[edi], dword [esi]
mov edx, dword [ebx + 0x2c]
mov dword [eax + 0x88], edx
and dword [eax + 0x18], 0
cmp dword [ebx + 0x54], 8
jne 0x40674a
cmp dword [ebp + 0x14], 0
jne 0x40674a
and dword [eax + 0x24], 0
and dword [eax + 0x28], 0
and dword [eax + 0x2c], 0
and dword [eax + 4], 0
and dword [eax + 8], 0
push 0x38
push 0x4144b1
push 0xfffffffffffffff1
add eax, 4
push eax
call fcn.00406fb8
add esp, 0x10
mov dword [ebp - 0x14], eax
test eax, eax
jne 0x406742
mov eax, dword [ebp - 4]
mov dword [eax + 0x40], 1
jmp 0x40674a
mov eax, dword [ebp - 0x14]
jmp 0x40684a
mov eax, dword [ebp - 4]
mov edx, dword [ebx + 0x60]
mov dword [eax + 0x58], edx
mov edx, dword [ebx + 0x64]
mov dword [eax + 0x5c], edx
mov edx, dword [ebx + 0x98]
add edx, 0x1e
add edx, dword [ebp - 0x18]
mov dword [eax + 0x3c], edx
and dword [eax + 8], 0
mov dword [ebx + 0x9c], eax
cmp dword [ebp + 0x18], 0
je 0x406848
call fcn.004089e0
mov dword [ebx + 0xb0], eax
push dword [ebx + 0xb0]
mov eax, ebx
add eax, 0xa4
push eax
push dword [ebp + 0x18]
call fcn.004056de
push 0
mov eax, dword [ebx + 0x9c]
mov edx, dword [eax + 0x3c]
add edx, dword [eax + 0x88]
push edx
push dword [ebx + 0x20]
push dword [ebx + 0x1c]
call dword [ebx + 0x10]
add esp, 0x1c
or eax, eax
je 0x4067c9
mov eax, 0xffffff98
jmp 0x40684a
push 0xc
lea eax, [ebp - 0x10]
push eax
push dword [ebx + 0x20]
push dword [ebx + 0x1c]
call dword [ebx + 4]
add esp, 0x10
cmp eax, 0xc
jae 0x4067e7
mov eax, 0xffffff98
jmp 0x40684a
and dword [ebp - 0x24], 0
push dword [ebx + 0xb0]
mov eax, ebx
add eax, 0xa4
push eax
call fcn.00405650
mov edi, dword [ebp - 0x24]
lea edi, [ebp + edi - 0x10]
movsx esi, byte [edi]
xor esi, eax
mov edx, esi
mov byte [edi], dl
movsx edi, dl
push edi
push dword [ebx + 0xb0]
mov edi, ebx
add edi, 0xa4
push edi
call fcn.0040567a
add esp, 0x14
inc dword [ebp - 0x24]
cmp dword [ebp - 0x24], 0xc
jl 0x4067eb
mov eax, dword [ebx + 0x9c]
add eax, 0x3c
add dword [eax], 0xc
mov dword [ebx + 0xa0], 1
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret