Function at 0x404761
Capabilities:
Move file

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x58
nop
mov eax, 0
mov dword [ebp - 0x50], eax
mov eax, 0x407b04
push eax
call sub.msvcrt.dll__unlink
add esp, 4
mov eax, 0x407b0c
push eax
mov eax, dword [ebp + 8]
push eax
call sub.msvcrt.dll_fopen
add esp, 8
mov dword [ebp - 4], eax
mov eax, dword [ebp - 4]
cmp eax, 0
je 0x4047a7
jmp 0x4047d5
mov eax, dword [ebp + 8]
push eax
mov eax, str.ERROR:_Cant_open__s_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
push eax
call sub.msvcrt.dll_fflush
add esp, 4
mov eax, 1
jmp 0x404ff5
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, 8
jge 0x404816
jmp 0x4047f9
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x4047dd
mov eax, dword [ebp - 0x14]
lea ecx, [ebp - 0x10]
add ecx, eax
push ecx
mov eax, 0x407b25
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
jmp 0x4047ee
mov eax, 0
mov byte [ebp - 8], al
mov eax, 8
push eax
mov eax, 0x407b28
push eax
lea eax, [ebp - 0x10]
push eax
call sub.msvcrt.dll_strncmp
add esp, 0xc
cmp eax, 0
je 0x404883
mov eax, str.ERROR:_Not_a_PS_X_EXE_file_n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
push eax
call sub.msvcrt.dll_fflush
add esp, 4
mov eax, dword [ebp + 8]
push eax
call sub.msvcrt.dll__unlink
add esp, 4
mov eax, str.COMBINE.TMP
push eax
call sub.msvcrt.dll__unlink
add esp, 4
mov eax, 1
jmp 0x404ff5
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, 0xc
jge 0x404923
jmp 0x4048a7
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x40488b
lea eax, [ebp - 0x10]
push eax
mov eax, 0x407b59
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
lea eax, [ebp - 0xf]
push eax
mov eax, 0x407b5c
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
lea eax, [ebp - 0xe]
push eax
mov eax, 0x407b5f
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
lea eax, [ebp - 0xd]
push eax
mov eax, 0x407b62
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
mov eax, dword [ebp - 0x14]
shl eax, 2
lea ecx, [ebp - 0x44]
add ecx, eax
lea eax, [ebp - 0x10]
push eax
mov dword [ebp - 0x54], ecx
call fcn.004046e8
add esp, 4
mov ecx, dword [ebp - 0x54]
mov dword [ecx], eax
jmp 0x40489c
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404a18
mov eax, str.id_tPS_X_EXE_n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [ebp - 0x44]
push eax
mov eax, str.text_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x40]
push eax
mov eax, str.data_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x3c]
push eax
mov eax, str.pc0_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x38]
push eax
mov eax, str.gp0_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x34]
push eax
mov eax, str.t_addr_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x30]
push eax
mov eax, str.t_size_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x2c]
push eax
mov eax, str.d_addr_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x28]
push eax
mov eax, str.d_size_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x24]
push eax
mov eax, str.b_addr_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x20]
push eax
mov eax, str.b_size_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x1c]
push eax
mov eax, str.s_addr_t0x_.8x_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x18]
push eax
mov eax, str.s_size_t0x_.8x_n_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, 2
push eax
mov eax, 0
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fseek
add esp, 0xc
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_ftell
add esp, 4
sub eax, 0x800
mov dword [ebp - 0x48], eax
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404a66
mov eax, dword [ebp - 0x48]
push eax
mov eax, str.sizeEXEC_t__d_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x48]
mov ecx, 0x800
xor edx, edx
div ecx
mov eax, 0x800
sub eax, edx
mov dword [ebp - 0x4c], eax
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404a9d
mov eax, dword [ebp - 0x4c]
push eax
mov eax, str.padsizeEXE_t__d_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x4c]
cmp eax, 0x800
je 0x404c5f
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404ac9
mov eax, str.Creating_psx.exe:_Fixing_EXE_size_to_a_multiple_of_2048__n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, 0x407c7d
push eax
mov eax, 0x407c75
push eax
call sub.msvcrt.dll_fopen
add esp, 8
mov dword [ebp - 8], eax
mov eax, dword [ebp - 8]
cmp eax, 0
je 0x404af1
jmp 0x404b09
mov eax, str.ERROR_in_padsizeEXE:_Cant_open_psx.exe
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, 1
jmp 0x404ff5
mov eax, dword [ebp - 0x48]
mov ecx, dword [ebp - 0x4c]
add eax, ecx
mov dword [ebp - 0x30], eax
mov eax, 0x407ca8
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 8
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, 0xc
jge 0x404b8c
jmp 0x404b4a
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x404b2e
mov eax, dword [ebp - 0x14]
shl eax, 2
lea ecx, [ebp - 0x44]
add ecx, eax
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ecx]
push eax
call fcn.00404724
add esp, 8
movzx eax, byte [ebp - 0xd]
push eax
movzx eax, byte [ebp - 0xe]
push eax
movzx eax, byte [ebp - 0xf]
push eax
movzx eax, byte [ebp - 0x10]
push eax
mov eax, 0x407cb1
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0x18
jmp 0x404b3f
mov eax, 0
push eax
mov eax, 0x38
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fseek
add esp, 0xc
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x48]
add eax, 0x7c8
mov ecx, dword [ebp - 0x14]
cmp ecx, eax
jae 0x404bff
jmp 0x404bd0
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x404bac
lea eax, [ebp - 0x10]
push eax
mov eax, 0x407cba
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
movzx eax, byte [ebp - 0x10]
push eax
mov eax, 0x407cbd
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
jmp 0x404bc5
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x4c]
cmp eax, ecx
jae 0x404c3f
jmp 0x404c25
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x404c07
mov eax, 0
push eax
mov eax, 0x407cc0
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
jmp 0x404c1a
mov eax, dword [ebp - 0x30]
mov dword [ebp - 0x48], eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fclose
add esp, 4
mov eax, dword [ebp - 0x50]
mov ecx, eax
inc eax
mov dword [ebp - 0x50], eax
jmp 0x404c7c
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404c7c
mov eax, str.padsizeEXE_already_2048__n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [ebp - 0x48]
mov ecx, dword [ebp - 0x30]
cmp eax, ecx
je 0x404ebe
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404ccb
mov eax, str.2_Fixing:_EXE_header_t_size_does_not_match_filesize_2048_n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [ebp - 0x30]
push eax
mov eax, str.EXE_header:_t_0x_.8x_bytes_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x48]
push eax
mov eax, str.filesize_2048:_t_0x_.8x_bytes_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, 0x407d58
push eax
mov eax, 0x407d50
push eax
call sub.msvcrt.dll_fopen
add esp, 8
mov dword [ebp - 8], eax
mov eax, dword [ebp - 8]
cmp eax, 0
je 0x404cf3
jmp 0x404d1d
mov eax, str.ERROR_in_sizeEXEC:_Cant_open_psx.exe
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
push eax
call sub.msvcrt.dll_fflush
add esp, 4
mov eax, 1
jmp 0x404ff5
mov eax, 0x407d81
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 8
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, 5
jge 0x404d95
jmp 0x404d53
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x404d37
mov eax, dword [ebp - 0x14]
shl eax, 2
lea ecx, [ebp - 0x44]
add ecx, eax
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ecx]
push eax
call fcn.00404724
add esp, 8
movzx eax, byte [ebp - 0xd]
push eax
movzx eax, byte [ebp - 0xe]
push eax
movzx eax, byte [ebp - 0xf]
push eax
movzx eax, byte [ebp - 0x10]
push eax
mov eax, 0x407d8a
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0x18
jmp 0x404d48
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ebp - 0x48]
push eax
call fcn.00404724
add esp, 8
movzx eax, byte [ebp - 0xd]
push eax
movzx eax, byte [ebp - 0xe]
push eax
movzx eax, byte [ebp - 0xf]
push eax
movzx eax, byte [ebp - 0x10]
push eax
mov eax, 0x407d93
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0x18
mov eax, 6
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x14]
cmp eax, 0xc
jge 0x404e31
jmp 0x404def
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x404dd3
mov eax, dword [ebp - 0x14]
shl eax, 2
lea ecx, [ebp - 0x44]
add ecx, eax
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ecx]
push eax
call fcn.00404724
add esp, 8
movzx eax, byte [ebp - 0xd]
push eax
movzx eax, byte [ebp - 0xe]
push eax
movzx eax, byte [ebp - 0xf]
push eax
movzx eax, byte [ebp - 0x10]
push eax
mov eax, str._c_c_c_c
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0x18
jmp 0x404de4
mov eax, 0
push eax
mov eax, 0x38
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fseek
add esp, 0xc
mov eax, 0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x48]
add eax, 0x7c8
mov ecx, dword [ebp - 0x14]
cmp ecx, eax
jae 0x404ea4
jmp 0x404e75
mov eax, dword [ebp - 0x14]
mov ecx, eax
inc eax
mov dword [ebp - 0x14], eax
jmp 0x404e51
lea eax, [ebp - 0x10]
push eax
mov eax, 0x407da5
push eax
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fscanf
add esp, 0xc
movzx eax, byte [ebp - 0x10]
push eax
mov eax, 0x407da8
push eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
jmp 0x404e6a
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_fclose
add esp, 4
mov eax, dword [ebp - 0x50]
mov ecx, eax
inc eax
mov dword [ebp - 0x50], eax
jmp 0x404edb
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404edb
mov eax, str.sizeEXEC_already_equal_to_headerDATA_5___n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404ef8
mov eax, str.exeFixUp_main_finished_n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_fclose
add esp, 4
mov eax, dword [ebp - 0x50]
cmp eax, 0
jle 0x404f42
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404f31
mov eax, dword [ebp + 8]
push eax
mov eax, str._s_removed._n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp + 8]
push eax
call sub.msvcrt.dll__unlink
add esp, 4
jmp 0x404fd0
mov eax, str.psx.exe
push eax
mov eax, dword [ebp + 8]
push eax
call sub.msvcrt.dll_rename
add esp, 8
mov dword [ebp - 0x58], eax
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404f78
mov eax, dword [ebp + 8]
push eax
mov eax, str._s_renamed_to_psx.exe_n
push eax
call sub.msvcrt.dll_printf
add esp, 8
mov eax, dword [ebp - 0x58]
cmp eax, 0
jne 0x404fa6
mov eax, dword [0x406010]
cmp eax, 1
jne 0x404fa1
mov eax, str.File_renamed_successfully_n
push eax
call sub.msvcrt.dll_printf
add esp, 4
jmp 0x404fd0
mov eax, str.Error:_unable_to_rename_the_file
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
push eax
call sub.msvcrt.dll_fflush
add esp, 4
mov eax, 1
jmp 0x404ff5
mov eax, str._nOutput:_psx.exe_built_correctly__n
push eax
call sub.msvcrt.dll_printf
add esp, 4
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
push eax
call sub.msvcrt.dll_fflush
add esp, 4
mov eax, 0
leave
ret