Function at 0x408650
Capabilities:
Encode data using xor

Disassembly:
push ebp
push ebx
push edi
push esi
mov eax, 0x15b4
call fcn.00409000
mov edi, edx
mov dword [esp + 0x10], ecx
mov ebx, dword [esp + 0x15cc]
mov esi, dword [esp + 0x15c8]
lea eax, [esp + 0x30]
push 0x84
push 0
push eax
call fcn.004091d0
add esp, 0xc
cmp dword [esp + 0x15d0], 0
mov dword [esp + 0x1c], edi
je 0x4086d0
test esi, esi
jle 0x408e04
xor eax, eax
mov ecx, dword [esp + 0x1c]
lea ecx, [ecx + ecx*8]
shl ecx, 5
add ecx, dword [esp + 0x10]
nop
nop
nop
nop
movzx edx, byte [eax + ecx + 0x8f12]
inc dword [esp + edx*4 + 0x30]
mov edx, eax
and edx, 1
xor eax, 1
lea eax, [eax + edx*2]
cmp eax, esi
jl 0x4086b0
jmp 0x408e04
lea eax, [edi + edi*8]
mov dword [esp + 0x24], eax
shl eax, 6
mov dword [esp + 0x18], eax
test esi, esi
jle 0x4087cb
cmp esi, 1
jne 0x408cc2
xor eax, eax
xor edi, edi
mov ecx, dword [esp + 0x15c8]
test cl, 1
je 0x408729
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x18]
add ecx, edx
add ecx, 0x8192
movzx ecx, word [ecx + eax*2]
test cx, cx
je 0x408729
mov word [esp + edi*4 + 0x4b4], cx
mov word [esp + edi*4 + 0x4b6], ax
inc edi
lea eax, [esp + 0x934]
push 0x800
push 0
push eax
call fcn.004091d0
add esp, 0xc
test edi, edi
sete byte [esp + 0xb]
je 0x4087e2
mov eax, edi
mov ecx, edi
xor eax, eax
cmp edi, 1
je 0x40879f
mov ecx, edi
and ecx, 0xfffffffe
xor eax, eax
nop
movzx edx, word [esp + eax*4 + 0x4b4]
movzx esi, dl
inc dword [esp + esi*4 + 0x934]
shr edx, 8
inc dword [esp + edx*4 + 0xd34]
movzx edx, word [esp + eax*4 + 0x4b8]
movzx esi, dl
inc dword [esp + esi*4 + 0x934]
shr edx, 8
inc dword [esp + edx*4 + 0xd34]
add eax, 2
cmp ecx, eax
jne 0x408760
mov ecx, edi
test cl, 1
je 0x4087c2
movzx eax, word [esp + eax*4 + 0x4b4]
movzx ecx, al
inc dword [esp + ecx*4 + 0x934]
shr eax, 8
inc dword [esp + eax*4 + 0xd34]
mov eax, dword [esp + 0xd34]
jmp 0x4087eb
lea eax, [esp + 0x934]
push 0x800
push 0
push eax
call fcn.004091d0
add esp, 0xc
xor edi, edi
mov byte [esp + 0xb], 1
xor eax, eax
xor ecx, ecx
cmp eax, edi
setne cl
inc ecx
mov dword [esp + 0x2c], ecx
lea eax, [edi - 1]
mov dword [esp + 0x20], eax
mov dword [esp], edi
and edi, 0xfffffffe
mov dword [esp + 0xc], edi
lea ebp, [esp + 0x4b4]
lea eax, [esp + 0x1134]
xor ecx, ecx
lea esi, [esp + 0x934]
xor edi, edi
jmp 0x408848
inc edi
add ecx, 8
add esi, 0x400
mov eax, dword [esp + 4]
cmp edi, dword [esp + 0x2c]
je 0x408962
mov dword [esp + 0x14], edi
mov dword [esp + 4], ebp
mov ebp, eax
mov eax, 3
xor edx, edx
nop
nop
nop
nop
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 0x408860
cmp byte [esp + 0xb], 0
mov edi, dword [esp + 0x14]
jne 0x408830
cmp dword [esp + 0x20], 0
je 0x40890e
xor eax, eax
mov edi, dword [esp + 4]
nop
nop
nop
movzx edx, word [edi + eax*4]
shr edx, cl
movzx edx, dl
mov ebx, dword [esp + edx*4 + 0xb4]
mov edi, ebp
lea ebp, [ebx + 1]
mov dword [esp + edx*4 + 0xb4], ebp
mov edx, dword [esp + 4]
mov edx, dword [edx + eax*4]
mov dword [edi + ebx*4], edx
mov edx, dword [esp + 4]
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, edi
mov edi, dword [esp + 4]
mov edx, dword [edi + eax*4 + 4]
mov dword [ebp + ebx*4], edx
add eax, 2
cmp dword [esp + 0xc], eax
jne 0x4088b0
jmp 0x408910
xor eax, eax
test byte [esp], 1
mov ebx, dword [esp + 0x15cc]
mov edi, dword [esp + 0x14]
je 0x408830
mov edx, dword [esp + 4]
movzx edx, word [edx + eax*4]
shr edx, cl
movzx edx, dl
mov ebx, dword [esp + edx*4 + 0xb4]
mov dword [esp + 0x28], ebp
lea ebp, [ebx + 1]
mov dword [esp + edx*4 + 0xb4], ebp
mov ebp, dword [esp + 0x28]
mov edx, dword [esp + 4]
mov eax, dword [edx + eax*4]
mov dword [ebp + ebx*4], eax
mov ebx, dword [esp + 0x15cc]
jmp 0x408830
cmp dword [esp], 0
je 0x408d35
mov ecx, dword [esp]
cmp ecx, 1
jne 0x40897f
mov word [ebp], 1
jmp 0x408bad
movzx eax, word [ebp + 4]
add word [ebp], ax
mov eax, ecx
not eax
and eax, 1
mov ecx, dword [esp + 0xc]
sub ecx, eax
mov dword [esp + 0xc], ecx
cmp ecx, 2
jl 0x408a1d
xor eax, eax
mov ecx, 2
mov esi, 1
jmp 0x4089c2
movzx edx, word [ebp + ecx*4]
inc ecx
add word [ebp + esi*4], dx
inc esi
cmp dword [esp + 0xc], esi
je 0x408a1d
movzx edx, word [ebp + eax*4]
cmp ecx, dword [esp]
jge 0x4089d6
movzx edi, word [ebp + ecx*4]
cmp dx, di
jae 0x408a00
mov word [ebp + esi*4], dx
mov word [ebp + eax*4], si
inc eax
cmp ecx, dword [esp]
jge 0x408a0b
cmp eax, esi
jge 0x4089b0
movzx edi, word [ebp + eax*4]
movzx edx, word [ebp + ecx*4]
cmp di, dx
jae 0x4089b5
jmp 0x408a10
inc ecx
mov word [ebp + esi*4], di
cmp ecx, dword [esp]
jl 0x4089e6
movzx edi, word [ebp + eax*4]
add word [ebp + esi*4], di
mov word [ebp + eax*4], si
inc eax
jmp 0x4089bb
mov eax, dword [esp]
mov word [ebp + eax*4 - 8], 0
cmp eax, 3
jl 0x408aa5
mov esi, dword [esp]
lea ecx, [esi - 3]
and esi, 3
xor esi, 2
mov eax, ecx
je 0x408a54
mov eax, ecx
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 0x408a40
cmp ecx, 3
jb 0x408aa5
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 0x408a60
mov eax, dword [esp]
add eax, 0xfffffffe
mov edi, 1
xor ecx, ecx
mov esi, dword [esp + 0xc]
jmp 0x408acc
lea edi, [edx + edx]
inc ecx
test edx, edx
jle 0x408ba3
test eax, eax
mov dword [esp + 4], edi
js 0x408b00
mov edi, esi
lea ebx, [eax + 1]
xor edx, edx
nop
nop
nop
nop
nop
movzx esi, word [ebp + eax*4]
cmp ecx, esi
jne 0x408b10
inc edx
dec eax
cmp ebx, edx
jne 0x408ae0
mov eax, 0xffffffff
mov esi, edi
mov edx, ebx
jmp 0x408b12
xor edx, edx
sub edi, edx
jle 0x408ac0
jmp 0x408b21
mov esi, edi
mov ebx, dword [esp + 0x15cc]
mov edi, dword [esp + 4]
sub edi, edx
jle 0x408ac0
and edi, 3
je 0x408b5d
mov dword [esp + 0x14], edx
mov dword [esp + 0xc], esi
lea esi, [esi*4]
add esi, ebp
xor edx, edx
nop
nop
nop
nop
nop
nop
nop
mov word [esi], cx
inc edx
add esi, 0xfffffffc
cmp edi, edx
jne 0x408b40
mov edi, dword [esp + 4]
sub edi, edx
mov esi, dword [esp + 0xc]
sub esi, edx
mov edx, dword [esp + 0x14]
jmp 0x408b61
mov edi, dword [esp + 4]
mov ebx, edx
sub edx, dword [esp + 4]
cmp edx, 0xfffffffc
mov edx, ebx
mov ebx, dword [esp + 0x15cc]
ja 0x408ac0
nop
nop
nop
nop
nop
nop
nop
mov word [ebp + esi*4], cx
mov word [ebp + esi*4 - 4], cx
mov word [ebp + esi*4 - 8], cx
mov word [ebp + esi*4 - 0xc], cx
add edi, 0xfffffffc
add esi, 0xfffffffc
cmp edi, edx
jg 0x408b80
jmp 0x408ac0
cmp dword [esp], 0
jle 0x408d35
mov eax, dword [esp]
and eax, 3
xor ecx, ecx
cmp dword [esp + 0x20], 3
jb 0x408bfb
mov edx, dword [esp]
and edx, 0xfffffffc
xor ecx, ecx
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
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 0x408bd0
test eax, eax
je 0x408c1d
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 0x408c10
cmp dword [esp], 2
jl 0x408d35
cmp ebx, 0x20
jge 0x408c90
mov eax, dword [esp + ebx*4 + 0x30]
mov edx, ebx
neg edx
mov ecx, ebx
and edx, 3
je 0x408c4c
nop
nop
nop
nop
nop
add eax, dword [esp + ecx*4 + 0x34]
inc ecx
mov dword [esp + ebx*4 + 0x30], eax
dec edx
jne 0x408c40
lea edx, [ebx - 0x1d]
cmp edx, 3
jb 0x408c88
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
add eax, dword [esp + ecx*4 + 0x34]
mov dword [esp + ebx*4 + 0x30], eax
add eax, dword [esp + ecx*4 + 0x38]
mov dword [esp + ebx*4 + 0x30], eax
add eax, dword [esp + ecx*4 + 0x3c]
mov dword [esp + ebx*4 + 0x30], eax
add eax, dword [esp + ecx*4 + 0x40]
add ecx, 4
mov dword [esp + ebx*4 + 0x30], eax
cmp ecx, 0x20
jne 0x408c60
test ebx, ebx
jle 0x408d25
lea edx, [ebx + 1]
xor ecx, ecx
xor eax, eax
nop
nop
nop
nop
nop
nop
nop
nop
nop
mov esi, dword [esp + edx*4 + 0x2c]
shl esi, cl
add eax, esi
dec edx
inc ecx
cmp edx, 1
ja 0x408ca0
mov edx, 1
mov ecx, ebx
shl edx, cl
cmp eax, edx
jne 0x408f5d
jmp 0x408d35
mov ecx, esi
and ecx, 0x7ffffffe
mov eax, dword [esp + 0x10]
mov edx, dword [esp + 0x18]
add edx, eax
add edx, 0x8194
xor eax, eax
xor edi, edi
jmp 0x408ceb
add eax, 2
cmp ecx, eax
je 0x4086f3
movzx esi, word [edx + eax*2 - 2]
test si, si
je 0x408d06
mov word [esp + edi*4 + 0x4b4], si
mov word [esp + edi*4 + 0x4b6], ax
inc edi
movzx esi, word [edx + eax*2]
test si, si
je 0x408ce0
mov word [esp + edi*4 + 0x4b4], si
lea esi, [eax + 1]
mov word [esp + edi*4 + 0x4b6], si
inc edi
jmp 0x408ce0
mov edx, 1
mov ecx, ebx
shl edx, cl
xor eax, eax
jmp 0x408f5d
mov edi, dword [esp + 0x24]
shl edi, 5
mov esi, dword [esp + 0x10]
lea eax, [esi + edi]
add eax, 0x8f12
push 0x120
push 0
push eax
call fcn.004091d0
add esp, 0xc
mov eax, dword [esp + 0x18]
add eax, esi
add eax, 0x8852
mov esi, edi
push 0x240
push 0
push eax
call fcn.004091d0
add esp, 0xc
test ebx, ebx
jle 0x408e04
mov eax, 1
add esi, dword [esp + 0x10]
jmp 0x408d9f
mov edi, dword [esp]
mov dword [esp], edi
lea ecx, [eax + 1]
cmp eax, ebx
mov eax, ecx
je 0x408e04
mov edx, dword [esp + eax*4 + 0x30]
test edx, edx
jle 0x408d90
test dl, 1
jne 0x408db0
mov ecx, edx
jmp 0x408dca
mov edi, dword [esp]
movzx ecx, word [ebp + edi*4 - 2]
dec edi
mov dword [esp], edi
mov byte [ecx + esi + 0x8f12], al
mov ecx, edx
not ecx
lea ecx, [ecx + edx*2]
cmp edx, 1
mov edi, dword [esp]
je 0x408d93
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
movzx edx, word [ebp + edi*4 - 2]
mov byte [edx + esi + 0x8f12], al
movzx edx, word [ebp + edi*4 - 6]
add edi, 0xfffffffe
mov byte [edx + esi + 0x8f12], al
add ecx, 0xfffffffe
test ecx, ecx
jg 0x408de0
jmp 0x408d93
mov dword [esp + 0x938], 0
cmp ebx, 2
jl 0x408e76
lea ecx, [ebx - 1]
cmp ebx, 2
jne 0x408e2a
xor eax, eax
mov edx, 2
test cl, 1
jne 0x408e69
jmp 0x408e76
mov ebx, ecx
and ebx, 0xfffffffe
xor eax, eax
xor edx, edx
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
add eax, dword [esp + edx*4 + 0x34]
add eax, eax
mov dword [esp + edx*4 + 0x93c], eax
add eax, dword [esp + edx*4 + 0x38]
add eax, eax
mov dword [esp + edx*4 + 0x940], eax
add edx, 2
cmp ebx, edx
jne 0x408e40
add edx, 2
test cl, 1
je 0x408e76
add eax, dword [esp + edx*4 + 0x2c]
add eax, eax
mov dword [esp + edx*4 + 0x934], eax
mov ecx, dword [esp + 0x15c8]
test ecx, ecx
jle 0x408f52
xor eax, eax
mov edx, dword [esp + 0x1c]
lea edi, [edx + edx*8]
mov edx, edi
shl edx, 5
mov esi, dword [esp + 0x10]
add edx, esi
shl edi, 6
add edi, esi
mov dword [esp + 4], edi
jmp 0x408ecc
mov ecx, dword [esp + 4]
mov word [ecx + eax*2 + 0x8852], di
mov ecx, dword [esp + 0x15c8]
inc eax
cmp eax, ecx
je 0x408f52
movzx ebx, byte [eax + edx + 0x8f12]
test ebx, ebx
je 0x408ec3
mov ecx, dword [esp + ebx*4 + 0x934]
lea edi, [ecx + 1]
mov dword [esp + ebx*4 + 0x934], edi
xor edi, edi
cmp bl, 4
jb 0x408f2f
mov ebp, ebx
and ebp, 0xfffffffc
xor edi, edi
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 0x408f00
and ebx, 3
je 0x408eb0
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 0x408f40
jmp 0x408eb0
add esp, 0x15b4
pop esi
pop edi
pop ebx
pop ebp
ret
dec dword [esp + ebx*4 + 0x30]
mov ecx, ebx
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
cmp ecx, 2
jl 0x408f88
mov esi, dword [esp + ecx*4 + 0x2c]
dec ecx
test esi, esi
je 0x408f70
dec esi
mov dword [esp + ecx*4 + 0x30], esi
add dword [esp + ecx*4 + 0x34], 2
dec eax
cmp eax, edx
jne 0x408f5d
jmp 0x408d35