Function at 0x406d90
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x34
mov eax, dword [0x440068]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
push ebx
mov ebx, dword [ebp + 8]
push esi
cmp dword [eax + 0x14], 8
push edi
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0x28], 0
jb 0x406dbb
mov eax, dword [eax]
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, eax
mov dword [ebp - 0x24], ecx
cmp ecx, 0xffffffff
jne 0x406df7
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00415024
mov esp, ebp
pop ebp
ret 8
mov eax, dword [ebx + 4]
xor esi, esi
push esi
mov dword [ebp - 0x2c], eax
lea eax, [ebp - 0x1c]
push eax
push 2
lea eax, [ebp - 0x18]
mov dword [ebp - 0x18], esi
push eax
push ecx
mov dword [ebp - 0x1c], esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x406e29
call edi
mov esi, eax
test esi, esi
jne 0x406e33
cmp dword [ebp - 0x1c], 2
je 0x406e33
call edi
mov esi, eax
mov dword [ebp - 0x18], 1
test esi, esi
jne 0x406e68
push esi
lea eax, [ebp - 0x1c]
push eax
push 2
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x406e5e
call edi
mov esi, eax
test esi, esi
jne 0x406e68
cmp dword [ebp - 0x1c], 2
je 0x406e68
call edi
mov esi, eax
mov eax, dword [ebp - 0x2c]
movzx eax, ax
mov dword [ebp - 0x18], eax
test esi, esi
jne 0x406e9f
push esi
lea eax, [ebp - 0x1c]
push eax
push 2
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x406e95
call edi
mov esi, eax
test esi, esi
jne 0x406e9f
cmp dword [ebp - 0x1c], 2
je 0x406e9f
call edi
mov esi, eax
xor eax, eax
mov dword [ebp - 0x18], eax
test esi, esi
jne 0x406fa7
lea ecx, [ebx + 0xc]
mov dword [ebp - 0x1c], ecx
jmp 0x406eb7
mov ebx, dword [ebp - 0x20]
mov ebx, dword [ebx + 4]
cmp eax, ebx
jae 0x406fa7
movzx eax, byte [ecx - 4]
mov byte [ebp - 0x14], al
movzx eax, byte [ecx]
mov byte [ebp - 0x13], al
mov eax, dword [ecx + 0x10]
mov byte [ebp - 0x11], 0
movzx ecx, word [eax + 0xc]
mov word [ebp - 0x10], cx
movzx eax, word [eax + 0xe]
mov edx, eax
mov word [ebp - 0xe], ax
imul edx, ecx
cmp edx, 8
jl 0x406ef6
mov byte [ebp - 0x12], 0
jmp 0x406eff
mov al, 1
mov ecx, edx
shl al, cl
mov byte [ebp - 0x12], al
mov eax, dword [ebp - 0x1c]
xor edx, edx
mov ecx, dword [ebp - 0x18]
xor edi, edi
shl ebx, 4
add ebx, 6
mov eax, dword [eax + 0xc]
mov dword [ebp - 0xc], eax
xor eax, eax
mov dword [ebp - 0x2c], ebx
cmp ecx, 2
jb 0x406f48
mov eax, dword [ebp - 0x20]
add ecx, 0xfffffffe
shr ecx, 1
add eax, 0x38
inc ecx
lea ebx, [ecx + ecx]
mov dword [ebp - 0x30], ebx
mov ebx, dword [ebp - 0x2c]
add edx, dword [eax - 0x20]
lea eax, [eax + 0x40]
add edi, dword [eax - 0x40]
sub ecx, 1
jne 0x406f34
mov ecx, dword [ebp - 0x18]
mov eax, dword [ebp - 0x30]
cmp eax, ecx
jae 0x406f56
mov ecx, dword [ebp - 0x20]
shl eax, 5
add ebx, dword [eax + ecx + 0x18]
lea eax, [edi + edx]
add eax, ebx
push 0
mov dword [ebp - 8], eax
lea eax, [ebp - 0x28]
push eax
push 0x10
lea eax, [ebp - 0x14]
push eax
push dword [ebp - 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x406f81
call edi
mov esi, eax
test esi, esi
jne 0x406f8f
cmp dword [ebp - 0x28], 0x10
je 0x406f8f
call edi
mov esi, eax
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x1c]
inc eax
add ecx, 0x20
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x1c], ecx
test esi, esi
je 0x406eb4
xor ebx, ebx
test esi, esi
jne 0x407012
mov eax, dword [ebp - 0x20]
lea edi, [eax + 0x18]
cmp ebx, dword [eax + 4]
jae 0x407012
mov eax, dword [edi + 4]
mov ecx, dword [eax + 0x14]
mov dword [ebp - 0x18], ecx
mov dword [eax + 0x14], 0
test esi, esi
jne 0x407001
push esi
lea eax, [ebp - 0x28]
push eax
push dword [edi]
push dword [edi - 4]
push dword [ebp - 0x24]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x406fef
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
test esi, esi
jne 0x406ffe
mov eax, dword [ebp - 0x28]
cmp eax, dword [edi]
je 0x406ffe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
mov ecx, dword [ebp - 0x18]
mov eax, dword [edi + 4]
inc ebx
add edi, 0x20
mov dword [eax + 0x14], ecx
mov eax, dword [ebp - 0x20]
test esi, esi
je 0x406fb3
mov eax, dword [ebp - 0x24]
test eax, eax
je 0x407020
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 4]
mov eax, esi
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00415024
mov esp, ebp
pop ebp
ret 8