Function at 0x40be70
Capabilities:
Encode data using xor

Disassembly:
push ebp
push ebx
push edi
push esi
mov eax, 0x15b4
call fcn.0040c840
mov edi, edx
mov dword [esp + 0x10], ecx
mov esi, dword [esp + 0x15c8]
lea eax, [esp + 0x30]
push 0x84
push 0
push eax
call fcn.0040ca70
add esp, 0xc
cmp dword [esp + 0x15d0], 0
mov dword [esp + 0x18], edi
je 0x40bf37
test esi, esi
jle 0x40c614
xor eax, eax
cmp dword [esp + 0x15c8], 1
je 0x40bf08
mov ecx, dword [esp + 0x15c8]
and ecx, 0x7ffffffe
mov eax, dword [esp + 0x18]
lea eax, [eax + eax*8]
shl eax, 5
mov edx, dword [esp + 0x10]
add edx, eax
add edx, 0x8f13
xor eax, eax
nop
nop
nop
nop
nop
nop
movzx esi, byte [edx + eax - 1]
inc dword [esp + esi*4 + 0x30]
movzx esi, byte [edx + eax]
inc dword [esp + esi*4 + 0x30]
add eax, 2
cmp ecx, eax
jne 0x40bef0
mov ecx, dword [esp + 0x15c8]
test cl, 1
mov edi, dword [esp + 0x18]
je 0x40c614
lea ecx, [edi + edi*8]
shl ecx, 5
add ecx, dword [esp + 0x10]
movzx eax, byte [eax + ecx + 0x8f12]
inc dword [esp + eax*4 + 0x30]
jmp 0x40c614
lea edi, [edi + edi*8]
mov ecx, edi
shl ecx, 6
test esi, esi
mov dword [esp + 0x14], edi
mov dword [esp + 0x28], ecx
jle 0x40bff4
mov eax, dword [esp + 0x10]
add eax, ecx
add eax, 0x8192
xor ecx, ecx
xor ebx, ebx
jmp 0x40bf74
mov edx, ecx
and edx, 1
xor ecx, 1
lea ecx, [ecx + edx*2]
cmp ecx, dword [esp + 0x15c8]
jge 0x40bf90
movzx edx, word [eax + ecx*2]
test dx, dx
je 0x40bf60
mov word [esp + ebx*4 + 0xcb4], dx
mov word [esp + ebx*4 + 0xcb6], cx
inc ebx
jmp 0x40bf60
lea eax, [esp + 0x4b4]
push 0x800
push 0
push eax
call fcn.0040ca70
add esp, 0xc
test ebx, ebx
sete byte [esp + 7]
je 0x40c00b
xor eax, eax
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
movzx ecx, word [esp + eax*4 + 0xcb4]
movzx edx, cl
inc dword [esp + edx*4 + 0x4b4]
shr ecx, 8
inc dword [esp + ecx*4 + 0x8b4]
mov ecx, eax
and ecx, 1
xor eax, 1
lea eax, [eax + ecx*2]
cmp eax, ebx
jb 0x40bfc0
mov eax, dword [esp + 0x8b4]
jmp 0x40c014
lea eax, [esp + 0x4b4]
push 0x800
push 0
push eax
call fcn.0040ca70
add esp, 0xc
xor ebx, ebx
mov byte [esp + 7], 1
xor eax, eax
xor ecx, ecx
cmp eax, ebx
setne cl
inc ecx
mov dword [esp + 0x2c], ecx
lea eax, [ebx - 1]
mov dword [esp + 0x20], eax
mov eax, ebx
and eax, 0xfffffffe
mov dword [esp + 0xc], eax
lea ebp, [esp + 0xcb4]
lea eax, [esp + 0x1134]
xor ecx, ecx
lea esi, [esp + 0x4b4]
xor edi, edi
mov dword [esp + 0x1c], ebx
jmp 0x40c06b
inc edi
add ecx, 8
add esi, 0x400
mov eax, dword [esp]
cmp edi, dword [esp + 0x2c]
mov ebp, dword [esp + 8]
je 0x40c16d
mov dword [esp + 0x24], edi
mov dword [esp], ebp
mov dword [esp + 8], eax
mov eax, 3
xor edx, edx
nop
nop
nop
mov dword [esp + eax*4 + 0xa8], edx
add edx, dword [esi + eax*4 - 0xc]
mov dword [esp + eax*4 + 0xac], edx
add edx, dword [esi + eax*4 - 8]
mov dword [esp + eax*4 + 0xb0], edx
add edx, dword [esi + eax*4 - 4]
mov dword [esp + eax*4 + 0xb4], edx
add edx, dword [esi + eax*4]
add eax, 4
cmp eax, 0x103
jne 0x40c080
cmp byte [esp + 7], 0
mov edi, dword [esp + 0x24]
jne 0x40c050
cmp dword [esp + 0x20], 0
je 0x40c127
xor eax, eax
mov edi, dword [esp + 8]
mov ebp, dword [esp]
movzx edx, word [ebp + eax*4]
shr edx, cl
movzx edx, dl
mov ebp, dword [esp + edx*4 + 0xb4]
lea ebx, [ebp + 1]
mov dword [esp + edx*4 + 0xb4], ebx
mov edx, dword [esp]
mov edx, dword [edx + eax*4]
mov dword [edi + ebp*4], edx
mov edx, dword [esp]
movzx edx, word [edx + eax*4 + 4]
shr edx, cl
movzx edx, dl
mov ebx, dword [esp + edx*4 + 0xb4]
lea ebp, [ebx + 1]
mov dword [esp + edx*4 + 0xb4], ebp
mov ebp, dword [esp]
mov edx, dword [ebp + eax*4 + 4]
mov dword [edi + ebx*4], edx
add eax, 2
cmp dword [esp + 0xc], eax
jne 0x40c0d0
jmp 0x40c129
xor eax, eax
mov ebx, dword [esp + 0x1c]
test bl, 1
mov edi, dword [esp + 0x24]
je 0x40c050
mov edx, dword [esp]
movzx edx, word [edx + eax*4]
shr edx, cl
movzx edx, dl
mov ebx, dword [esp + edx*4 + 0xb4]
lea ebp, [ebx + 1]
mov dword [esp + edx*4 + 0xb4], ebp
mov edx, dword [esp]
mov eax, dword [edx + eax*4]
mov edx, dword [esp + 8]
mov dword [edx + ebx*4], eax
mov ebx, dword [esp + 0x1c]
jmp 0x40c050
test ebx, ebx
je 0x40c4e0
cmp ebx, 1
jne 0x40c185
mov word [ebp], 1
jmp 0x40c3ba
movzx eax, word [ebp + 4]
add word [ebp], ax
mov eax, ebx
not eax
and eax, 1
mov ecx, dword [esp + 0xc]
sub ecx, eax
mov dword [esp + 0xc], ecx
cmp ecx, 2
jl 0x40c23c
xor eax, eax
mov dword [esp], 2
mov esi, 1
jmp 0x40c1d5
movzx edi, word [ecx + ebp*4]
inc ebp
mov dword [esp], ebp
add word [ecx + esi*4], di
mov ebp, ecx
inc esi
cmp dword [esp + 0xc], esi
je 0x40c23c
movzx edx, word [ebp + eax*4]
mov edi, dword [esp]
cmp edi, ebx
mov ecx, ebp
mov ebp, edi
jge 0x40c1ee
movzx edi, word [ecx + ebp*4]
cmp dx, di
jae 0x40c210
mov word [ecx + esi*4], dx
mov word [ecx + eax*4], si
inc eax
cmp ebp, ebx
jge 0x40c219
cmp eax, esi
jge 0x40c1c0
movzx edx, word [ecx + eax*4]
movzx edi, word [ecx + ebp*4]
cmp dx, di
jae 0x40c1c4
jmp 0x40c21d
mov word [ecx + esi*4], di
inc ebp
cmp ebp, ebx
jl 0x40c1fb
movzx edx, word [ecx + eax*4]
mov dword [esp], ebp
movzx edi, word [ecx + esi*4]
mov ebx, edi
and ebx, edx
xor edi, edx
lea edx, [edi + ebx*2]
mov ebx, dword [esp + 0x1c]
mov word [ecx + esi*4], dx
mov word [ecx + eax*4], si
inc eax
jmp 0x40c1cc
mov word [ebp + ebx*4 - 8], 0
cmp ebx, 3
jl 0x40c2c5
lea ecx, [ebx - 3]
mov esi, ebx
and esi, 3
xor esi, 2
mov eax, ecx
je 0x40c274
mov eax, ecx
nop
nop
nop
nop
nop
nop
nop
movzx edx, word [ebp + eax*4]
movzx edx, word [ebp + edx*4]
inc edx
mov word [ebp + eax*4], dx
dec eax
dec esi
jne 0x40c260
cmp ecx, 3
jb 0x40c2c5
inc eax
nop
nop
nop
nop
nop
nop
movzx ecx, word [ebp + eax*4 - 4]
movzx ecx, word [ebp + ecx*4]
inc ecx
mov word [ebp + eax*4 - 4], cx
movzx ecx, word [ebp + eax*4 - 8]
movzx ecx, word [ebp + ecx*4]
inc ecx
mov word [ebp + eax*4 - 8], cx
movzx ecx, word [ebp + eax*4 - 0xc]
movzx ecx, word [ebp + ecx*4]
inc ecx
mov word [ebp + eax*4 - 0xc], cx
movzx ecx, word [ebp + eax*4 - 0x10]
movzx ecx, word [ebp + ecx*4]
inc ecx
mov word [ebp + eax*4 - 0x10], cx
add eax, 0xfffffffc
jne 0x40c280
lea eax, [ebx - 2]
mov edi, 1
xor ecx, ecx
mov esi, dword [esp + 0xc]
jmp 0x40c2f6
mov edx, dword [esp + 8]
lea edi, [ebp*2]
inc ecx
test ebp, ebp
mov ebp, edx
je 0x40c3b2
test eax, eax
mov dword [esp + 0xc], esi
mov dword [esp], edi
js 0x40c330
lea edi, [eax + 1]
xor edx, edx
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
movzx esi, word [ebp + eax*4]
cmp ecx, esi
jne 0x40c340
inc edx
dec eax
cmp edi, edx
jne 0x40c310
mov eax, 0xffffffff
mov esi, dword [esp + 0xc]
mov ebp, edi
jmp 0x40c346
xor ebp, ebp
sub edi, ebp
jle 0x40c2e0
jmp 0x40c34d
mov ebp, edx
mov esi, dword [esp + 0xc]
mov edi, dword [esp]
sub edi, ebp
jle 0x40c2e0
and edi, 3
je 0x40c378
mov edx, dword [esp + 8]
lea esi, [edx + esi*4]
xor edx, edx
nop
nop
nop
nop
nop
mov word [esi], cx
inc edx
add esi, 0xfffffffc
cmp edi, edx
jne 0x40c360
mov edi, dword [esp]
sub edi, edx
mov esi, dword [esp + 0xc]
sub esi, edx
jmp 0x40c37b
mov edi, dword [esp]
mov edx, ebp
sub edx, dword [esp]
cmp edx, 0xfffffffc
mov edx, dword [esp + 8]
ja 0x40c2e4
nop
nop
nop
mov word [edx + esi*4], cx
mov word [edx + esi*4 - 4], cx
mov word [edx + esi*4 - 8], cx
mov word [edx + esi*4 - 0xc], cx
add esi, 0xfffffffc
add edi, 0xfffffffc
cmp edi, ebp
jg 0x40c390
jmp 0x40c2e4
test ebx, ebx
jle 0x40c4e0
mov eax, ebx
and eax, 3
xor ecx, ecx
cmp dword [esp + 0x20], 3
jb 0x40c3fb
mov edx, ebx
and edx, 0xfffffffc
xor ecx, ecx
nop
movzx esi, word [ebp + ecx*4]
inc dword [esp + esi*4 + 0x30]
movzx esi, word [ebp + ecx*4 + 4]
inc dword [esp + esi*4 + 0x30]
movzx esi, word [ebp + ecx*4 + 8]
inc dword [esp + esi*4 + 0x30]
movzx esi, word [ebp + ecx*4 + 0xc]
inc dword [esp + esi*4 + 0x30]
add ecx, 4
cmp edx, ecx
jne 0x40c3d0
test eax, eax
je 0x40c41d
lea ecx, [ecx*4]
add ecx, ebp
xor edx, edx
nop
nop
nop
nop
nop
nop
movzx esi, word [ecx + edx*4]
inc dword [esp + esi*4 + 0x30]
inc edx
cmp eax, edx
jne 0x40c410
cmp ebx, 2
jl 0x40c4e0
mov edx, dword [esp + 0x15cc]
cmp edx, 0x20
jge 0x40c4a0
mov eax, dword [esp + edx*4 + 0x30]
mov esi, edx
neg edx
mov ecx, esi
and edx, 3
je 0x40c45c
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
add eax, dword [esp + ecx*4 + 0x34]
inc ecx
mov dword [esp + esi*4 + 0x30], eax
dec edx
jne 0x40c450
lea edx, [esi - 0x1d]
cmp edx, 3
mov edx, esi
jb 0x40c498
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
add eax, dword [esp + ecx*4 + 0x34]
mov dword [esp + edx*4 + 0x30], eax
add eax, dword [esp + ecx*4 + 0x38]
mov dword [esp + edx*4 + 0x30], eax
add eax, dword [esp + ecx*4 + 0x3c]
mov dword [esp + edx*4 + 0x30], eax
add eax, dword [esp + ecx*4 + 0x40]
add ecx, 4
mov dword [esp + edx*4 + 0x30], eax
cmp ecx, 0x20
jne 0x40c470
test edx, edx
jle 0x40c79d
inc edx
xor ecx, ecx
xor eax, eax
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
mov esi, dword [esp + edx*4 + 0x2c]
shl esi, cl
mov edi, esi
and edi, eax
xor esi, eax
lea eax, [esi + edi*2]
dec edx
inc ecx
cmp edx, 1
ja 0x40c4b0
mov edx, 1
mov ecx, dword [esp + 0x15cc]
shl edx, cl
cmp eax, edx
mov ebp, dword [esp + 8]
jne 0x40c7c3
mov ecx, dword [esp + 0x14]
shl ecx, 5
mov esi, dword [esp + 0x10]
mov dword [esp + 0x14], ecx
lea eax, [esi + ecx]
add eax, 0x8f12
push 0x120
push 0
push eax
call fcn.0040ca70
add esp, 0xc
mov eax, dword [esp + 0x28]
add eax, esi
add eax, 0x8852
push 0x240
push 0
push eax
call fcn.0040ca70
add esp, 0xc
cmp dword [esp + 0x15cc], 0
jle 0x40c610
add ebp, 0xfffffffe
mov eax, 1
mov ecx, dword [esp + 0x14]
add ecx, dword [esp + 0x10]
mov dword [esp + 0x14], ecx
mov dword [esp + 8], ebp
jmp 0x40c562
lea ecx, [eax + 1]
cmp eax, dword [esp + 0x15cc]
mov eax, ecx
je 0x40c610
mov ecx, dword [esp + eax*4 + 0x30]
test ecx, ecx
jle 0x40c550
mov edx, ecx
and edx, 3
je 0x40c5c0
mov dword [esp + 0x1c], ebx
lea edi, [ebx*4]
add edi, ebp
xor esi, esi
mov ebp, dword [esp + 0x14]
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
movzx ebx, word [edi]
mov byte [ebx + ebp + 0x8f12], al
inc esi
add edi, 0xfffffffc
cmp edx, esi
jne 0x40c590
mov ebx, dword [esp + 0x1c]
sub ebx, esi
mov edx, ecx
sub edx, esi
mov ebp, dword [esp + 8]
jmp 0x40c5c2
mov edx, ecx
cmp ecx, 4
mov esi, dword [esp + 0x14]
jb 0x40c550
dec edx
nop
nop
nop
nop
movzx ecx, word [ebp + ebx*4]
mov byte [ecx + esi + 0x8f12], al
movzx ecx, word [ebp + ebx*4 - 4]
mov byte [ecx + esi + 0x8f12], al
movzx ecx, word [ebp + ebx*4 - 8]
mov byte [ecx + esi + 0x8f12], al
movzx ecx, word [ebp + ebx*4 - 0xc]
add ebx, 0xfffffffc
mov byte [ecx + esi + 0x8f12], al
add edx, 0xfffffffc
cmp edx, 0xfffffffe
jb 0x40c5d0
jmp 0x40c550
mov edi, dword [esp + 0x18]
mov dword [esp + 0x4b8], 0
mov eax, dword [esp + 0x15cc]
cmp eax, 2
jl 0x40c6b8
lea edx, [eax - 1]
cmp eax, 2
jne 0x40c640
xor eax, eax
mov ecx, 2
jmp 0x40c68d
mov ebx, edx
and ebx, 0xfffffffe
xor eax, eax
mov esi, 4
mov ecx, 0xfffffffe
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
add eax, dword [esp + esi*2 + 0x2c]
add eax, eax
mov dword [esp + esi*2 + 0x4b4], eax
add eax, dword [esp + esi*2 + 0x30]
add eax, eax
mov dword [esp + esi*2 + 0x4b8], eax
add esi, 4
lea edi, [ebx + ecx]
add edi, 0xfffffffe
add ecx, 0xfffffffe
cmp edi, 0xfffffffe
jne 0x40c660
neg ecx
test dl, 1
mov edi, dword [esp + 0x18]
je 0x40c6b8
mov edx, ecx
xor edx, 1
mov esi, ecx
and esi, 0x1ffffffe
add esi, esi
sub esi, edx
mov edi, dword [esp + 0x18]
add eax, dword [esp + esi*4 + 0x30]
add eax, eax
mov dword [esp + ecx*4 + 0x4b4], eax
mov ecx, dword [esp + 0x15c8]
test ecx, ecx
jle 0x40c792
xor eax, eax
lea edi, [edi + edi*8]
mov edx, edi
shl edx, 5
mov esi, dword [esp + 0x10]
add edx, esi
shl edi, 6
add edi, esi
mov dword [esp], edi
jmp 0x40c70b
mov ecx, dword [esp]
mov word [ecx + eax*2 + 0x8852], di
mov ecx, dword [esp + 0x15c8]
inc eax
cmp eax, ecx
je 0x40c792
movzx ebx, byte [eax + edx + 0x8f12]
test ebx, ebx
je 0x40c702
mov ecx, dword [esp + ebx*4 + 0x4b4]
lea edi, [ecx + 1]
mov dword [esp + ebx*4 + 0x4b4], edi
xor edi, edi
cmp bl, 4
jb 0x40c76f
mov ebp, ebx
and ebp, 0xfffffffc
xor edi, edi
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
mov esi, ecx
and esi, 1
shl esi, 2
lea esi, [esi + edi*8]
mov edi, ecx
and edi, 2
or edi, esi
mov esi, ecx
shr esi, 2
and esi, 1
or esi, edi
mov edi, ecx
shr edi, 3
and edi, 1
lea edi, [edi + esi*2]
shr ecx, 4
add ebp, 0xfffffffc
jne 0x40c740
and ebx, 3
je 0x40c6f0
nop
nop
nop
nop
nop
nop
nop
nop
mov esi, ecx
and esi, 1
lea edi, [esi + edi*2]
shr ecx, 1
dec ebx
jne 0x40c780
jmp 0x40c6f0
add esp, 0x15b4
pop esi
pop edi
pop ebx
pop ebp
ret
mov ecx, edx
mov edx, 1
shl edx, cl
xor eax, eax
jmp 0x40c7c3
dec esi
mov dword [esp + ecx*4 + 0x30], esi
add dword [esp + ecx*4 + 0x34], 2
dec eax
cmp eax, edx
je 0x40c4e0
mov ecx, dword [esp + 0x15cc]
dec dword [esp + ecx*4 + 0x30]
nop
nop
cmp ecx, 2
jl 0x40c7ba
mov esi, dword [esp + ecx*4 + 0x2c]
dec ecx
test esi, esi
je 0x40c7d0
jmp 0x40c7b0