Function at 0x100018e0
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
push ebx
push esi
xor edx, edx
mov dword [ebp - 0x18], ecx
mov ecx, dword [ebp + 8]
xor eax, eax
push edi
xor esi, esi
mov dword [ebp - 0x14], edx
xor edi, edi
mov dword [ebp - 0x1c], esi
xor ebx, ebx
mov dword [ebp - 0xc], eax
mov dword [ebp - 8], edx
test ecx, ecx
je 0x10001de9
mov ecx, dword [ecx + 4]
test ecx, ecx
je 0x10001de9
mov esi, dword [ebp + 8]
mov esi, dword [esi + 8]
test esi, esi
mov dword [ebp - 0x20], esi
mov esi, eax
je 0x10001de9
mov cl, byte [ecx]
cmp cl, 0x4d
je 0x10001aec
cmp cl, 0x50
jne 0x10001dd2
cmp dword [ebp - 0x20], 1
jbe 0x10001ad0
mov ecx, dword [ebp + 8]
mov esi, dword [ebp - 0x18]
mov ebx, dword [ecx + 4]
mov eax, dword [esi + 4]
inc ebx
cmp eax, 0xffffffff
je 0x10001981
lea edi, [esi + 0x130]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetCommTimeouts]
test eax, eax
je 0x10001981
push edi
push dword [esi + 4]
mov dword [esi + 0x138], 0x3e8
call dword [sym.imp.KERNEL32.dll_SetCommTimeouts]
push 0xc
push dword [esi + 4]
call dword [sym.imp.KERNEL32.dll_PurgeComm]
mov edi, dword [esi + 0x158]
add edi, dword [ebp - 0x20]
test ebx, ebx
je 0x10001ad0
mov eax, dword [esi + 0x144]
test eax, eax
je 0x100019c2
cmp edi, dword [esi + 0x148]
jbe 0x100019d7
push eax
call fcn.10004309
add esp, 4
mov dword [esi + 0x144], 0
push edi
call fcn.1000453b
add esp, 4
mov dword [esi + 0x144], eax
mov dword [esi + 0x148], edi
push edi
push 0
push eax
call sub.VCRUNTIME140.dll_memset
mov ecx, dword [esi + 0x144]
add esp, 0xc
mov edx, edi
push ebx
call fcn.10001180
mov eax, dword [esi + 0x144]
test eax, eax
je 0x10001a29
cmp edi, 0x7fffffff
ja 0x10001a29
xor edx, edx
mov ecx, edi
test edi, edi
je 0x10001a1e
nop dword [eax + eax]
cmp byte [eax], dl
je 0x10001a9b
inc eax
sub ecx, 1
jne 0x10001a10
mov edx, 0x80070057
xor edi, edi
test edx, edx
jns 0x10001a2b
xor edi, edi
mov eax, dword [esi + 0x154]
test eax, eax
je 0x10001a4d
push dword [esi + 0x158]
push eax
mov eax, dword [esi + 0x144]
add eax, edi
push eax
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
mov ecx, dword [esi + 0x158]
xor eax, eax
mov edx, dword [esi + 4]
add ecx, edi
mov edi, dword [esi + 0x144]
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x20], eax
cmp edx, 0xffffffff
je 0x10001aa7
test edi, edi
je 0x10001aa7
test ecx, ecx
je 0x10001aa7
push eax
lea eax, [ebp - 0x20]
push eax
push ecx
push edi
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x10001a9f
push dword [ebp - 0x20]
mov ecx, dword [esi + 8]
push edi
push str.MMSerial:_Write
call fcn.10005ba0
mov eax, dword [ebp - 0x20]
jmp 0x10001aa4
sub edi, ecx
jmp 0x10001a25
xor eax, eax
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x14], eax
test eax, eax
je 0x10001aca
push 0
push 0
push 0
push 0x100
lea eax, [esi + 0x15c]
push eax
lea ecx, [esi + 4]
call fcn.10003a20
mov eax, dword [ebp - 0x14]
test eax, eax
js 0x10001dd2
mov ecx, dword [ebp - 0x18]
push 0x100
lea eax, [ecx + 0x39c]
add ecx, 4
push eax
call fcn.10003bf0
jmp 0x10001dd2
mov eax, dword [ebp - 0x20]
xor ecx, ecx
mov dword [ebp - 0x10], ecx
test eax, eax
je 0x10001dcd
dec eax
mov dword [ebp - 0x28], eax
mov eax, 1
mov dword [ebp - 4], eax
nop dword [eax + eax]
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 4]
mov ecx, dword [ebp - 0x10]
movzx eax, byte [edx + eax - 1]
mov edx, dword [ebp - 8]
add eax, 0xffffffb3
cmp eax, 6
ja 0x10001cc6
jmp dword [eax*4 + 0x10001e00]
mov eax, dword [ebp - 4]
dec eax
cmp eax, dword [ebp - 0x28]
jne 0x10001d3c
mov edx, dword [ebp + 8]
xor eax, eax
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x24], eax
mov edx, dword [edx + 4]
add edx, ecx
je 0x10001d39
mov cl, byte [edx]
test cl, cl
je 0x10001d39
mov esi, eax
nop dword [eax]
cmp eax, dword [ebp - 8]
jae 0x10001d33
lea eax, [ecx - 0x30]
cmp al, 9
ja 0x10001d04
add esi, 0xfffffffd
shl esi, 4
jmp 0x10001d20
lea eax, [ecx - 0x41]
cmp al, 5
ja 0x10001d13
shl esi, 4
add esi, 0xffffffc9
jmp 0x10001d20
lea eax, [ecx - 0x61]
cmp al, 5
ja 0x10001d25
shl esi, 4
add esi, 0xffffffa9
movsx eax, cl
add esi, eax
mov eax, dword [ebp - 0x24]
inc edx
inc eax
mov dword [ebp - 0x24], eax
mov cl, byte [edx]
test cl, cl
jne 0x10001cf0
mov dword [ebp - 0x14], esi
mov esi, dword [ebp - 0x1c]
mov edx, dword [ebp - 8]
mov eax, dword [ebp - 4]
inc edx
inc eax
mov dword [ebp - 8], edx
mov dword [ebp - 4], eax
dec eax
cmp eax, dword [ebp - 0x20]
mov eax, dword [ebp - 4]
jb 0x10001b10
mov eax, dword [ebp - 0xc]
and eax, 7
cmp al, 7
jne 0x10001dcd
mov ecx, dword [ebp - 0x18]
mov edx, dword [ebp - 0x14]
push edx
push ebx
lea eax, [ecx + 0x39c]
add ecx, 4
push eax
push edi
push esi
call fcn.10003660
mov ecx, dword [ebp - 0x18]
mov dword [ebp - 0x14], eax
push edi
push esi
mov ecx, dword [ecx + 0x268]
test eax, eax
js 0x10001dba
push str.ELM327:_Request_for_Mode__i_PID__.4X_succeeded
push ecx
call fcn.10005b10
mov ecx, dword [ebp + 0x55]
push ebp
clc