Function at 0x497640
Capabilities:
Write file on windows

Disassembly:
mov eax, 0x4238
call fcn.004a1600
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x4258]
mov ebp, ecx
cmp edi, 3
je 0x497680
cmp edi, 2
je 0x497755
cmp edi, 1
je 0x497755
pop edi
pop esi
pop ebp
mov eax, 0x10000
pop ebx
add esp, 0x4238
ret 0x10
mov eax, dword [ebp + 4]
mov esi, dword [esp + 0x424c]
cmp esi, eax
je 0x4976f6
cmp eax, 0xffffffff
je 0x49769f
mov eax, dword [ebp]
push eax
call fcn.00496f60
add esp, 4
mov eax, dword [ebp]
mov dword [ebp + 4], 0xffffffff
cmp esi, dword [eax + 4]
jl 0x4976c0
pop edi
pop esi
pop ebp
mov eax, 0x10000
pop ebx
add esp, 0x4238
ret 0x10
cmp esi, dword [eax + 0x10]
jge 0x4976ce
push eax
call fcn.00496970
add esp, 4
mov eax, dword [ebp]
cmp dword [eax + 0x10], esi
jge 0x4976e7
push eax
call fcn.004969c0
mov eax, dword [ebp]
add esp, 4
cmp dword [eax + 0x10], esi
jl 0x4976d6
mov ecx, dword [ebp]
push ecx
call fcn.00496c40
add esp, 4
mov dword [ebp + 4], esi
mov edx, dword [esp + 0x4254]
mov eax, dword [esp + 0x4250]
mov ecx, dword [ebp]
push edx
push eax
push ecx
call fcn.00496d70
mov esi, eax
add esp, 0xc
test esi, esi
jle 0x49772a
pop edi
pop esi
pop ebp
mov eax, 0x600
pop ebx
add esp, 0x4238
ret 0x10
mov edx, dword [ebp]
push edx
call fcn.00496f60
add esp, 4
mov eax, esi
neg eax
pop edi
mov dword [ebp + 4], 0xffffffff
sbb eax, eax
pop esi
pop ebp
and eax, 0x5000000
pop ebx
add esp, 0x4238
ret 0x10
mov eax, dword [ebp + 4]
or esi, 0xffffffff
cmp eax, esi
je 0x49776b
mov eax, dword [ebp]
push eax
call fcn.00496f60
add esp, 4
mov eax, dword [ebp]
mov dword [ebp + 4], esi
mov esi, dword [esp + 0x424c]
cmp esi, dword [eax + 4]
jl 0x49778f
pop edi
pop esi
pop ebp
mov eax, 0x10000
pop ebx
add esp, 0x4238
ret 0x10
cmp esi, dword [eax + 0x10]
jge 0x49779d
push eax
call fcn.00496970
add esp, 4
mov eax, dword [ebp]
cmp dword [eax + 0x10], esi
jge 0x4977b6
push eax
call fcn.004969c0
mov eax, dword [ebp]
add esp, 4
cmp dword [eax + 0x10], esi
jl 0x4977a5
lea ecx, [esp + 0x11c]
push ecx
push esi
mov ecx, ebp
call fcn.00497130
test byte [esp + 0x224], 0x10
je 0x49780a
cmp edi, 1
jne 0x4977e4
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x4238
ret 0x10
lea edx, [esp + 0x120]
add ebp, 0x138
push edx
push ebp
call fcn.00497570
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4238
ret 0x10
cmp edi, 1
jne 0x49781b
mov esi, dword [esp + 0x4250]
jmp 0x497902
mov ebx, dword [esp + 0x4250]
mov edx, ebx
mov esi, ebx
mov al, byte [ebx]
test al, al
je 0x4978e4
cmp al, 0x2f
je 0x497838
cmp al, 0x5c
jne 0x49783b
lea edx, [esi + 1]
mov al, byte [esi + 1]
inc esi
test al, al
jne 0x497830
cmp edx, ebx
je 0x4978e4
mov edi, ebx
or ecx, 0xffffffff
xor eax, eax
lea esi, [esp + 0x18]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov dword [esp + 0x14], esi
mov eax, ecx
mov esi, edi
mov edi, dword [esp + 0x14]
sub edx, ebx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov byte [esp + edx + 0x17], 0
mov al, byte [esp + 0x18]
cmp al, 0x2f
je 0x497894
cmp al, 0x5c
je 0x497894
mov al, byte [esp + 0x19]
mov byte [esp + 0x13], 0
cmp al, 0x3a
jne 0x497899
mov byte [esp + 0x13], 1
lea ecx, [esp + 0x18]
push 0x5dd5ec
push ecx
call fcn.004a1e60
lea edx, [esp + 0x20]
push 0x5dd5e8
push edx
mov esi, eax
call fcn.004a1e60
add esp, 0x10
test eax, eax
setne al
test esi, esi
setne cl
or al, cl
mov cl, byte [esp + 0x13]
or al, cl
jne 0x4978e4
lea edx, [esp + 0x18]
lea eax, [ebp + 0x138]
push edx
push eax
call fcn.00497570
add esp, 8
mov ecx, dword [esp + 0x224]
push 0
push ecx
push 2
push 0
push 0
push 0x40000000
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
jne 0x497919
pop edi
pop esi
pop ebp
mov eax, 0x200
pop ebx
add esp, 0x4238
ret 0x10
mov edx, dword [ebp]
push edx
call fcn.00496c40
mov ecx, dword [ebp]
lea eax, [esp + 0x24c]
push 0x4000
push eax
push ecx
xor bl, bl
call fcn.00496d70
add esp, 0x10
test eax, eax
jl 0x49797d
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
je 0x49797f
lea edx, [esp + 0x14]
push 0
push edx
push eax
lea eax, [esp + 0x254]
push eax
push esi
call edi
test eax, eax
je 0x49797d
mov edx, dword [ebp]
lea ecx, [esp + 0x248]
push 0x4000
push ecx
push edx
call fcn.00496d70
add esp, 0xc
test eax, eax
jge 0x497947
mov bl, 1
push esi
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 1
jne 0x4979ae
test bl, bl
jne 0x4979ae
lea eax, [esp + 0x238]
lea ecx, [esp + 0x228]
push eax
lea edx, [esp + 0x234]
push ecx
push edx
push esi
call dword [sym.imp.KERNEL32.dll_SetFileTime]
cmp dword [esp + 0x4258], 1
je 0x4979bf
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp]
push eax
call fcn.00496f60
add esp, 4
neg bl
sbb ebx, ebx
pop edi
and ebx, 0x400
pop esi
mov eax, ebx
pop ebp
pop ebx
add esp, 0x4238
ret 0x10