Function at 0x404020
Capabilities:
Encode data using xor

Disassembly:
push ebp
push ebx
push edi
push esi
mov eax, 0x2038
call fcn.00405a30
mov dword [esp + 8], edx
mov edx, dword [esp + 0x2050]
mov edi, ecx
mov ecx, dword [esp + 0x204c]
cmp edx, 0x1001
jae 0x40404e
mov esi, edx
jmp 0x40408a
cmp byte [ecx + 0x1000], 0xbf
mov esi, 0x1000
jg 0x40408a
cmp byte [ecx + 0xfff], 0xbf
mov esi, 0xfff
jg 0x40408a
xor eax, eax
cmp byte [ecx + 0xffe], 0xc0
setge al
cmp byte [ecx + eax + 0xffd], 0xbf
lea esi, [eax + 0xffd]
jle 0x404389
lea ebp, [esp + 0x38]
push 0x1000
push ebp
push esi
push ecx
push 8
push 0xfde9
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
test eax, eax
je 0x404385
mov ebx, eax
cmp eax, 0x1001
mov dword [esp + 4], edi
jae 0x404385
mov edi, esp
mov dword [esp], 0
push 0
push edi
push ebx
push ebp
push dword [esp + 0x18]
call dword [sym.imp.KERNEL32.dll_WriteConsoleW]
test eax, eax
je 0x404352
mov ecx, dword [esp]
cmp ecx, ebx
je 0x404370
jae 0x404385
movzx eax, word [esp + ecx*2 + 0x38]
add eax, 0x2312
movzx eax, ax
cmp eax, 0x312
jae 0x40412b
lea eax, [esp + ecx*2 + 0x38]
inc ecx
mov dword [esp], 0
mov esi, ecx
push 0
push edi
push 1
push eax
push dword [esp + 0x18]
call dword [sym.imp.KERNEL32.dll_WriteConsoleW]
test eax, eax
jne 0x404129
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, esi
cmp ecx, ebx
ja 0x404385
test ecx, ecx
je 0x40436e
lea eax, [ecx - 1]
xor esi, esi
and eax, 0x7fffffff
cmp eax, 7
jb 0x404301
inc eax
mov edi, ecx
pxor xmm1, xmm1
lea edx, [esp + 0x40]
pxor xmm2, xmm2
mov ecx, eax
and ecx, 0xfffffff8
lea ebp, [esp + ecx*2 + 0x38]
mov esi, ecx
nop dword [eax + eax]
movq xmm7, qword [edx - 8]
movq xmm4, qword [edx]
movdqu xmmword [esp + 8], xmm1
movdqa xmm1, xmmword [0x4071e0]
movdqu xmmword [esp + 0x28], xmm2
movdqa xmm2, xmmword [0x4071f0]
add edx, 0x10
add esi, 0xfffffff8
movdqa xmm0, xmm7
movdqa xmm6, xmm4
movdqa xmm3, xmm7
movdqu xmmword [esp + 0x18], xmm4
paddw xmm0, xmm1
paddw xmm6, xmm1
movdqa xmm1, xmmword [0x4071c0]
movdqa xmm5, xmm1
pxor xmm0, xmm1
movdqa xmm1, xmm2
pxor xmm6, xmm5
pcmpgtw xmm1, xmm0
movdqa xmm5, xmmword [0x4071a0]
pcmpgtw xmm2, xmm6
punpcklwd xmm1, xmm1
punpcklwd xmm6, xmm2
movdqa xmm2, xmmword [0x407200]
psrad xmm1, 0x10
movdqa xmm0, xmm1
psrad xmm6, 0x10
pand xmm1, xmm5
pandn xmm0, xmm2
movdqu xmm2, xmmword [esp + 0x28]
por xmm1, xmm0
movdqa xmm0, xmm6
pand xmm6, xmm5
movdqa xmm5, xmmword [0x4071c0]
pandn xmm0, xmmword [0x407200]
pxor xmm3, xmm5
por xmm6, xmm0
movdqa xmm0, xmmword [0x407210]
paddw xmm7, xmm0
paddw xmm4, xmm0
movdqa xmm0, xmmword [0x407220]
pxor xmm7, xmm5
pxor xmm4, xmm5
movdqa xmm5, xmmword [0x4071a0]
pcmpgtw xmm0, xmm7
movdqa xmm7, xmmword [0x407220]
punpcklwd xmm0, xmm0
pand xmm0, xmm5
pcmpgtw xmm7, xmm4
movdqa xmm4, xmmword [0x4071d0]
pcmpgtw xmm3, xmm4
pcmpeqd xmm4, xmm4
punpcklwd xmm3, xmm3
psubd xmm0, xmm4
psrad xmm3, 0x10
pand xmm1, xmm3
pandn xmm3, xmm0
por xmm3, xmm1
movdqu xmm1, xmmword [esp + 8]
paddd xmm1, xmm3
movdqu xmm3, xmmword [esp + 0x18]
pxor xmm3, xmmword [0x4071c0]
pcmpgtw xmm3, xmmword [0x4071d0]
punpcklwd xmm3, xmm3
psrad xmm3, 0x10
punpcklwd xmm7, xmm3
pand xmm6, xmm3
pand xmm7, xmm5
psubd xmm7, xmm4
pandn xmm3, xmm7
por xmm3, xmm6
paddd xmm2, xmm3
jne 0x404170
paddd xmm2, xmm1
cmp eax, ecx
mov ecx, edi
pshufd xmm0, xmm2, 0xee
paddd xmm0, xmm2
pshufd xmm1, xmm0, 0x55
paddd xmm1, xmm0
movd esi, xmm1
je 0x404370
lea eax, [esp + ecx*2 + 0x38]
jmp 0x404316
add esi, edx
cmp ebp, eax
je 0x404370
movzx ecx, word [ebp]
add ebp, 2
mov edx, 1
cmp cx, 0x7f
jbe 0x404310
movzx edi, cx
mov edx, 2
cmp edi, 0x800
jb 0x404310
add ecx, 0x2312
xor edx, edx
movzx ecx, cx
cmp ecx, 0x312
setae dl
lea edx, [edx + edx + 1]
jmp 0x404310
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 4]
mov byte [ecx + 3], 0
mov word [ecx + 1], 0
mov byte [ecx], 0
mov dword [ecx + 4], eax
jmp 0x40437a
xor esi, esi
mov eax, dword [esp + 4]
mov dword [eax + 4], esi
mov byte [eax], 4
add esp, 0x2038
pop esi
pop edi
pop ebx
pop ebp
ret
ud2
push esi
push 0
call fcn.00406620
add esp, 8
ud2