Function at 0x40309f
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x1038
call fcn.0040a790
mov edx, dword [0x412b48]
and dword [ebp - 0x20], 0
push ebx
xor ebx, ebx
and dword [ebp - 4], ebx
push esi
mov esi, dword [0x412b40]
xor eax, eax
xor ecx, ecx
mov dword [ebp - 8], ebx
mov bl, byte [edx]
push edi
mov dword [ebp - 0x34], esi
mov dword [ebp - 0xc], edx
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x10], ecx
cmp dword [str.lmi_rescue.exe], eax
je 0x40310d
mov eax, 0x411da0
push str.HEADER
push dword [eax]
call dword [sym.imp.KERNEL32.dll_lstrcmpA]
mov ecx, dword [ebp - 0x10]
test eax, eax
je 0x40310a
inc ecx
mov dword [ebp - 0x10], ecx
lea eax, [ecx*4 + 0x411da0]
cmp dword [eax], 0
jne 0x4030e6
mov edx, dword [ebp - 0xc]
cmp esi, 0xd
mov esi, dword [sym.imp.KERNEL32.dll_SetLastError]
jb 0x403348
mov edi, dword [edx + 5]
shl ecx, 2
mov dword [ebp - 0x24], ecx
cmp edi, 0xffffffff
je 0x403348
cmp edi, ecx
jb 0x403348
push edi
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [ebp - 8], eax
test eax, eax
jne 0x403154
push 0xe
jmp 0x40334a
cmp bl, 0xe1
jae 0x403348
and dword [ebp - 0x30], 0
cmp bl, 0x2d
jb 0x40317a
xor ah, ah
mov al, bl
mov cl, 0x2d
div cl
movzx eax, al
mov dword [ebp - 0x30], eax
add bl, 0xd3
dec eax
jne 0x403174
xor ecx, ecx
mov dword [ebp - 0x14], ecx
cmp bl, 9
jb 0x40319a
xor ah, ah
mov al, bl
mov cl, 9
div cl
movzx eax, al
mov ecx, eax
mov dword [ebp - 0x14], eax
add bl, 0xf7
dec eax
jne 0x403194
movzx eax, bl
mov dword [ebp - 0x38], eax
add ecx, eax
mov eax, 0x300
shl eax, cl
lea eax, [eax*2 + 0xe6c]
push eax
push 0
mov dword [ebp - 0x2c], eax
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
mov dword [ebp - 4], ebx
test ebx, ebx
jne 0x4031d5
push 0xe
call esi
jmp 0x40334f
mov ebx, dword [ebp - 8]
mov edx, dword [ebp - 0x2c]
lea eax, [ebp - 0x18]
push eax
mov eax, dword [ebp - 0x34]
push edi
push ebx
mov ebx, dword [ebp - 4]
add eax, 0xfffffff3
push eax
mov eax, dword [ebp - 0xc]
add eax, 0xd
push eax
push dword [ebp - 0x30]
mov ecx, ebx
push dword [ebp - 0x14]
push dword [ebp - 0x38]
call fcn.0040221a
add esp, 0x20
test eax, eax
jne 0x403341
cmp dword [ebp - 0x18], edi
jne 0x403341
mov ecx, dword [ebp - 8]
test dword [ecx], 0x80000000
je 0x40323e
cmp dword [ecx], 0x80000001
jne 0x403341
push ecx
mov edx, edi
call fcn.00402f9f
pop ecx
mov dword [ebp - 0x20], eax
jmp 0x40334f
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x403341
and dword [ebp - 0xc], 0
mov edx, dword [ebp - 0x24]
test eax, eax
je 0x403314
mov ebx, dword [ebp - 8]
mov eax, dword [ebp - 0xc]
sub ecx, 0x411da0
mov dword [ebp - 0x2c], ecx
mov ecx, dword [ecx + eax*4 + 0x411da0]
mov dword [ebp - 0x14], ecx
add ecx, edx
mov dword [ebp - 0x18], ecx
cmp ecx, edi
ja 0x403348
push dword [eax*4 + 0x411da0]
lea eax, [ebp - 0x1038]
push eax
mov byte [ebp - 0x1038], 0
call dword [sym.imp.KERNEL32.dll_lstrcatA]
push 0
push 0x8000080
push 2
push 0
push 1
push 0x40000000
lea eax, [ebp - 0x1038]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x1c], eax
cmp eax, 0xffffffff
je 0x40334c
push 0
lea ecx, [ebp - 0x28]
push ecx
push dword [ebp - 0x14]
mov ecx, dword [ebp - 0x24]
add ecx, ebx
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40334c
mov eax, dword [ebp - 0x14]
cmp dword [ebp - 0x28], eax
jne 0x40334c
mov eax, dword [ebp - 0x1c]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov edx, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x2c]
xor eax, eax
mov dword [ebp - 0x1c], eax
mov eax, dword [ebp - 0xc]
inc eax
mov dword [ebp - 0x24], edx
mov dword [ebp - 0xc], eax
cmp eax, dword [ebp - 0x10]
jb 0x403267
mov ecx, dword [ebp - 8]
mov ebx, dword [ebp - 4]
lea eax, [edx + 0x10]
cmp eax, edi
jae 0x403334
add ecx, edx
test dword [ecx], 0x80000000
je 0x403334
cmp dword [ecx], 0x80000001
jne 0x403341
sub edi, edx
jmp 0x40322d
cmp edx, edi
jne 0x403341
mov dword [ebp - 0x20], 1
jmp 0x40334f
push 0xd
jmp 0x4031ce
push 0xd
call esi
mov ebx, dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, dword [sym.imp.KERNEL32.dll_HeapFree]
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 8]
test eax, eax
je 0x403371
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call edi
test ebx, ebx
je 0x403381
push ebx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call edi
mov eax, dword [ebp - 0x1c]
test eax, eax
je 0x403394
cmp eax, 0xffffffff
je 0x403394
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x28]
call esi
mov eax, dword [ebp - 0x20]
pop edi
pop esi
pop ebx
leave
ret