Function at 0x59d420
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x24
call fcn.005eb280
mov eax, dword [esp + 0x28]
push ebx
push esi
mov esi, dword [esp + 0x40]
mov ebx, 1
mov ecx, esi
shl ebx, cl
mov ecx, dword [esp + 0x34]
push edi
mov edi, dword [esp + 0x3c]
cmp ecx, dword [eax + 8]
jle 0x59d459
push ecx
push eax
call fcn.00571800
mov ecx, dword [esp + 0x40]
add esp, 8
test eax, eax
jne 0x59d464
pop edi
pop esi
pop ebx
add esp, 0x24
ret
push ebp
cmp esi, 3
jg 0x59d4d3
xor ebp, ebp
test ecx, ecx
jle 0x59d62e
xor esi, esi
xor eax, eax
test ebx, ebx
jle 0x59d4a8
lea esp, [esp]
mov ecx, eax
xor ecx, dword [esp + 0x44]
lea edx, [ecx - 1]
not ecx
shr edx, 0x1f
shr ecx, 0x1f
and edx, ecx
neg edx
and edx, 1
neg edx
and edx, dword [edi + eax*4]
inc eax
or esi, edx
cmp eax, ebx
jl 0x59d480
mov ecx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
mov eax, dword [eax]
mov dword [eax + ebp*4], esi
lea eax, [ebx*4]
inc ebp
add edi, eax
cmp ebp, ecx
jl 0x59d474
mov eax, dword [esp + 0x38]
pop ebp
pop edi
pop esi
mov dword [eax + 4], ecx
mov eax, 1
pop ebx
add esp, 0x24
ret
mov ebp, dword [esp + 0x44]
lea ecx, [esi - 2]
mov esi, 1
mov edx, ebp
shl esi, cl
sar edx, cl
mov dword [esp + 0x2c], esi
lea eax, [esi - 1]
and ebp, eax
lea ecx, [edx - 1]
shr ecx, 0x1f
mov eax, edx
not eax
mov dword [esp + 0x18], ebp
shr eax, 0x1f
and ecx, eax
mov eax, edx
neg ecx
xor eax, 1
and ecx, 1
neg ecx
mov dword [esp + 0x28], ecx
lea ecx, [eax - 1]
not eax
shr eax, 0x1f
shr ecx, 0x1f
and ecx, eax
mov eax, edx
neg ecx
xor eax, 2
and ecx, 1
xor edx, 3
neg ecx
mov dword [esp + 0x24], ecx
lea ecx, [eax - 1]
not eax
shr eax, 0x1f
shr ecx, 0x1f
and ecx, eax
lea eax, [edx - 1]
shr eax, 0x1f
not edx
shr edx, 0x1f
neg ecx
and eax, edx
and ecx, 1
neg eax
neg ecx
and eax, 1
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0x3c]
neg eax
mov dword [esp + 0x1c], eax
xor eax, eax
mov dword [esp + 0x14], eax
test ecx, ecx
jle 0x59d62e
lea ecx, [ebx*4]
mov dword [esp + 0x30], ecx
mov edi, edi
xor edx, edx
xor ebx, ebx
mov dword [esp + 0x48], edx
test esi, esi
jle 0x59d610
lea eax, [esi + esi*2]
lea ecx, [edi + esi*8]
lea eax, [edi + eax*4]
mov dword [esp + 0x10], ecx
lea ebp, [edi + esi*4]
mov dword [esp + 0x40], eax
mov eax, dword [eax]
lea ebp, [ebp + 4]
mov ecx, dword [ecx]
mov esi, ebx
and ecx, dword [esp + 0x20]
and eax, dword [esp + 0x1c]
xor esi, dword [esp + 0x18]
or ecx, eax
mov edx, dword [ebp - 4]
and edx, dword [esp + 0x24]
mov eax, dword [edi + ebx*4]
or edx, ecx
and eax, dword [esp + 0x28]
lea ecx, [esi - 1]
shr ecx, 0x1f
not esi
shr esi, 0x1f
or eax, edx
mov edx, dword [esp + 0x48]
and ecx, esi
mov esi, dword [esp + 0x2c]
neg ecx
and ecx, 1
inc ebx
neg ecx
and ecx, eax
mov eax, dword [esp + 0x40]
or edx, ecx
add eax, 4
mov ecx, dword [esp + 0x10]
add ecx, 4
mov dword [esp + 0x48], edx
mov dword [esp + 0x40], eax
mov dword [esp + 0x10], ecx
cmp ebx, esi
jl 0x59d5a4
mov eax, dword [esp + 0x14]
mov ecx, dword [esp + 0x38]
add edi, dword [esp + 0x30]
mov ecx, dword [ecx]
mov dword [ecx + eax*4], edx
inc eax
mov ecx, dword [esp + 0x3c]
mov dword [esp + 0x14], eax
cmp eax, ecx
jl 0x59d580
mov eax, dword [esp + 0x38]
pop ebp
pop edi
pop esi
mov dword [eax + 4], ecx
mov eax, 1
pop ebx
add esp, 0x24
ret