Function at 0x40d4a6
Capabilities:
Check if file exists
Get file attributes
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x130
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x128], 0xffffffff
call fcn.00412279
mov dword [ebp - 0x1c], eax
push 0
mov ax, word [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.00412144
add esp, 0xc
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
je 0x40d4e9
jmp 0x40dc66
push 0x4389ac
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
jne 0x40d511
call fcn.00411a16
push eax
push 0xc
call fcn.00412a9b
add esp, 8
mov dword [ebp - 0x18], eax
jmp 0x40dc66
push 0x4389ac
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0xffffffff
jne 0x40d542
push 0x4389ac
call fcn.00411a16
push eax
push 0xe
call fcn.00412a9b
add esp, 0xc
mov dword [ebp - 0x18], eax
jmp 0x40dc66
push 0x20
push 0x8000
push 0x4389ac
call fcn.00415070
add esp, 0xc
mov edx, dword [ebp + 0x14]
mov dword [edx], eax
mov eax, dword [ebp + 0x14]
cmp dword [eax], 0xffffffff
jne 0x40d580
call fcn.00411a16
push eax
push 0x4389ac
push 0xf
call fcn.00412a9b
add esp, 0xc
mov dword [ebp - 0x18], eax
jmp 0x40dc66
lea ecx, [ebp - 8]
push ecx
mov edx, dword [ebp + 0x14]
mov eax, dword [edx]
push eax
call fcn.004119c4
add esp, 8
cmp dword [ebp - 8], 0xac
jae 0x40d5bb
mov ecx, dword [ebp - 8]
push ecx
push 0xac
push 0x4389ac
push 0x10
call fcn.00412a9b
add esp, 0x10
mov dword [ebp - 0x18], eax
jmp 0x40dc49
push 0
push 0
mov edx, dword [ebp + 0x14]
mov eax, dword [edx]
push eax
call fcn.00415d3b
add esp, 0xc
mov dword [ebp - 0x124], eax
push 0xac
mov ecx, dword [ebp + 0x10]
push ecx
mov edx, dword [ebp + 0x14]
mov eax, dword [edx]
push eax
call fcn.00414d91
add esp, 0xc
mov dword [ebp - 0x124], eax
cmp dword [ebp - 0x124], 0xac
je 0x40d64e
push 0xac
mov ecx, dword [ebp + 0x10]
push ecx
mov edx, dword [ebp + 0x14]
mov eax, dword [edx]
push eax
call fcn.00414d91
add esp, 0xc
mov dword [ebp - 0x124], eax
cmp dword [ebp - 0x124], 0xac
je 0x40d64e
mov ecx, dword [ebp - 0x124]
push ecx
push 0xac
call fcn.00411a16
push eax
push 0x4389ac
push 0x11
call fcn.00412a9b
add esp, 0x14
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 0x14]
cmp eax, 4
jle 0x40d685
push 0x4389ac
mov ecx, dword [ebp + 0x10]
movsx edx, word [ecx + 0x16]
push edx
mov eax, dword [ebp + 0x10]
movsx ecx, word [eax + 0x14]
push ecx
push 7
push 4
push 0x12
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov edx, dword [ebp + 0x10]
movsx eax, byte [edx]
movsx ecx, byte [0x42b2a8]
cmp eax, ecx
jne 0x40d6a8
mov edx, dword [ebp + 0x10]
movsx eax, byte [edx + 1]
movsx ecx, byte [0x42b2a9]
cmp eax, ecx
je 0x40d6de
mov edx, dword [ebp + 0x10]
movsx eax, byte [edx + 1]
push eax
mov ecx, dword [ebp + 0x10]
movsx edx, byte [ecx]
push edx
movsx eax, byte [0x42b2a9]
push eax
movsx ecx, byte [0x42b2a8]
push ecx
push 0x4389ac
push 0x13
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 0x14]
movsx ecx, word [ebp + 0xc]
cmp eax, ecx
je 0x40d719
push 0x4389ac
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 0x16]
push eax
mov ecx, dword [ebp + 0x10]
movsx edx, word [ecx + 0x14]
push edx
movsx eax, word [ebp + 0xc]
push eax
push 0x14
call fcn.00412a9b
add esp, 0x14
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov ecx, dword [ebp + 0x10]
mov edx, dword [ecx + 0xa]
cmp edx, dword [ebp - 8]
je 0x40d7b2
mov eax, dword [ebp + 0x10]
movsx ecx, word [eax + 8]
test ecx, ecx
je 0x40d765
mov edx, dword [ebp - 8]
push edx
mov eax, dword [ebp + 0x10]
mov ecx, dword [eax + 0xa]
push ecx
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 0x16]
push eax
mov ecx, dword [ebp + 0x10]
movsx edx, word [ecx + 0x14]
push edx
push 0x4389ac
push 0x16
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov dword [ebp - 0x124], 0x18
mov eax, dword [ebp + 0x10]
mov ecx, dword [eax + 0xa]
cmp ecx, dword [ebp - 0x124]
je 0x40d7b2
mov edx, dword [ebp + 0x10]
mov eax, dword [edx + 0xa]
push eax
mov ecx, dword [ebp - 0x124]
push ecx
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 0x16]
push eax
mov ecx, dword [ebp + 0x10]
movsx edx, word [ecx + 0x14]
push edx
push 0x4389ac
push 0x17
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov eax, dword [ebp + 0x10]
movsx ecx, word [eax + 8]
sub ecx, 1
imul ecx, ecx, 0x94
add ecx, 0xac
mov dword [ebp - 8], ecx
mov edx, dword [ebp + 0x10]
mov eax, dword [edx + 0xa]
cmp eax, dword [ebp - 8]
je 0x40d808
mov ecx, dword [ebp - 8]
push ecx
mov edx, dword [ebp + 0x10]
mov eax, dword [edx + 0xa]
push eax
mov ecx, dword [ebp + 0x10]
movsx edx, word [ecx + 0x16]
push edx
mov eax, dword [ebp + 0x10]
movsx ecx, word [eax + 0x14]
push ecx
push 0x4389ac
push 0x18
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov dword [ebp - 0x10], 6
push 0x4389ac
call fcn.00412999
add esp, 4
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0
je 0x40d82e
mov edx, dword [ebp - 0x10]
and edx, 0xfffffffb
mov dword [ebp - 0x10], edx
mov eax, dword [ebp - 0x14]
and eax, dword [ebp - 0x10]
mov ecx, dword [0x4316f8]
and ecx, dword [ebp - 0x10]
cmp eax, ecx
je 0x40d868
mov edx, dword [ebp - 0x14]
and edx, 6
push edx
mov eax, dword [0x4316f8]
and eax, 6
push eax
push 0x4389ac
push 0x15
call fcn.00412a9b
add esp, 0x10
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov ecx, dword [ebp + 0x10]
mov dx, word [ecx + 2]
and dx, 0x7fff
mov eax, dword [ebp + 0x10]
mov word [eax + 2], dx
mov ecx, dword [ebp - 4]
neg ecx
sbb ecx, ecx
and ecx, 0x8000
mov edx, dword [ebp + 0x10]
mov ax, word [edx + 2]
or ax, cx
mov ecx, dword [ebp + 0x10]
mov word [ecx + 2], ax
cmp dword [ebp + 0x18], 0
je 0x40da0b
cmp dword [ebp - 4], 0
je 0x40d8ba
mov edx, dword [ebp + 0x10]
cmp dword [edx + 4], 0x1b5de6b6
jne 0x40d8ba
jmp 0x40da0b
lea eax, [ebp - 0xc]
push eax
push 0x4389ac
call fcn.0040e25c
add esp, 8
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
je 0x40d8d9
jmp 0x40dc49
mov ecx, dword [ebp + 0x10]
mov edx, dword [ecx + 4]
cmp edx, dword [ebp - 0xc]
je 0x40da0b
cmp dword [ebp - 0xc], 0x1b5de6b6
je 0x40da0b
mov eax, dword [ebp + 0x10]
cmp dword [eax + 4], 0x1b5de6b6
je 0x40d9e9
cmp dword [ebp - 0xc], 0x1b5de6b6
je 0x40d9e9
mov ecx, dword [ebp + 0x10]
push ecx
call fcn.0040d0a0
add esp, 4
mov edx, dword [ebp + 0x10]
movsx eax, byte [edx + 0x48]
cmp eax, 1
jne 0x40d9dd
lea ecx, [ebp - 0x12c]
push ecx
lea edx, [ebp - 0x130]
push edx
call fcn.0040f2cc
add esp, 8
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
je 0x40d952
jmp 0x40dc49
mov eax, dword [ebp - 0x130]
and eax, 0xff
mov ecx, dword [ebp + 0x10]
movsx edx, byte [ecx + 0x49]
cmp eax, edx
jg 0x40d994
mov eax, dword [ebp - 0x130]
and eax, 0xff
mov ecx, dword [ebp + 0x10]
movsx edx, byte [ecx + 0x49]
cmp eax, edx
jne 0x40d9dd
mov eax, dword [ebp - 0x12c]
and eax, 0xff
mov ecx, dword [ebp + 0x10]
movsx edx, byte [ecx + 0x4a]
cmp eax, edx
jle 0x40d9dd
mov eax, dword [ebp + 0x10]
push eax
call fcn.0040d0a0
add esp, 4
push 0x4389ac
mov ecx, dword [ebp + 0x10]
movsx edx, byte [ecx + 0x4a]
push edx
mov eax, dword [ebp + 0x10]
movsx ecx, byte [eax + 0x49]
push ecx
mov edx, dword [ebp - 0x12c]
and edx, 0xff
push edx
mov eax, dword [ebp - 0x130]
and eax, 0xff
push eax
push 0x19
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40da0b
mov ecx, dword [ebp + 0x10]
push ecx
call fcn.0040d0a0
add esp, 4
mov edx, dword [ebp - 0xc]
push edx
mov eax, dword [ebp + 0x10]
mov ecx, dword [eax + 4]
push ecx
push 0x4389ac
push 0x1a
call fcn.00412a9b
add esp, 0x10
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 2]
and eax, 1
test eax, eax
jne 0x40dc49
mov ecx, dword [ebp + 0x10]
movsx edx, word [ecx + 0x14]
cmp edx, 2
jl 0x40dc49
movsx eax, byte [0x438ab0]
test eax, eax
je 0x40dc49
push 0x4389ac
call fcn.0040f32b
add esp, 4
cmp eax, 2
je 0x40dc49
push 0x438ab0
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
jne 0x40da7a
call fcn.00411a16
push eax
push 0x1b
call fcn.00412a9b
add esp, 8
mov dword [ebp - 0x18], eax
jmp 0x40dc49
push 0x438ab0
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
mov dword [ebp - 0x14], eax
cmp dword [ebp - 0x14], 0xffffffff
jne 0x40daab
push 0x438ab0
call fcn.00411a16
push eax
push 0x1c
call fcn.00412a9b
add esp, 0xc
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov ecx, dword [ebp - 0x14]
and ecx, 6
mov edx, dword [0x4316fc]
and edx, 6
cmp ecx, edx
je 0x40dae6
mov eax, dword [ebp - 0x14]
and eax, 6
push eax
mov ecx, dword [0x4316fc]
and ecx, 6
push ecx
push 0x438ab0
push 0x1d
call fcn.00412a9b
add esp, 0x10
mov dword [ebp - 0x18], eax
jmp 0x40dc49
push 0x20
push 0x8000
push 0x438ab0
call fcn.00415070
add esp, 0xc
mov dword [ebp - 0x128], eax
cmp dword [ebp - 0x128], 0xffffffff
jne 0x40db26
call fcn.00411a16
push eax
push 0x438ab0
push 0x1e
call fcn.00412a9b
add esp, 0xc
mov dword [ebp - 0x18], eax
jmp 0x40dc49
lea edx, [ebp - 8]
push edx
mov eax, dword [ebp - 0x128]
push eax
call fcn.004119c4
add esp, 8
cmp dword [ebp - 8], 0x104
je 0x40db81
mov ecx, dword [ebp - 0x128]
push ecx
call fcn.00414cb1
add esp, 4
mov edx, dword [ebp - 8]
push edx
push 0x104
mov eax, dword [ebp + 0x10]
movsx ecx, word [eax + 0x16]
push ecx
mov edx, dword [ebp + 0x10]
movsx eax, word [edx + 0x14]
push eax
push 0x438ab0
push 0x1f
call fcn.00412a9b
add esp, 0x18
mov dword [ebp - 0x18], eax
jmp 0x40dc49
push 0x104
lea ecx, [ebp - 0x120]
push ecx
mov edx, dword [ebp - 0x128]
push edx
call fcn.00414d91
add esp, 0xc
mov dword [ebp - 0x124], eax
cmp dword [ebp - 0x124], 0x104
je 0x40dc10
push 0x104
lea eax, [ebp - 0x120]
push eax
mov ecx, dword [ebp - 0x128]
push ecx
call fcn.00414d91
add esp, 0xc
mov dword [ebp - 0x124], eax
cmp dword [ebp - 0x124], 0x104
je 0x40dc10
mov edx, dword [ebp - 0x128]
push edx
call fcn.00414cb1
add esp, 4
mov eax, dword [ebp - 0x124]
push eax
push 0x104
call fcn.00411a16
push eax
push 0x438ab0
push 0x20
call fcn.00412a9b
add esp, 0x14
mov dword [ebp - 0x18], eax
jmp 0x40dc49
mov ecx, dword [ebp - 0x128]
push ecx
call fcn.00414cb1
add esp, 4
push 0x438ab0
lea edx, [ebp - 0x120]
push edx
call fcn.004120d6
add esp, 8
test eax, eax
jne 0x40dc49
push 0x438ab0
push 0x21
call fcn.00412a9b
add esp, 8
mov dword [ebp - 0x18], eax
cmp dword [ebp - 0x18], 0
je 0x40dc66
mov eax, dword [ebp + 0x14]
mov ecx, dword [eax]
push ecx
call fcn.00414cb1
add esp, 4
mov edx, dword [ebp + 0x14]
mov dword [edx], 0xffffffff
mov eax, dword [ebp - 0x1c]
push eax
call fcn.00412286
add esp, 4
mov eax, dword [ebp - 0x18]
mov esp, ebp
pop ebp
ret