Function at 0x420380
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x24
push ebx
mov ebx, dword [esp + 0x38]
push ebp
mov ebp, dword [esp + 0x30]
push esi
push edi
mov edi, eax
mov eax, dword [esp + 0x3c]
mov esi, 1
mov ecx, ebx
shl esi, cl
mov dword [esp + 0x44], edi
cmp eax, dword [ebp + 8]
jle 0x4203e9
push ebp
call fcn.004137c0
add esp, 4
mov dword [esp + 0x28], eax
test eax, eax
je 0x42045d
mov ecx, dword [ebp]
test ecx, ecx
je 0x4203df
mov eax, dword [ebp + 8]
add eax, eax
add eax, eax
push eax
push ecx
call fcn.0045e7a0
add esp, 8
mov eax, ebp
call fcn.00413610
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x3c]
mov dword [ebp], eax
mov dword [ebp + 8], ecx
cmp ebx, 3
jg 0x420467
xor ebx, ebx
cmp dword [esp + 0x3c], ebx
jle 0x4205c6
lea ebx, [ebx]
xor edx, edx
xor ecx, ecx
test esi, esi
jle 0x420433
mov eax, ecx
xor eax, dword [esp + 0x40]
inc ecx
lea ebp, [eax - 1]
shr ebp, 0x1f
not eax
shr eax, 0x1f
and ebp, eax
mov eax, dword [edi + ecx*4 - 4]
neg ebp
and ebp, 1
neg ebp
and ebp, eax
or edx, ebp
cmp ecx, esi
jl 0x420408
mov ebp, dword [esp + 0x38]
mov ecx, dword [ebp]
mov dword [ecx + ebx*4], edx
lea eax, [esi*4]
inc ebx
add edi, eax
cmp ebx, dword [esp + 0x3c]
jl 0x420400
mov eax, dword [esp + 0x3c]
pop edi
pop esi
mov dword [ebp + 4], eax
pop ebp
mov eax, 1
pop ebx
add esp, 0x24
ret
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x24
ret
mov edx, dword [esp + 0x40]
lea ecx, [ebx - 2]
mov eax, edx
sar eax, cl
mov edi, 1
shl edi, cl
lea ebx, [eax - 1]
shr ebx, 0x1f
lea ecx, [edi - 1]
and edx, ecx
mov dword [esp + 0x40], edx
mov edx, eax
not edx
shr edx, 0x1f
and ebx, edx
mov ecx, eax
xor ecx, 1
lea edx, [ecx - 1]
not ecx
shr ecx, 0x1f
shr edx, 0x1f
and edx, ecx
mov ecx, eax
xor ecx, 2
lea ebp, [ecx - 1]
not ecx
shr ecx, 0x1f
shr ebp, 0x1f
and ebp, ecx
xor eax, 3
lea ecx, [eax - 1]
shr ecx, 0x1f
not eax
shr eax, 0x1f
and ecx, eax
neg ebx
neg edx
neg ebp
neg ecx
and ebx, 1
and edx, 1
and ebp, 1
and ecx, 1
xor eax, eax
neg edx
neg ebp
neg ecx
neg ebx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x20], ebp
mov dword [esp + 0x24], ecx
mov dword [esp + 0x28], eax
cmp dword [esp + 0x3c], eax
jle 0x4205c2
lea edx, [esi*4]
mov dword [esp + 0x30], edx
xor esi, esi
mov dword [esp + 0x1c], esi
cmp edi, esi
jle 0x42059e
mov eax, dword [esp + 0x44]
lea edx, [eax + edi*4]
mov dword [esp + 0x18], edx
lea edx, [eax + edi*8]
mov dword [esp + 0x14], edx
lea edx, [edi + edi*2]
lea eax, [eax + edx*4]
mov dword [esp + 0x10], eax
mov edx, dword [esp + 0x10]
mov edx, dword [edx]
and edx, ecx
mov ecx, dword [esp + 0x14]
mov ecx, dword [ecx]
and ecx, ebp
or ecx, edx
mov edx, dword [esp + 0x18]
mov edx, dword [edx]
and edx, dword [esp + 0x2c]
mov ebp, dword [esp + 0x20]
or edx, ecx
mov eax, esi
xor eax, dword [esp + 0x40]
inc esi
lea ecx, [eax - 1]
not eax
shr ecx, 0x1f
shr eax, 0x1f
and ecx, eax
mov eax, dword [esp + 0x44]
mov eax, dword [eax + esi*4 - 4]
neg ecx
and ecx, 1
and eax, ebx
neg ecx
or eax, edx
and ecx, eax
or dword [esp + 0x1c], ecx
mov ecx, dword [esp + 0x24]
mov eax, 4
add dword [esp + 0x10], eax
add dword [esp + 0x14], eax
add dword [esp + 0x18], eax
cmp esi, edi
jl 0x420532
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x38]
mov edx, dword [edx]
mov esi, dword [esp + 0x1c]
mov dword [edx + eax*4], esi
mov edx, dword [esp + 0x30]
add dword [esp + 0x44], edx
inc eax
mov dword [esp + 0x28], eax
cmp eax, dword [esp + 0x3c]
jl 0x420508
mov ebp, dword [esp + 0x38]
mov eax, dword [esp + 0x3c]
pop edi
pop esi
mov dword [ebp + 4], eax
pop ebp
mov eax, 1
pop ebx
add esp, 0x24
ret