Function at 0x51a520
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov edx, dword [0x5ed084]
sub esp, 0x10
mov dword [0x8012c8], 0x51ae80
mov dword [0x8012cc], 0x51b540
mov dword [0x8012b8], 1
push ebx
push esi
push edi
mov edi, dword [ebp + 8]
mov ebx, 1
mov dword [0x8012c0], 7
mov dword [0x7f9d48], 0
mov dword [0x8012a4], 3
mov ecx, dword [edi + 0x10]
mov eax, ecx
shr eax, 0x18
mov dword [edi + 4], 0
mov dword [edi + 8], 0
mov byte [edx], al
mov eax, ecx
shr eax, 0x10
mov byte [edx + 1], al
mov eax, ecx
shr eax, 8
mov byte [edx + 2], al
movzx eax, byte [0x5ed04c]
mov byte [edx + 3], cl
mov ecx, dword [0x5ed05c]
mov byte [edx + 4], al
movzx eax, byte [0x5ed04d]
mov byte [edx + 5], al
movzx eax, byte [0x5ed050]
or al, cl
mov dword [0x8012a8], 0
mov byte [edx + 6], al
lea eax, [edx + 7]
mov esi, dword [edi + 0x14]
mov dword [0x5ed084], eax
xor eax, eax
test ecx, ecx
mov dword [0x7feb84], 0
mov ecx, dword [edi + 4]
setne al
mov dword [0x8012a0], 0
add eax, 0x100
mov dword [0x5ed064], ebx
mov dword [0x5ed060], 0x2710
mov dword [0x7f9d4c], 9
mov dword [0x7f9d50], 0x1ff
mov dword [0x7f9d54], eax
mov dword [0x8012bc], 0xffffffff
mov dword [0x5ed080], 0x5f9d48
cmp ecx, esi
jne 0x51a67a
push edi
push 0xffffffffffffffff
call fcn.0051b170
mov eax, dword [0x8012cc]
add esp, 8
cmp eax, 0x51b540
jne 0x51a9dc
mov ebx, dword [0x8012c0]
lea edx, [ebp + 8]
mov dword [ebp + 8], ebx
lea esi, [ebp + 0xb]
mov al, byte [esi]
mov cl, byte [edx]
mov byte [edx], al
inc edx
mov byte [esi], cl
dec esi
cmp edx, esi
jb 0x51a667
jmp 0x51a961
lea eax, [ecx + 0x100000]
cmp eax, esi
jle 0x51a688
sub esi, ecx
jmp 0x51a68d
mov esi, 0x100000
mov eax, dword [edi + 0x10]
push esi
add eax, ecx
mov dword [ebp - 4], esi
push eax
push 0x5f9d48
call sub.VCRUNTIME140.dll_memcpy
mov eax, dword [ebp - 4]
add esp, 0xc
mov edx, dword [0x5ed058]
dec eax
add dword [edi + 4], esi
xor ecx, ecx
movzx esi, byte [0x5f9d48]
mov dword [0x8012bc], eax
mov eax, edx
mov dword [ebp + 8], esi
mov dword [0x5ed080], 0x5f9d49
mov dword [ebp - 8], edx
cmp eax, 0x10000
jge 0x51a6ea
mov dword [ebp + 8], esi
nop dword [eax + eax]
add eax, eax
inc ecx
cmp eax, 0x10000
jl 0x51a6e0
mov eax, 8
sub eax, ecx
push edx
mov dword [ebp - 0xc], eax
call fcn.0051adc0
add esp, 4
nop dword [eax]
mov eax, dword [0x8012bc]
dec dword [0x8012bc]
test eax, eax
jle 0x51a722
mov eax, dword [0x5ed080]
inc dword [0x5ed080]
movzx eax, byte [eax]
jmp 0x51a7a8
cmp dword [0x8012c8], 0x51ae80
jne 0x51a798
mov esi, dword [edi + 0x14]
mov ecx, dword [edi + 4]
mov dword [0x5ed080], 0x5f9d48
cmp ecx, esi
jne 0x51a74a
mov esi, dword [ebp + 8]
or eax, 0xffffffff
jmp 0x51a7a8
lea eax, [ecx + 0x100000]
cmp eax, esi
jle 0x51a758
sub esi, ecx
jmp 0x51a75d
mov esi, 0x100000
mov eax, dword [edi + 0x10]
push esi
add eax, ecx
push eax
push 0x5f9d48
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
mov dword [0x5ed080], 0x5f9d49
add dword [edi + 4], esi
movzx eax, byte [0x5f9d48]
mov dword [ebp - 4], eax
lea eax, [esi - 1]
mov esi, dword [ebp + 8]
mov dword [0x8012bc], eax
mov eax, dword [ebp - 4]
jmp 0x51a7ab
push edi
call dword [0x8012c8]
mov ebx, dword [0x5ed064]
add esp, 4
mov dword [ebp - 4], eax
cmp eax, 0xffffffff
je 0x51a91c
mov ecx, dword [0x5ed050]
mov edx, eax
shl edx, cl
inc ebx
mov ecx, dword [ebp - 0xc]
add edx, esi
mov esi, eax
mov dword [0x5ed064], ebx
mov eax, dword [ebp + 8]
shl esi, cl
xor esi, eax
mov dword [ebp - 0x10], edx
mov ecx, dword [esi*4 + 0x7f9d58]
cmp ecx, edx
jne 0x51a7f1
movzx esi, word [esi*2 + 0x7feb88]
mov dword [ebp + 8], esi
jmp 0x51a700
test ecx, ecx
js 0x51a823
mov ecx, dword [ebp - 8]
mov eax, 1
sub ecx, esi
test esi, esi
cmove ecx, eax
mov eax, esi
mov esi, dword [ebp - 8]
sub eax, ecx
lea esi, [eax + esi]
cmovns esi, eax
mov eax, dword [esi*4 + 0x7f9d58]
cmp eax, edx
je 0x51a7e1
test eax, eax
jg 0x51a804
mov eax, dword [ebp + 8]
push edi
push eax
call fcn.0051b170
mov eax, dword [ebp - 4]
add esp, 8
inc dword [0x8012a8]
mov ebx, dword [0x5ed064]
mov dword [ebp + 8], eax
mov eax, dword [0x7f9d54]
cmp eax, dword [0x5ed054]
jge 0x51a86c
mov word [esi*2 + 0x7feb88], ax
inc eax
mov dword [0x7f9d54], eax
mov eax, dword [ebp - 0x10]
mov dword [esi*4 + 0x7f9d58], eax
mov esi, dword [ebp + 8]
jmp 0x51a700
cmp ebx, dword [0x5ed060]
jl 0x51a880
cmp dword [0x5ed05c], 0
jne 0x51a888
nop dword [eax]
mov esi, dword [ebp + 8]
jmp 0x51a700
lea eax, [ebx + 0x2710]
mov dword [0x5ed060], eax
cmp ebx, 0x7fffff
jle 0x51a8b6
mov ecx, dword [0x8012a4]
sar ecx, 8
test ecx, ecx
jne 0x51a8af
mov eax, bind
jmp 0x51a8c2
mov eax, ebx
cdq
idiv ecx
jmp 0x51a8c2
mov eax, ebx
shl eax, 8
cdq
idiv dword [0x8012a4]
cmp eax, dword [0x8012a0]
jle 0x51a8d7
mov esi, dword [ebp + 8]
mov dword [0x8012a0], eax
jmp 0x51a700
push dword [0x5ed058]
mov dword [0x8012a0], 0
call fcn.0051adc0
push edi
push 0x100
mov dword [0x7f9d54], 0x101
mov dword [0x7feb84], 1
call fcn.0051b170
mov ebx, dword [0x5ed064]
add esp, 0xc
mov esi, dword [ebp + 8]
jmp 0x51a700
push edi
push esi
call fcn.0051b170
inc dword [0x8012a8]
push edi
push 0xffffffffffffffff
call fcn.0051b170
mov eax, dword [0x8012cc]
add esp, 0x10
cmp eax, 0x51b540
jne 0x51a9dc
mov ebx, dword [0x8012c0]
lea edx, [ebp + 8]
mov dword [ebp + 8], ebx
lea esi, [ebp + 0xb]
mov al, byte [esi]
mov cl, byte [edx]
mov byte [edx], al
inc edx
mov byte [esi], cl
dec esi
cmp edx, esi
jb 0x51a953
mov eax, dword [edi]
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fwrite]
push eax
push 1
push 4
test ebx, ebx
je 0x51a978
lea eax, [ebp + 8]
push eax
jmp 0x51a97d
push 0x5a8290
call esi
mov ecx, dword [0x8012c0]
add esp, 0x10
test ecx, ecx
jle 0x51a9b6
push dword [edi]
push ecx
push 1
push 0x6f9d48
call esi
mov ecx, dword [0x8012c0]
xor esi, esi
mov edx, dword [0x8012b8]
add esp, 0x10
cmp eax, ecx
cmovne edx, esi
mov dword [0x8012b8], edx
jmp 0x51a9bc
mov edx, dword [0x8012b8]
add dword [edi + 8], ecx
mov eax, edx
pop edi
pop esi
mov dword [0x5ed084], 0x6f9d48
mov dword [0x8012c0], 0
pop ebx
mov esp, ebp
pop ebp
ret
push edi
call eax
mov eax, dword [0x8012b8]
add esp, 4
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret