Function at 0x40c8d0
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x24
mov dword [esp + 0x20], edx
mov edx, dword [ecx + 0x30]
push ebx
push esi
push edi
mov eax, dword [edx + 4]
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x18], edx
mov edi, dword [eax + 0x14]
mov esi, dword [eax + 0x10]
sub edi, esi
mov eax, dword [ecx + 0x18]
test eax, eax
je 0x40c953
cmp byte [eax], 0
je 0x40c953
push 0x32
push ecx
push edi
mov edx, esi
xor ecx, ecx
call fcn.00401300
inc eax
push eax
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov ebx, eax
add esp, 0x10
test ebx, ebx
je 0x40c930
push 0x32
push ecx
push edi
mov edx, esi
mov ecx, ebx
call fcn.00401300
add esp, 0xc
push ebx
push edi
push str.ws.recv_frame
push str._s__zd_:_n_s_n
call fcn.00401df0
push ebx
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov ecx, dword [esp + 0x30]
add esp, 0x14
mov edx, dword [esp + 0x18]
cmp dword [edx + 0x34], 0
mov eax, dword [edx + 0x38]
jne 0x40cb16
test eax, eax
je 0x40cb16
cmp edi, eax
jb 0x40cb16
mov cl, byte [esi]
movsx eax, cl
shr eax, 7
and eax, 0xffffff01
and cl, 0xf
mov dword [esp + 0x28], eax
mov byte [esp + 0x13], cl
jne 0x40c991
mov al, byte [edx + 0x3c]
mov byte [esp + 0x13], al
movsx edi, byte [esi + 1]
add esi, 2
mov ebx, edi
and edi, 0x7f
shr ebx, 7
and ebx, 0xffffff01
mov dword [esp + 0x20], edi
mov dword [esp + 0x14], ebx
cmp edi, 0x7e
jb 0x40c9d4
cmp edi, 0x7f
movzx eax, bl
mov edi, dword [edx + 0x38]
sbb ecx, ecx
shl eax, 2
and ecx, 0xfffffffa
sub edi, eax
add ecx, 8
sub edi, ecx
sub edi, 2
add esi, ecx
mov dword [esp + 0x20], edi
test bl, bl
je 0x40c9fe
xor bl, bl
mov edi, 1
xor edx, edx
mov cl, byte [esi]
test cl, cl
movzx ebx, bl
mov byte [esp + edx + 0x24], cl
cmovne ebx, edi
inc edx
inc esi
cmp edx, 4
jb 0x40c9e1
mov edi, dword [esp + 0x20]
mov dword [esp + 0x14], ebx
mov ebx, dword [esp + 0x18]
mov edx, edi
mov ecx, dword [ebx + 0xc]
call fcn.00401140
test eax, eax
je 0x40ca2a
mov eax, dword [esp + 0x1c]
push edi
push str.Payload__zd_exceeds_buffer_capacity
push eax
mov eax, dword [eax + 0x2c]
call eax
add esp, 0xc
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp byte [esp + 0x14], 0
mov eax, dword [ebx + 0xc]
mov ebx, dword [eax + 8]
je 0x40ca58
xor edx, edx
test edi, edi
je 0x40ca65
nop dword [eax]
mov cl, byte [esi]
mov eax, edx
and eax, 3
inc edx
inc esi
mov al, byte [esp + eax + 0x24]
xor al, cl
mov byte [ebx], al
inc ebx
cmp edx, edi
jb 0x40ca40
jmp 0x40ca65
push edi
push esi
push ebx
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
add ebx, edi
cmp byte [esp + 0x13], 1
mov ecx, dword [esp + 0x18]
mov eax, dword [ecx + 4]
mov dword [eax + 0x10], esi
jne 0x40cab4
mov eax, dword [ecx + 0xc]
xor ecx, ecx
mov dword [esp + 0x20], 0
mov eax, dword [eax + 8]
mov edx, eax
mov dword [esp + 0x24], eax
test edi, edi
je 0x40cab4
mov al, byte [edx]
inc edx
movzx esi, al
mov eax, dword [esp + 0x20]
add eax, esi
movzx eax, word [eax*2 + 0x40f370]
mov dword [esp + 0x20], eax
cmp eax, 0x800
je 0x40cae3
inc ecx
cmp ecx, edi
jb 0x40ca90
mov ecx, dword [esp + 0x2c]
mov eax, dword [esp + 0x28]
mov byte [ecx], al
mov eax, dword [ebp + 8]
mov cl, byte [esp + 0x13]
mov byte [eax], cl
mov eax, dword [ebp + 0xc]
mov ecx, dword [esp + 0x14]
mov byte [eax], cl
mov eax, dword [esp + 0x18]
mov eax, dword [eax + 0xc]
mov dword [eax + 8], ebx
xor al, al
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
sub edx, dword [esp + 0x24]
mov eax, str.masked
dec edx
cmp byte [esp + 0x14], 0
push edx
mov edx, 0x410991
cmove eax, edx
push esi
push eax
mov eax, dword [esp + 0x28]
push str.Invalid__sUTF8_character_0x_x_at__zd
push eax
mov eax, dword [eax + 0x2c]
call eax
add esp, 0x14
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ecx + 0x2c]
push str.Invalid_partial_frame
push ecx
call eax
add esp, 8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret