Function at 0x405f40
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x58c
push esi
push edi
push 0x44
lea eax, [ebp - 0x88]
push 0
push eax
call fcn.0040b860
mov edi, dword [ebp + 8]
mov esi, dword [ebp + 0xc]
add esp, 0xc
mov ecx, edi
mov edx, esi
jmp 0x405f70
mov eax, dword [ecx]
add dword [ebp + eax*4 - 0x88], 1
lea eax, [ebp + eax*4 - 0x88]
add ecx, 4
sub edx, 1
jne 0x405f70
cmp dword [ebp - 0x88], esi
mov edx, dword [ebp + 0x20]
jne 0x405fab
mov ecx, dword [ebp + 0x1c]
pop edi
mov dword [ecx], 0
mov dword [edx], 0
xor eax, eax
pop esi
mov esp, ebp
pop ebp
ret
mov esi, dword [edx]
mov dword [ebp - 4], esi
mov ecx, 1
cmp dword [ebp + ecx*4 - 0x88], 0
jne 0x405fc7
add ecx, 1
cmp ecx, 0x10
jbe 0x405fb5
cmp esi, ecx
push ebx
mov ebx, ecx
mov dword [ebp - 8], ebx
jae 0x405fd6
mov dword [ebp - 4], ecx
mov esi, ecx
mov eax, 0x10
jmp 0x405fe0
cmp dword [ebp + eax*4 - 0x88], 0
jne 0x405fef
sub eax, 1
jne 0x405fe0
cmp esi, eax
mov dword [ebp - 0x24], eax
jbe 0x405ffb
mov dword [ebp - 4], eax
mov esi, eax
mov dword [edx], esi
mov edx, 1
shl edx, cl
cmp ecx, eax
jae 0x406022
jmp 0x406010
sub edx, dword [ebp + ecx*4 - 0x88]
js 0x406030
add ecx, 1
add edx, edx
cmp ecx, eax
jb 0x406010
mov ecx, dword [ebp + eax*4 - 0x88]
sub edx, ecx
mov dword [ebp - 0x40], edx
jns 0x40603c
pop ebx
pop edi
mov eax, 2
pop esi
mov esp, ebp
pop ebp
ret
add ecx, edx
mov dword [ebp + eax*4 - 0x88], ecx
xor ecx, ecx
sub eax, 1
mov dword [ebp - 0xc8], ecx
je 0x406076
xor edx, edx
jmp 0x406060
add ecx, dword [ebp + edx - 0x84]
add edx, 4
sub eax, 1
mov dword [ebp + edx - 0xc8], ecx
jne 0x406060
xor ecx, ecx
xor edx, edx
lea ebx, [ebx]
mov eax, dword [edi]
add edi, 4
cmp eax, ecx
je 0x4060a5
mov ecx, dword [ebp + eax*4 - 0xcc]
lea eax, [ebp + eax*4 - 0xcc]
mov dword [ebp + ecx*4 - 0x58c], edx
add ecx, 1
mov dword [eax], ecx
xor ecx, ecx
add edx, 1
cmp edx, dword [ebp + 0xc]
jb 0x406080
mov eax, esi
xor edi, edi
lea edx, [ebp - 0x58c]
neg eax
cmp ebx, dword [ebp - 0x24]
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 0xcc], ecx
mov dword [ebp - 0x10], edx
mov dword [ebp + 8], 0xffffffff
mov dword [ebp - 0x10c], ecx
mov dword [ebp - 0x38], ecx
mov dword [ebp - 0x3c], edi
jg 0x40633e
lea ecx, [ebx - 1]
mov dword [ebp - 0x2c], ecx
lea ecx, [ebp + ebx*4 - 0x88]
mov dword [ebp - 0x20], ecx
mov ecx, dword [ebp - 0x20]
mov ecx, dword [ecx]
test ecx, ecx
mov dword [ebp - 0xc], ecx
je 0x406327
sub dword [ebp - 0xc], 1
lea ecx, [eax + esi]
cmp ebx, ecx
jle 0x40622a
mov dword [ebp - 0x28], ecx
mov ecx, eax
sub ecx, esi
jmp 0x406123
mov ecx, dword [ebp - 0x30]
mov edx, dword [ebp - 0x24]
add dword [ebp + 8], 1
add dword [ebp - 0x28], esi
add eax, esi
add ecx, esi
sub edx, eax
cmp edx, esi
mov dword [ebp - 0x34], eax
mov dword [ebp - 0x30], ecx
jbe 0x40613f
mov edx, esi
mov ebx, dword [ebp - 8]
sub ebx, eax
mov ecx, ebx
mov eax, 1
shl eax, cl
mov ecx, dword [ebp - 0xc]
add ecx, 1
cmp eax, ecx
jbe 0x406185
mov esi, dword [ebp - 0x20]
or ecx, 0xffffffff
sub ecx, dword [ebp - 0xc]
add ebx, 1
add eax, ecx
cmp ebx, edx
jae 0x406185
lea esp, [esp]
mov ecx, dword [esi + 4]
add esi, 4
add eax, eax
cmp eax, ecx
jbe 0x406185
add ebx, 1
sub eax, ecx
cmp ebx, edx
jb 0x406170
mov ecx, ebx
mov edi, 1
shl edi, cl
lea edx, [edi*8 + 8]
push edx
mov dword [ebp - 0x3c], edi
call fcn.0040b99e
add esp, 4
test eax, eax
je 0x406357
mov ecx, dword [0x42cc00]
lea edx, [ecx + edi + 1]
mov dword [0x42cc00], edx
mov edx, dword [ebp + 0x1c]
lea ecx, [eax + 8]
add eax, 4
mov dword [edx], ecx
mov dword [ebp + 0x1c], eax
mov dword [eax], 0
mov eax, dword [ebp + 8]
test eax, eax
lea edx, [ebp + eax*4 - 0x10c]
mov dword [ebp - 0x38], ecx
mov dword [ebp - 0x44], edx
mov dword [edx], ecx
je 0x406215
mov esi, dword [ebp - 0x1c]
mov dword [ebp + eax*4 - 0xcc], esi
mov al, byte [ebp - 4]
mov edx, ecx
mov ecx, dword [ebp - 0x30]
mov byte [ebp - 0x17], al
mov eax, esi
add bl, 0x10
shr eax, cl
mov ecx, dword [ebp - 0x44]
mov ecx, dword [ecx - 4]
mov byte [ebp - 0x18], bl
mov esi, dword [ebp - 0x18]
mov dword [ecx + eax*8], esi
mov dword [ebp - 0x14], edx
mov dword [ecx + eax*8 + 4], edx
mov edx, dword [ebp - 0x28]
cmp dword [ebp - 8], edx
mov eax, dword [ebp - 0x34]
mov esi, dword [ebp - 4]
jg 0x406120
mov edx, dword [ebp - 0x10]
mov cl, byte [ebp - 8]
sub cl, al
mov byte [ebp - 0x17], cl
mov ecx, dword [ebp + 0xc]
lea ecx, [ebp + ecx*4 - 0x58c]
cmp edx, ecx
jb 0x406246
mov byte [ebp - 0x18], 0x63
jmp 0x406281
mov ecx, dword [edx]
mov ebx, dword [ebp + 0x10]
cmp ecx, ebx
jae 0x406263
cmp ecx, 0x100
setb cl
add cl, 0xf
mov byte [ebp - 0x18], cl
mov cx, word [edx]
jmp 0x406277
sub ecx, ebx
mov ebx, dword [ebp + 0x18]
add ecx, ecx
mov bl, byte [ecx + ebx]
mov byte [ebp - 0x18], bl
mov ebx, dword [ebp + 0x14]
mov cx, word [ecx + ebx]
add edx, 4
mov dword [ebp - 0x10], edx
mov word [ebp - 0x14], cx
mov ecx, dword [ebp - 8]
mov edx, dword [ebp - 0x1c]
sub ecx, eax
mov ebx, 1
shl ebx, cl
mov ecx, eax
shr edx, cl
cmp edx, edi
jae 0x4062bd
mov ecx, dword [ebp - 0x38]
lea ecx, [ecx + edx*8]
mov edi, edi
mov edi, dword [ebp - 0x18]
mov dword [ecx], edi
mov edi, dword [ebp - 0x14]
mov dword [ecx + 4], edi
lea edi, [ebx*8]
add ecx, edi
mov edi, dword [ebp - 0x3c]
add edx, ebx
cmp edx, edi
jb 0x4062a0
mov ecx, dword [ebp - 0x2c]
mov ebx, dword [ebp - 0x1c]
mov edx, 1
shl edx, cl
test ebx, edx
je 0x4062d8
mov edi, edi
xor ebx, edx
shr edx, 1
test ebx, edx
jne 0x4062d0
xor ebx, edx
mov ecx, eax
mov edx, 1
shl edx, cl
mov ecx, dword [ebp + 8]
mov dword [ebp - 0x1c], ebx
sub edx, 1
and edx, ebx
cmp edx, dword [ebp + ecx*4 - 0xcc]
je 0x406317
sub dword [ebp + 8], 1
sub eax, esi
mov ecx, eax
mov edx, 1
shl edx, cl
mov ecx, dword [ebp + 8]
sub edx, 1
and edx, ebx
cmp edx, dword [ebp + ecx*4 - 0xcc]
jne 0x4062f7
cmp dword [ebp - 0xc], 0
mov ebx, dword [ebp - 8]
mov edx, dword [ebp - 0x10]
jne 0x406101
add dword [ebp - 0x20], 4
add dword [ebp - 0x2c], 1
add ebx, 1
cmp ebx, dword [ebp - 0x24]
mov dword [ebp - 8], ebx
jle 0x4060f1
cmp dword [ebp - 0x40], 0
je 0x40634e
mov eax, 1
cmp dword [ebp - 0x24], eax
jne 0x406350
xor eax, eax
pop ebx
pop edi
pop esi
mov esp, ebp
pop ebp
ret
cmp dword [ebp + 8], 0
je 0x40637c
mov eax, dword [ebp - 0x10c]
test eax, eax
je 0x40637c
mov esi, dword [eax - 4]
sub eax, 8
push eax
call fcn.0040ad1f
add esp, 4
test esi, esi
mov eax, esi
jne 0x406367
pop ebx
pop edi
mov eax, 3
pop esi
mov esp, ebp
pop ebp
ret