Function at 0x40654e
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x4f8
and dword [esp + 0xc], 0
push ebx
push ebp
mov ebp, dword [esp + 0x50c]
mov ebx, ecx
mov dword [esp + 0xc], ebx
push esi
push edi
mov edi, edx
mov dword [esp + 0x18], edi
test ebp, ebp
jle 0x4065bb
mov eax, dword [esp + 0x510]
mov edi, dword [esp + 0x50c]
sub eax, edi
mov ebx, dword [esp + 0x1c]
mov dword [esp + 0x510], eax
mov esi, dword [eax + edi]
mov eax, dword [esp + 0x18]
push esi
push dword [edi]
add eax, ebx
push eax
call fcn.0040d3c0
mov eax, dword [esp + 0x51c]
lea edi, [edi + 4]
add esp, 0xc
add ebx, esi
dec ebp
jne 0x40658f
mov ebx, dword [esp + 0x14]
mov edi, dword [esp + 0x18]
xor ebp, ebp
mov ecx, ebp
mov edx, ebp
test ebx, ebx
jle 0x4065e4
mov esi, dword [esp + 0x518]
mov al, byte [ecx + esi]
xor byte [edx + edi], al
inc ecx
xor eax, eax
cmp ecx, dword [esp + 0x51c]
cmove ecx, eax
inc edx
cmp edx, ebx
jl 0x4065cc
push 0x44c
call fcn.0040e777
mov esi, eax
pop ecx
test esi, esi
je 0x406610
or dword [esi + 4], 0xffffffff
or dword [esi + 0x238], 0xffffffff
mov dword [esi], ebp
mov dword [esi + 0x23c], ebp
mov dword [esi + 0x240], ebp
jmp 0x406612
mov esi, ebp
push ecx
push ebx
push edi
mov ecx, esi
call fcn.0040cb21
mov dword [0x46f3d4], eax
test eax, eax
je 0x406635
test esi, esi
je 0x406631
push ecx
mov ecx, esi
call fcn.0040d1c7
mov edi, ebp
jmp 0x406648
push 8
call fcn.0040e777
mov edi, eax
pop ecx
mov dword [edi], 1
mov dword [edi + 4], esi
push 5
mov edx, 0x428b24
lea ecx, [esp + 0x24]
call fcn.00404f88
cmp dword [eax + 0x14], 8
jb 0x406660
mov eax, dword [eax]
mov edx, 0x80000
mov ecx, 0x10000
test edi, edi
jne 0x406678
mov dword [0x46f3d4], ecx
mov esi, ecx
jmp 0x4066a3
cmp dword [edi], 1
je 0x406687
mov dword [0x46f3d4], edx
mov esi, edx
jmp 0x4066a3
lea ecx, [esp + 0x38]
push ecx
lea ecx, [esp + 0x18]
push ecx
push ecx
mov ecx, dword [edi + 4]
push eax
call fcn.0040d03e
mov esi, eax
mov dword [0x46f3d4], esi
push ebp
push 1
lea ecx, [esp + 0x28]
call fcn.0040199b
test esi, esi
je 0x40673c
cmp byte [0x4738d6], 0
je 0x406714
push esi
push str.z__x
lea eax, [esp + 0x270]
push 0x3ff
push eax
call fcn.00404f56
add esp, 0x10
lea ecx, [esp + 0x20]
mov edx, 0x428a54
push 3
call fcn.00404f88
cmp dword [eax + 0x14], 8
jb 0x4066f3
mov eax, dword [eax]
push 0x40040
push eax
lea eax, [esp + 0x270]
push eax
push ebp
call dword [0x469670]
push ebp
push 1
lea ecx, [esp + 0x28]
call fcn.0040199b
push 0x2f
mov edx, 0x42d360
lea ecx, [esp + 0x24]
call fcn.00404f88
mov ecx, eax
call fcn.004079df
push ebp
push 1
lea ecx, [esp + 0x28]
call fcn.0040199b
jmp 0x4067d9
mov ebx, dword [esp + 0x264]
push ebx
call fcn.0040d3a8
mov ebp, eax
pop ecx
test edi, edi
jne 0x40675c
mov dword [0x46f3d4], 0x10000
jmp 0x406781
cmp dword [edi], 1
je 0x40676d
mov dword [0x46f3d4], 0x80000
jmp 0x406781
push ecx
mov ecx, dword [edi + 4]
push ebx
push ebp
push dword [esp + 0x20]
call fcn.0040d0e6
mov dword [0x46f3d4], eax
push ebx
push ebp
push dword [esp + 0x20]
call fcn.0040d3c0
add esp, 0xc
test edi, edi
jne 0x40679f
mov dword [0x46f3d4], 0x10000
jmp 0x4067d2
cmp dword [edi], 1
je 0x4067b0
mov dword [0x46f3d4], 0x80000
jmp 0x4067d2
mov esi, dword [edi + 4]
mov ecx, esi
call fcn.0040d189
mov dword [0x46f3d4], eax
test esi, esi
je 0x4067cb
push ecx
mov ecx, esi
call fcn.0040d1c7
push edi
call fcn.0040e602
pop ecx
push ebp
call fcn.0040e8fb
pop ecx
pop edi
pop esi
pop ebp
mov eax, ebx
pop ebx
add esp, 0x4f8
ret 0x14