Function at 0x477880
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x18
push ebx
mov ebx, ecx
push esi
push edi
xor edi, edi
mov dword [ebp - 0x10], ebx
mov eax, dword [ebx]
mov dword [ebp - 0x14], edi
mov dword [ebp - 0xc], edi
cmp eax, ebx
je 0x477920
mov ecx, dword [eax + 0x10]
lea edx, [eax]
mov eax, dword [eax]
mov dword [ebp - 8], eax
lea esi, [ecx + 2]
nop dword [eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4778b0
sub ecx, esi
lea eax, [edx + 8]
mov esi, dword [eax]
add edi, 4
sar ecx, 1
add edi, ecx
mov dword [ebp - 0x14], eax
cmp esi, eax
je 0x477913
mov eax, dword [esi + 0xc]
lea edx, [esi]
mov esi, dword [esi]
xor ecx, ecx
test eax, eax
je 0x477909
mov edx, dword [edx + 8]
lea ebx, [edx + 2]
mov cx, word [edx]
add edx, 2
test cx, cx
jne 0x4778e3
sub edx, ebx
lea ebx, [eax + 2]
sar edx, 1
mov cx, word [eax]
add eax, 2
test cx, cx
jne 0x4778f5
sub eax, ebx
sar eax, 1
lea ecx, [eax + 3]
add ecx, edx
add edi, ecx
cmp esi, dword [ebp - 0x14]
jne 0x4778d0
mov ebx, dword [ebp - 0x10]
mov eax, dword [ebp - 8]
add edi, 2
cmp eax, ebx
jne 0x4778a0
mov dword [ebp - 0x14], edi
xor ecx, ecx
lea esi, [edi + 2]
mov eax, esi
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0047d5a7
mov edx, eax
add esp, 4
mov dword [ebp - 4], edx
mov ecx, edx
mov dword [ebp - 8], ecx
test edx, edx
jne 0x477956
pop edi
pop esi
lea eax, [edx + 8]
pop ebx
mov esp, ebp
pop ebp
ret
lea eax, [edx + esi*2]
mov dword [ebp - 0x18], eax
mov eax, dword [ebx]
cmp eax, ebx
je 0x4779ef
mov edi, dword [ebp - 0x18]
nop dword [eax]
push dword [eax + 0x10]
lea esi, [eax]
mov eax, dword [eax]
push str.__s__r_n
mov dword [ebp - 0x18], eax
lea eax, [ebp - 8]
push 0
push 0
push eax
mov eax, edi
sub eax, edx
sar eax, 1
push eax
push ecx
call fcn.00401c00
lea ebx, [esi + 8]
add esp, 0x1c
mov esi, dword [ebx]
cmp esi, ebx
je 0x4779d3
mov ecx, dword [esi + 0xc]
lea eax, [esi]
mov esi, dword [esi]
test ecx, ecx
je 0x4779cf
push ecx
push dword [eax + 8]
mov ecx, dword [ebp - 8]
lea eax, [ebp - 8]
push str._s_s_r_n
push 0
push 0
push eax
mov eax, edi
sub eax, ecx
sar eax, 1
push eax
push ecx
call fcn.00401c00
add esp, 0x20
cmp esi, ebx
jne 0x4779a0
mov eax, dword [ebp - 8]
lea ecx, [eax + 4]
mov dword [eax], 0xa000d
mov eax, dword [ebp - 0x18]
mov edx, ecx
mov dword [ebp - 8], ecx
cmp eax, dword [ebp - 0x10]
jne 0x477970
mov edi, dword [ebp - 0x14]
lea ebx, [edi + edi]
lea eax, [ebx + 3]
push eax
mov dword [ebp - 0x14], eax
call fcn.0047d5a7
mov esi, eax
add esp, 4
test esi, esi
je case.default.0x477a1a
mov ecx, dword [ebp - 0x10]
mov eax, dword [ecx + 0xc]
cmp eax, 3
ja case.default.0x477a1a
jmp dword [eax*4 + 0x477b08]
mov ebx, dword [ebp - 4]
push 0
push 0
push dword [ebp - 0x14]
push esi
push edi
push ebx
push 0x200
push 0
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov dword [ebp - 0xc], edi
jmp 0x477aa0
mov ebx, dword [ebp - 4]
lea eax, [esi + 3]
push 0
push 0
push dword [ebp - 0x14]
push eax
push edi
push ebx
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
add eax, 3
mov word [esi], 0xbbef
mov dword [ebp - 0xc], eax
mov byte [esi + 2], 0xbf
jmp 0x477aa0
push ebx
push dword [ebp - 4]
lea eax, [esi + 2]
push eax
call fcn.00477cf0
mov word [esi], 0xfffe
jmp 0x477a97
push ebx
push dword [ebp - 4]
lea eax, [esi + 2]
push eax
call fcn.0047efe0
add esp, 0xc
mov word [esi], 0xfeff
lea eax, [ebx + 2]
mov dword [ebp - 0xc], eax
mov ebx, dword [ebp - 4]
mov eax, dword [ebp - 0x10]
push 0
push 0
push 2
push 0
push 0
push 0x40000000
push dword [eax + 8]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x477ade
push 0
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0xc]
push esi
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor edi, edi
jmp 0x477ae6
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
cmp esi, ebx
je 0x477af3
push esi
call fcn.00457d90
add esp, 4
push ebx
call fcn.00457d90
add esp, 4
mov eax, edi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret