Function at 0x405850
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x78
mov eax, dword [0x45d074]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
push edi
lea ecx, [ebp - 0x60]
push ecx
lea edi, [ebp - 0x5c]
lea ebx, [ebp - 0x70]
mov dword [ebp - 0x50], 0xffffffff
call fcn.004057d0
mov bl, byte [ebp - 0x70]
add esp, 4
test bl, bl
je 0x40588f
cmp dword [ebp - 0x6c], 1
jl 0x405b17
call dword [sym.imp.MSVCR100.dll__errno]
mov edx, dword [eax]
mov eax, dword [0x45c2b8]
mov dword [ebp - 0x64], edx
test eax, eax
jle 0x405b17
push esi
cmp eax, 1
jne 0x405918
push 0
call dword [sym.imp.MSVCR100.dll__time64]
mov ecx, dword [ebp - 0x5c]
add esp, 4
mov dword [ebp - 0x58], eax
mov dword [ebp - 0x54], edx
test ecx, ecx
je 0x4058f4
mov esi, dword [ecx + 8]
mov edi, dword [ecx + 0xc]
mov ebx, esi
and ebx, edi
cmp ebx, 0xffffffff
je 0x4058f1
cmp eax, esi
jne 0x4058e0
cmp edx, edi
je 0x405b16
mov bl, byte [ebp - 0x70]
mov dword [ecx + 8], eax
mov eax, dword [ebp - 0x54]
mov dword [ecx + 0xc], eax
jmp 0x4059c6
mov bl, byte [ebp - 0x70]
cmp eax, dword [0x468de8]
jne 0x405908
cmp edx, dword [0x468dec]
je 0x405b16
mov dword [0x468de8], eax
mov dword [0x468dec], edx
jmp 0x4059c6
lea ecx, [ebp - 0x78]
push ecx
lea edx, [ebp - 0x4c]
push edx
call fcn.00407ab0
add esp, 8
test eax, eax
jne 0x405b16
mov eax, 0xf4240
cdq
idiv dword [0x45c2b8]
mov edi, eax
cmp eax, 0x186a0
jg 0x40594a
mov edi, 0x186a0
mov eax, dword [ebp - 0x5c]
test eax, eax
je 0x40597f
mov ecx, dword [eax + 0x10]
cmp ecx, 0xffffffff
je 0x40597f
mov edx, dword [ebp - 0x4c]
cmp edx, ecx
jne 0x40596e
mov ecx, dword [ebp - 0x48]
sub ecx, dword [eax + 0x14]
cmp ecx, edi
jl 0x405b16
mov dword [eax + 0x10], edx
mov edx, dword [ebp - 0x48]
mov dword [eax + 0x14], edx
mov ecx, dword [ebp - 0x48]
mov esi, dword [ebp - 0x4c]
jmp 0x4059a9
mov esi, dword [ebp - 0x4c]
mov ecx, dword [ebp - 0x48]
cmp esi, dword [0x46d6f0]
jne 0x40599d
mov eax, ecx
sub eax, dword [0x46d6f4]
cmp eax, edi
jl 0x405b16
mov dword [0x46d6f0], esi
mov dword [0x46d6f4], ecx
mov eax, 0x10624dd3
imul ecx
sar edx, 6
mov eax, edx
shr eax, 0x1f
add eax, edx
mov dword [ebp - 0x50], eax
mov eax, esi
cdq
mov dword [ebp - 0x58], eax
mov dword [ebp - 0x54], edx
cmp byte [0x46d75b], 0
jne 0x405b16
lea ecx, [ebp - 0x58]
push ecx
mov byte [0x46d75b], 1
call fcn.004079b0
add esp, 4
cmp dword [0x46d6f8], 1
mov esi, eax
mov byte [0x46d75b], 0
mov edi, 0x468df0
jne 0x405a20
test bl, bl
je 0x405a95
mov byte [0x468df0], bl
mov word [0x468df1], 0x2020
mov byte [0x468df3], 0xa
mov edi, 0x468df4
test bl, bl
je 0x405a2d
mov byte [edi], bl
mov byte [edi + 1], 0x20
add edi, 2
test byte [ebp + 0xc], 2
je 0x405a3c
mov eax, edi
call fcn.004053f0
add edi, eax
mov ebx, 0x46adef
sub ebx, edi
cmp dword [ebp - 0x50], 0xffffffff
mov byte [edi], 0
push esi
je 0x405aa3
push str._a__b__d__H:_M:_S
lea edx, [ebp - 0x44]
push 0x40
push edx
call dword [sym.imp.MSVCR100.dll_strftime]
add esp, 0x10
test eax, eax
jle 0x405b0b
cmp dword [esi + 0xc], 0xa
jge 0x405a73
mov byte [ebp - 0x3c], 0x20
mov eax, dword [esi + 0x14]
mov ecx, dword [ebp - 0x50]
add eax, 0x76c
push eax
push ecx
lea edx, [ebp - 0x44]
push edx
push str._.24s:_03ld__4.4d_n
push ebx
push edi
call fcn.00407340
add esp, 0x18
jmp 0x405ab9
mov byte [0x468df0], 0xa
mov edi, 0x468df1
jmp 0x405a2d
call dword [sym.imp.MSVCR100.dll_asctime]
push eax
push str._.24s_n
push ebx
push edi
call fcn.00407340
add esp, 0x14
test eax, eax
jle 0x405b0b
mov ecx, dword [0x46d75c]
mov esi, dword [ebp - 0x60]
sub edi, 0x468df0
add eax, edi
test ecx, ecx
je 0x405ae6
mov edx, dword [0x46d760]
push edx
push eax
push 0x468df0
call ecx
add esp, 0xc
jmp 0x405af8
push esi
push 1
push eax
push 0x468df0
call dword [sym.imp.MSVCR100.dll_fwrite]
add esp, 0x10
cmp dword [0x46d75c], 0
jne 0x405b0b
push esi
call dword [sym.imp.MSVCR100.dll_fflush]
add esp, 4
call dword [sym.imp.MSVCR100.dll__errno]
mov ecx, dword [ebp - 0x64]
mov dword [eax], ecx
pop esi
mov ecx, dword [ebp - 4]
pop edi
xor ecx, ebp
pop ebx
call fcn.0040981a
mov esp, ebp
pop ebp
ret