Function at 0x1016a570
Capabilities:
Encode data using xor

Disassembly:
sub esp, 0x40
push ebx
mov ebx, dword [esp + 0x4c]
push ebp
push esi
mov esi, dword [esp + 0x5c]
mov eax, dword [ebx + 0x10b0]
push edi
mov eax, dword [eax]
movsx ebp, byte [eax + 0x14]
mov dword [esp + 0x44], eax
mov dword [esp + 0x24], ebp
mov cl, byte [eax + 5]
lea edi, [eax + 0x9f]
mov dl, byte [eax + 0x15]
mov byte [esp + 0x13], cl
lea ecx, [eax + 0x14]
mov al, byte [edi]
mov dword [esp + 0x30], ecx
test dl, dl
jns 0x1016a745
movzx ecx, al
shr ecx, 4
and ecx, 3
mov dword [esp + 0x14], ecx
mov ecx, dword [esp + 0x54]
mov dword [esp + 0x20], closesocket
cmp dword [ecx + 0x5ce3c], 0
je 0x1016a8a0
test al, 0x30
jbe 0x1016a8a0
push 0
push ebx
call fcn.100bcdd0
xor ebp, ebp
movzx edx, ax
add esp, 8
shr eax, 0x10
test byte [edi], 0x30
mov ecx, closesocket
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x48], ebp
mov dword [esp + 0x4c], ebp
mov dword [esp + 0x18], ebp
jbe 0x1016a8a0
mov esi, dword [esp + 0x14]
add ebx, 0x2c70
cwde
mov dword [esp + 0x34], eax
movsx eax, dx
mov dword [esp + 0x2c], ebx
or ebx, 0xffffffff
mov dword [esp + 0x38], eax
push dword [esp + 0x2c]
mov dword [esp + 0x18], ebx
mov ebp, ecx
mov ebx, dword [esp + 0x1c]
push ebx
push dword [esp + 0x38]
mov dword [esp + 0x48], edi
push 0
call fcn.100bce10
mov edi, dword [esp + 0x48]
mov ecx, eax
mov dword [esp + ebx*4 + 0x58], eax
add esp, 0x10
mov ebx, dword [esp + 0x34]
cwde
sub edi, eax
shr ecx, 0x10
movsx ecx, cx
mov eax, edi
cdq
sub ebx, ecx
mov ecx, eax
mov eax, ebx
xor ecx, edx
sub ecx, edx
cdq
xor eax, edx
sub eax, edx
cmp ecx, eax
mov ecx, dword [esp + 0x1c]
cmovle edi, ebx
mov ebx, dword [esp + 0x18]
mov eax, edi
mov edi, dword [esp + 0x3c]
cdq
xor eax, edx
sub eax, edx
mov edx, esi
cmp ecx, eax
mov dword [esp + 0x40], edx
cmovg ecx, eax
cmp ebp, eax
movzx eax, byte [edi]
cmovle ebx, dword [esp + 0x14]
mov ebp, dword [esp + 0x18]
shr eax, 4
inc ebp
and eax, 3
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x18], ebp
cmp ebp, eax
jl 0x1016a630
mov esi, dword [esp + 0x60]
mov edi, edx
mov ebp, dword [esp + 0x68]
cmp ecx, 0x80
jge 0x1016a73c
mov eax, dword [esp + 0x24]
lea ecx, [eax + ebx*8]
mov eax, dword [ebp + 0x38]
shl ecx, 2
cmp dword [ecx + eax], 0
je 0x1016a73c
add ecx, dword [ebp + 0x30]
movsx eax, word [esp + ebx*4 + 0x4a]
movsx ebx, word [esp + ebx*4 + 0x48]
movsx edi, word [ecx + 2]
sub edi, eax
movzx eax, word [ecx]
mov ecx, eax
cwde
sub eax, ebx
mov dword [esp + 0x3c], ecx
cdq
mov ecx, eax
mov eax, edi
xor ecx, edx
sub ecx, edx
cdq
xor eax, edx
sub eax, edx
cmp ecx, eax
jle 0x1016a721
mov eax, dword [esp + 0x3c]
movsx edi, ax
sub edi, ebx
mov ebx, dword [esp + 0x1c]
mov eax, edi
mov edi, dword [esp + 0x40]
add ebx, 4
cdq
xor eax, edx
sub eax, edx
add ebx, eax
sar ebx, 3
mov dword [esp + 0x20], ebx
mov ebx, dword [esp + 0x58]
jmp 0x1016a8a8
movsx ecx, dl
mov dword [esp + 0x28], ecx
movzx ecx, al
shr ecx, 4
and ecx, 3
mov dword [esp + 0x14], ecx
test dl, dl
jle 0x1016a5c1
mov edx, dword [esp + 0x68]
lea edi, [ecx*8]
add edi, ebp
mov eax, dword [edx + 0x38]
mov ebp, dword [eax + edi*4]
mov dword [esp + 0x58], ebp
mov ebp, dword [esp + 0x28]
lea ebp, [ebp + ecx*8]
mov ecx, dword [eax + ebp*4]
mov al, byte [esp + 0x13]
mov dword [esp + 0x28], ecx
cmp al, 0x18
jne 0x1016a820
cmp dword [esp + 0x58], 0
je 0x1016a7b6
mov eax, dword [edx + 0x30]
push 0
push esi
push ebx
mov eax, dword [eax + edi*4]
mov dword [esi], eax
call fcn.10166e90
mov edx, dword [esp + 0x74]
add esp, 0xc
mov ecx, dword [esp + 0x28]
test ecx, ecx
je 0x1016a7d1
mov eax, dword [edx + 0x30]
lea ecx, [esi + 4]
push 1
push ecx
push ebx
mov eax, dword [eax + ebp*4]
mov dword [ecx], eax
call fcn.10166e90
add esp, 0xc
mov ebp, dword [esp + 0x64]
xor edi, edi
mov dword [ebp], 0
nop
push edi
push ebx
call fcn.100bcdd0
mov dword [esp + 0x60], eax
mov eax, dword [ebx + 0xa97c]
push 0x6c
push dword [eax + 0x80010]
push eax
lea eax, [esp + 0x6c]
push eax
push esi
call fcn.10100bf0
add dword [ebp], eax
inc edi
add esp, 0x1c
add esi, 4
cmp edi, 2
jl 0x1016a7e0
pop edi
pop esi
pop ebp
xor eax, eax
xor edx, edx
pop ebx
add esp, 0x40
ret
cmp al, 0x13
je 0x1016a847
cmp al, 0x15
je 0x1016a847
cmp dword [esp + 0x58], 0
je 0x1016a843
mov eax, dword [edx + 0x30]
push 0
push esi
push ebx
mov eax, dword [eax + edi*4]
mov dword [esi], eax
call fcn.10166e90
add esp, 0xc
push 0
jmp 0x1016a864
add esi, 4
test ecx, ecx
je 0x1016a862
mov eax, dword [edx + 0x30]
push 1
push esi
push ebx
mov eax, dword [eax + ebp*4]
mov dword [esi], eax
call fcn.10166e90
add esp, 0xc
push 1
push ebx
call fcn.100bcdd0
mov dword [esp + 0x60], eax
mov eax, dword [ebx + 0xa97c]
push 0x6c
push dword [eax + 0x80010]
push eax
lea eax, [esp + 0x6c]
push eax
push esi
call fcn.10100bf0
mov ecx, dword [esp + 0x80]
add esp, 0x1c
pop edi
pop esi
mov dword [ecx], eax
xor eax, eax
pop ebp
xor edx, edx
pop ebx
add esp, 0x40
ret
mov edi, dword [esp + 0x14]
mov ebp, dword [esp + 0x68]
push ebp
lea eax, [esp + 0x2c]
push eax
push dword [esp + 0x74]
push dword [esp + 0x2c]
push dword [esp + 0x74]
push 0
push dword [esp + 0x74]
push ebx
push dword [esp + 0x74]
call fcn.10462440
mov eax, dword [esp + 0x4c]
add esp, 0x24
cmp eax, 0x80008000
je 0x1016a92c
mov ecx, dword [esp + 0x24]
lea edx, [ecx + edi*8]
mov ecx, dword [ebp + 0x30]
mov dword [ecx + edx*4], eax
mov ecx, dword [ebp + 0x34]
mov eax, dword [esp + 0x64]
mov eax, dword [eax]
mov dword [ecx + edx*4], eax
mov eax, dword [ebp + 0x38]
mov ecx, dword [esp + 0x6c]
mov dword [eax + edx*4], 1
mov eax, dword [esp + 0x28]
mov dword [esi], eax
mov eax, dword [esp + 0x44]
movzx eax, byte [eax + 0x9f]
shr eax, 4
and eax, 3
lea eax, [eax + eax*4]
cmp dword [ecx + eax*4 + 0x10], 0
jne 0x1016a92c
pop edi
pop esi
pop ebp
xor eax, eax
xor edx, edx
pop ebx
add esp, 0x40
ret
pop edi
pop esi
pop ebp
or eax, 0xffffffff
mov edx, closesocket
pop ebx
add esp, 0x40
ret