Function at 0x40d5a0
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 [0x431594]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x431594]
mov dword [0x43158c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x4355bc]
mov ecx, dword [0x4355c8]
mov ax, word [eax - 2]
mov word [0x4315b0], ax
mov eax, ecx
and eax, 3
cmp eax, 3
jne 0x40d8d1
cmp eax, 2
je 0x41d473
cmp dword [0x4355c4], 0
je 0x41d473
push dword [0x431594]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x431594]
mov dword [0x43158c], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x4355c4]
test eax, eax
je 0x41d4a3
push eax
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov ebx, eax
mov dword [ebp - 0x18], ebx
mov edi, 0x4397e0
push 1
push 0
push 0
push ebx
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
push 0x447df4
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 0x447df4
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 0x41d611
test ecx, ecx
je 0x40d930
cmp dword [0x431590], 0xfde9
mov esi, ecx
mov edx, dword [ebp - 0x14]
mov ebx, ecx
mov dword [ebp - 0x10], esi
je 0x41d618
mov ecx, edi
mov dword [ebp - 0x14], ecx
test ebx, ebx
jle 0x40d6f2
lea ecx, [ecx]
cmp esi, 3
jl 0x40d6d3
mov al, byte [edi]
cmp al, 0xa
je 0x41d65d
cmp al, 0xd
je 0x40d6f7
movzx eax, byte [edi]
cmp byte [eax + 0x447ae0], 0
jne 0x41d66c
dec esi
mov eax, 1
add edi, eax
mov dword [ebp - 0x10], esi
test esi, esi
jg 0x40d6c0
mov ebx, dword [ebp - 8]
jmp 0x40d719
cmp byte [edi + 1], 0xa
jne 0x40d6d3
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 [0x431590]
call fcn.0040e188
test eax, eax
je 0x41d6c7
mov eax, 1
push 0x1fff
push 0x43ba20
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 [0x43158c], 0
jne 0x41d6ce
test eax, eax
je 0x40d937
test ecx, ecx
jle 0x40d937
mov dword [ebp - 0xc], 0
mov eax, dword [0x4355c4]
test ecx, ecx
je 0x40d952
cmp dword [0x448040], 0
jne 0x40d795
test ecx, ecx
je 0x40d795
test eax, eax
je 0x41d71d
cmp ecx, 0x7ffffffe
ja 0x41d72c
mov eax, 0x4315b2
mov esi, 0x43ba20
mov edx, 0x2002
sub esi, eax
add ecx, 0xffffdffe
add ecx, edx
je 0x40d7d8
movzx ecx, word [esi + eax]
test cx, cx
je 0x40d7d8
mov word [eax], cx
add eax, 2
mov ecx, dword [ebp - 8]
sub edx, 1
jne 0x40d7b2
jmp 0x41d73a
test edx, edx
je 0x41d73a
xor ecx, ecx
mov word [eax], cx
mov dx, word [0x4315b2]
mov ecx, 0x4315b2
lea esi, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d7f4
sub ecx, esi
movzx eax, dx
sar ecx, 1
xor edi, edi
mov dword [ebp - 4], ecx
mov ebx, ecx
mov esi, 0x4315b2
test ax, ax
je 0x40d839
push eax
push 0x4022c8
lea esi, [esi + 2]
call dword [sym.imp.msvcrt.dll_wcschr]
add esp, 8
test eax, eax
jne 0x40d836
movzx eax, word [esi]
inc edi
test ax, ax
jne 0x40d817
mov ecx, dword [ebp - 4]
mov dword [ebp - 0xc], edi
cmp edi, ebx
jae 0x40d91b
movzx eax, word [edi*2 + 0x4315b2]
lea edx, [edi*2 + 0x4315b2]
mov esi, eax
cmp eax, 0x1a
je 0x41d7c9
cmp esi, 0xa
jne 0x40d95f
sub edi, ecx
add edx, 2
mov eax, 1
inc edi
mov ecx, dword [0x4355c4]
mov dword [ebp - 0xc], eax
xor eax, eax
mov word [edx], ax
call fcn.0040dcd8
test eax, eax
jne 0x40d8b1
push dword [ebp - 0xc]
push eax
push edi
push dword [0x4355c4]
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 [0x4355c4], 0
je 0x41d7d6
mov dword [0x4355bc], 0x4315b2
call fcn.0040d970
mov eax, dword [0x4355bc]
pop edi
pop esi
mov dword [0x4355b8], eax
pop ebx
mov esp, ebp
pop ebp
ret
mov edx, eax
sub edx, 1
jne 0x41d465
mov esi, dword [0x4355c4]
xor eax, eax
push esi
mov edx, 0x2002
mov word [0x4355b2], ax
mov ecx, 0x4315b2
call fcn.0040f2e0
mov ecx, 0x4315b2
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d902
sub ecx, edx
sar ecx, 1
lea eax, [esi + ecx*2]
mov dword [0x4355c4], eax
jmp 0x40d8b1
test ecx, ecx
je 0x40d844
cmp edi, 0x2000
jb 0x40d8b1
jmp 0x41d742
xor eax, eax
jmp 0x40d74f
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 0x40d773
test eax, eax
jne 0x40d780
jmp 0x41d6e0
mov eax, 2
xor edi, edi
jmp 0x40d872
sub edx, 1
je 0x40d5f0
jmp 0x40d8b1
test ecx, 0x8000
je 0x41d48f
push 0
push 0x2352
call fcn.0040630a
add esp, 8
jmp 0x40d606
call fcn.004274de
or dword [0x4355c8], 0x8000
jmp 0x40d606
xor ecx, ecx
call fcn.00429e01
test eax, eax
jne 0x41d59b
xor ecx, ecx
call fcn.0040dcd8
test eax, eax
je 0x41d4ca
test byte [0x43570c], 1
je 0x41d59b
mov eax, dword [0x4355c4]
test eax, eax
jne 0x40d635
xor ecx, ecx
call fcn.0040dcd8
test eax, eax
je 0x41d591
test byte [0x43570c], 1
je 0x41d591
cmp dword [0x448508], 0
je 0x41d50b
lea eax, [ebp - 4]
push eax
push ecx
call fcn.00427453
jmp 0x40d944
push dword [0x431594]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x431594]
mov dword [0x43158c], 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 [0x4355c4]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, 0x43ba20
mov ecx, eax
call fcn.00423fbb
test eax, eax
je 0x40d937
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
test ecx, ecx
jne 0x41d58a
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push 0x401f7c
mov esi, eax
call fcn.00409890
add esp, 4
cmp esi, 0x3e3
je 0x41d7bc
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
xor eax, eax
jmp 0x40d94a
mov eax, dword [0x4355c4]
jmp 0x40d635
mov dword [ebp - 4], 0
xor ecx, ecx
lea eax, [ebp - 0xc]
push eax
push 1
push dword [0x4355c4]
lea esi, [ecx*2 + 0x43ba20]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, esi
mov ecx, eax
call fcn.00424423
test eax, eax
jne 0x41d5da
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
cmp eax, 0xea
jne 0x41d606
cmp dword [ebp - 0xc], 0
je 0x41d606
mov ecx, dword [ebp - 4]
inc ecx
mov dword [ebp - 8], ecx
mov dword [ebp - 4], ecx
cmp word [ecx*2 + 0x43ba1e], 0xa
je 0x40d773
cmp ecx, 0x2000
jb 0x41d5a4
jmp 0x40d773
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
jmp 0x40d773
xor eax, eax
jmp 0x40d74f
test edx, edx
jne 0x40d6b4
push 3
push 0x40343c
push 0x4397e0
call sub.msvcrt.dll_memcmp
add esp, 0xc
mov ecx, ebx
test eax, eax
jne 0x41d655
lea ebx, [ecx - 3]
mov edi, 0x4397e3
mov esi, ebx
mov dword [ebp - 8], ebx
lea edx, [eax + 3]
mov dword [ebp - 4], ebx
mov dword [ebp - 0x10], esi
jmp 0x40d6b4
mov edx, dword [ebp - 0x14]
jmp 0x40d6b4
cmp byte [edi + 1], 0xd
je 0x40d6fd
jmp 0x40d6d3
cmp esi, 1
je 0x41d67e
add esi, 0xfffffffe
mov eax, 2
jmp 0x40d6e9
push 0x447df4
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 0x447df4
mov esi, eax
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_ReleaseSRWLockShared]
test esi, esi
je 0x41d6be
cmp dword [ebp - 0x10], 0
je 0x41d6be
mov ebx, dword [ebp - 8]
inc ebx
jmp 0x40d719
xor ecx, ecx
xor eax, eax
jmp 0x40d749
xor eax, eax
jmp 0x40d731
call fcn.00427351
push 0xffffffffffffffff
push 0x43fa60
call dword [sym.imp.msvcrt.dll_longjmp]
xor ecx, ecx
call fcn.0040dcd8
test eax, eax
je 0x41d70b
cmp dword [0x448040], 0
je 0x41d70b
mov ecx, dword [ebp - 4]
mov eax, 0xa
inc ecx
mov word [0x43ba20], ax
mov dword [ebp - 8], ecx
jmp 0x40d795
call fcn.00429762
push 2
push 0x43fa20
call dword [sym.imp.msvcrt.dll_longjmp]
mov dword [0x448040], 1
jmp 0x40d795
xor edx, edx
mov word [0x4315b2], dx
jmp 0x40d7ec
sub eax, 2
jmp 0x40d7e0
cmp dword [0x4355dc], 3
jne 0x41d794
cmp dword [0x42d0c0], 1
jne 0x41d773
call fcn.004274de
push 0x4315b2
call fcn.00409890
add esp, 4
push 0x401f7c
call fcn.00409890
add esp, 4
push 0
push 0x233f
call fcn.00407834
add esp, 8
call fcn.00429762
push 1
push 0x43fa20
call dword [sym.imp.msvcrt.dll_longjmp]
push 0
push 0x233f
call fcn.00407834
add esp, 8
cmp dword [0x4355c4], 0
jne 0x41d7bc
xor ecx, ecx
call fcn.0040dcd8
test eax, eax
je 0x41d7bc
call fcn.00429f0c
push 0xffffffffffffffff
push 0x43fa60
call dword [sym.imp.msvcrt.dll_longjmp]
mov eax, 0xa
mov word [edx], ax
jmp 0x40d867
cmp dword [0x44850c], 0
jne 0x40d8b1
mov edx, 0x4315b2
lea ecx, [edx + 2]
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x41d7eb
sub edx, ecx
mov ecx, 0x4315b2
sar edx, 1
call fcn.004098cd
jmp 0x40d8b1