Function at 0x51d5a0
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x654
mov eax, dword [0x669404]
xor eax, esp
mov dword [esp + 0x650], eax
push ebx
push esi
push edi
mov edi, ecx
cmp dword [edi + 4], 0xffffffff
mov esi, edx
mov dword [esp + 0xc], esi
je 0x51d5d2
mov ebx, dword [edi]
call fcn.0051ccd0
mov eax, dword [edi]
mov ebx, dword [ebp + 8]
mov dword [edi + 4], 0xffffffff
cmp ebx, dword [eax + 4]
jl 0x51d5ff
mov eax, 0x10000
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x650]
xor ecx, esp
call fcn.00546bdc
mov esp, ebp
pop ebp
ret 4
cmp ebx, dword [eax + 0x10]
jge 0x51d60f
mov esi, eax
call fcn.0051c680
mov esi, dword [esp + 0xc]
mov eax, dword [edi]
cmp dword [eax + 0x10], ebx
jge 0x51d667
mov esi, dword [edi]
test esi, esi
je 0x51d65c
cmp dword [esi + 0x18], 0
je 0x51d65c
mov eax, dword [esi + 0x10]
inc eax
cmp eax, dword [esi + 4]
je 0x51d65c
mov ecx, dword [esi + 0x50]
add ecx, dword [esi + 0x4c]
mov edx, dword [esi + 0x48]
push 0
lea ecx, [ecx + edx + 0x2e]
add dword [esi + 0x14], ecx
mov dword [esi + 0x10], eax
push 0
lea edx, [esi + 0x78]
push edx
lea eax, [esi + 0x28]
push eax
mov eax, esi
call fcn.0051c410
add esp, 0x10
neg eax
sbb eax, eax
inc eax
mov dword [esi + 0x18], eax
mov ecx, dword [edi]
cmp dword [ecx + 0x10], ebx
jl 0x51d616
mov esi, dword [esp + 0xc]
push ebx
lea edx, [esp + 0x1c]
mov ecx, edi
call fcn.0051cea0
test byte [esp + 0x224], 0x10
movzx eax, word [esi]
je 0x51d6e3
cmp eax, 0x2f
je 0x51d696
cmp eax, 0x5c
je 0x51d696
test ax, ax
je 0x51d6ba
cmp word [esi + 2], 0x3a
jne 0x51d6ba
push esi
push 0
call fcn.0051d470
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x650]
xor ecx, esp
call fcn.00546bdc
mov esp, ebp
pop ebp
ret 4
push esi
add edi, 0x244
push edi
call fcn.0051d470
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x650]
xor ecx, esp
call fcn.00546bdc
mov esp, ebp
pop ebp
ret 4
mov ebx, esi
mov ecx, esi
test ax, ax
je 0x51d70b
lea esp, [esp]
cmp ax, 0x2f
je 0x51d6fc
cmp ax, 0x5c
jne 0x51d6ff
lea ebx, [ecx + 2]
movzx eax, word [ecx + 2]
add ecx, 2
test ax, ax
jne 0x51d6f0
lea edx, [esp + 0x248]
mov eax, esi
sub edx, esi
movzx ecx, word [eax]
mov word [edx + eax], cx
add eax, 2
test cx, cx
jne 0x51d716
cmp ebx, esi
jne 0x51d7b8
xor edx, edx
mov word [esp + 0x248], dx
push ebx
lea edx, [esp + 0x24c]
push edx
lea esi, [edi + 0x244]
push esi
lea eax, [esp + 0x45c]
push str._s_s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x14
lea ecx, [esp + 0x248]
push ecx
push esi
call fcn.0051d470
add esp, 8
mov edx, dword [esp + 0x224]
push 0
push edx
push 2
push 0
push 0
push 0x40000000
lea eax, [esp + 0x468]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x51d827
mov eax, 0x200
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x650]
xor ecx, esp
call fcn.00546bdc
mov esp, ebp
pop ebp
ret 4
mov eax, ebx
sub eax, esi
sar eax, 1
xor ecx, ecx
mov word [esp + eax*2 + 0x248], cx
mov ax, word [esp + 0x248]
cmp ax, 0x2f
je 0x51d7f4
cmp ax, 0x5c
je 0x51d7f4
test ax, ax
je 0x51d737
cmp word [esp + 0x24a], 0x3a
jne 0x51d737
push ebx
lea edx, [esp + 0x24c]
push edx
lea eax, [esp + 0x458]
push str._s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
lea ecx, [esp + 0x258]
push ecx
push 0
call fcn.0051d470
add esp, 0x18
jmp 0x51d76e
mov ecx, dword [edi + 0x23c]
mov eax, dword [edi]
push ecx
call fcn.0051c8f0
add esp, 4
cmp dword [edi + 0x240], 0
jne 0x51d854
push 0x4000
call fcn.00543310
add esp, 4
mov dword [edi + 0x240], eax
mov dword [esp + 0xc], 0
lea esp, [esp]
mov eax, dword [edi + 0x240]
lea edx, [esp + 0x13]
push edx
push eax
mov eax, dword [edi]
mov ecx, 0x4000
call fcn.0051ca70
mov esi, eax
add esp, 8
cmp esi, 0xffffff96
je 0x51d8b7
test esi, esi
js 0x51d8ad
jle 0x51d8a2
mov edx, dword [edi + 0x240]
push 0
lea ecx, [esp + 0x18]
push ecx
push esi
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x51d8c1
cmp byte [esp + 0x13], 0
jne 0x51d8cb
test esi, esi
jne 0x51d860
mov dword [esp + 0xc], 0x5000000
jmp 0x51d8ea
mov dword [esp + 0xc], 0x1000
jmp 0x51d8ea
mov dword [esp + 0xc], 0x400
jmp 0x51d8ea
lea eax, [esp + 0x238]
push eax
lea ecx, [esp + 0x22c]
push ecx
lea edx, [esp + 0x238]
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileTime]
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [edi]
call fcn.0051ccd0
mov ecx, dword [esp + 0x65c]
mov eax, dword [esp + 0xc]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.00546bdc
mov esp, ebp
pop ebp
ret 4