Function at 0x581aa0
Capabilities:
Encode data using xor

Disassembly:
mov eax, 0x24
call fcn.0052a370
mov eax, dword [esp + 0x28]
push ebx
push ebp
mov ebp, dword [esp + 0x34]
push esi
mov esi, dword [esp + 0x44]
mov ebx, 1
mov ecx, esi
shl ebx, cl
push edi
mov edi, dword [esp + 0x40]
cmp ebp, dword [eax + 8]
jle 0x581ad6
push ebp
push eax
call fcn.0056b3e0
add esp, 8
test eax, eax
jne 0x581ae2
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x24
ret
cmp esi, 3
jg 0x581b4a
xor ecx, ecx
mov dword [esp + 0x3c], ecx
test ebp, ebp
jle 0x581c9f
xor esi, esi
xor eax, eax
test ebx, ebx
jle 0x581b29
lea ecx, [ecx]
mov ecx, eax
xor ecx, dword [esp + 0x44]
inc eax
lea edx, [ecx - 1]
shr edx, 0x1f
not ecx
shr ecx, 0x1f
and edx, ecx
neg edx
and edx, 1
neg edx
and edx, dword [edi + eax*4 - 4]
or esi, edx
cmp eax, ebx
jl 0x581b00
mov ecx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
inc ecx
mov eax, dword [eax]
mov dword [esp + 0x3c], ecx
mov dword [eax + ecx*4 - 4], esi
lea eax, [ebx*4]
add edi, eax
cmp ecx, ebp
jl 0x581af5
jmp 0x581c9f
mov edx, dword [esp + 0x44]
lea ecx, [esi - 2]
sar edx, cl
mov esi, 1
shl esi, cl
mov ecx, dword [esp + 0x44]
mov dword [esp + 0x2c], esi
lea eax, [esi - 1]
and ecx, eax
mov dword [esp + 0x18], ecx
mov eax, edx
not eax
shr eax, 0x1f
lea ecx, [edx - 1]
shr ecx, 0x1f
and ecx, eax
neg ecx
and ecx, 1
neg ecx
mov dword [esp + 0x28], ecx
mov eax, edx
xor eax, 1
lea ecx, [eax - 1]
not eax
shr ecx, 0x1f
shr eax, 0x1f
and ecx, eax
neg ecx
and ecx, 1
neg ecx
mov eax, edx
xor eax, 2
mov dword [esp + 0x24], ecx
lea ecx, [eax - 1]
not eax
shr eax, 0x1f
shr ecx, 0x1f
and ecx, eax
xor edx, 3
neg ecx
lea eax, [edx - 1]
shr eax, 0x1f
not edx
shr edx, 0x1f
and eax, edx
and ecx, 1
neg eax
neg ecx
and eax, 1
mov dword [esp + 0x20], ecx
neg eax
xor ecx, ecx
mov dword [esp + 0x1c], eax
mov dword [esp + 0x14], ecx
test ebp, ebp
jle 0x581c9f
shl ebx, 2
mov dword [esp + 0x30], ebx
nop
xor edx, edx
xor ebx, ebx
mov dword [esp + 0x48], edx
test esi, esi
jle 0x581c84
lea eax, [esi + esi*2]
lea ecx, [edi + esi*8]
lea eax, [edi + eax*4]
lea ebp, [edi + esi*4]
mov dword [esp + 0x10], ecx
mov dword [esp + 0x40], eax
mov eax, dword [eax]
mov ecx, dword [ecx]
and ecx, dword [esp + 0x20]
and eax, dword [esp + 0x1c]
mov edx, dword [ebp]
and edx, dword [esp + 0x24]
or ecx, eax
mov eax, dword [edi + ebx*4]
and eax, dword [esp + 0x28]
or edx, ecx
mov esi, ebx
xor esi, dword [esp + 0x18]
or eax, edx
mov edx, dword [esp + 0x48]
lea ecx, [esi - 1]
shr ecx, 0x1f
not esi
shr esi, 0x1f
and ecx, esi
mov esi, dword [esp + 0x2c]
neg ecx
and ecx, 1
neg ecx
and ecx, eax
mov eax, dword [esp + 0x40]
or edx, ecx
mov ecx, dword [esp + 0x10]
inc ebx
add eax, 4
add ecx, 4
mov dword [esp + 0x48], edx
mov dword [esp + 0x40], eax
mov dword [esp + 0x10], ecx
lea ebp, [ebp + 4]
cmp ebx, esi
jl 0x581c14
mov ebp, dword [esp + 0x3c]
mov ecx, dword [esp + 0x14]
mov eax, dword [esp + 0x38]
add edi, dword [esp + 0x30]
mov eax, dword [eax]
inc ecx
mov dword [eax + ecx*4 - 4], edx
mov dword [esp + 0x14], ecx
cmp ecx, ebp
jl 0x581bf0
mov esi, dword [esp + 0x38]
mov dword [esi + 4], ebp
test ebp, ebp
jle 0x581cc3
mov ecx, dword [esi]
add ecx, 0xfffffffc
lea ecx, [ecx + ebp*4]
mov eax, dword [ecx]
lea ecx, [ecx - 4]
test eax, eax
jne 0x581cc0
dec ebp
test ebp, ebp
jg 0x581cb2
mov dword [esi + 4], ebp
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x24
ret