Function at 0x403640
Capabilities:
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x274
mov eax, dword [0x41caf8]
xor eax, esp
mov dword [esp + 0x270], eax
push ebx
push ebp
push esi
mov esi, dword [esp + 0x284]
lea eax, [esp + 0x1c]
push edi
push 0x58
push 0
push eax
call sub.VCRUNTIME140.dll_memset
push esi
call dword [sym.imp.lua54.dll_lua_gettop]
add esp, 0x10
mov dword [esp + 0x18], 0
mov edi, eax
xor ebp, ebp
call dword [sym.imp.USER32.dll_GetFocus]
lea ecx, [esp + 0x78]
mov dword [esp + 0x1c], eax
mov dword [esp + 0x3c], ecx
xor ecx, ecx
mov dword [esp + 0x20], 0x58
mov word [esp + 0x78], cx
mov dword [esp + 0x24], eax
mov dword [esp + 0x40], 0x208
test edi, edi
je 0x403752
mov ebx, dword [sym.imp.lua54.dll_lua_tolwstring]
push ecx
push 1
push esi
call ebx
add esp, 0xc
mov dword [esp + 0x50], eax
cmp edi, 1
jle 0x403752
push 2
push esi
call dword [sym.imp.lua54.dll_lua_toboolean]
add esp, 8
mov ebp, eax
cmp edi, 2
jle 0x403752
push 0
push 3
push esi
call dword [sym.imp.lua54.dll_luaL_checklstring]
push 3
push esi
call dword [sym.imp.lua54.dll_lua_pushvalue]
push 0x416a98
push esi
call dword [sym.imp.lua54.dll_lua_pushstring]
push 2
push esi
call dword [sym.imp.lua54.dll_lua_concat]
lea eax, [esp + 0x38]
push eax
push 0xffffffffffffffff
push esi
call ebx
mov edx, dword [esp + 0x44]
add esp, 0x30
mov ebx, eax
xor ecx, ecx
mov dword [esp + 0x18], ebx
test edx, edx
jle 0x403746
nop dword [eax]
cmp word [ebx + ecx*2], 0x7c
jne 0x403741
xor eax, eax
mov word [ebx + ecx*2], ax
mov edx, dword [esp + 0x14]
inc ecx
cmp ecx, edx
jl 0x403730
mov dword [esp + 0x2c], ebx
mov dword [esp + 0x38], 1
mov eax, dword [esp + 0x290]
mov dword [esp + 0x4c], 0
mov dword [esp + 0x64], 0x4034f0
test ebp, ebp
je 0x403772
or eax, 0x200
mov dword [esp + 0x54], eax
xor eax, eax
cmp dword [0x41ce1c], eax
sete al
test dword [0x41ce24], eax
je 0x403793
push 0
call fcn.004132e0
add esp, 4
cmp dword [esp + 0x28c], 0
lea eax, [esp + 0x20]
push eax
je 0x4037aa
call dword [sym.imp.COMDLG32.dll_GetSaveFileNameW]
jmp 0x4037b0
call dword [sym.imp.COMDLG32.dll_GetOpenFileNameW]
mov dword [esp + 0x10], eax
test eax, eax
je 0x403963
test ebp, ebp
je 0x403884
movzx eax, word [esp + 0x58]
cmp word [esp + eax*2 + 0x76], 0
jne 0x403884
mov edx, dword [esp + 0x3c]
mov ecx, edx
lea edi, [ecx + 2]
nop
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4037e0
sub ecx, edi
xor ebx, ebx
sar ecx, 1
lea edi, [edx + 2]
mov dword [esp + 0x10], ebx
cmp word [edi + ecx*2], bx
lea edi, [edi + ecx*2]
je 0x403971
mov ebx, dword [sym.imp.lua54.dll_lua_pushlwstring]
mov ebp, dword [sym.imp.lua54.dll_lua_pushnewinstance]
push 0xffffffffffffffff
push edx
push esi
call ebx
push 1
push 0x416a9c
push esi
call ebx
push 0xffffffffffffffff
push edi
push esi
call ebx
push 3
push esi
call dword [sym.imp.lua54.dll_lua_concat]
push 1
push str.File
push esi
call ebp
push 0xffffffffffffffff
push 0xfffffffffffffffe
push esi
call dword [sym.imp.lua54.dll_lua_rotate]
add esp, 0x44
push 0xfffffffffffffffe
push esi
call dword [sym.imp.lua54.dll_lua_settop]
mov ecx, edi
add esp, 8
inc dword [esp + 0x10]
lea edx, [ecx + 2]
nop dword [eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x403860
sub ecx, edx
sar ecx, 1
lea edi, [edi + ecx*2]
add edi, 2
cmp word [edi], ax
je 0x40396d
mov edx, dword [esp + 0x3c]
jmp 0x403811
mov ebx, dword [sym.imp.lua54.dll_lua_pushlwstring]
lea eax, [esp + 0x78]
push 0xffffffffffffffff
push eax
push esi
call ebx
add esp, 0xc
cmp dword [esp + 0x38], 0
je 0x403950
lea eax, [esp + 0x78]
push 0x2e
push eax
call sub.VCRUNTIME140.dll_wcschr
add esp, 8
test eax, eax
jne 0x403950
mov eax, dword [esp + 0x38]
xor edx, edx
mov ebp, dword [esp + 0x2c]
add eax, eax
cmp eax, 1
jbe 0x4038fd
lea edi, [eax - 1]
nop dword [eax]
lea ecx, [edx*2]
add ecx, ebp
lea ebx, [ecx + 2]
nop dword [eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4038e0
sub ecx, ebx
inc edx
sar ecx, 1
add edx, ecx
sub edi, 1
jne 0x4038d0
mov ebx, dword [sym.imp.lua54.dll_lua_pushlwstring]
cmp word [ebp + edx*2 + 4], 0x2a
je 0x403950
lea edi, [ebp + 2]
lea edi, [edi + edx*2]
push 0x416aa8
push edi
call sub.VCRUNTIME140.dll_wcsstr
mov ecx, eax
add esp, 8
test ecx, ecx
je 0x403923
sub ecx, edi
jmp 0x40393d
mov ecx, edi
lea edx, [ecx + 2]
nop dword [eax + eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x403930
sub ecx, edx
sar ecx, 1
push ecx
push edi
push esi
call ebx
push 2
push esi
call dword [sym.imp.lua54.dll_lua_concat]
add esp, 0x14
push 1
push str.File
push esi
call dword [sym.imp.lua54.dll_lua_pushnewinstance]
add esp, 0xc
jmp 0x40396d
push esi
call dword [sym.imp.lua54.dll_lua_pushnil]
add esp, 4
mov ebx, dword [esp + 0x10]
push dword [0x41ce24]
call fcn.004132e0
push dword [esp + 0x54]
mov esi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
call esi
push dword [esp + 0x20]
call esi
add esp, 0xc
push dword [esp + 0x1c]
call dword [sym.imp.USER32.dll_SetFocus]
mov ecx, dword [esp + 0x280]
mov eax, ebx
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00414d65
add esp, 0x274
ret