Function at 0x40c540
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 [0x43561c]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x43561c]
mov dword [0x435614], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x439644]
mov ecx, dword [0x439650]
mov ax, word [eax - 2]
mov word [0x435638], ax
mov eax, ecx
and eax, 3
cmp eax, 3
jne 0x40c86f
cmp dword [0x43964c], 0
je 0x41ff60
push dword [0x43561c]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x43561c]
mov dword [0x435614], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
mov eax, dword [0x43964c]
test eax, eax
je 0x41ff90
push eax
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov ebx, eax
mov dword [ebp - 0x18], ebx
mov edi, 0x43d860
push 1
push 0
push 0
push ebx
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
push 0x44be6c
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 0x44be6c
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 0x42010e
test ecx, ecx
je 0x40c8ce
cmp dword [0x435618], 0xfde9
mov esi, ecx
mov edx, dword [ebp - 0x14]
mov ebx, ecx
mov dword [ebp - 0x10], esi
je 0x420115
mov ecx, edi
mov dword [ebp - 0x14], ecx
test ebx, ebx
jle 0x40c686
cmp esi, 3
jl 0x40c667
mov al, byte [edi]
cmp al, 0xa
je 0x42015a
cmp al, 0xd
je 0x40c68b
movzx eax, byte [edi]
cmp byte [eax + 0x44bb58], 0
jne 0x420169
dec esi
mov eax, 1
add edi, eax
mov dword [ebp - 0x10], esi
test esi, esi
jg 0x40c654
mov ebx, dword [ebp - 8]
jmp 0x40c6ad
cmp byte [edi + 1], 0xa
jne 0x40c667
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 [0x435618]
call fcn.0040d13e
test eax, eax
je 0x4201c4
mov eax, 1
push 0x1fff
push 0x43fa98
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 [0x435614], 0
jne 0x4201cb
test eax, eax
je 0x40c8d5
test ecx, ecx
jle 0x40c8d5
mov dword [ebp - 0xc], 0
mov eax, dword [0x43964c]
test ecx, ecx
je 0x40c8f0
cmp dword [0x44c12c], 0
jne 0x40c729
test ecx, ecx
je 0x40c729
test eax, eax
je 0x420237
cmp ecx, 0x7ffffffe
ja 0x420246
mov eax, 0x43563a
mov esi, 0x43fa98
mov edx, 0x2002
sub esi, eax
add ecx, 0xffffdffe
add ecx, edx
je 0x40c774
movzx ecx, word [esi + eax]
test cx, cx
je 0x40c76c
mov word [eax], cx
add eax, 2
mov ecx, dword [ebp - 8]
sub edx, 1
jne 0x40c746
jmp 0x420254
test edx, edx
je 0x420254
xor ecx, ecx
mov word [eax], cx
mov dx, word [0x43563a]
mov ecx, 0x43563a
lea esi, [ecx + 2]
jmp 0x40c790
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40c790
sub ecx, esi
movzx eax, dx
sar ecx, 1
xor edi, edi
mov dword [ebp - 4], ecx
mov ebx, ecx
mov esi, 0x43563c
test ax, ax
je 0x40c7d5
push eax
push 0x4023e0
call dword [sym.imp.msvcrt.dll_wcschr]
add esp, 8
test eax, eax
jne 0x40c7d2
movzx eax, word [esi]
inc edi
add esi, 2
test ax, ax
jne 0x40c7b3
mov ecx, dword [ebp - 4]
mov dword [ebp - 0xc], edi
cmp edi, ebx
jae 0x40c8b9
movzx eax, word [edi*2 + 0x43563a]
lea edx, [edi*2 + 0x43563a]
mov esi, eax
cmp eax, 0x1a
je 0x4202e3
cmp esi, 0xa
jne 0x40c8fd
sub edi, ecx
add edx, 2
mov eax, 1
inc edi
mov ecx, dword [0x43964c]
mov dword [ebp - 0xc], eax
xor eax, eax
mov word [edx], ax
call fcn.0040cc8e
test eax, eax
jne 0x40c84f
push dword [0x43964c]
mov esi, dword [ebp - 0xc]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
push esi
push 0
push edi
push eax
call dword [sym.imp.api_ms_win_core_file_l1_1_0.dll_SetFilePointer]
cmp dword [0x43964c], 0
je 0x4202f0
mov dword [0x439644], 0x43563a
call fcn.0040c910
mov eax, dword [0x439644]
pop edi
pop esi
mov dword [0x439640], eax
pop ebx
mov esp, ebp
pop ebp
ret
sub eax, 1
jne 0x41ff57
mov esi, dword [0x43964c]
mov edx, 0x2002
push esi
mov ecx, 0x43563a
mov word [0x43963a], ax
call fcn.0040dfe0
mov ecx, 0x43563a
lea edx, [ecx + 2]
lea esp, [esp]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40c8a0
sub ecx, edx
sar ecx, 1
lea eax, [esi + ecx*2]
mov dword [0x43964c], eax
jmp 0x40c84f
test ecx, ecx
je 0x40c7e0
cmp edi, 0x2000
jb 0x40c84f
jmp 0x42025c
xor eax, eax
jmp 0x40c6e3
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 0x40c707
test eax, eax
jne 0x40c714
jmp 0x4201fa
mov eax, 2
xor edi, edi
jmp 0x40c80e
sub eax, 1
jne 0x40c84f
test ecx, 0x8000
je 0x41ff7c
push 0
push 0x2352
call fcn.004156ed
add esp, 8
jmp 0x40c59d
call fcn.0042ac20
or dword [0x439650], 0x8000
jmp 0x40c59d
xor ecx, ecx
call fcn.0042d545
test eax, eax
jne 0x420096
xor ecx, ecx
call fcn.0040cc8e
test eax, eax
je 0x41ffb7
test byte [0x439794], 1
je 0x420096
mov eax, dword [0x43964c]
test eax, eax
jne 0x40c5cc
xor ecx, ecx
call fcn.0040cc8e
test eax, eax
je 0x42008c
test byte [0x439794], 1
je 0x42008c
cmp dword [0x44c5e8], 0
je 0x41fff8
lea eax, [ebp - 4]
push eax
push ecx
call fcn.0042ab89
jmp 0x40c8e2
push dword [0x43561c]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x43561c]
mov dword [0x435614], 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 [0x43964c]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
mov edx, 0x43fa98
mov ecx, eax
call fcn.0042775c
test eax, eax
je 0x40c8d5
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
test ecx, ecx
jne 0x420085
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
push 0x40208c
cmp eax, 0x3e3
jne 0x420077
call fcn.00408ec2
add esp, 4
push 0xffffffffffffffff
push 0x443ad8
call dword [sym.imp.msvcrt.dll_longjmp]
call fcn.00408ec2
mov ecx, dword [ebp - 4]
add esp, 4
mov dword [ebp - 8], ecx
xor eax, eax
jmp 0x40c8e8
mov eax, dword [0x43964c]
jmp 0x40c5cc
mov dword [ebp - 4], 0
xor ebx, ebx
jmp 0x4200a3
mov ebx, ecx
push dword [0x43964c]
call dword [sym.imp.msvcrt.dll__get_osfhandle]
add esp, 4
lea ecx, [ebp - 0xc]
lea edx, [ebx*2 + 0x43fa98]
push ecx
push 1
mov ecx, eax
call fcn.00427bc5
test eax, eax
jne 0x4200d7
call dword [sym.imp.api_ms_win_core_errorhandling_l1_1_0.dll_GetLastError]
cmp eax, 0xea
jne 0x420103
cmp dword [ebp - 0xc], 0
je 0x420103
mov ecx, dword [ebp - 4]
inc ecx
mov dword [ebp - 8], ecx
mov dword [ebp - 4], ecx
cmp word [ecx*2 + 0x43fa96], 0xa
je 0x40c707
cmp ecx, 0x2000
jb 0x4200a1
jmp 0x40c707
mov ecx, dword [ebp - 4]
mov dword [ebp - 8], ecx
jmp 0x40c707
xor eax, eax
jmp 0x40c6e3
test edx, edx
jne 0x40c64b
push 3
push 0x403644
push 0x43d860
call sub.msvcrt.dll_memcmp
add esp, 0xc
mov ecx, ebx
test eax, eax
jne 0x420152
lea ebx, [ecx - 3]
mov edi, 0x43d863
mov esi, ebx
mov dword [ebp - 8], ebx
lea edx, [eax + 3]
mov dword [ebp - 4], ebx
mov dword [ebp - 0x10], esi
jmp 0x40c64b
mov edx, dword [ebp - 0x14]
jmp 0x40c64b
cmp byte [edi + 1], 0xd
je 0x40c691
jmp 0x40c667
cmp esi, 1
je 0x42017b
add esi, 0xfffffffe
mov eax, 2
jmp 0x40c67d
push 0x44be6c
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 0x44be6c
mov esi, eax
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_ReleaseSRWLockShared]
test esi, esi
je 0x4201bb
cmp dword [ebp - 0x10], 0
je 0x4201bb
mov ebx, dword [ebp - 8]
inc ebx
jmp 0x40c6ad
xor ecx, ecx
xor eax, eax
jmp 0x40c6dd
xor eax, eax
jmp 0x40c6c5
push dword [0x43561c]
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_EnterCriticalSection]
push dword [0x43561c]
mov dword [0x435614], 0
call dword [sym.imp.api_ms_win_core_synch_l1_1_0.dll_LeaveCriticalSection]
push 0xffffffffffffffff
push 0x443ad8
call dword [sym.imp.msvcrt.dll_longjmp]
xor ecx, ecx
call fcn.0040cc8e
test eax, eax
je 0x420225
cmp dword [0x44c12c], 0
je 0x420225
mov ecx, dword [ebp - 4]
mov eax, 0xa
inc ecx
mov word [0x43fa98], ax
mov dword [ebp - 8], ecx
jmp 0x40c729
call fcn.0042ce7c
push 2
push 0x443a98
call dword [sym.imp.msvcrt.dll_longjmp]
mov dword [0x44c12c], 1
jmp 0x40c729
xor edx, edx
mov word [0x43563a], dx
jmp 0x40c780
sub eax, 2
jmp 0x40c774
cmp dword [0x439664], 3
jne 0x4202ae
cmp dword [0x4310c0], 1
jne 0x42028d
call fcn.0042ac20
push 0x43563a
call fcn.00408ec2
add esp, 4
push 0x40208c
call fcn.00408ec2
add esp, 4
push 0
push 0x233f
call fcn.004128ff
add esp, 8
call fcn.0042ce7c
push 1
push 0x443a98
call dword [sym.imp.msvcrt.dll_longjmp]
push 0
push 0x233f
call fcn.004128ff
add esp, 8
cmp dword [0x43964c], 0
jne 0x4202d6
xor ecx, ecx
call fcn.0040cc8e
test eax, eax
je 0x4202d6
call fcn.0042d65c
push 0xffffffffffffffff
push 0x443ad8
call dword [sym.imp.msvcrt.dll_longjmp]
mov eax, 0xa
mov word [edx], ax
jmp 0x40c803
cmp dword [0x44c5ec], 0
jne 0x40c84f
mov edx, 0x43563a
lea ecx, [edx + 2]
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x420305
sub edx, ecx
mov ecx, 0x43563a
sar edx, 1
call fcn.00408f06
jmp 0x40c84f