Function at 0x40c4d6
Capabilities:
Encode data using xor
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x11c
mov al, byte [ebp + 0x14]
add al, 5
mov byte [ebp - 0x1a], al
push ebx
push edi
xor eax, eax
mov byte [ebp - 0x1c], 3
mov byte [ebp - 0x1b], 1
lea edi, [ebp - 0x19]
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
xor ebx, ebx
push 0xff
stosb byte es:[edi], al
lea eax, [ebp - 0x11b]
push ebx
push eax
mov dword [ebp - 4], ebx
mov byte [ebp - 0x11c], bl
call sub.msvcrt.dll_memset
add esp, 0xc
cmp byte [ebp + 0x14], 0x12
jae 0x40c6cf
mov al, byte [ebp + 0xc]
push esi
movzx esi, byte [ebp + 0x14]
push esi
push dword [ebp + 0x10]
mov byte [ebp - 0x19], al
lea eax, [ebp - 0x18]
push eax
call sub.msvcrt.dll_memcpy
lea ecx, [esi + 3]
add esp, 0xc
xor al, al
cmp ecx, ebx
mov byte [ebp + 0x17], bl
jle 0x40c55e
xor edx, edx
xor al, byte [ebp + edx - 0x1b]
inc byte [ebp + 0x17]
movzx edx, byte [ebp + 0x17]
cmp edx, ecx
jl 0x40c54f
mov edi, dword [ebp + 8]
push 0xc
push edi
mov byte [ebp + esi - 0x18], al
mov byte [ebp + esi - 0x17], 4
call dword [sym.imp.KERNEL32.dll_PurgeComm]
mov esi, dword [sym.imp.KERNEL32.dll_Sleep]
push 0x64
call esi
push ebx
lea eax, [ebp + 0x14]
push eax
push 0x18
lea eax, [ebp - 0x1c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40c6bb
cmp dword [ebp + 0x14], 0x18
jne 0x40c6bb
push ebx
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_ClearCommError]
push 0x64
call esi
push ebx
lea eax, [ebp + 0x14]
push eax
push 0x100
lea eax, [ebp - 0x11c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40c6ad
cmp dword [ebp + 0x14], 6
jb 0x40c6a3
cmp byte [ebp - 0x11c], 5
jne 0x40c69c
cmp byte [ebp - 0x11b], 1
jne 0x40c69c
mov al, byte [ebp - 0x11a]
cmp al, 5
jb 0x40c695
mov cl, byte [ebp + 0xc]
or cl, 0x80
cmp byte [ebp - 0x119], cl
jne 0x40c695
sub al, 5
movzx esi, al
lea edx, [esi + 3]
xor cl, cl
cmp edx, ebx
jle 0x40c634
xor edi, edi
xor cl, byte [ebp + edi - 0x11b]
inc bl
movzx edi, bl
cmp edi, edx
jl 0x40c622
xor ebx, ebx
cmp byte [ebp + esi - 0x118], cl
jne 0x40c689
cmp byte [ebp + esi - 0x117], 4
jne 0x40c689
mov dword [ebp - 4], 1
cmp al, bl
je 0x40c6ce
mov edi, dword [ebp + 0x18]
cmp edi, ebx
je 0x40c6ce
mov ecx, dword [ebp + 0x1c]
cmp ecx, ebx
je 0x40c6ce
push esi
push 0x40
mov byte [ecx], al
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov dword [edi], eax
cmp eax, ebx
je 0x40c684
push esi
lea ecx, [ebp - 0x118]
push ecx
push eax
call sub.msvcrt.dll_memcpy
add esp, 0xc
jmp 0x40c6ce
mov dword [ebp - 4], ebx
jmp 0x40c6ce
push str.ERROR_sr98_send_receive___Bad_CRC_data_n
call fcn.00409709
jmp 0x40c6cd
push str.ERROR_sr98_send_receive___Bad_data_size_ctl_code_n
jmp 0x40c68e
push str.ERROR_sr98_send_receive___Bad_header_n
jmp 0x40c68e
push dword [ebp + 0x14]
push str.ERROR_sr98_send_receive___Read_size___u_n
jmp 0x40c6c7
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_sr98_send_receive___ReadFile__0x_08x__n
jmp 0x40c6c7
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_sr98_send_receive___WriteFile__0x_08x__n
call fcn.00409709
pop ecx
pop ecx
pop esi
mov eax, dword [ebp - 4]
pop edi
pop ebx
leave
ret