Function at 0x401810
Capabilities:
Read file on windows
Terminate process
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0xbc
mov eax, dword [ebp + 8]
lea edx, [eax - 2]
lea eax, [eax + eax*4 - 5]
shl eax, 2
mov dword [ebp - 0xa8], eax
add eax, 0xf
shr eax, 4
shl eax, 4
call fcn.004011e8
sub esp, eax
lea eax, [esp + 0x13]
mov ecx, eax
and eax, 0xfffffffc
shr ecx, 2
mov dword [ebp - 0xa4], eax
mov dword [ebp - 0xac], ecx
test edx, edx
js 0x401878
lea esi, [esi]
nop
sub edx, 1
mov dword [eax], method.std::string.append_std::string_const_
add eax, 0x14
mov dword [eax - 8], 0x4091ac
cmp edx, 0xffffffff
jne 0x401860
cmp dword [ebp + 8], 2
mov dword [ebp - 0x7c], method.std::string.append_std::string_const_
jle 0x40239d
mov dword [ebp - 0x8c], 2
mov dword [ebp - 0xa0], 0x1000
mov dword [ebp - 0x9c], 0
jmp 0x401942
cmp byte [eax + 1], 0x6f
jne 0x401973
cmp byte [eax + 2], 0
jne 0x401973
mov eax, dword [ebp + 0xc]
add dword [ebp - 0x8c], 1
lea edi, [ebp - 0x6c]
mov ebx, dword [eax + edx + 4]
mov dword [esp], ebx
call sub.cygwin1.dll_strlen
mov dword [esp + 4], ebx
mov dword [esp + 8], eax
lea eax, [ebp - 0x7c]
mov dword [esp], eax
lea eax, [ebp - 0x78]
mov dword [ebp - 0x90], eax
call fcn.004011b0
mov eax, dword [ebp - 0x70]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x401d40
mov eax, dword [ebp - 0x74]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x401d10
mov eax, dword [ebp - 0x78]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x401ce0
add dword [ebp - 0x8c], 1
mov eax, dword [ebp - 0x8c]
cmp dword [ebp + 8], eax
jle 0x401d66
mov eax, dword [ebp - 0x8c]
mov ecx, dword [ebp + 0xc]
mov dword [ebp - 0x78], method.std::string.append_std::string_const_
mov dword [ebp - 0x74], method.std::string.append_std::string_const_
lea edx, [eax*4]
mov eax, dword [ecx + eax*4]
mov dword [ebp - 0x70], method.std::string.append_std::string_const_
cmp byte [eax], 0x2d
je 0x4018b0
mov ecx, 9
mov edi, str.__output
mov esi, eax
repe cmpsb byte [esi], byte es:[edi]
seta cl
sbb cl, 0
test cl, cl
je 0x4018c4
mov dword [esp + 4], 0x40533f
mov dword [esp], eax
call sub.cygwin1.dll_strtok
mov esi, eax
lea eax, [ebp - 0x78]
mov dword [ebp - 0x90], eax
mov ebx, eax
test esi, esi
je 0x4019e8
mov dword [esp], esi
lea edi, [ebp - 0x6c]
call sub.cygwin1.dll_strlen
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov dword [esp], ebx
call fcn.004011b0
mov dword [esp + 4], 0x405343
add ebx, 4
mov dword [esp], 0
call sub.cygwin1.dll_strtok
mov esi, eax
test eax, eax
jne 0x4019b0
lea ebx, [ebp - 0x74]
mov dword [esp + 4], str.cmdline
mov dword [esp], ebx
call fcn.004011d8
mov esi, eax
test eax, eax
je 0x401c38
mov eax, dword [ebp - 0x90]
mov dword [esp + 4], str.header
mov dword [esp], eax
call fcn.004011d8
test eax, eax
je 0x401c60
mov eax, dword [ebp - 0x74]
mov dword [esp + 8], 0x10
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.cygwin1.dll_strtol
mov esi, eax
test eax, eax
jne 0x401aa5
mov eax, dword [ebp - 0x74]
mov ecx, dword [eax - 0xc]
test ecx, ecx
jne 0x401a69
mov dword [esp + 8], 6
lea edi, [ebp - 0x6c]
mov dword [esp + 4], str.kernel
mov dword [esp], ebx
call fcn.004011b0
lea eax, [ebp - 0x70]
mov dword [esp + 4], ebx
lea edi, [ebp - 0x6c]
mov dword [esp], eax
call fcn.004011a8
mov dword [esp + 4], ebx
lea ebx, [ebp - 0x4c]
mov dword [esp], ebx
call fcn.004011a0
mov dword [esp], ebx
call fcn.00402e10
mov esi, eax
mov eax, dword [ebp - 0x4c]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402339
mov eax, dword [ebp - 0x78]
mov dword [esp], str.Reading_file__s_n
lea edi, [ebp - 0x6c]
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
mov eax, dword [ebp - 0x78]
mov dword [esp + 4], 0x405394
mov dword [esp], eax
call sub.cygwin1.dll__fopen64
mov ebx, eax
test eax, eax
je 0x4023c8
mov dword [esp + 8], 2
lea edi, [ebp - 0x6c]
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.cygwin1.dll_fseek
mov dword [esp], ebx
call sub.cygwin1.dll_ftell
mov ecx, dword [ebp - 0x90]
lea edx, [ebp - 0x4c]
mov dword [ebp - 0x94], eax
mov dword [esp], edx
mov dword [esp + 4], ecx
mov dword [ebp - 0x98], edx
call fcn.004011a0
lea eax, [ebp - 0x70]
lea edi, [ebp - 0x40]
mov dword [ebp - 0x48], esi
mov esi, dword [ebp - 0x94]
mov dword [esp + 4], eax
mov dword [esp], edi
mov dword [ebp - 0x44], esi
call fcn.004011a0
mov eax, dword [ebp - 0xa0]
mov dword [esp], ebx
mov dword [ebp - 0x3c], eax
add eax, esi
mov dword [ebp - 0xa0], eax
call sub.cygwin1.dll_fclose
mov esi, dword [ebp - 0x9c]
mov ecx, dword [ebp - 0xa4]
mov edx, dword [ebp - 0x98]
lea ebx, [esi + esi*4]
shl ebx, 2
mov dword [esp + 4], edx
lea eax, [ecx + ebx]
mov dword [esp], eax
call fcn.004011a8
mov ecx, dword [ebp - 0xa4]
mov edx, dword [ebp - 0x48]
lea eax, [esi + esi*4]
lea eax, [ecx + eax*4]
mov dword [eax + 4], edx
mov edx, dword [ebp - 0x44]
mov dword [eax + 8], edx
lea eax, [ecx + ebx + 0xc]
mov dword [esp + 4], edi
mov edi, ecx
mov dword [esp], eax
call fcn.004011a8
mov edx, dword [ebp - 0x3c]
lea eax, [esi + esi*4]
add esi, 1
mov dword [ebp - 0x9c], esi
mov dword [edi + eax*4 + 0x10], edx
mov eax, dword [ebp - 0x40]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402198
mov eax, dword [ebp - 0x4c]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402172
mov eax, dword [ebp - 0x70]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402149
mov eax, dword [ebp - 0x74]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402120
mov eax, dword [ebp - 0x78]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
je 0x40192c
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x40192c
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x40192c
lea eax, [ebp - 0x70]
mov dword [esp + 8], 7
lea edi, [ebp - 0x6c]
mov dword [esp + 4], str.cmdline
mov dword [esp], eax
call fcn.004011b0
jmp 0x401aa5
mov eax, dword [ebp - 0x74]
mov dword [esp + 4], 0x40534d
lea edi, [ebp - 0x6c]
mov dword [esp], eax
call sub.cygwin1.dll__fopen64
mov dword [esp + 8], 0
mov esi, eax
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.cygwin1.dll_fseek
lea eax, [ebp - 0x4c]
mov dword [esp + 0xc], esi
mov dword [esp + 8], 1
mov dword [esp + 4], 0x34
mov dword [esp], eax
mov dword [ebp - 0x98], eax
call sub.cygwin1.dll_fread
mov eax, dword [0x4055a8]
cmp dword [ebp - 0x4c], eax
je 0x40220a
mov dword [esp], str.Header_file_is_not_a_valid_elf_image_header...Exit
lea edi, [ebp - 0x6c]
call sub.cygwin1.dll_printf
mov dword [esp], 1
call sub.cygwin1.dll_exit
nop
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x40192c
lea eax, [ebp - 0x4c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x40192c
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x40191b
lea eax, [ebp - 0x4c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x40191b
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x40190a
lea eax, [ebp - 0x4c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x40190a
cmp dword [ebp - 0x9c], 1
jle 0x40239d
mov eax, dword [ebp - 0x7c]
mov edx, dword [eax - 0xc]
test edx, edx
je 0x4023e0
mov dword [esp + 4], 0x4053d3
mov dword [esp], eax
call sub.cygwin1.dll__fopen64
mov dword [ebp - 0x94], eax
test eax, eax
je 0x40235c
mov eax, dword [ebp - 0xac]
mov esi, dword [ebp - 0x9c]
mov ebx, dword [eax*4 + 4]
mov dword [esp + 8], esi
mov dword [esp], str.Writing_elf_header_t_address_:__x__t_number_:__i_n
mov dword [esp + 4], ebx
call sub.cygwin1.dll_printf
xor eax, eax
lea edi, [ebp - 0x44]
mov ecx, 0xb
mov edx, 0x28
rep stosd dword es:[edi], eax
mov eax, 2
mov ecx, 0x34
mov word [ebp - 0x3a], dx
mov word [ebp - 0x3c], ax
mov eax, dword [ebp - 0x94]
mov edi, 0x20
mov dword [esp + 8], 1
mov dword [esp + 0xc], eax
lea eax, [ebp - 0x4c]
mov dword [esp + 4], 0x34
mov dword [esp], eax
mov dword [ebp - 0x4c], 0x464c457f
mov dword [ebp - 0x48], 0x61010101
mov dword [ebp - 0x38], 1
mov dword [ebp - 0x30], 0x34
mov word [ebp - 0x24], cx
mov word [ebp - 0x22], di
mov dword [ebp - 0x34], ebx
mov word [ebp - 0x20], si
mov dword [ebp - 0x98], eax
call sub.cygwin1.dll_fwrite
mov ebx, dword [ebp - 0xa4]
lea edi, [ebp - 0x40]
mov dword [ebp - 0xa0], 0
mov esi, ebx
jmp 0x401e66
mov dword [ebp - 0xa0], eax
mov eax, dword [ebp - 0x98]
mov dword [esp + 4], ebx
mov dword [esp], eax
call fcn.004011a0
mov eax, dword [ebx + 8]
mov edx, dword [ebx + 4]
mov dword [esp], edi
mov dword [ebp - 0x44], eax
lea eax, [ebx + 0xc]
mov dword [esp + 4], eax
mov dword [ebp - 0x48], edx
call fcn.004011a0
mov eax, dword [ebx + 0x10]
mov dword [ebp - 0x3c], eax
mov eax, dword [ebp - 0x98]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x94]
mov dword [esp], eax
call fcn.00402c90
mov eax, dword [ebp - 0x40]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x4021e4
mov eax, dword [ebp - 0x4c]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x4021be
mov eax, dword [ebp - 0xa0]
add ebx, 0x14
add eax, 1
cmp dword [ebp - 0x9c], eax
jne 0x401e60
mov dword [ebp - 0x9c], 0
lea edi, [ebp - 0x6c]
jmp 0x401f2f
mov eax, dword [ebp - 0x6c]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402098
mov ecx, dword [ebp - 0x9c]
add esi, 0x14
lea eax, [ecx + 1]
cmp ecx, dword [ebp - 0xa0]
je 0x4020c1
mov dword [ebp - 0x9c], eax
mov dword [esp + 4], esi
mov dword [esp], edi
call fcn.004011a0
mov eax, dword [esi + 8]
mov edx, dword [esi + 4]
mov dword [ebp - 0x64], eax
lea eax, [esi + 0xc]
mov dword [esp + 4], eax
lea eax, [ebp - 0x60]
mov dword [esp], eax
mov dword [ebp - 0x68], edx
call fcn.004011a0
mov eax, dword [esi + 0x10]
mov dword [esp + 8], 0
mov dword [ebp - 0x5c], eax
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x94]
mov dword [esp], eax
call sub.cygwin1.dll_fseek
mov eax, dword [ebp - 0x6c]
mov dword [esp], str.Writing_file_:__s_to_elf_image_n
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
mov eax, dword [ebp - 0x6c]
mov dword [esp + 4], 0x405394
mov dword [esp], eax
call sub.cygwin1.dll__fopen64
mov ebx, eax
test eax, eax
je 0x4023b0
mov dword [esp + 8], 2
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.cygwin1.dll_fseek
mov dword [esp], ebx
call sub.cygwin1.dll_ftell
mov dword [esp], eax
mov dword [ebp - 0x8c], eax
call sub.cygwin1.dll___wrap__Znaj
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], ebx
mov dword [ebp - 0x90], eax
call sub.cygwin1.dll_fseek
mov ecx, dword [ebp - 0x8c]
mov edx, dword [ebp - 0x90]
mov dword [esp + 0xc], ebx
mov dword [esp + 8], 1
mov dword [esp + 4], ecx
mov dword [esp], edx
call sub.cygwin1.dll_fread
mov dword [esp], ebx
call sub.cygwin1.dll_fclose
mov ebx, dword [ebp - 0x94]
mov ecx, dword [ebp - 0x8c]
mov dword [esp + 8], 1
mov edx, dword [ebp - 0x90]
mov dword [esp + 0xc], ebx
mov dword [esp + 4], ecx
mov dword [esp], edx
call sub.cygwin1.dll_fwrite
mov eax, dword [ebp - 0x60]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
je 0x401f00
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401f00
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
mov eax, dword [ebp - 0x6c]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
je 0x401f11
lea esi, [esi]
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401f11
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401f11
mov eax, dword [ebp - 0x94]
mov dword [esp], eax
call sub.cygwin1.dll_fclose
mov eax, dword [ebp - 0x7c]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402374
mov ebx, dword [ebp - 0xa8]
mov esi, dword [ebp - 0xa4]
add ebx, esi
jmp 0x402114
mov eax, dword [ebx - 8]
sub ebx, 0x14
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x402310
mov eax, dword [ebx]
lea edx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
jne 0x4022e7
cmp esi, ebx
jne 0x4020f0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401bfb
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401bfb
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401bea
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401bea
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401bd9
lea eax, [ebp - 0x6c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401bd9
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401bc8
lea eax, [ebp - 0x6c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401bc8
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401ed3
lea eax, [ebp - 0x6c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401ed3
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401ec2
lea eax, [ebp - 0x6c]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x401ec2
mov eax, dword [ebp - 0x98]
mov ecx, dword [0x4055ac]
cmp dword [eax + 4], ecx
jne 0x401cc3
cmp word [ebp - 0x20], 0
mov ebx, 0x34
mov dword [ebp - 0x94], 0
je 0x4022d7
lea esi, [esi]
mov dword [esp + 8], 0
mov dword [esp + 4], ebx
mov dword [esp], esi
call sub.cygwin1.dll_fseek
lea eax, [ebp - 0x6c]
mov dword [esp + 0xc], esi
mov dword [esp + 8], 1
mov dword [esp + 4], 0x20
mov dword [esp], eax
call sub.cygwin1.dll_fread
mov eax, dword [ebp - 0x6c]
add dword [ebp - 0x94], 1
add ebx, 0x20
mov edx, dword [ebp - 0x94]
mov dword [ebx + 0x407fcc], eax
mov eax, dword [ebp - 0x68]
mov dword [ebx + 0x407fd0], eax
mov eax, dword [ebp - 0x64]
mov dword [ebx + 0x407fd4], eax
mov eax, dword [ebp - 0x60]
mov dword [ebx + 0x407fd8], eax
mov eax, dword [ebp - 0x5c]
mov dword [ebx + 0x407fdc], eax
mov eax, dword [ebp - 0x58]
mov dword [ebx + 0x407fe0], eax
mov eax, dword [ebp - 0x54]
mov dword [ebx + 0x407fe4], eax
mov eax, dword [ebp - 0x50]
mov dword [ebx + 0x407fe8], eax
movzx eax, word [ebp - 0x20]
cmp eax, edx
jg 0x402240
mov dword [esp], esi
lea edi, [ebp - 0x6c]
call sub.cygwin1.dll_fclose
jmp 0x4018f9
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x402114
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x402114
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x402104
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x402104
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x401aa5
mov dword [esp + 4], edi
mov dword [esp], edx
call fcn.004011d0
jmp 0x401aa5
mov eax, dword [ebp - 0x7c]
mov dword [esp], str.Invalid_path__s_n
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
jmp 0x401d9f
mov ecx, 0xffffffff
lock xadd dword [eax - 4], ecx
test ecx, ecx
jg 0x4020e0
mov eax, dword [ebp - 0x98]
mov dword [esp], edx
mov dword [esp + 4], eax
call fcn.004011d0
jmp 0x4020e0
mov dword [esp], str.Kernel_and_ramdisk_must_be_specified....Error
call sub.cygwin1.dll_puts
call fcn.00402f70
nop
mov eax, dword [ebp - 0x6c]
mov dword [esp], str.Cannot_read_file__s_n
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
jmp 0x401cd2
mov eax, dword [ebp - 0x78]
mov dword [esp], str.Failed_to_open__s_n
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
jmp 0x401cd2
mov dword [esp], str.Output_path_must_be_specified....Error
call sub.cygwin1.dll_puts
call fcn.00402f70
mov ebx, eax
jmp 0x403080
mov eax, dword [ebp - 0x98]
lea edi, [ebp - 0x6c]
mov dword [esp], eax
call fcn.00402fe0
mov esi, edi
mov eax, dword [esi - 4]
sub esi, 4
lea ecx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
je 0x4030ac
mov edx, edi
mov eax, ecx
call fcn.00403050
cmp esi, dword [ebp - 0x90]
je 0x4030be
jmp 0x403093
mov eax, dword [ebp - 0x7c]
lea ecx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
je 0x4030d5
lea edx, [ebp - 0x6c]
mov eax, ecx
call fcn.00403050
mov esi, dword [ebp - 0xa8]
add esi, dword [ebp - 0xa4]
cmp esi, dword [ebp - 0xa4]
jne 0x40318c
mov dword [esp], ebx
call sub.cyggcc_s_1.dll__Unwind_Resume
mov eax, dword [ebp - 0x6c]
lea ecx, [eax - 0xc]
cmp eax, method.std::string.append_std::string_const_
je 0x4030be
mov edx, dword [ebp - 0x98]
mov eax, ecx
call fcn.00403050
jmp 0x4030be
sub esi, 0x14
mov dword [esp], esi
call fcn.00402fe0
jmp 0x4030e1