Function at 0x401040
Capabilities:
Link many functions at runtime

Disassembly:
sub esp, 0x418
mov eax, dword [0x415060]
xor eax, esp
mov dword [esp + 0x414], eax
push ebx
mov ebx, dword [esp + 0x420]
cmp dword [ebx], 0
push ebp
mov ebp, dword [esp + 0x428]
je 0x401082
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x414]
xor ecx, esp
call fcn.00406a2d
add esp, 0x418
ret
push 0x400
lea eax, [esp + 0x20]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
push eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea ecx, [esp + 0x1c]
push 0x5c
push ecx
call fcn.00406a00
add esp, 8
test eax, eax
je 0x4010b3
add eax, 1
jmp 0x4010b7
lea eax, [esp + 0x1c]
mov byte [eax], 0
mov eax, 0x412308
mov edx, eax
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x4010c1
push esi
push edi
lea edi, [esp + 0x24]
sub eax, edx
add edi, 0xffffffff
mov cl, byte [edi + 1]
add edi, 1
test cl, cl
jne 0x4010d5
mov ecx, eax
shr ecx, 2
mov esi, edx
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
lea edx, [esp + 0x24]
rep movsb byte es:[edi], byte [esi]
mov esi, dword [sym.imp.KERNEL32.dll_LoadLibraryA]
push edx
call esi
cmp eax, 0x20
mov dword [ebx], eax
jae 0x401181
lea eax, [esp + 0x10]
push eax
lea ecx, [esp + 0x28]
push ecx
push str.GS_DLL
mov dword [esp + 0x1c], 0x400
call fcn.00406460
add esp, 0xc
test eax, eax
jne 0x40112f
lea edx, [esp + 0x24]
push edx
call esi
mov dword [ebx], eax
cmp dword [ebx], 0x20
jae 0x401181
push 0x412308
call esi
cmp eax, 0x20
mov dword [ebx], eax
jae 0x401181
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esp + 0x28]
push str.Cant_load_DLL__LoadLibrary_error_code__ld
push eax
call fcn.00406984
mov ecx, dword [esp + 0x440]
add ecx, 0xffffffff
push ecx
lea edx, [esp + 0x34]
push edx
push ebp
call fcn.00406860
add esp, 0x18
mov dword [ebx], 0
mov eax, 1
jmp 0x401451
mov eax, dword [ebx]
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str.gsapi_revision
push eax
call esi
test eax, eax
mov dword [ebx + 4], eax
jne 0x4011c1
mov ecx, dword [esp + 0x434]
add ecx, 0xffffffff
push ecx
push str.Cant_find_gsapi_revision_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
push 0x10
lea edx, [esp + 0x18]
push edx
call eax
test eax, eax
je 0x401206
lea eax, [esp + 0x24]
push str.Unable_to_identify_Ghostscript_DLL_revision___it_must_be_newer_than_needed._n
push eax
call fcn.00406984
mov ecx, dword [esp + 0x43c]
add ecx, 0xffffffff
push ecx
lea edx, [esp + 0x30]
push edx
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x18
mov eax, 1
jmp 0x401451
mov eax, dword [esp + 0x1c]
mov ecx, dword [0x412998]
cmp eax, ecx
je 0x40124e
push ecx
push eax
lea eax, [esp + 0x2c]
push str.Wrong_version_of_DLL_found._n__Found_version__ld_n__Need_version___ld_n
push eax
call fcn.00406984
mov ecx, dword [esp + 0x444]
add ecx, 0xffffffff
push ecx
lea edx, [esp + 0x38]
push edx
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x20
mov eax, 1
jmp 0x401451
mov eax, dword [ebx]
push str.gsapi_new_instance
push eax
call esi
test eax, eax
mov dword [ebx + 8], eax
jne 0x401288
mov ecx, dword [esp + 0x434]
add ecx, 0xffffffff
push ecx
push str.Cant_find_gsapi_new_instance_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov edx, dword [ebx]
push str.gsapi_delete_instance
push edx
call esi
test eax, eax
mov dword [ebx + 0xc], eax
jne 0x4012c2
mov eax, dword [esp + 0x434]
add eax, 0xffffffff
push eax
push str.Cant_find_gsapi_delete_instance_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov ecx, dword [ebx]
push str.gsapi_set_stdio
push ecx
call esi
test eax, eax
mov dword [ebx + 0x10], eax
jne 0x4012fc
mov edx, dword [esp + 0x434]
add edx, 0xffffffff
push edx
push str.Cant_find_gsapi_set_stdio_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov eax, dword [ebx]
push str.gsapi_set_poll
push eax
call esi
test eax, eax
mov dword [ebx + 0x14], eax
jne 0x401336
mov ecx, dword [esp + 0x434]
add ecx, 0xffffffff
push ecx
push str.Cant_find_gsapi_set_poll_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov edx, dword [ebx]
push str.gsapi_set_display_callback
push edx
call esi
test eax, eax
mov dword [ebx + 0x18], eax
jne 0x401370
mov eax, dword [esp + 0x434]
add eax, 0xffffffff
push eax
push str.Cant_find_gsapi_set_display_callback_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov ecx, dword [ebx]
push str.gsapi_init_with_args
push ecx
call esi
test eax, eax
mov dword [ebx + 0x1c], eax
jne 0x4013aa
mov edx, dword [esp + 0x434]
add edx, 0xffffffff
push edx
push str.Cant_find_gsapi_init_with_args_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov eax, dword [ebx]
push str.gsapi_run_string
push eax
call esi
test eax, eax
mov dword [ebx + 0x20], eax
jne 0x4013e1
mov ecx, dword [esp + 0x434]
add ecx, 0xffffffff
push ecx
push str.Cant_find_gsapi_run_string_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov edx, dword [ebx]
push str.gsapi_exit
push edx
call esi
test eax, eax
mov dword [ebx + 0x24], eax
jne 0x401418
mov eax, dword [esp + 0x434]
add eax, 0xffffffff
push eax
push str.Cant_find_gsapi_exit_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
mov ecx, dword [ebx]
push str.gsapi_set_visual_tracer
push ecx
call esi
test eax, eax
mov dword [ebx + 0x28], eax
jne 0x40144f
mov edx, dword [esp + 0x434]
add edx, 0xffffffff
push edx
push str.Cant_find_gsapi_set_visual_tracer_n
push ebp
call fcn.00406860
push ebx
call fcn.00401000
add esp, 0x10
mov eax, 1
jmp 0x401451
xor eax, eax
mov ecx, dword [esp + 0x424]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00406a2d
add esp, 0x418
ret