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

Disassembly:
push ebp
push edi
mov ecx, 5
push esi
push ebx
mov edi, str.boot
sub esp, 0xbc
mov esi, dword [esp + 0xd0]
mov ebx, dword [esp + 0xd4]
repe cmpsb byte [esi], byte es:[edi]
je 0x402290
mov esi, dword [esp + 0xd0]
mov edi, str.recovery
mov ecx, 9
repe cmpsb byte [esi], byte es:[edi]
mov esi, 1
seta dl
setb al
cmp dl, al
jne 0x4022c2
mov dword [esp + 4], 0
mov dword [esp], ebx
call sub.cygwin1.dll__open64
test eax, eax
mov ebp, eax
js 0x4022a0
mov eax, dword [esp + 0xd8]
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.cygwin1.dll__open64
test eax, eax
mov dword [esp + 0x20], eax
js 0x4022e0
mov eax, dword [esp + 0xdc]
mov dword [esp + 8], 0x1a4
mov dword [esp + 4], 0x601
mov dword [esp], eax
call sub.cygwin1.dll__open64
test eax, eax
mov dword [esp + 0x24], eax
js 0x402390
lea edi, [esp + 0x50]
mov dword [esp], ebp
mov dword [esp + 4], edi
call sub.cygwin1.dll__fstat64
test eax, eax
mov ebx, eax
jne 0x402310
mov eax, dword [esp + 0x78]
mov dword [esp + 0x14], 0
mov dword [esp + 0x18], 0
mov dword [esp + 0x10], ebp
mov dword [esp + 0xc], 2
mov dword [esp + 8], 1
add eax, 0xfff
mov dword [esp], 0
and eax, 0xfffff000
mov dword [esp + 4], eax
call sub.cygwin1.dll__mmap64
cmp eax, 0xffffffff
je 0x402430
mov ecx, dword [eax + 0xc]
mov edx, dword [esp + 0x78]
sub ecx, 0x28
mov dword [esp + 0x28], ecx
lea ecx, [eax + edx - 0x1000]
cmp eax, ecx
jae 0x4023f0
mov edx, eax
jmp 0x40212b
cmp dword [edx], 0xb08fb5f0
je 0x402330
cmp dword [edx], 0x41f0e92d
je 0x402349
cmp dword [edx], 0x4ff0e92d
je 0x402362
cmp dword [edx], 0x4ff0e92d
je 0x40237b
add edx, 1
cmp edx, ecx
je 0x4023c0
cmp dword [edx], 0xb08fb5f0
jne 0x4020f0
cmp dword [edx + 4], 0xf7f04606
jne 0x4020f0
mov dword [esp + 0x2c], edx
mov edx, dword [esp + 0x28]
sub edx, eax
add edx, dword [esp + 0x2c]
je 0x4023c0
cmp edx, dword [0x40308c]
je 0x402177
mov eax, 0x4030a4
mov ebx, 1
jmp 0x402173
add ebx, 1
add eax, 0x18
cmp ebx, 0x31
je 0x402410
cmp dword [eax], edx
jne 0x402164
lea eax, [ebx + ebx*2]
mov dword [esp], str.___Detected_target__s__s_build__s_n
shl eax, 3
mov edx, dword [eax + 0x403088]
lea ecx, [eax + 0x403080]
mov dword [esp + 0x2c], ecx
mov dword [esp + 0xc], edx
mov edx, dword [eax + 0x403084]
mov eax, dword [eax + 0x403080]
mov dword [esp + 8], edx
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
mov eax, dword [esp + 0x20]
mov dword [esp + 4], edi
mov dword [esp], eax
call sub.cygwin1.dll__fstat64
test eax, eax
mov ecx, dword [esp + 0x2c]
jne 0x402310
mov eax, dword [esp + 0x20]
mov dword [esp + 0x14], 0
mov dword [esp + 0x18], 0
mov dword [esp + 0xc], 2
mov dword [esp + 8], 3
mov dword [esp], 0
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x78]
mov dword [esp + 0x30], ecx
add eax, 0x2fff
and eax, 0xfffff000
mov dword [esp + 4], eax
call sub.cygwin1.dll__mmap64
cmp eax, 0xffffffff
mov dword [esp + 0x2c], eax
mov ecx, dword [esp + 0x30]
je 0x4025ca
cmp dword [eax + 0x400], 0x494b4f4c
mov edi, eax
jne 0x402450
mov dword [esp], str.____Input_file_is_already_a_Loki_image.
call sub.cygwin1.dll_puts
mov eax, dword [esp + 0x78]
mov dword [esp + 4], edi
mov dword [esp + 8], eax
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sub.cygwin1.dll_write
mov edx, dword [esp + 0x7c]
mov ebx, eax
xor eax, dword [esp + 0x78]
sar ebx, 0x1f
xor edx, ebx
or edx, eax
je 0x4025e0
mov dword [esp], 0x404490
mov edi, 1
call sub.cygwin1.dll_puts
jmp 0x4022b5
xor esi, esi
jmp 0x402000
mov dword [esp + 4], ebx
mov dword [esp], 0x404350
mov edi, 1
call sub.cygwin1.dll_printf
add esp, 0xbc
mov eax, edi
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], str.___First_argument_must_be__boot__or__recovery_.
mov edi, 1
call sub.cygwin1.dll_puts
add esp, 0xbc
mov eax, edi
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esp + 0xd8]
mov dword [esp], 0x404350
mov edi, 1
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
add esp, 0xbc
mov eax, edi
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], 0x404398
mov edi, 1
call sub.cygwin1.dll_puts
add esp, 0xbc
mov eax, edi
pop ebx
pop esi
pop edi
pop ebp
ret
cmp dword [edx + 4], 0xf7f04607
je 0x40213c
cmp dword [edx], 0x41f0e92d
jne 0x402108
cmp dword [edx + 4], 0xf7f1b086
je 0x40213c
cmp dword [edx], 0x4ff0e92d
jne 0x402114
cmp dword [edx + 4], 0x6dc6f5ad
je 0x40213c
cmp dword [edx], 0x4ff0e92d
jne 0x402120
cmp dword [edx + 4], 0x7d21f5ad
jne 0x402120
jmp 0x40213c
mov eax, dword [esp + 0xdc]
mov dword [esp], 0x404374
mov edi, 1
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
add esp, 0xbc
mov eax, edi
pop ebx
pop esi
pop edi
pop ebp
ret
mov edx, eax
jmp 0x4023cb
add edx, 1
cmp edx, ecx
jae 0x4023f0
cmp dword [edx], 0x4ff0e92d
jne 0x4023c4
cmp dword [edx + 4], 0x4605b0f3
jne 0x4023c4
mov ecx, dword [esp + 0x28]
sub ecx, eax
add edx, ecx
jne 0x402150
lea esi, [esi]
mov dword [esp], str.____Failed_to_find_function_to_patch.
mov edi, 1
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov dword [esp], str.____Unsupported_aboot_image.
mov edi, 1
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov dword [esp], 0x4043ac
mov edi, 1
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov dword [eax + 0x404], esi
mov dword [eax + 0x400], 0x494b4f4c
mov dword [esp + 8], 0x7f
mov eax, dword [ecx + 8]
mov dword [esp + 0x44], ecx
mov dword [esp + 4], eax
lea eax, [edi + 0x408]
mov dword [esp], eax
call sub.cygwin1.dll_strncpy
mov eax, edi
mov edi, dword [edi + 0x24]
mov ecx, dword [eax + 8]
mov edx, dword [eax + 0x10]
lea esi, [edi - 1]
mov dword [esp + 0x30], edi
neg edi
mov dword [esp + 0x38], ecx
mov dword [esp + 0x3c], edx
mov dword [esp + 0x34], esi
mov esi, eax
mov eax, dword [eax + 0xc]
mov dword [esp], str.___Original_kernel_address:__.08x_n
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
mov eax, dword [esi + 0x14]
mov dword [esp], str.___Original_ramdisk_address:__.08x_n
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
mov eax, dword [esp + 0x34]
add eax, dword [esi + 8]
mov ecx, dword [esp + 0x38]
mov edx, dword [esp + 0x3c]
mov dword [esp + 0x4c], edi
and eax, edi
mov dword [esi + 0x488], ecx
mov ecx, dword [esp + 0x44]
mov dword [esp + 0x48], eax
add eax, dword [esi + 0xc]
xor edi, edi
mov dword [esi + 0x48c], edx
mov dword [esp + 0x44], ebp
xor edx, edx
mov dword [esi + 0x490], eax
mov eax, dword [esi + 0x14]
mov esi, dword [ecx + 0x10]
mov dword [esp + 0x40], eax
mov ebp, dword [esp + 0x40]
xor eax, eax
mov ecx, dword [edx + 0x403020]
cmp ecx, 0xffffffff
jne 0x40252b
mov dword [edx + 0x403020], esi
mov ecx, esi
mov edi, 1
cmp ecx, 0xeeeeeeee
jne 0x40253e
mov dword [edx + 0x403020], ebp
mov eax, 1
add edx, 1
cmp edx, 0x41
jne 0x402513
and edi, eax
mov ebp, dword [esp + 0x44]
je 0x4025fe
mov ecx, dword [esp + 0x2c]
mov eax, dword [esp + 0x48]
add eax, dword [ecx + 0x10]
mov dword [ecx + 8], eax
lea eax, [ebx + ebx*2]
lea edx, [eax*8 + 0x403080]
mov eax, dword [edx + 0xc]
mov esi, eax
and esi, 0xf
sub eax, esi
mov dword [esp + 0x44], esi
mov dword [ecx + 0x14], eax
mov eax, dword [edx + 0x14]
mov edx, 0x200
mov esi, edx
mov edx, dword [esp + 0x30]
test eax, eax
mov eax, 0
cmovne eax, dword [esp + 0x30]
cmovne esi, edx
mov dword [esp + 0x40], esi
mov esi, edx
mov dword [ecx + 0x10], eax
mov eax, dword [esp + 0x24]
mov dword [esp + 8], edx
mov dword [esp + 4], ecx
mov dword [esp], eax
call sub.cygwin1.dll_write
cmp eax, esi
je 0x402614
mov dword [esp], 0x40453c
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov dword [esp], 0x404448
mov edi, 1
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov eax, dword [esp + 0xdc]
mov dword [esp], 0x4044af
xor edi, edi
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
jmp 0x4022b5
mov dword [esp], str.____Failed_to_patch_shellcode.
mov edi, 1
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov eax, dword [esp + 0x38]
add eax, dword [esp + 0x34]
and eax, dword [esp + 0x4c]
mov dword [esp + 8], eax
mov dword [esp + 0x38], eax
mov eax, dword [esp + 0x2c]
add eax, dword [esp + 0x30]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sub.cygwin1.dll_write
mov edx, dword [esp + 0x38]
cmp eax, edx
je 0x402659
mov dword [esp], 0x404568
call sub.cygwin1.dll_puts
jmp 0x4022b5
add eax, dword [esp + 0x30]
mov esi, dword [esp + 0x2c]
mov edx, dword [esp + 0x34]
add edx, dword [esp + 0x3c]
and edx, dword [esp + 0x4c]
add esi, eax
mov dword [esp + 0x30], eax
mov eax, dword [esp + 0x24]
mov dword [esp + 4], esi
mov dword [esp + 8], edx
mov dword [esp + 0x38], edx
mov dword [esp], eax
call sub.cygwin1.dll_write
mov edx, dword [esp + 0x38]
mov dword [esp + 0x34], eax
cmp eax, edx
je 0x4026a8
mov dword [esp], 0x404594
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov eax, dword [esp + 0x40]
mov dword [esp], eax
call sub.cygwin1.dll_malloc
test eax, eax
je 0x402732
imul ebx, ebx, 0x18
mov dword [esp + 0x38], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp], ebp
mov eax, dword [ebx + 0x40308c]
sub eax, dword [esp + 0x28]
sub eax, dword [esp + 0x44]
mov dword [esp + 4], eax
call sub.cygwin1.dll__lseek64
mov ebx, dword [esp + 0x40]
mov ecx, dword [esp + 0x38]
mov dword [esp], ebp
mov dword [esp + 4], ecx
mov dword [esp + 8], ebx
mov dword [esp + 0x28], ecx
call sub.cygwin1.dll_read
mov ecx, dword [esp + 0x28]
mov eax, dword [esp + 0x24]
mov dword [esp + 8], ebx
mov dword [esp + 4], ecx
mov dword [esp], eax
call sub.cygwin1.dll_write
cmp eax, ebx
je 0x402743
mov dword [esp], str.____Failed_to_write_original_aboot_code_to_output_file.
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov dword [esp], str.____Out_of_memory.
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov eax, dword [esp + 0x24]
mov dword [esp + 0xc], 1
mov dword [esp + 4], 0
mov dword [esp + 8], 0
mov dword [esp], eax
call sub.cygwin1.dll__lseek64
mov esi, dword [esp + 0x2c]
mov ebx, eax
cmp dword [esi + 0x28], 0
je 0x4027a7
mov dword [esp], 0x40460c
call sub.cygwin1.dll_puts
mov ecx, dword [esp + 0x30]
add ecx, dword [esp + 0x34]
mov eax, dword [esi + 0x28]
mov dword [esp + 8], eax
mov eax, ecx
add eax, esi
mov dword [esp + 4], eax
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sub.cygwin1.dll_write
cmp eax, dword [esi + 0x28]
jne 0x4027fe
mov edx, dword [esp + 0x40]
sub edx, dword [esp + 0x44]
mov dword [esp + 0xc], 0
sub ebx, edx
mov dword [esp + 4], ebx
sar ebx, 0x1f
mov dword [esp + 8], ebx
mov ebx, dword [esp + 0x24]
mov dword [esp], ebx
call sub.cygwin1.dll__lseek64
mov dword [esp + 8], 0x41
mov dword [esp + 4], 0x403020
mov dword [esp], ebx
call sub.cygwin1.dll_write
cmp eax, 0x41
je 0x40280f
mov dword [esp], str.____Failed_to_write_patch_to_output_file.
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov dword [esp], 0x404628
call sub.cygwin1.dll_puts
jmp 0x4022b5
mov eax, dword [esp + 0x20]
xor edi, edi
mov dword [esp], eax
call sub.cygwin1.dll_close
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call sub.cygwin1.dll_close
mov dword [esp], ebp
call sub.cygwin1.dll_close
mov eax, dword [esp + 0xdc]
mov dword [esp], 0x404684
mov dword [esp + 4], eax
call sub.cygwin1.dll_printf
jmp 0x4022b5