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 [0x4315a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4315a4]
mov dword [0x43159c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x4355cc]
mov ecx, dword [0x4355d8]
mov ax, word [eax - 2]
mov word [0x4315c0], ax
mov eax, ecx
and eax, 3
cmp eax, 3
jne 0x40d991
cmp eax, 2
je 0x41d545
cmp dword [0x4355d4], 0
je 0x41d545
push dword [0x4315a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4315a4]
mov dword [0x43159c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x4355d4]
test eax, eax
je 0x41d575
push eax
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov ebx, eax
mov dword [ebp - 0x18], ebx
mov edi, 0x4397f0
push 1
push 0
push 0
push ebx
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
push 0x447e04
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 0x447e04
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 0x41d6f1
test ecx, ecx
je 0x40d9f0
cmp dword [0x4315a0], 0xfde9
mov esi, ecx
mov edx, dword [ebp - 0x14]
mov ebx, ecx
mov dword [ebp - 0x10], esi
je 0x41d6f8
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 0x41d73d
cmp al, 0xd
je 0x40d7b7
movzx eax, byte [edi]
cmp byte [eax + 0x447af0], 0
jne 0x41d74c
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 [0x4315a0]
call fcn.0040e248
test eax, eax
je 0x41d7a7
mov eax, 1
push 0x1fff
push 0x43ba30
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 [0x43159c], 0
jne 0x41d7ae
test eax, eax
je 0x40d9f7
test ecx, ecx
jle 0x40d9f7
mov dword [ebp - 0xc], 0
mov eax, dword [0x4355d4]
test ecx, ecx
je 0x40da12
cmp dword [0x448054], 0
jne 0x40d855
test ecx, ecx
je 0x40d855
test eax, eax
je 0x41d81a
cmp ecx, 0x7ffffffe
ja 0x41d829
mov eax, 0x4315c2
mov esi, 0x43ba30
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 0x41d837
test edx, edx
je 0x41d837
xor ecx, ecx
mov word [eax], cx
mov dx, word [0x4315c2]
mov ecx, 0x4315c2
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, 0x4315c2
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 + 0x4315c2]
lea edx, [edi*2 + 0x4315c2]
mov esi, eax
cmp eax, 0x1a
je 0x41d8c6
cmp esi, 0xa
jne 0x40da1f
sub edi, ecx
add edx, 2
mov eax, 1
inc edi
mov ecx, dword [0x4355d4]
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 [0x4355d4]
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 [0x4355d4], 0
je 0x41d8d3
mov dword [0x4355cc], 0x4315c2
call fcn.0040da30
mov eax, dword [0x4355cc]
pop edi
pop esi
mov dword [0x4355c8], eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, eax
sub edx, 1
jne 0x41d537
mov esi, dword [0x4355d4]
xor eax, eax
push esi
mov edx, 0x2002
mov word [0x4355c2], ax
mov ecx, 0x4315c2
call fcn.0040f3a0
mov ecx, 0x4315c2
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 [0x4355d4], eax
jmp 0x40d971
test ecx, ecx
je 0x40d904
cmp edi, 0x2000
jb 0x40d971
jmp 0x41d83f
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 0x41d7dd
mov eax, 2
xor edi, edi
jmp 0x40d932
sub edx, 1
je 0x40d6b0
jmp 0x40d971
test ecx, 0x8000
je 0x41d561
push 0
push 0x2352
call fcn.004063bd
add esp, 8
jmp 0x40d6c6
call fcn.0042765e
or dword [0x4355d8], 0x8000
jmp 0x40d6c6
xor ecx, ecx
call fcn.00429f8f
test eax, eax
jne 0x41d67b
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d59c
test byte [0x43571c], 1
je 0x41d67b
mov eax, dword [0x4355d4]
test eax, eax
jne 0x40d6f5
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d671
test byte [0x43571c], 1
je 0x41d671
cmp dword [0x448518], 0
je 0x41d5dd
lea eax, [ebp - 4]
push eax
push ecx
call fcn.004275d3
jmp 0x40da04
push dword [0x4315a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4315a4]
mov dword [0x43159c], 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 [0x4355d4]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, 0x43ba30
mov ecx, eax
call fcn.00424151
test eax, eax
je 0x40d9f7
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
test ecx, ecx
jne 0x41d66a
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push 0x401f8c
cmp eax, 0x3e3
jne 0x41d65c
call fcn.00409950
add esp, 4
push 0xffffffffffffffff
push 0x43fa70
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 [0x4355d4]
jmp 0x40d6f5
mov dword [ebp - 4], 0
xor ecx, ecx
lea eax, [ebp - 0xc]
push eax
push 1
push dword [0x4355d4]
lea esi, [ecx*2 + 0x43ba30]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, esi
mov ecx, eax
call fcn.004245b9
test eax, eax
jne 0x41d6ba
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
cmp eax, 0xea
jne 0x41d6e6
cmp dword [ebp - 0xc], 0
je 0x41d6e6
mov ecx, dword [ebp - 4]
inc ecx
mov dword [ebp - 8], ecx
mov dword [ebp - 4], ecx
cmp word [ecx*2 + 0x43ba2e], 0xa
je 0x40d833
cmp ecx, 0x2000
jb 0x41d684
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 0x4397f0
call sub.msvcrt.dll_memcmp
add esp, 0xc
mov ecx, ebx
test eax, eax
jne 0x41d735
lea ebx, [ecx - 3]
mov edi, 0x4397f3
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 0x41d75e
add esi, 0xfffffffe
mov eax, 2
jmp 0x40d7a9
push 0x447e04
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 0x447e04
mov esi, eax
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_ReleaseSRWLockShared]
test esi, esi
je 0x41d79e
cmp dword [ebp - 0x10], 0
je 0x41d79e
mov ebx, dword [ebp - 8]
inc ebx
jmp 0x40d7d9
xor ecx, ecx
xor eax, eax
jmp 0x40d809
xor eax, eax
jmp 0x40d7f1
push dword [0x4315a4]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x4315a4]
mov dword [0x43159c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
push 0xffffffffffffffff
push 0x43fa70
call dword [sym.imp.msvcrt.dll_longjmp]
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d808
cmp dword [0x448054], 0
je 0x41d808
mov ecx, dword [ebp - 4]
mov eax, 0xa
inc ecx
mov word [0x43ba30], ax
mov dword [ebp - 8], ecx
jmp 0x40d855
call fcn.004298e4
push 2
push 0x43fa30
call dword [sym.imp.msvcrt.dll_longjmp]
mov dword [0x448054], 1
jmp 0x40d855
xor edx, edx
mov word [0x4315c2], dx
jmp 0x40d8ac
sub eax, 2
jmp 0x40d8a0
cmp dword [0x4355ec], 3
jne 0x41d891
cmp dword [0x42d0c0], 1
jne 0x41d870
call fcn.0042765e
push 0x4315c2
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.004298e4
push 1
push 0x43fa30
call dword [sym.imp.msvcrt.dll_longjmp]
push 0
push 0x233f
call fcn.004078e4
add esp, 8
cmp dword [0x4355d4], 0
jne 0x41d8b9
xor ecx, ecx
call fcn.0040dd98
test eax, eax
je 0x41d8b9
call fcn.0042a09a
push 0xffffffffffffffff
push 0x43fa70
call dword [sym.imp.msvcrt.dll_longjmp]
mov eax, 0xa
mov word [edx], ax
jmp 0x40d927
cmp dword [0x44851c], 0
jne 0x40d971
mov edx, 0x4315c2
lea ecx, [edx + 2]
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x41d8e8
sub edx, ecx
mov ecx, 0x4315c2
sar edx, 1
call fcn.0040998d
jmp 0x40d971