Function at 0x401320
Capabilities:
Check if file exists
Create directory
Get file attributes
Read file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x85c
mov eax, dword [section..data]
xor eax, esp
mov dword [esp + 0x858], eax
push ebx
push esi
mov esi, ecx
mov dword [esp + 0x18], 0x54534449
push edi
push esi
push str.MDL:__s_n
mov dword [esp + 0x1c], esi
mov dword [esp + 0x28], 0x51534449
call fcn.00401070
add esp, 8
test esi, esi
je 0x4013ad
mov ebx, esi
lea ecx, [ebx + 1]
nop word [eax + eax]
mov al, byte [ebx]
inc ebx
test al, al
jne 0x401370
sub ebx, ecx
cmp ebx, 0x3fd
jbe 0x4013af
push 2
call fcn.00416fcb
push eax
push str.ERROR:_Source_path_is_too_long._n
call fcn.00431875
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x858]
xor ecx, esp
call fcn.0040b758
mov esp, ebp
pop ebp
ret
xor ebx, ebx
push 0x2f
push esi
call fcn.0040cb20
push 0x5c
push esi
mov edi, eax
call fcn.0040cb20
add esp, 0x10
test edi, edi
je 0x4013cc
cmp edi, eax
jae 0x4013ce
mov edi, eax
push 0x3a
push esi
call fcn.0040cb20
add esp, 8
test edi, edi
je 0x4013e1
cmp edi, eax
jae 0x4013e3
mov edi, eax
push 0x2e
push esi
call fcn.0040cb20
add esp, 8
test eax, eax
je 0x40142e
test edi, edi
je 0x4013fa
cmp eax, edi
jb 0x40142e
add eax, 1
jne 0x401433
push str.ERROR:_Source_file_does_not_have_extension._n
push 2
call fcn.00416fcb
add esp, 4
push eax
call fcn.00401040
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x858]
xor ecx, esp
call fcn.0040b758
mov esp, ebp
pop ebp
ret
mov eax, 0x46c6b1
mov ecx, 0x46b90c
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x401458
test dl, dl
je 0x401454
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x401458
add eax, 2
add ecx, 2
test dl, dl
jne 0x401438
xor eax, eax
jmp 0x40145d
sbb eax, eax
or eax, 1
test eax, eax
je 0x401468
push str.ERROR:_Only_.mdl_files_is_supported._n
jmp 0x401404
mov ecx, esi
call fcn.00405850
mov ecx, eax
mov dword [0x474940], ecx
test ecx, ecx
jne 0x4014ab
push esi
push str.ERROR:_Cant_open__s_n
push 2
call fcn.00416fcb
add esp, 4
push eax
call fcn.00401040
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x858]
xor ecx, esp
call fcn.0040b758
mov esp, ebp
pop ebp
ret
mov eax, dword [ecx]
lea edx, [esp + 0x1c]
cmp eax, dword [edx]
je 0x4014f0
lea edx, [esp + 0x20]
mov edi, str.ERROR:__s_is_not_a_main_HL_model_file._n
cmp eax, dword [edx]
je 0x4014c7
mov edi, str.ERROR:__s_is_not_a_valid_HL_model_file._n
push 2
call fcn.00416fcb
push esi
push edi
push eax
call fcn.00401040
add esp, 0x10
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x858]
xor ecx, esp
call fcn.0040b758
mov esp, ebp
pop ebp
ret
cmp dword [ecx + 4], 0xa
je 0x4014fe
push esi
push str.ERROR:__s_has_unknown_Studio_MDL_format_version._n
jmp 0x401481
cmp dword [ecx + 0xcc], 0
jne 0x401512
push esi
push str.ERROR:__s_is_not_a_main_HL_model_file._n
jmp 0x401481
cmp byte [0x474140], 0
je 0x401592
push 0x474140
call fcn.00432f65
add esp, 4
cmp eax, 0xffffffff
jne 0x401567
call fcn.00432c2d
cmp dword [eax], 0x11
jne 0x401558
push 0x474140
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
je 0x401552
test al, 0x10
je 0x401552
mov eax, 1
jmp 0x401554
xor eax, eax
test eax, eax
jne 0x401567
push 0x474140
push str.ERROR:_Couldnt_create_directory__s_n
jmp 0x401481
mov ecx, 0x474140
lea edx, [ecx + 1]
nop
mov al, byte [ecx]
inc ecx
test al, al
jne 0x401570
sub ecx, edx
mov al, byte [ecx + 0x47413f]
cmp al, 0x5c
je 0x4015f7
cmp al, 0x2f
je 0x4015f7
mov word [ecx + 0x474140], 0x2f
jmp 0x4015f7
test esi, esi
je 0x4015b4
mov ecx, esi
lea edx, [ecx + 1]
nop dword [eax + eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x4015a0
sub ecx, edx
lea edi, [esi - 1]
add edi, ecx
cmp edi, esi
je 0x4015d6
jmp 0x4015b7
lea edi, [esi - 1]
mov cl, byte [edi - 1]
cmp cl, 0x5c
je 0x4015df
cmp cl, 0x2f
je 0x4015d2
dec edi
cmp edi, esi
jne 0x4015b7
mov byte [0x474140], 0
jmp 0x4015f7
cmp edi, esi
jne 0x4015df
mov byte [0x474140], 0
jmp 0x4015f7
sub edi, esi
push edi
push esi
push 0x474140
call fcn.004151e0
add esp, 0xc
mov byte [edi + 0x47413f], 0
mov eax, dword [0x474940]
sub ebx, 4
mov dword [esp + 0x10], ebx
cmp dword [eax + 0xb4], 0
jne 0x4016ef
test esi, esi
je 0x40165c
mov ecx, esi
lea edx, [ecx + 1]
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x401620
sub ecx, edx
inc ecx
cmp ecx, 0x400
jbe 0x40164d
mov ecx, 0xff
lea edi, [esp + 0x60]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
movsb byte es:[edi], byte [esi]
mov esi, dword [esp + 0x14]
mov byte [esp + 0x45f], al
jmp 0x40165c
push ecx
lea eax, [esp + 0x64]
push esi
push eax
call fcn.004151e0
add esp, 0xc
mov edi, 0x400
sub edi, ebx
lea ebx, [esp + ebx + 0x60]
mov dword [esp + 0x18], edi
test ebx, ebx
je 0x4016a2
test edi, edi
je 0x4016a2
cmp edi, 6
jae 0x401691
lea eax, [edi - 1]
push eax
push str.t.mdl
push ebx
call fcn.004151e0
add esp, 0xc
mov byte [ebx + edi - 1], 0
jmp 0x4016a2
mov eax, dword [str.t.mdl]
mov dword [ebx], eax
mov ax, word [0x46ba04]
mov word [ebx + 4], ax
lea ecx, [esp + 0x60]
call fcn.00405850
mov ecx, eax
mov dword [0x474124], ecx
test ecx, ecx
jne 0x4016c6
lea eax, [esp + 0x60]
push eax
push str.ERROR:_Cant_open_external_textures_file__s_n
jmp 0x401481
mov eax, dword [ecx]
lea edx, [esp + 0x1c]
cmp eax, dword [edx]
jne 0x4016e0
cmp dword [ecx + 0xb4], 0
je 0x4016e0
mov eax, dword [0x474940]
jmp 0x4016ff
lea eax, [esp + 0x60]
push eax
push str.ERROR:__s_is_not_a_valid_external_textures_file._n
jmp 0x401481
mov ecx, 0x400
mov dword [0x474124], eax
sub ecx, ebx
mov dword [esp + 0x18], ecx
mov eax, dword [eax + 0xac]
shl eax, 2
push eax
call fcn.004318a9
add esp, 4
mov dword [0x474128], eax
test eax, eax
jne 0x401731
push 2
call fcn.00416fcb
push eax
push str.ERROR:_Couldnt_allocate_memory_for_sequences._n
call fcn.00431875
jmp 0x401491
mov ebx, dword [0x474940]
mov dword [eax], ebx
cmp dword [ebx + 0xac], 1
jle 0x4018b3
test esi, esi
je 0x401792
mov ecx, esi
lea edx, [ecx + 1]
nop
mov al, byte [ecx]
inc ecx
test al, al
jne 0x401750
sub ecx, edx
inc ecx
cmp ecx, 0x400
jbe 0x401780
mov ecx, 0xff
lea edi, [esp + 0x460]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
movsb byte es:[edi], byte [esi]
mov esi, dword [esp + 0x14]
mov byte [esp + 0x85f], al
jmp 0x401792
push ecx
lea eax, [esp + 0x464]
push esi
push eax
call fcn.004151e0
add esp, 0xc
mov edi, 1
cmp dword [ebx + 0xac], edi
jle 0x4018b3
mov eax, dword [esp + 0x10]
lea eax, [esp + eax + 0x460]
mov dword [esp + 0x14], eax
push edi
push str._02d.mdl
push dword [esp + 0x20]
push eax
call fcn.00406560
lea eax, [esp + 0x470]
push 0x46c624
push eax
call fcn.00431b72
mov ebx, eax
lea ecx, [edi*4]
add esp, 0x18
mov dword [esp + 0x24], ecx
test ebx, ebx
je 0x401895
push ebx
call fcn.0043b8f5
lea ecx, [esp + 0x34]
push ecx
push eax
call fcn.00435074
mov eax, dword [esp + 0x50]
push eax
mov dword [esp + 0x20], eax
call fcn.004318a9
add esp, 0x10
mov dword [esp + 0x2c], eax
test eax, eax
je 0x401873
push ebx
push 1
push dword [esp + 0x18]
push eax
call fcn.004331db
push ebx
call fcn.00431d31
mov eax, dword [0x474128]
lea edx, [edi*4]
mov ecx, dword [esp + 0x40]
add esp, 0x14
mov dword [edx + eax], ecx
lea edx, [esp + 0x20]
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x401861
mov ebx, dword [0x474940]
inc edi
cmp edi, dword [ebx + 0xac]
jge 0x4018b3
mov eax, dword [esp + 0x14]
jmp 0x4017b2
lea eax, [esp + 0x460]
push eax
push str.ERROR:__s_is_not_a_valid_sequence_file._n
jmp 0x401481
mov eax, dword [0x474128]
mov edx, dword [esp + 0x24]
mov dword [edx + eax], 0
lea eax, [esp + 0x460]
push eax
push str.ERROR:_Cant_open_sequence_file__s_n
jmp 0x401481
mov eax, dword [0x474128]
mov dword [ecx + eax], 0
lea eax, [esp + 0x460]
push eax
push str.ERROR:_Cant_open_sequence_file__s_n
jmp 0x401481
push 0x400
mov edx, 0x474540
mov ecx, esi
call fcn.00406790
xor eax, eax
add esp, 4
mov dword [esp + 0x2c], eax
mov dword [esp + 0x14], eax
cmp dword [ebx + 0xa4], eax
jle 0x401a00
xor edx, edx
mov dword [esp + 0x10], edx
mov edi, dword [ebx + 0xa8]
xor ecx, ecx
add edi, edx
mov dword [esp + 0x24], ecx
add edi, ebx
mov edx, 1
mov dword [esp + 0x28], edx
cmp dword [ebx + 0xa4], ecx
jle 0x4019c6
xor eax, eax
mov dword [esp + 0x18], eax
nop
mov esi, dword [ebx + 0xa8]
add esi, eax
add esi, ebx
cmp ecx, dword [esp + 0x14]
je 0x401973
test esi, esi
jne 0x40192c
mov eax, edi
neg eax
sbb eax, eax
jmp 0x40194a
test edi, edi
je 0x401973
push 0x20
push edi
push esi
call fcn.004315c0
mov ebx, dword [0x474940]
add esp, 0xc
mov ecx, dword [esp + 0x24]
mov edx, dword [esp + 0x28]
test eax, eax
jne 0x40196f
inc edx
push edx
push esi
push 0x46b7f0
push 0x20
push esi
mov dword [esp + 0x3c], edx
call fcn.00406560
mov ebx, dword [0x474940]
add esp, 0x14
mov ecx, dword [esp + 0x24]
mov eax, dword [esp + 0x18]
mov edx, dword [esp + 0x28]
inc ecx
add eax, 0xb0
mov dword [esp + 0x24], ecx
mov dword [esp + 0x18], eax
cmp ecx, dword [ebx + 0xa4]
jl 0x401910
mov eax, edx
cmp eax, 1
jle 0x4019c2
push eax
push edi
push str.WARNING:_Sequence_name___s__is_repeated__i_times._n
call fcn.00401070
push edi
push str._s_1
push 0x20
push edi
call fcn.00406560
mov ebx, dword [0x474940]
mov eax, 1
add esp, 0x1c
mov dword [esp + 0x2c], eax
jmp 0x4019c6
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x14]
mov edx, dword [esp + 0x10]
inc ecx
add edx, 0xb0
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], edx
cmp ecx, dword [ebx + 0xa4]
jl 0x4018e3
test eax, eax
je 0x401a00
push str.WARNING:_Added_numeric_suffix_to_repeated_sequence_name_s_.
call fcn.004174e1
mov ebx, dword [0x474940]
add esp, 4
xor esi, esi
xor edi, edi
cmp dword [ebx + 0x8c], esi
jle 0x401a5f
xor ecx, ecx
mov dword [esp + 0x10], ecx
mov eax, dword [ebx + 0x90]
add eax, ecx
add eax, ebx
cmp byte [eax], 0
jne 0x401a3d
inc esi
push esi
push str.MDLDEC_Bone_i
push 0x20
push eax
call fcn.00406560
mov ebx, dword [0x474940]
add esp, 0x10
mov ecx, dword [esp + 0x10]
inc edi
add ecx, 0x70
mov dword [esp + 0x10], ecx
cmp edi, dword [ebx + 0x8c]
jl 0x401a12
test esi, esi
je 0x401a5f
push esi
push str.WARNING:_Gived_name_to__i_unnamed_bone_s_._n
call fcn.00401070
add esp, 8
mov ecx, dword [esp + 0x864]
mov eax, 1
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.0040b758
mov esp, ebp
pop ebp
ret