Function at 0x12a7570
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 8
push ebx
push esi
mov esi, dword [ebp + 0x10]
push edi
test esi, esi
je 0x12a75c2
mov ebx, dword [ebp + 8]
mov dword [ebp - 4], 0
cmp ebx, 0xffffffff
je 0x12a7593
mov eax, ebx
jmp 0x12a7596
or eax, 0xffffffff
mov edi, dword [ebp + 0xc]
lea ecx, [ebp - 4]
push 0
push ecx
push esi
push edi
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x12a7659
mov ecx, dword [ebp + 0x14]
mov eax, dword [ebp - 4]
test ecx, ecx
je 0x12a75cb
cmp eax, esi
jbe 0x12a75c0
mov eax, esi
mov dword [ecx], eax
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp eax, esi
jae 0x12a75c2
nop
mov ecx, esi
mov dword [ebp - 8], 0
sub ecx, eax
lea edx, [eax + edi]
cmp ebx, 0xffffffff
je 0x12a75e7
mov eax, ebx
jmp 0x12a75ea
or eax, 0xffffffff
push 0
lea esi, [ebp - 8]
push esi
push ecx
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, dword [ebp + 0x10]
test eax, eax
je 0x12a7620
mov ecx, dword [ebp - 8]
test ecx, ecx
je 0x12a7730
mov eax, dword [ebp - 4]
add eax, ecx
mov dword [ebp - 4], eax
cmp eax, esi
jb 0x12a75d0
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.0128c1e0
add esp, 4
cmp eax, 0xffffff68
jne 0x12a75c4
push ebx
call fcn.012af9a0
xor ecx, ecx
sub esi, dword [ebp - 4]
sbb ecx, ecx
add eax, esi
adc edx, ecx
push edx
push eax
push ebx
call fcn.012a6990
add esp, 0x10
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 8
jne 0x12a774d
mov ebx, esi
xor eax, eax
shr ebx, 1
mov dword [ebp - 4], eax
cmp ebx, 0x8000
jbe 0x12a7680
mov ebx, 0x8000
jmp 0x12a7690
add ebx, 0xff
and ebx, 0xffffff00
lea esp, [esp]
mov edi, esi
sub edi, eax
cmp ebx, edi
ja 0x12a769a
mov edi, ebx
mov ecx, dword [ebp + 0xc]
add ecx, eax
mov dword [ebp - 8], 0
mov eax, dword [ebp + 8]
cmp eax, 0xffffffff
jne 0x12a76b0
or eax, eax
push 0
lea edx, [ebp - 8]
push edx
push edi
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x12a76d9
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 8
jne 0x12a76fc
cmp ebx, eax
jbe 0x12a76fc
mov eax, dword [ebp - 4]
shr ebx, 1
jmp 0x12a76ef
mov eax, dword [ebp - 4]
mov ecx, dword [ebp - 8]
add eax, ecx
mov edx, dword [ebp + 0x14]
mov dword [ebp - 4], eax
test edx, edx
jne 0x12a773c
test ecx, ecx
je 0x12a7730
cmp eax, esi
jb 0x12a7690
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
push eax
call fcn.0128c1e0
add esp, 4
cmp eax, 0xffffff68
jne 0x12a75c4
mov esi, dword [ebp + 8]
push esi
call fcn.012af9a0
add eax, edi
adc edx, 0
push edx
push eax
push esi
call fcn.012a6990
add esp, 0x10
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov eax, 0xffffff90
pop ebx
mov esp, ebp
pop ebp
ret
cmp eax, esi
jbe 0x12a7742
mov eax, esi
pop edi
pop esi
mov dword [edx], eax
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
push eax
call fcn.0128c1e0
add esp, 4
cmp eax, 0xffffff68
jne 0x12a75c4
push ebx
call fcn.012af9a0
add eax, esi
adc edx, 0
push edx
push eax
push ebx
call fcn.012a6990
add esp, 0x10
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret