Function at 0x521177
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x1af0
call fcn.00520ea0
mov eax, dword [0x53a090]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 0xc]
xor edx, edx
push edi
mov edi, edx
mov dword [ebp - 0x1ac0], eax
mov dword [ebp - 0x1abc], ecx
mov dword [ebp - 0x1ac4], edi
mov dword [ebp - 0x1ad4], edx
cmp dword [ebp + 0x10], edx
jne 0x5211bd
xor eax, eax
jmp 0x521994
test ecx, ecx
jne 0x5211e0
call fcn.005135c9
and dword [eax], edi
call fcn.005135fd
mov dword [eax], 0x16
call fcn.0051233e
or eax, 0xffffffff
jmp 0x521994
push ebx
push esi
mov ecx, eax
sar ecx, 5
mov esi, eax
and esi, 0x1f
shl esi, 6
mov dword [ebp - 0x1ad0], ecx
mov ecx, dword [ecx*4 + 0x565128]
mov dword [ebp - 0x1aec], esi
mov bl, byte [esi + ecx + 0x24]
add bl, bl
sar bl, 1
cmp bl, 2
je 0x521214
cmp bl, 1
jne 0x52123f
mov eax, dword [ebp + 0x10]
not eax
test al, 1
jne 0x521239
call fcn.005135c9
and dword [eax], edi
call fcn.005135fd
mov dword [eax], 0x16
call fcn.0051233e
jmp 0x521985
mov eax, dword [ebp - 0x1ac0]
test byte [esi + ecx + 4], 0x20
je 0x521253
push 2
push edx
push edx
push eax
call fcn.00521a9d
add esp, 0x10
push dword [ebp - 0x1ac0]
call fcn.00521041
pop ecx
test eax, eax
je 0x52157f
mov eax, dword [ebp - 0x1ad0]
mov eax, dword [eax*4 + 0x565128]
test byte [esi + eax + 4], 0x80
je 0x52157f
call fcn.00513788
mov eax, dword [eax + 0x6c]
xor ecx, ecx
cmp dword [eax + 0xa8], ecx
lea eax, [ebp - 0x1ae4]
push eax
mov eax, dword [ebp - 0x1ad0]
sete cl
mov eax, dword [eax*4 + 0x565128]
push dword [esi + eax]
mov dword [ebp - 0x1ac0], ecx
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x52157f
cmp dword [ebp - 0x1ac0], edi
je 0x5212cd
test bl, bl
je 0x52157f
call dword [sym.imp.KERNEL32.dll_GetConsoleCP]
mov edx, dword [ebp - 0x1abc]
and dword [ebp - 0x1adc], edi
mov ecx, edx
mov dword [ebp - 0x1af0], eax
mov dword [ebp - 0x1acc], ecx
cmp dword [ebp + 0x10], edi
jbe 0x521574
xor eax, eax
mov dword [ebp - 0x1ac8], eax
mov dword [ebp - 0x1ae8], 0xa
test bl, bl
jne 0x52149f
mov cl, byte [ecx]
xor eax, eax
cmp cl, 0xa
sete al
mov dword [ebp - 0x1ac0], eax
mov eax, dword [ebp - 0x1ad0]
mov edx, dword [eax*4 + 0x565128]
cmp dword [esi + edx + 0x38], 0
je 0x52134b
mov al, byte [esi + edx + 0x34]
mov byte [ebp - 0xc], al
push 2
lea eax, [ebp - 0xc]
mov byte [ebp - 0xb], cl
and dword [esi + edx + 0x38], 0
push eax
jmp 0x5213a5
movsx eax, cl
push eax
call fcn.0051af8e
pop ecx
test eax, eax
je 0x52139d
mov eax, dword [ebp - 0x1abc]
mov edx, dword [ebp - 0x1acc]
sub eax, edx
add eax, dword [ebp + 0x10]
cmp eax, 1
jbe 0x521546
push 2
push edx
lea eax, [ebp - 0x1ac4]
push eax
call fcn.0051bc27
add esp, 0xc
cmp eax, 0xffffffff
je 0x521569
mov eax, dword [ebp - 0x1acc]
inc eax
inc dword [ebp - 0x1ac8]
jmp 0x5213c3
push 1
push dword [ebp - 0x1acc]
lea eax, [ebp - 0x1ac4]
push eax
call fcn.0051bc27
add esp, 0xc
cmp eax, 0xffffffff
je 0x521569
mov eax, dword [ebp - 0x1acc]
xor ecx, ecx
push ecx
push ecx
inc eax
inc dword [ebp - 0x1ac8]
push 5
mov dword [ebp - 0x1acc], eax
lea eax, [ebp - 0xc]
push eax
push 1
lea eax, [ebp - 0x1ac4]
push eax
push ecx
push dword [ebp - 0x1af0]
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov dword [ebp - 0x1ae4], eax
test eax, eax
je 0x521569
push 0
lea ecx, [ebp - 0x1adc]
push ecx
push eax
lea eax, [ebp - 0xc]
push eax
mov eax, dword [ebp - 0x1ad0]
mov eax, dword [eax*4 + 0x565128]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x521915
mov edi, dword [ebp - 0x1ac8]
mov eax, dword [ebp - 0x1ae4]
add edi, dword [ebp - 0x1ad4]
cmp dword [ebp - 0x1adc], eax
jl 0x521569
cmp dword [ebp - 0x1ac0], 0
je 0x52152f
push 0
lea eax, [ebp - 0x1adc]
push eax
push 1
lea eax, [ebp - 0xc]
push eax
mov eax, dword [ebp - 0x1ad0]
mov byte [ebp - 0xc], 0xd
mov eax, dword [eax*4 + 0x565128]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x521915
cmp dword [ebp - 0x1adc], 1
jl 0x521569
inc dword [ebp - 0x1ad4]
inc edi
jmp 0x52152f
cmp bl, 1
je 0x5214a9
cmp bl, 2
jne 0x5214dc
movzx eax, word [ecx]
xor edx, edx
cmp ax, word [ebp - 0x1ae8]
mov dword [ebp - 0x1ac4], eax
mov eax, dword [ebp - 0x1ac8]
sete dl
add ecx, 2
add eax, 2
mov dword [ebp - 0x1acc], ecx
mov dword [ebp - 0x1ac8], eax
mov dword [ebp - 0x1ac0], edx
cmp bl, 1
je 0x5214e6
cmp bl, 2
jne 0x52153b
push dword [ebp - 0x1ac4]
call fcn.0052476e
pop ecx
cmp ax, word [ebp - 0x1ac4]
jne 0x521915
add edi, 2
cmp dword [ebp - 0x1ac0], 0
je 0x52152f
push 0xd
pop eax
push eax
mov dword [ebp - 0x1ac4], eax
call fcn.0052476e
pop ecx
cmp ax, word [ebp - 0x1ac4]
jne 0x521915
inc edi
inc dword [ebp - 0x1ad4]
mov eax, dword [ebp - 0x1ac8]
mov ecx, dword [ebp - 0x1acc]
cmp eax, dword [ebp + 0x10]
jb 0x521308
jmp 0x521569
mov ebx, dword [ebp - 0x1ad0]
mov al, byte [edx]
mov ecx, dword [ebx*4 + 0x565128]
inc edi
mov byte [esi + ecx + 0x34], al
mov eax, dword [ebx*4 + 0x565128]
mov dword [esi + eax + 0x38], 1
mov esi, dword [ebp - 0x1ac0]
jmp 0x52191d
mov esi, dword [ebp - 0x1ac0]
jmp 0x521927
mov eax, dword [ebp - 0x1ad0]
mov eax, dword [eax*4 + 0x565128]
test byte [esi + eax + 4], 0x80
je 0x5218ec
mov edx, dword [ebp - 0x1abc]
xor esi, esi
mov dword [ebp - 0x1ac8], esi
test bl, bl
jne 0x52168e
mov eax, edx
mov dword [ebp - 0x1ac4], eax
cmp dword [ebp + 0x10], esi
jbe 0x52194f
xor ecx, ecx
sub eax, edx
mov edx, dword [ebp - 0x1ac4]
lea ebx, [ebp - 0x1ab8]
mov dword [ebp - 0x1ac0], ecx
cmp eax, dword [ebp + 0x10]
jae 0x52161d
mov cl, byte [edx]
inc edx
inc eax
mov byte [ebp - 0x1add], cl
cmp cl, 0xa
mov ecx, dword [ebp - 0x1ac0]
mov dword [ebp - 0x1ac4], edx
jne 0x5215ff
inc dword [ebp - 0x1ad4]
mov byte [ebx], 0xd
inc ebx
inc ecx
mov dl, byte [ebp - 0x1add]
mov byte [ebx], dl
mov edx, dword [ebp - 0x1ac4]
inc ebx
inc ecx
mov dword [ebp - 0x1ac0], ecx
cmp ecx, 0x13ff
jb 0x5215d4
mov ecx, dword [ebp - 0x1aec]
lea eax, [ebp - 0x1ab8]
sub ebx, eax
push 0
lea eax, [ebp - 0x1ad8]
push eax
push ebx
lea eax, [ebp - 0x1ab8]
push eax
mov eax, dword [ebp - 0x1ad0]
mov eax, dword [eax*4 + 0x565128]
push dword [ecx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x521915
add edi, dword [ebp - 0x1ad8]
mov edx, dword [ebp - 0x1abc]
cmp dword [ebp - 0x1ad8], ebx
jl 0x521923
mov eax, dword [ebp - 0x1ac4]
sub eax, edx
cmp eax, dword [ebp + 0x10]
mov eax, dword [ebp - 0x1ac4]
jb 0x5215be
jmp 0x521923
mov ecx, edx
cmp bl, 2
jne 0x521797
mov dword [ebp - 0x1ac0], ecx
cmp dword [ebp + 0x10], esi
jbe 0x52194f
mov dword [ebp - 0x1ae8], 0xa
and dword [ebp - 0x1ae4], 0
mov edi, dword [ebp - 0x1ad4]
mov eax, ecx
sub eax, edx
mov edx, dword [ebp - 0x1ae4]
lea ebx, [ebp - 0x1ab8]
cmp eax, dword [ebp + 0x10]
jae 0x521712
movzx esi, word [ecx]
add ecx, 2
add eax, 2
mov dword [ebp - 0x1ac0], ecx
cmp si, word [ebp - 0x1ae8]
jne 0x521701
push 0xd
pop ecx
mov word [ebx], cx
mov ecx, dword [ebp - 0x1ac0]
add edi, 2
add ebx, 2
add edx, 2
mov word [ebx], si
add edx, 2
add ebx, 2
cmp edx, 0x13fe
jb 0x5216cf
mov ecx, dword [ebp - 0x1aec]
lea eax, [ebp - 0x1ab8]
sub ebx, eax
push 0
lea eax, [ebp - 0x1ad8]
push eax
push ebx
lea eax, [ebp - 0x1ab8]
push eax
mov eax, dword [ebp - 0x1ad0]
mov dword [ebp - 0x1ad4], edi
mov eax, dword [eax*4 + 0x565128]
push dword [ecx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov esi, dword [ebp - 0x1ac8]
mov edi, dword [ebp - 0x1ac4]
test eax, eax
je 0x521915
add edi, dword [ebp - 0x1ad8]
mov edx, dword [ebp - 0x1abc]
mov dword [ebp - 0x1ac4], edi
cmp dword [ebp - 0x1ad8], ebx
jl 0x521923
mov ecx, dword [ebp - 0x1ac0]
mov eax, ecx
sub eax, edx
cmp eax, dword [ebp + 0x10]
jb 0x5216b2
jmp 0x521923
mov ebx, dword [ebp + 0x10]
mov dword [ebp - 0x1adc], ecx
test ebx, ebx
je 0x52194f
mov dword [ebp - 0x1ae8], 0xa
and dword [ebp - 0x1ae4], 0
mov esi, dword [ebp - 0x1adc]
sub ecx, edx
mov edx, dword [ebp - 0x1ae4]
lea eax, [ebp - 0x6b8]
cmp ecx, ebx
jae 0x52180c
movzx edi, word [esi]
add esi, 2
add ecx, 2
mov dword [ebp - 0x1adc], esi
cmp di, word [ebp - 0x1ae8]
jne 0x5217fb
push 0xd
pop esi
mov word [eax], si
mov esi, dword [ebp - 0x1adc]
add eax, 2
add edx, 2
mov word [eax], di
add edx, 2
add eax, 2
cmp edx, 0x6a8
jb 0x5217cd
xor esi, esi
push esi
push esi
push 0xd55
lea ecx, [ebp - 0x1410]
push ecx
lea ecx, [ebp - 0x6b8]
sub eax, ecx
cdq
sub eax, edx
sar eax, 1
push eax
mov eax, ecx
push eax
push esi
push 0xfde9
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov esi, dword [ebp - 0x1ac8]
mov edi, dword [ebp - 0x1ac4]
mov dword [ebp - 0x1acc], eax
test eax, eax
je 0x521915
xor ecx, ecx
mov dword [ebp - 0x1ac0], ecx
push 0
sub eax, ecx
lea edx, [ebp - 0x1ad8]
push edx
push eax
lea eax, [ebp - 0x1410]
add eax, ecx
mov ecx, dword [ebp - 0x1aec]
push eax
mov eax, dword [ebp - 0x1ad0]
mov eax, dword [eax*4 + 0x565128]
push dword [ecx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x5218ae
mov ecx, dword [ebp - 0x1ac0]
add ecx, dword [ebp - 0x1ad8]
mov eax, dword [ebp - 0x1acc]
mov dword [ebp - 0x1ac0], ecx
cmp eax, ecx
jg 0x52185b
jmp 0x5218c8
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [ebp - 0x1ac0]
mov esi, eax
mov eax, dword [ebp - 0x1acc]
mov dword [ebp - 0x1ac8], esi
cmp eax, ecx
jg 0x52191d
mov ecx, dword [ebp - 0x1adc]
mov edx, dword [ebp - 0x1abc]
mov edi, ecx
sub edi, edx
mov dword [ebp - 0x1ac4], edi
cmp edi, ebx
jb 0x5217b2
jmp 0x521923
push 0
lea ecx, [ebp - 0x1ad8]
push ecx
push dword [ebp + 0x10]
push dword [ebp - 0x1abc]
push dword [esi + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x521915
mov edi, dword [ebp - 0x1ad8]
xor esi, esi
jmp 0x52191d
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
mov edx, dword [ebp - 0x1abc]
test edi, edi
jne 0x52198a
test esi, esi
je 0x52194f
push 5
pop ebx
cmp esi, ebx
jne 0x521946
call fcn.005135fd
mov dword [eax], 9
call fcn.005135c9
mov dword [eax], ebx
jmp 0x521985
push esi
call fcn.005135dc
pop ecx
jmp 0x521985
mov eax, dword [ebp - 0x1ad0]
mov ecx, dword [ebp - 0x1aec]
mov eax, dword [eax*4 + 0x565128]
test byte [ecx + eax + 4], 0x40
je 0x521972
cmp byte [edx], 0x1a
jne 0x521972
xor eax, eax
jmp 0x521992
call fcn.005135fd
mov dword [eax], 0x1c
call fcn.005135c9
and dword [eax], 0
or eax, 0xffffffff
jmp 0x521992
sub edi, dword [ebp - 0x1ad4]
mov eax, edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
pop edi
call fcn.0050ecf7
leave
ret