Function at 0x409560
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x24
mov ecx, dword [esp + 0x28]
xor eax, eax
mov dword [esp + 0x10], eax
push ebx
mov dword [esp + 0x18], eax
push esi
mov dword [esp + 0x20], eax
push edi
mov dword [esp + 0x28], eax
mov al, byte [ecx + 0x148]
cmp al, 9
je 0x409592
pop edi
pop esi
mov eax, 0xfffffffb
pop ebx
add esp, 0x24
ret
cmp byte [ecx + 1], 2
je 0x4095a4
pop edi
pop esi
mov eax, 0xfffffffa
pop ebx
add esp, 0x24
ret
mov esi, dword [esp + 0x38]
test esi, esi
je 0x4097a3
mov eax, dword [esp + 0x3c]
test eax, eax
jle 0x4097a3
mov edx, eax
and edx, 0x8000000f
jns 0x4095cb
dec edx
or edx, 0xfffffff0
inc edx
je 0x4095d9
pop edi
pop esi
mov eax, 0xfffffff9
pop ebx
add esp, 0x24
ret
cdq
and edx, 0xf
add eax, edx
movsx edx, byte [ecx]
sar eax, 4
sub edx, 3
mov dword [esp + 0x3c], eax
je 0x409714
dec edx
je 0x4095ff
pop edi
pop esi
or eax, 0xffffffff
pop ebx
add esp, 0x24
ret
lea edx, [ecx + 0x44]
push ebp
dec eax
mov ebx, dword [edx]
test eax, eax
mov edi, dword [edx + 4]
mov ebp, dword [edx + 8]
mov edx, dword [edx + 0xc]
mov dword [esp + 0x1c], edx
jle 0x40969d
mov dword [esp + 0x3c], eax
lea eax, [esp + 0x20]
push eax
push esi
push ecx
call fcn.00409fd0
mov ecx, dword [esp + 0x30]
mov eax, dword [esp + 0x2c]
mov edx, dword [esp + 0x28]
xor ecx, edi
mov edi, dword [esp + 0x38]
xor eax, ebx
mov ebx, dword [esp + 0x34]
xor edi, edx
xor ebx, ebp
mov edx, esi
mov dword [esp + 0x34], ebx
mov dword [esp + 0x38], edi
mov ebx, dword [edx]
mov dword [esp + 0x2c], eax
mov dword [esp + 0x30], ecx
add esp, 0xc
mov edi, dword [edx + 4]
add esi, 0x10
mov ebp, dword [edx + 8]
mov edx, dword [edx + 0xc]
mov dword [esp + 0x1c], edx
mov edx, dword [esp + 0x44]
mov dword [edx], eax
mov eax, dword [esp + 0x28]
mov dword [edx + 4], ecx
mov ecx, dword [esp + 0x2c]
mov dword [edx + 8], eax
mov eax, dword [esp + 0x3c]
mov dword [edx + 0xc], ecx
mov ecx, edx
add ecx, 0x10
dec eax
mov dword [esp + 0x44], ecx
mov ecx, dword [esp + 0x38]
mov dword [esp + 0x3c], eax
jne 0x40961f
lea edx, [esp + 0x20]
push edx
push esi
push ecx
call fcn.00409fd0
mov eax, dword [esp + 0x2c]
mov edx, dword [esp + 0x34]
mov ecx, dword [esp + 0x38]
mov esi, dword [esp + 0x30]
xor eax, ebx
xor edx, ebp
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x28]
xor ecx, eax
mov dword [esp + 0x34], edx
mov dword [esp + 0x38], ecx
mov edx, dword [esp + 0x3b]
add esp, 0xc
xor esi, edi
and edx, 0xff
mov dword [esp + 0x24], esi
pop ebp
jle 0x409755
cmp edx, 0x10
jg 0x409755
mov esi, 0x10
sub esi, edx
mov eax, esi
cmp eax, 0x10
jge 0x409708
xor ecx, ecx
mov cl, byte [esp + eax + 0x1c]
cmp ecx, edx
jne 0x409755
inc eax
cmp eax, 0x10
jl 0x4096f8
mov edi, dword [esp + 0x40]
mov ecx, esi
lea esi, [esp + 0x1c]
jmp 0x409785
mov edi, dword [esp + 0x40]
lea ebx, [eax - 1]
test ebx, ebx
jle 0x409737
push edi
push esi
push ecx
call fcn.00409fd0
mov ecx, dword [esp + 0x40]
add esp, 0xc
add esi, 0x10
add edi, 0x10
dec ebx
jne 0x40971f
lea edx, [esp + 0x1c]
push edx
push esi
push ecx
call fcn.00409fd0
mov edx, dword [esp + 0x37]
add esp, 0xc
and edx, 0xff
cmp edx, 0x10
jl 0x409761
pop edi
pop esi
mov eax, 0xfffffff9
pop ebx
add esp, 0x24
ret
mov esi, 0x10
sub esi, edx
mov eax, esi
cmp eax, 0x10
jge 0x40977f
xor ecx, ecx
mov cl, byte [esp + eax + 0x1c]
cmp ecx, edx
jne 0x409755
inc eax
cmp eax, 0x10
jl 0x40976f
mov ecx, esi
lea esi, [esp + 0x1c]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x3c]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
shl eax, 4
pop edi
pop esi
sub eax, edx
pop ebx
add esp, 0x24
ret
pop edi
pop esi
xor eax, eax
pop ebx
add esp, 0x24
ret