Function at 0x40d660
Capabilities:
Read file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x1c
push ebx
push esi
push edi
push dword [0x4325a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4325a4]
mov dword [0x43259c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x4365cc]
mov ecx, dword [0x4365d8]
mov ax, word [eax - 2]
mov word [0x4325c0], ax
mov eax, ecx
and eax, 3
cmp eax, 3
jne 0x40d991
cmp eax, 2
je 0x41d587
cmp dword [0x4365d4], 0
je 0x41d587
push dword [0x4325a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4325a4]
mov dword [0x43259c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x4365d4]
test eax, eax
je 0x41d5b7
push eax
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov ebx, eax
mov dword [ebp - 0x18], ebx
mov edi, 0x43a7f0
push 1
push 0
push 0
push ebx
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
push 0x448e04
mov dword [ebp - 0x14], eax
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_AcquireSRWLockShared]
push 0
lea eax, [ebp - 4]
push eax
push 0x1fff
push edi
push ebx
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_ReadFile]
push 0x448e04
mov esi, eax
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_ReleaseSRWLockShared]
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
test esi, esi
je 0x41d733
test ecx, ecx
je 0x40d9f0
cmp dword [0x4325a0], 0xfde9
mov esi, ecx
mov edx, dword [ebp - 0x14]
mov ebx, ecx
mov dword [ebp - 0x10], esi
je 0x41d73a
mov ecx, edi
mov dword [ebp - 0x14], ecx
test ebx, ebx
jle 0x40d7b2
lea ecx, [ecx]
cmp esi, 3
jl 0x40d793
mov al, byte [edi]
cmp al, 0xa
je 0x41d77f
cmp al, 0xd
je 0x40d7b7
movzx eax, byte [edi]
cmp byte [eax + 0x448af0], 0
jne 0x41d78e
dec esi
mov eax, 1
add edi, eax
mov dword [ebp - 0x10], esi
test esi, esi
jg 0x40d780
mov ebx, dword [ebp - 8]
jmp 0x40d7d9
cmp byte [edi + 1], 0xa
jne 0x40d793
mov ebx, edi
mov byte [edi + 2], 0
sub ebx, ecx
add ebx, 2
push 0
push 0
lea eax, [ebx + edx]
push eax
push dword [ebp - 0x18]
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
mov ecx, dword [0x4325a0]
call fcn.0040e248
test eax, eax
je 0x41d7e9
mov eax, 1
push 0x1fff
push 0x43ca30
push ebx
push dword [ebp - 0x14]
push eax
push ecx
call dword [sym.imp.api_ms_win_core_string_l1_1_0.dll_MultiByteToWideChar]
mov ecx, eax
mov dword [ebp - 4], ecx
mov dword [ebp - 8], ecx
cmp dword [0x43259c], 0
jne 0x41d7f0
test eax, eax
je 0x40d9f7
test ecx, ecx
jle 0x40d9f7
mov dword [ebp - 0xc], 0
mov eax, dword [0x4365d4]
test ecx, ecx
je 0x40da12
cmp dword [0x449054], 0
jne 0x40d855
test ecx, ecx
je 0x40d855
test eax, eax
je 0x41d85c
cmp ecx, 0x7ffffffe
ja 0x41d86b
mov eax, 0x4325c2
mov esi, 0x43ca30
mov edx, 0x2002
sub esi, eax
add ecx, 0xffffdffe
add ecx, edx
je 0x40d898
movzx ecx, word [esi + eax]
test cx, cx
je 0x40d898
mov word [eax], cx
add eax, 2
mov ecx, dword [ebp - 8]
sub edx, 1
jne 0x40d872
jmp 0x41d879
test edx, edx
je 0x41d879
xor ecx, ecx
mov word [eax], cx
mov dx, word [0x4325c2]
mov ecx, 0x4325c2
lea esi, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d8b4
sub ecx, esi
movzx eax, dx
sar ecx, 1
xor edi, edi
mov dword [ebp - 4], ecx
mov ebx, ecx
mov esi, 0x4325c2
test ax, ax
je 0x40d8f9
push eax
push 0x4022d8
lea esi, [esi + 2]
call dword [sym.imp.msvcrt.dll_wcschr]
add esp, 8
test eax, eax
jne 0x40d8f6
movzx eax, word [esi]
inc edi
test ax, ax
jne 0x40d8d7
mov ecx, dword [ebp - 4]
mov dword [ebp - 0xc], edi
cmp edi, ebx
jae 0x40d9db
movzx eax, word [edi*2 + 0x4325c2]
lea edx, [edi*2 + 0x4325c2]
mov esi, eax
cmp eax, 0x1a
je 0x41d908
cmp esi, 0xa
jne 0x40da1f
sub edi, ecx
add edx, 2
mov eax, 1
inc edi
mov ecx, dword [0x4365d4]
mov dword [ebp - 0xc], eax
xor eax, eax
mov word [edx], ax
call fcn.0040dd98
test eax, eax
jne 0x40d971
push dword [ebp - 0xc]
push eax
push edi
push dword [0x4365d4]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
push eax
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
cmp dword [0x4365d4], 0
je 0x41d915
mov dword [0x4365cc], 0x4325c2
call fcn.0040da30
mov eax, dword [0x4365cc]
pop edi
pop esi
mov dword [0x4365c8], eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, eax
sub edx, 1
jne 0x41d579
mov esi, dword [0x4365d4]
xor eax, eax
push esi
mov edx, 0x2002
mov word [0x4365c2], ax
mov ecx, 0x4325c2
call fcn.0040f3a0
mov ecx, 0x4325c2
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d9c2
sub ecx, edx
sar ecx, 1
lea eax, [esi + ecx*2]
mov dword [0x4365d4], eax
jmp 0x40d971
test ecx, ecx
je 0x40d904
cmp edi, 0x2000
jb 0x40d971
jmp 0x41d881
xor eax, eax
jmp 0x40d80f
mov dword [ebp - 4], 0
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
mov dword [ebp - 0xc], eax
jmp 0x40d833
test eax, eax
jne 0x40d840
jmp 0x41d81f
mov eax, 2
xor edi, edi
jmp 0x40d932
sub edx, 1
je 0x40d6b0
jmp 0x40d971
test ecx, 0x8000
je 0x41d5a3
push 0
push 0x2352
call fcn.004063bd
add esp, 8
jmp 0x40d6c6
call fcn.0042769e
or dword [0x4365d8], 0x8000
jmp 0x40d6c6
xor ecx, ecx
call fcn.00429fcf
test eax, eax
jne 0x41d6bd
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d5de
test byte [0x43671c], 1
je 0x41d6bd
mov eax, dword [0x4365d4]
test eax, eax
jne 0x40d6f5
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d6b3
test byte [0x43671c], 1
je 0x41d6b3
cmp dword [0x449518], 0
je 0x41d61f
lea eax, [ebp - 4]
push eax
push ecx
call fcn.00427613
jmp 0x40da04
push dword [0x4325a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4325a4]
mov dword [0x43259c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
lea eax, [ebp - 4]
push eax
push 0x2000
push dword [0x4365d4]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, 0x43ca30
mov ecx, eax
call fcn.00424191
test eax, eax
je 0x40d9f7
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
test ecx, ecx
jne 0x41d6ac
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push 0x401f8c
cmp eax, 0x3e3
jne 0x41d69e
call fcn.00409950
add esp, 4
push 0xffffffffffffffff
push 0x440a70
call dword [sym.imp.msvcrt.dll_longjmp]
call fcn.00409950
mov ecx, dword [ebp - 4]
add esp, 4
mov dword [ebp - 8], ecx
xor eax, eax
jmp 0x40da0a
mov eax, dword [0x4365d4]
jmp 0x40d6f5
mov dword [ebp - 4], 0
xor ecx, ecx
lea eax, [ebp - 0xc]
push eax
push 1
push dword [0x4365d4]
lea esi, [ecx*2 + 0x43ca30]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, esi
mov ecx, eax
call fcn.004245f9
test eax, eax
jne 0x41d6fc
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
cmp eax, 0xea
jne 0x41d728
cmp dword [ebp - 0xc], 0
je 0x41d728
mov ecx, dword [ebp - 4]
inc ecx
mov dword [ebp - 8], ecx
mov dword [ebp - 4], ecx
cmp word [ecx*2 + 0x43ca2e], 0xa
je 0x40d833
cmp ecx, 0x2000
jb 0x41d6c6
jmp 0x40d833
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
jmp 0x40d833
xor eax, eax
jmp 0x40d80f
test edx, edx
jne 0x40d774
push 3
push 0x4034f8
push 0x43a7f0
call sub.msvcrt.dll_memcmp
add esp, 0xc
mov ecx, ebx
test eax, eax
jne 0x41d777
lea ebx, [ecx - 3]
mov edi, 0x43a7f3
mov esi, ebx
mov dword [ebp - 8], ebx
lea edx, [eax + 3]
mov dword [ebp - 4], ebx
mov dword [ebp - 0x10], esi
jmp 0x40d774
mov edx, dword [ebp - 0x14]
jmp 0x40d774
cmp byte [edi + 1], 0xd
je 0x40d7bd
jmp 0x40d793
cmp esi, 1
je 0x41d7a0
add esi, 0xfffffffe
mov eax, 2
jmp 0x40d7a9
push 0x448e04
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_AcquireSRWLockShared]
push 0
lea eax, [ebp - 0x10]
push eax
push 1
lea eax, [edi + 1]
push eax
push dword [ebp - 0x18]
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_ReadFile]
push 0x448e04
mov esi, eax
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_ReleaseSRWLockShared]
test esi, esi
je 0x41d7e0
cmp dword [ebp - 0x10], 0
je 0x41d7e0
mov ebx, dword [ebp - 8]
inc ebx
jmp 0x40d7d9
xor ecx, ecx
xor eax, eax
jmp 0x40d809
xor eax, eax
jmp 0x40d7f1
push dword [0x4325a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4325a4]
mov dword [0x43259c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
push 0xffffffffffffffff
push 0x440a70
call dword [sym.imp.msvcrt.dll_longjmp]
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d84a
cmp dword [0x449054], 0
je 0x41d84a
mov ecx, dword [ebp - 4]
mov eax, 0xa
inc ecx
mov word [0x43ca30], ax
mov dword [ebp - 8], ecx
jmp 0x40d855
call fcn.00429922
push 2
push 0x440a30
call dword [sym.imp.msvcrt.dll_longjmp]
mov dword [0x449054], 1
jmp 0x40d855
xor edx, edx
mov word [0x4325c2], dx
jmp 0x40d8ac
sub eax, 2
jmp 0x40d8a0
cmp dword [0x4365ec], 3
jne 0x41d8d3
cmp dword [0x42e0c0], 1
jne 0x41d8b2
call fcn.0042769e
push 0x4325c2
call fcn.00409950
add esp, 4
push 0x401f8c
call fcn.00409950
add esp, 4
push 0
push 0x233f
call fcn.004078e4
add esp, 8
call fcn.00429922
push 1
push 0x440a30
call dword [sym.imp.msvcrt.dll_longjmp]
push 0
push 0x233f
call fcn.004078e4
add esp, 8
cmp dword [0x4365d4], 0
jne 0x41d8fb
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d8fb
call fcn.0042a0da
push 0xffffffffffffffff
push 0x440a70
call dword [sym.imp.msvcrt.dll_longjmp]
mov eax, 0xa
mov word [edx], ax
jmp 0x40d927
cmp dword [0x44951c], 0
jne 0x40d971
mov edx, 0x4325c2
lea ecx, [edx + 2]
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x41d92a
sub edx, ecx
mov ecx, 0x4325c2
sar edx, 1
call fcn.0040998d
jmp 0x40d971