Function at 0x401706
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push rbp
push r15
push r14
push r13
push r12
push rdi
push rsi
push rbx
sub rsp, 0x258
lea rbp, [rsp + 0x80]
mov dword [rbp + 0x220], ecx
mov qword [rbp + 0x228], rdx
call dbg.__main
mov rax, rsp
mov qword [rbp + 0x48], rax
mov qword [rbp + 0x1b8], 0
mov qword [rbp + 0x1c0], 0
cmp dword [rbp + 0x220], 1
jg 0x40178d
mov rax, qword [rbp + 0x228]
mov rbx, qword [rax]
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov r8, rbx
lea rdx, str.Usage:__s_INPUT_FILE_OUTPUT_FILE_n
mov rcx, rax
call sym.fprintf
mov ecx, 0xfffffffd
call sym.exit
cmp dword [rbp + 0x220], 1
jle 0x4017a8
mov rax, qword [rbp + 0x228]
mov rax, qword [rax + 8]
mov qword [rbp + 0x1b8], rax
cmp dword [rbp + 0x220], 2
jle 0x4017c3
mov rax, qword [rbp + 0x228]
mov rax, qword [rax + 0x10]
mov qword [rbp + 0x1c0], rax
mov rax, qword [rbp + 0x1b8]
lea rdx, [0x0040607a]
mov rcx, rax
call sym.fopen
mov qword [rbp + 0x1c8], rax
cmp qword [rbp + 0x1c8], 0
jne 0x40181b
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov rdx, qword [rbp + 0x1b8]
mov r8, rdx
lea rdx, str.Unable_to_open__s_n
mov rcx, rax
call sym.fprintf
mov eax, 0xffffffff
jmp 0x40252d
mov eax, 0x1c
movsxd rdx, eax
mov rax, qword [rbp + 0x1c8]
lea rcx, [rbp + 0xc0]
mov r9, rax
mov r8, rdx
mov edx, 1
call sym.fread
mov dword [rbp + 0x1a0], eax
mov eax, 0x1c
cmp dword [rbp + 0x1a0], eax
jge 0x401894
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov rdx, qword [rbp + 0x1b8]
mov r8, rdx
lea rdx, str.Unable_to_read_EXE_header_in__s_n
mov rcx, rax
call sym.fprintf
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, 0xffffffff
jmp 0x40252d
lea rdx, [rbp + 0xc0]
lea rax, [rbp + 0xa0]
mov rcx, rax
call dbg.read_EXE
movzx eax, word [rbp + 0xa0]
cmp ax, 0x5a4d
je 0x4018f7
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov rdx, qword [rbp + 0x1b8]
mov r8, rdx
lea rdx, str.Unable_to_parse_EXE_header_in__s_n
mov rcx, rax
call sym.fprintf
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, 0xffffffff
jmp 0x40252d
mov rdx, qword [rbp + 0x1b8]
lea rax, [rbp + 0xa0]
mov rcx, rax
call dbg.print_EXE
movzx eax, word [rbp + 0xa8]
movzx eax, ax
shl eax, 4
mov dword [rbp + 0x19c], eax
movzx eax, word [rbp + 0xa4]
movzx eax, ax
shl eax, 9
mov dword [rbp + 0x198], eax
movzx eax, word [rbp + 0xa2]
test ax, ax
je 0x401956
movzx eax, word [rbp + 0xa2]
movzx edx, ax
mov eax, 0x200
sub eax, edx
sub dword [rbp + 0x198], eax
movzx eax, word [rbp + 0xb6]
movzx eax, ax
shl eax, 4
mov dword [rbp + 0x194], eax
mov eax, dword [rbp + 0x194]
mov dword [rbp + 0x190], eax
mov eax, dword [rbp + 0x190]
mov edx, eax
lea rcx, str._t_Predicted_packed_exe_:__d_bytes_n
call sym.printf
mov edx, dword [rbp + 0x190]
movsxd rax, edx
sub rax, 1
mov qword [rbp + 0x188], rax
movsxd rax, edx
mov rsi, rax
mov edi, 0
movsxd rax, edx
mov r12, rax
mov r13d, 0
movsxd rax, edx
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.004041c0
sub rsp, rax
lea rax, [rsp + 0x40]
add rax, 0
mov qword [rbp + 0x180], rax
mov edx, dword [rbp + 0x19c]
mov rax, qword [rbp + 0x1c8]
mov r8d, 0
mov rcx, rax
call sym.fseek
mov eax, dword [rbp + 0x190]
movsxd rdx, eax
mov rcx, qword [rbp + 0x180]
mov rax, qword [rbp + 0x1c8]
mov r9, rax
mov r8, rdx
mov edx, 1
call sym.fread
mov dword [rbp + 0x1a0], eax
mov eax, dword [rbp + 0x1a0]
cmp eax, dword [rbp + 0x190]
jge 0x401a71
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov rdx, qword [rbp + 0x1b8]
mov r8, rdx
lea rdx, str.Unable_to_read_PACKED_data_from__s_n
mov rcx, rax
call sym.fprintf
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, 0xffffffff
jmp 0x40252d
mov eax, 0x12
cdqe
sub rax, 1
mov qword [rbp + 0x178], rax
mov eax, 0x12
cdqe
mov r14, rax
mov r15d, 0
mov eax, 0x12
cdqe
mov qword [rbp + 0x50], rax
mov qword [rbp + 0x58], 0
mov eax, 0x12
cdqe
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.004041c0
sub rsp, rax
lea rax, [rsp + 0x40]
add rax, 0
mov qword [rbp + 0x170], rax
mov eax, 0x12
movsxd rdx, eax
mov rcx, qword [rbp + 0x170]
mov rax, qword [rbp + 0x1c8]
mov r9, rax
mov r8, rdx
mov edx, 1
call sym.fread
mov dword [rbp + 0x1a0], eax
mov eax, 0x12
cmp dword [rbp + 0x1a0], eax
jge 0x401b5c
mov edx, dword [rbp + 0x19c]
mov eax, dword [rbp + 0x190]
lea ebx, [rdx + rax]
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov rdx, qword [rbp + 0x1b8]
mov r9d, ebx
mov r8, rdx
lea rdx, str.Unable_to_read_EXEPACK_variables_from__s:_08x_n
mov rcx, rax
call sym.fprintf
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, 0xffffffff
jmp 0x40252d
mov rdx, qword [rbp + 0x170]
lea rax, [rbp + 0x80]
mov rcx, rax
call dbg.read_EXEPACK
movzx eax, word [rbp + 0x90]
cmp ax, 0x4252
je 0x401bc2
movzx eax, word [rbp + 0x90]
movzx ebx, ax
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov r8d, ebx
lea rdx, str.Not_an_EXEPACK_file___corrupt_EXEPACK_header.__08x
mov rcx, rax
call sym.fprintf
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, 0xffffffff
jmp 0x40252d
movzx eax, word [rbp + 0x84]
movzx r9d, ax
movzx eax, word [rbp + 0x88]
movzx ecx, ax
movzx eax, word [rbp + 0x8a]
movzx r8d, ax
movzx eax, word [rbp + 0x80]
movzx edx, ax
movzx eax, word [rbp + 0x82]
movzx eax, ax
mov dword [rsp + 0x28], r9d
mov dword [rsp + 0x20], ecx
mov r9d, r8d
mov r8d, edx
mov edx, eax
lea rcx, str.Packed_CS:IP_t_t_t_04x:_04x_nPacked_SS:SP_t_t_t_04x:_04x_nStart_of_EXE:__04x_n
call sym.printf
movzx eax, word [rbp + 0x8c]
movzx eax, ax
shl eax, 4
mov r10d, eax
movzx eax, word [rbp + 0x8c]
movzx r9d, ax
movzx eax, word [rbp + 0x86]
movzx ecx, ax
movzx eax, word [rbp + 0x86]
movzx r8d, ax
movzx eax, word [rbp + 0x8e]
movzx edx, ax
movzx eax, word [rbp + 0x8e]
movzx eax, ax
mov dword [rsp + 0x30], r10d
mov dword [rsp + 0x28], r9d
mov dword [rsp + 0x20], ecx
mov r9d, r8d
mov r8d, edx
mov edx, eax
lea rcx, str.Skip_len__para__t_t_t_04x_t_t_d_nexepack_size__bytes__t_t_04x_t_t_d_nFull_length:__d16___d_n
call sym.printf
movzx eax, word [rbp + 0x86]
movzx edx, ax
mov eax, 0x12
sub edx, eax
mov eax, edx
mov dword [rbp + 0x16c], eax
mov edx, dword [rbp + 0x16c]
movsxd rax, edx
sub rax, 1
mov qword [rbp + 0x160], rax
movsxd rax, edx
mov qword [rbp + 0x30], rax
mov qword [rbp + 0x38], 0
movsxd rax, edx
mov qword [rbp + 0x20], rax
mov qword [rbp + 0x28], 0
movsxd rax, edx
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.004041c0
sub rsp, rax
lea rax, [rsp + 0x40]
add rax, 0
mov qword [rbp + 0x158], rax
mov eax, dword [rbp + 0x16c]
movsxd rdx, eax
mov rcx, qword [rbp + 0x158]
mov rax, qword [rbp + 0x1c8]
mov r9, rax
mov r8, rdx
mov edx, 1
call sym.fread
mov dword [rbp + 0x1a0], eax
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, dword [rbp + 0x1a0]
cmp eax, dword [rbp + 0x16c]
jge 0x401d6e
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov ecx, dword [rbp + 0x1a0]
mov edx, dword [rbp + 0x16c]
mov r9d, ecx
mov r8d, edx
lea rdx, str.Unable_to_read__d_bytes_of_unpacker_code_data__have__d_n
mov rcx, rax
call sym.fprintf
mov eax, 0xffffffff
jmp 0x40252d
movzx eax, word [rbp + 0x86]
movzx eax, ax
mov edx, 0x16
sub eax, edx
mov edx, 0x105
sub eax, edx
mov edx, 0x12
sub eax, edx
mov dword [rbp + 0x154], eax
mov eax, dword [rbp + 0x154]
cdqe
sub rax, 0x20
shr rax, 1
mov dword [rbp + 0x150], eax
mov eax, dword [rbp + 0x150]
add eax, eax
cdqe
add eax, eax
mov dword [rbp + 0x14c], eax
mov eax, dword [rbp + 0x150]
mov edx, dword [rbp + 0x154]
mov r8d, eax
lea rcx, str._t_Predicted_packed_reloc.table_:__d_bytes___d_entries__n
call sym.printf
mov eax, dword [rbp + 0x14c]
mov edx, eax
lea rcx, str._t_Unpacked_relocation_table_:__d_bytes_n
call sym.printf
cmp qword [rbp + 0x1c0], 0
jne 0x401e25
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov r9, rax
mov r8d, 0x19
mov edx, 1
lea rcx, str.No_output_file_specified_n
call sym.fwrite
mov eax, 0xfffffffd
jmp 0x40252d
movzx eax, word [rbp + 0x8c]
movzx eax, ax
shl eax, 4
mov dword [rbp + 0x148], eax
mov eax, dword [rbp + 0x148]
mov edx, eax
lea rcx, str._tExpected_unpacked_size:__d_bytes_n
call sym.printf
mov edx, dword [rbp + 0x148]
movsxd rax, edx
sub rax, 1
mov qword [rbp + 0x140], rax
movsxd rax, edx
mov qword [rbp + 0x10], rax
mov qword [rbp + 0x18], 0
movsxd rax, edx
mov qword [rbp], rax
mov qword [rbp + 8], 0
movsxd rax, edx
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.004041c0
sub rsp, rax
lea rax, [rsp + 0x40]
add rax, 0
mov qword [rbp + 0x138], rax
mov eax, dword [rbp + 0x148]
movsxd rdx, eax
mov rax, qword [rbp + 0x138]
mov r8, rdx
mov edx, 0xff
mov rcx, rax
call sym.memset
mov eax, dword [rbp + 0x190]
movsxd rcx, eax
mov rdx, qword [rbp + 0x180]
mov rax, qword [rbp + 0x138]
mov r8, rcx
mov rcx, rax
call sym.memcpy
mov edx, 0x105
mov eax, 0x16
add eax, edx
mov dword [rbp + 0x1a4], eax
mov eax, 0x16
movsxd rcx, eax
mov edx, 0x16
mov eax, dword [rbp + 0x1a4]
sub eax, edx
movsxd rdx, eax
mov rax, qword [rbp + 0x158]
add rax, rdx
mov r8, rcx
lea rdx, str.Packed_file_is_corrupt
mov rcx, rax
call sym.memcmp
test eax, eax
je 0x401f59
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov r9, rax
mov r8d, 0x14
mov edx, 1
lea rcx, str.RB_String_is_wrong__n
call sym.fwrite
mov eax, dword [rbp + 0x190]
sub eax, 1
movsxd rdx, eax
mov rax, qword [rbp + 0x180]
add rdx, rax
mov eax, dword [rbp + 0x148]
sub eax, 1
movsxd rcx, eax
mov rax, qword [rbp + 0x138]
add rax, rcx
lea rcx, [rbp + 0x7c]
mov r8, rcx
mov rcx, rax
call dbg.exepack_unpack
mov dword [rbp + 0x1a0], eax
cmp dword [rbp + 0x1a0], 0xffffffff
jne 0x401fd5
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov r9, rax
mov r8d, 0x16
mov edx, 1
lea rcx, str.Unable_to_UNPACK_data_n
call sym.fwrite
mov eax, 0xfffffffe
jmp 0x40252d
mov eax, dword [rbp + 0x190]
lea edx, [rax - 1]
mov eax, dword [rbp + 0x7c]
sub edx, eax
mov eax, dword [rbp + 0x190]
lea r8d, [rax - 1]
mov ecx, dword [rbp + 0x7c]
mov eax, dword [rbp + 0x1a0]
mov dword [rsp + 0x20], edx
mov r9d, r8d
mov r8d, ecx
mov edx, eax
lea rcx, str.Unpacked__d_bytes__from__d_packed_bytes__into___08x___08x__n
call sym.printf
mov dword [rbp + 0x1a8], 0
mov eax, dword [rbp + 0x14c]
movsxd rdx, eax
sub rdx, 1
mov qword [rbp + 0x130], rdx
movsxd rdx, eax
mov qword [rbp - 0x10], rdx
mov qword [rbp - 8], 0
movsxd rdx, eax
mov qword [rbp - 0x20], rdx
mov qword [rbp - 0x18], 0
cdqe
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.004041c0
sub rsp, rax
lea rax, [rsp + 0x40]
add rax, 0
mov qword [rbp + 0x128], rax
mov dword [rbp + 0x1ac], 0
mov dword [rbp + 0x1a8], 0
jmp 0x4021cc
mov eax, dword [rbp + 0x1a4]
add eax, 1
mov rdx, qword [rbp + 0x158]
cdqe
movzx eax, byte [rdx + rax]
movzx eax, al
shl eax, 8
mov ecx, eax
mov rdx, qword [rbp + 0x158]
mov eax, dword [rbp + 0x1a4]
cdqe
movzx eax, byte [rdx + rax]
movzx eax, al
add eax, ecx
mov dword [rbp + 0x124], eax
add dword [rbp + 0x1a4], 2
cmp dword [rbp + 0x124], 0
je 0x4021db
mov dword [rbp + 0x1b0], 0
jmp 0x4021b3
mov eax, dword [rbp + 0x1a4]
add eax, 1
mov rdx, qword [rbp + 0x158]
cdqe
movzx eax, byte [rdx + rax]
movzx eax, al
shl eax, 8
mov ecx, eax
mov rdx, qword [rbp + 0x158]
mov eax, dword [rbp + 0x1a4]
cdqe
movzx eax, byte [rdx + rax]
movzx eax, al
add eax, ecx
mov dword [rbp + 0x120], eax
add dword [rbp + 0x1a4], 2
mov eax, dword [rbp + 0x1a8]
shl eax, 0xc
mov word [rbp + 0x11e], ax
mov eax, dword [rbp + 0x120]
mov word [rbp + 0x11c], ax
mov eax, dword [rbp + 0x1ac]
movsxd rdx, eax
mov rax, qword [rbp + 0x128]
add rax, rdx
mov qword [rbp + 0x110], rax
mov rax, qword [rbp + 0x110]
movzx edx, word [rbp + 0x11c]
mov word [rax], dx
add dword [rbp + 0x1ac], 2
mov eax, dword [rbp + 0x1ac]
movsxd rdx, eax
mov rax, qword [rbp + 0x128]
add rax, rdx
mov qword [rbp + 0x108], rax
mov rax, qword [rbp + 0x108]
movzx edx, word [rbp + 0x11e]
mov word [rax], dx
add dword [rbp + 0x1ac], 2
add dword [rbp + 0x1b0], 1
mov eax, dword [rbp + 0x1b0]
cmp eax, dword [rbp + 0x124]
jl 0x4020e8
add dword [rbp + 0x1a8], 1
cmp dword [rbp + 0x1a8], 0xf
jle 0x402089
jmp 0x4021dc
nop
mov rax, rsp
mov rbx, rax
mov eax, 0x1c
cdqe
sub rax, 1
mov qword [rbp + 0x100], rax
mov eax, 0x1c
cdqe
mov qword [rbp - 0x30], rax
mov qword [rbp - 0x28], 0
mov eax, 0x1c
cdqe
mov qword [rbp - 0x40], rax
mov qword [rbp - 0x38], 0
mov eax, 0x1c
cdqe
add rax, 0xf
shr rax, 4
shl rax, 4
call fcn.004041c0
sub rsp, rax
lea rax, [rsp + 0x40]
add rax, 0
mov qword [rbp + 0xf8], rax
mov edx, 0x1c
mov eax, dword [rbp + 0x1ac]
add eax, edx
mov dword [rbp + 0xf4], eax
mov word [rbp + 0x60], 0x5a4d
mov eax, dword [rbp + 0xf4]
lea edx, [rax + 0xf]
test eax, eax
cmovs eax, edx
sar eax, 4
mov word [rbp + 0x68], ax
movzx eax, word [rbp + 0x68]
shr ax, 5
add eax, 1
shl eax, 5
mov word [rbp + 0x68], ax
movzx eax, word [rbp + 0x68]
movzx eax, ax
shl eax, 4
mov dword [rbp + 0xf0], eax
mov dword [rbp + 0xec], 0
mov eax, dword [rbp + 0xf0]
sub eax, dword [rbp + 0xf4]
sub eax, dword [rbp + 0xec]
mov dword [rbp + 0xe8], eax
mov edx, 0x1c
mov eax, dword [rbp + 0xec]
add edx, eax
mov eax, dword [rbp + 0x1ac]
add edx, eax
mov eax, dword [rbp + 0xe8]
add edx, eax
mov eax, dword [rbp + 0x148]
add eax, edx
mov dword [rbp + 0xe4], eax
movzx eax, word [rbp + 0x88]
mov word [rbp + 0x70], ax
movzx eax, word [rbp + 0x8a]
mov word [rbp + 0x6e], ax
movzx eax, word [rbp + 0x80]
mov word [rbp + 0x74], ax
movzx eax, word [rbp + 0x82]
mov word [rbp + 0x76], ax
mov word [rbp + 0x6c], 0xffff
mov eax, dword [rbp + 0xe4]
movsxd rdx, eax
imul rdx, rdx, 0xffffffff88888889
shr rdx, 0x20
add edx, eax
sar edx, 5
sar eax, 0x1f
sub edx, eax
mov eax, edx
mov word [rbp + 0x6a], ax
mov eax, 0x1c
mov edx, eax
mov eax, dword [rbp + 0xec]
add eax, edx
mov word [rbp + 0x78], ax
mov eax, dword [rbp + 0x1ac]
cdqe
shr rax, 2
mov word [rbp + 0x66], ax
mov eax, dword [rbp + 0xe4]
lea edx, [rax + 0x1ff]
test eax, eax
cmovs eax, edx
sar eax, 9
add eax, 1
mov word [rbp + 0x64], ax
mov eax, dword [rbp + 0xe4]
cdq
shr edx, 0x17
add eax, edx
and eax, 0x1ff
sub eax, edx
mov word [rbp + 0x62], ax
mov word [rbp + 0x7a], 0
mov ecx, 0xa
call sym.putchar
mov rdx, qword [rbp + 0x1c0]
lea rax, [rbp + 0x60]
mov rcx, rax
call dbg.print_EXE
mov rax, qword [rbp + 0xf8]
lea rdx, [rbp + 0x60]
mov rcx, rax
call dbg.write_EXE
mov rax, qword [rbp + 0x1c0]
lea rdx, [0x0040638c]
mov rcx, rax
call sym.fopen
mov qword [rbp + 0x1c8], rax
cmp qword [rbp + 0x1c8], 0
jne 0x40241b
mov ecx, 2
mov rax, qword [dbg.__acrt_iob_func]
call rax
mov rdx, qword [rbp + 0x1c0]
mov r8, rdx
lea rdx, str.Unable_to_open__s_for_writing_n
mov rcx, rax
call sym.fprintf
mov eax, 0xfffffffe
jmp 0x40252a
mov eax, 0x1c
movsxd rdx, eax
mov rax, qword [rbp + 0xf8]
mov rcx, qword [rbp + 0x1c8]
mov r9, rcx
mov r8d, 1
mov rcx, rax
call sym.fwrite
mov dword [rbp + 0x1b4], 0
jmp 0x402476
mov rax, qword [rbp + 0x1c8]
mov r9, rax
mov r8d, 1
mov edx, 1
lea rcx, [0x004063b1]
call sym.fwrite
add dword [rbp + 0x1b4], 1
mov eax, dword [rbp + 0x1b4]
cmp eax, dword [rbp + 0xec]
jl 0x40244e
mov eax, dword [rbp + 0x1ac]
movsxd rdx, eax
mov rax, qword [rbp + 0x128]
mov rcx, qword [rbp + 0x1c8]
mov r9, rcx
mov r8d, 1
mov rcx, rax
call sym.fwrite
mov dword [rbp + 0x1b4], 0
jmp 0x4024e0
mov rax, qword [rbp + 0x1c8]
mov r9, rax
mov r8d, 1
mov edx, 1
lea rcx, [0x004063b1]
call sym.fwrite
add dword [rbp + 0x1b4], 1
mov eax, dword [rbp + 0x1b4]
cmp eax, dword [rbp + 0xe8]
jl 0x4024b8
mov eax, dword [rbp + 0x148]
movsxd rdx, eax
mov rax, qword [rbp + 0x138]
mov rcx, qword [rbp + 0x1c8]
mov r9, rcx
mov r8d, 1
mov rcx, rax
call sym.fwrite
mov rax, qword [rbp + 0x1c8]
mov rcx, rax
call sym.fclose
mov eax, 0
mov rsp, rbx
mov rsp, qword [rbp + 0x48]
lea rsp, [rbp + 0x1d8]
pop rbx
pop rsi
pop rdi
pop r12
pop r13
pop r14
pop r15
pop rbp
ret