Function at 0x40b770
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x6c
mov eax, dword [esp + 0x80]
mov ebp, dword [eax + 0x14]
mov eax, dword [eax + 0x18]
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x80]
mov ecx, dword [eax + 0x10]
mov eax, dword [eax + 0x1c]
mov esi, eax
mov dword [esp + 0x34], eax
mov eax, ecx
cdq
idiv esi
mov esi, dword [esp + 0x80]
mov esi, dword [esi + 0x24]
mov edi, eax
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x80]
mov dword [esp + 0x20], edx
mov dword [esp + 0x38], edx
mov dword [esp + 0x40], esi
mov eax, dword [eax + 0x20]
test eax, eax
mov dword [esp + 0x30], eax
jne 0x40b7df
mov eax, dword [esp + 0x80]
cmp dword [eax + 8], 1
je 0x40baf0
mov esi, dword [esp + 0x94]
test esi, esi
jle 0x40bc1c
mov eax, dword [esp + 0x80]
mov edi, dword [esp + 0x80]
mov dword [esp + 0x18], 0
mov eax, dword [eax + 4]
mov edi, dword [edi + 0x28]
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x80]
mov dword [esp + 0x4c], edi
mov eax, dword [eax + 8]
mov dword [esp + 0x20], eax
add eax, eax
mov dword [esp + 0x54], eax
mov eax, dword [esp + 0x34]
mov dword [esp + 0x58], eax
sar eax, 0x1f
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x4c]
movzx ecx, byte [esp + 0x40]
mov ebx, ebp
mov esi, dword [esp + 0x48]
and eax, ebp
imul eax, dword [esp + 0x20]
sar ebx, cl
test ebx, ebx
lea edi, [esi + eax*2]
js 0x40ba90
mov esi, dword [esp + 0x20]
lea eax, [esi + ebx]
cmp eax, dword [esp + 0x90]
jg 0x40b92a
mov ecx, dword [esp + 0x80]
mov ecx, dword [ecx + 0x2c]
test ecx, ecx
jne 0x40b9c0
test esi, esi
jle 0x40b8da
mov esi, dword [esp + 0x88]
lea esi, [esi + ebx*2]
mov ebx, edi
mov edi, dword [esp + 0x88]
lea edi, [edi + eax*2]
nop
lea esi, [esi]
movsx eax, word [esi]
movsx edx, word [ebx]
add esi, 2
add ebx, 2
imul eax, edx
add ecx, eax
cmp edi, esi
jne 0x40b8a0
add ecx, 0x4000
mov eax, ecx
sar eax, 0xf
lea edx, [eax + 0x8000]
sar ecx, 0x1f
xor cx, 0x7fff
cmp edx, 0xffff
jbe 0x40b9b0
mov eax, dword [esp + 0x84]
mov edi, dword [esp + 0x18]
mov esi, dword [esp + 0x38]
add dword [esp + 0x24], esi
add ebp, dword [esp + 0x3c]
mov word [eax + edi*2], cx
mov eax, dword [esp + 0x24]
mov edi, dword [esp + 0x34]
cmp edi, eax
jg 0x40b90a
sub eax, edi
add ebp, 1
mov dword [esp + 0x24], eax
add dword [esp + 0x18], 1
mov eax, dword [esp + 0x18]
cmp eax, dword [esp + 0x30]
je 0x40ba51
cmp eax, dword [esp + 0x94]
jne 0x40b835
movzx ecx, byte [esp + 0x40]
test ebp, ebp
mov eax, 0
mov edi, dword [esp + 0x8c]
cmovns eax, ebp
sar eax, cl
test ebp, ebp
mov dword [edi], eax
js 0x40b952
mov eax, dword [esp + 0x80]
and ebp, dword [eax + 0x28]
mov edi, dword [esp + 0x30]
mov eax, edi
sub eax, dword [esp + 0x18]
test edi, edi
cmove eax, edi
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x98]
test eax, eax
je 0x40b999
mov eax, dword [esp + 0x80]
mov edi, dword [esp + 0x24]
mov esi, dword [esp + 0x30]
mov dword [eax + 0x18], edi
mov edi, eax
mov dword [eax + 0x14], ebp
mov eax, dword [esp + 0x3c]
mov dword [edi + 0x20], esi
imul eax, dword [edi + 0x1c]
add eax, dword [esp + 0x38]
mov dword [edi + 0x10], eax
mov eax, dword [esp + 0x18]
add esp, 0x6c
pop ebx
pop esi
pop edi
pop ebp
ret
xor eax, eax
mov esi, esi
lea edi, [edi]
mov ecx, eax
jmp 0x40b8da
mov edx, dword [esp + 0x20]
test edx, edx
jle 0x40b9a5
mov eax, dword [esp + 0x88]
mov dword [esp + 0x50], ebp
xor esi, esi
lea ecx, [eax + ebx*2]
mov eax, dword [esp + 0x54]
xor ebx, ebx
mov ebp, ecx
add eax, edi
mov dword [esp + 0x28], eax
xor eax, eax
nop
lea esi, [esi]
movsx ecx, word [ebp + ebx*2]
movsx edx, word [edi + ebx*2]
imul edx, ecx
add esi, edx
mov edx, dword [esp + 0x28]
movsx edx, word [edx + ebx*2]
add ebx, 1
imul edx, ecx
add eax, edx
cmp dword [esp + 0x20], ebx
jne 0x40b9f0
sub eax, esi
mov ecx, dword [esp + 0x58]
mov ebx, dword [esp + 0x5c]
imul dword [esp + 0x24]
mov ebp, dword [esp + 0x50]
mov dword [esp + 8], ecx
mov dword [esp + 0xc], ebx
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.005a71f0
lea ecx, [esi + eax + 0x4000]
mov eax, ecx
sar eax, 0xf
lea edx, [eax + 0x8000]
jmp 0x40b8c6
mov eax, dword [esp + 0x80]
mov dword [esp + 0x30], 0
mov eax, dword [eax + 0xc]
cdq
idiv dword [esp + 0x34]
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x18]
cmp dword [esp + 0x94], eax
mov dword [esp + 0x38], edx
jne 0x40b835
jmp 0x40b92a
mov eax, dword [esp + 0x20]
test eax, eax
jle 0x40bae1
lea esi, [eax + ebx]
mov dword [esp + 0x28], ebp
lea eax, [ebx + ebx]
mov ebp, dword [esp + 0x88]
xor ecx, ecx
sub edi, eax
lea esi, [esi]
mov edx, ebx
sar edx, 0x1f
mov eax, edx
xor eax, ebx
sub eax, edx
cdq
idiv dword [esp + 0x90]
movsx eax, word [ebp + edx*2]
movsx edx, word [edi + ebx*2]
add ebx, 1
imul eax, edx
add ecx, eax
cmp esi, ebx
jne 0x40bab0
mov ebp, dword [esp + 0x28]
jmp 0x40b8b5
xor ecx, ecx
jmp 0x40b8da
test esi, esi
jne 0x40b7df
mov ebx, dword [esp + 0x34]
xor eax, eax
mov dword [esp + 4], ecx
mov dword [esp + 0x40], eax
mov eax, ecx
mov dword [esp], 0
sar eax, 0x1f
mov dword [esp + 0x18], ecx
mov dword [esp + 0x44], ebp
mov dword [esp + 0x1c], eax
mov eax, ebx
mov dword [esp + 8], ebx
sar eax, 0x1f
mov dword [esp + 0xc], eax
call fcn.005a71f0
mov esi, dword [esp + 0x90]
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], edx
mov ecx, dword [esp + 0x18]
lea eax, [esi - 1]
mov dword [esp + 8], ecx
sub eax, ebp
imul ebx
mov ebx, dword [esp + 0x1c]
mov dword [esp], eax
mov dword [esp + 0xc], ebx
mov dword [esp + 4], edx
call fcn.005a71f0
mov esi, dword [esp + 0x94]
mov dword [esp + 0x30], eax
mov ebx, esi
sar ebx, 0x1f
cmp edx, ebx
jge 0x40bc29
mov ecx, dword [esp + 0x30]
test ecx, ecx
mov dword [esp + 0x18], ecx
jle 0x40bc43
mov eax, dword [esp + 0x84]
mov ebx, dword [esp + 0x40]
mov esi, dword [esp + 0x44]
mov dword [esp + 0x40], edi
mov edi, dword [esp + 0x88]
lea ecx, [eax + ecx*2]
mov esi, esi
lea edi, [edi]
movzx edx, word [edi + esi*2]
add ebx, dword [esp + 0x28]
adc esi, dword [esp + 0x2c]
add eax, 2
mov word [eax - 2], dx
cmp ecx, eax
jne 0x40bbb0
mov eax, dword [esp + 0x30]
mov edi, dword [esp + 0x40]
mov esi, dword [esp + 0x20]
imul esi, eax
add dword [esp + 0x24], esi
imul eax, edi
add ebp, eax
mov eax, dword [esp + 0x24]
mov edi, dword [esp + 0x8c]
mov dword [esp + 0x30], 0
cdq
idiv dword [esp + 0x34]
add ebp, eax
mov eax, 0
mov dword [esp + 0x24], edx
cmovns eax, ebp
mov dword [edi], eax
js 0x40b965
mov eax, dword [esp + 0x80]
and ebp, dword [eax + 0x28]
jmp 0x40b965
mov dword [esp + 0x18], 0
jmp 0x40b92a
jg 0x40bc33
cmp eax, esi
jbe 0x40bb7a
mov eax, dword [esp + 0x94]
mov dword [esp + 0x30], eax
jmp 0x40bb7a
mov dword [esp + 0x18], 0
jmp 0x40bbdf