Function at 0x1015480
Capabilities:
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x594
mov eax, dword [0x1020dd0]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
push esi
mov esi, dword [ebp + 8]
push edi
xor edi, edi
mov dword [ebp - 0x574], eax
mov dword [ebp - 0x570], edi
mov dword [ebp - 0x578], edi
cmp dword [ebp + 0x10], edi
jne 0x10154bd
xor eax, eax
jmp 0x1015b58
cmp eax, edi
jne 0x10154e8
call fcn.0100f603
mov dword [eax], edi
call fcn.0100f5eb
push edi
push edi
push edi
push edi
push edi
mov dword [eax], 0x16
call fcn.0100f594
add esp, 0x14
or eax, 0xffffffff
jmp 0x1015b58
push ebx
mov ebx, esi
and ebx, 0x1f
imul ebx, ebx, 0x24
mov eax, esi
sar eax, 5
lea edi, [eax*4 + 0x10239a0]
mov eax, dword [edi]
mov ecx, dword [eax + ebx + 8]
and ecx, 3
mov dword [ebp - 0x580], edi
mov dword [ebp - 0x594], ebx
mov dword [ebp - 0x588], ecx
cmp ecx, 2
je 0x1015522
cmp ecx, 1
jne 0x1015552
mov ecx, dword [ebp + 0x10]
not ecx
test cl, 1
jne 0x1015552
call fcn.0100f603
xor esi, esi
mov dword [eax], esi
call fcn.0100f5eb
push esi
push esi
push esi
push esi
push esi
mov dword [eax], 0x16
call fcn.0100f594
add esp, 0x14
jmp 0x1015b4c
test byte [eax + ebx + 4], 0x20
je 0x1015568
push 2
push 0
push 0
push esi
call fcn.0101896c
add esp, 0x10
push esi
call fcn.010152c5
pop ecx
test eax, eax
je 0x10157d4
mov eax, dword [edi]
test byte [ebx + eax + 4], 0x80
je 0x10157d4
call fcn.0100e19a
mov eax, dword [eax + 0x6c]
xor ecx, ecx
cmp dword [eax + 0x14], ecx
lea eax, [ebp - 0x58c]
sete cl
push eax
mov eax, dword [edi]
push dword [ebx + eax]
mov esi, ecx
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x10157d4
test esi, esi
je 0x10155c1
cmp dword [ebp - 0x588], 0
je 0x10157d4
call dword [sym.imp.KERNEL32.dll_GetConsoleCP]
and dword [ebp - 0x584], 0
cmp dword [ebp + 0x10], 0
mov esi, dword [ebp - 0x574]
mov dword [ebp - 0x594], eax
mov dword [ebp - 0x590], esi
jbe 0x1015ae5
and dword [ebp - 0x568], 0
jmp 0x10155f9
mov esi, dword [ebp - 0x590]
mov eax, dword [ebp - 0x588]
test eax, eax
jne 0x1015734
mov al, byte [esi]
xor ecx, ecx
cmp al, 0xa
sete cl
movsx eax, al
push eax
mov dword [ebp - 0x58c], ecx
call fcn.01010be0
pop ecx
test eax, eax
jne 0x1015641
push 1
lea eax, [ebp - 0x56c]
push esi
push eax
call fcn.01016d35
add esp, 0xc
cmp eax, 0xffffffff
je 0x1015adb
jmp 0x1015677
mov eax, dword [ebp - 0x574]
sub eax, esi
add eax, dword [ebp + 0x10]
cmp eax, 1
jbe 0x1015adb
push 2
lea eax, [ebp - 0x56c]
push esi
push eax
call fcn.01016d35
add esp, 0xc
cmp eax, 0xffffffff
je 0x1015adb
inc esi
inc dword [ebp - 0x568]
xor eax, eax
push eax
push eax
push 5
lea ecx, [ebp - 0xc]
push ecx
push 1
lea ecx, [ebp - 0x56c]
push ecx
push eax
push dword [ebp - 0x594]
inc esi
inc dword [ebp - 0x568]
mov dword [ebp - 0x590], esi
call dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
mov esi, eax
test esi, esi
je 0x1015adb
push 0
lea eax, [ebp - 0x584]
push eax
push esi
lea eax, [ebp - 0xc]
push eax
mov eax, dword [edi]
push dword [ebx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1015acf
mov eax, dword [ebp - 0x584]
add dword [ebp - 0x570], eax
cmp eax, esi
jl 0x1015adb
cmp dword [ebp - 0x58c], 0
je 0x10157c0
push 0
lea eax, [ebp - 0x584]
push eax
push 1
lea eax, [ebp - 0xc]
push eax
mov eax, dword [edi]
mov byte [ebp - 0xc], 0xd
push dword [ebx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1015acf
cmp dword [ebp - 0x584], 1
jl 0x1015adb
inc dword [ebp - 0x578]
inc dword [ebp - 0x570]
jmp 0x10157c0
cmp eax, 1
je 0x101573e
cmp eax, 2
jne 0x1015765
movzx ecx, word [esi]
xor edx, edx
cmp ecx, 0xa
sete dl
add esi, 2
add dword [ebp - 0x568], 2
mov dword [ebp - 0x56c], ecx
mov dword [ebp - 0x590], esi
mov dword [ebp - 0x58c], edx
cmp eax, 1
je 0x101576f
cmp eax, 2
jne 0x10157c0
push dword [ebp - 0x56c]
call fcn.01018b14
pop ecx
cmp ax, word [ebp - 0x56c]
jne 0x1015acf
inc dword [ebp - 0x570]
cmp dword [ebp - 0x58c], 0
je 0x10157c0
push 0xd
pop eax
push eax
mov dword [ebp - 0x56c], eax
call fcn.01018b14
pop ecx
cmp ax, word [ebp - 0x56c]
jne 0x1015acf
inc dword [ebp - 0x570]
inc dword [ebp - 0x578]
mov eax, dword [ebp + 0x10]
cmp dword [ebp - 0x568], eax
jb 0x10155f3
jmp 0x1015adb
mov eax, dword [edi]
test byte [eax + ebx + 4], 0x80
je 0x1015a9b
xor eax, eax
mov dword [ebp - 0x56c], eax
cmp dword [ebp - 0x588], eax
jne 0x10158b0
mov ecx, dword [ebp - 0x574]
mov dword [ebp - 0x568], ecx
cmp dword [ebp + 0x10], eax
jbe 0x1015b1b
mov ecx, dword [ebp - 0x568]
xor esi, esi
sub ecx, dword [ebp - 0x574]
lea eax, [ebp - 0x564]
cmp ecx, dword [ebp + 0x10]
jae 0x1015854
mov edx, dword [ebp - 0x568]
inc dword [ebp - 0x568]
mov dl, byte [edx]
inc ecx
cmp dl, 0xa
jne 0x1015842
inc dword [ebp - 0x578]
mov byte [eax], 0xd
inc eax
inc esi
mov edi, dword [ebp - 0x580]
mov byte [eax], dl
inc eax
inc esi
cmp esi, 0x400
jb 0x101581e
mov esi, eax
lea eax, [ebp - 0x564]
sub esi, eax
push 0
lea eax, [ebp - 0x57c]
push eax
push esi
lea eax, [ebp - 0x564]
push eax
mov eax, dword [edi]
push dword [ebx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1015acf
mov eax, dword [ebp - 0x57c]
add dword [ebp - 0x570], eax
cmp eax, esi
jl 0x1015adb
mov eax, dword [ebp - 0x568]
sub eax, dword [ebp - 0x574]
cmp eax, dword [ebp + 0x10]
jb 0x101580a
jmp 0x1015adb
cmp dword [ebp - 0x588], 2
jne 0x101598c
mov edi, dword [ebp - 0x574]
cmp dword [ebp + 0x10], eax
jbe 0x1015b1b
mov ecx, edi
xor esi, esi
sub ecx, dword [ebp - 0x574]
lea eax, [ebp - 0x564]
cmp ecx, dword [ebp + 0x10]
jae 0x1015926
movzx edx, word [edi]
add edi, 2
add ecx, 2
cmp edx, 0xa
jne 0x1015910
cmp esi, 0x3fd
ja 0x1015923
add dword [ebp - 0x578], 2
push 0xd
pop ebx
mov word [eax], bx
mov ebx, dword [ebp - 0x594]
add eax, 2
add esi, 2
mov word [eax], dx
add esi, 2
add eax, 2
cmp esi, 0x3ff
jb 0x10158dc
jmp 0x1015926
sub edi, 2
mov esi, eax
lea eax, [ebp - 0x564]
sub esi, eax
push 0
lea eax, [ebp - 0x57c]
push eax
push esi
lea eax, [ebp - 0x564]
push eax
mov eax, dword [ebp - 0x580]
mov eax, dword [eax]
push dword [ebx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1015acf
mov eax, dword [ebp - 0x57c]
add dword [ebp - 0x570], eax
cmp eax, esi
jl 0x1015adb
test eax, eax
je 0x1015adb
mov eax, edi
sub eax, dword [ebp - 0x574]
cmp eax, dword [ebp + 0x10]
jb 0x10158cc
jmp 0x1015adb
mov ecx, dword [ebp - 0x574]
mov dword [ebp - 0x568], ecx
cmp dword [ebp + 0x10], eax
jbe 0x1015b1b
mov ecx, dword [ebp - 0x568]
xor esi, esi
sub ecx, dword [ebp - 0x574]
lea eax, [ebp - 0x160]
cmp ecx, dword [ebp + 0x10]
jae 0x1015a00
mov edx, dword [ebp - 0x568]
movzx edx, word [edx]
add dword [ebp - 0x568], 2
add ecx, 2
cmp edx, 0xa
jne 0x10159e6
cmp esi, 0x150
ja 0x10159f9
push 0xd
pop edi
mov word [eax], di
add eax, 2
add esi, 2
mov word [eax], dx
add esi, 2
add eax, 2
cmp esi, 0x152
jb 0x10159b5
jmp 0x1015a00
sub dword [ebp - 0x568], 2
xor esi, esi
push esi
push esi
push 0x2ab
lea ecx, [ebp - 0x410]
push ecx
lea ecx, [ebp - 0x160]
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 edi, eax
cmp edi, esi
je 0x1015acf
push 0
lea eax, [ebp - 0x57c]
push eax
mov eax, edi
sub eax, esi
push eax
lea eax, [ebp + esi - 0x410]
push eax
mov eax, dword [ebp - 0x580]
mov eax, dword [eax]
push dword [ebx + eax]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1015a6e
add esi, dword [ebp - 0x57c]
cmp edi, esi
jg 0x1015a37
jmp 0x1015a7a
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x56c], eax
cmp edi, esi
jg 0x1015adb
mov eax, dword [ebp - 0x568]
sub eax, dword [ebp - 0x574]
mov dword [ebp - 0x570], eax
cmp eax, dword [ebp + 0x10]
jb 0x10159a1
jmp 0x1015adb
push 0
lea ecx, [ebp - 0x57c]
push ecx
push dword [ebp + 0x10]
push dword [ebp - 0x574]
push dword [eax + ebx]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1015acf
mov eax, dword [ebp - 0x57c]
and dword [ebp - 0x56c], 0
mov dword [ebp - 0x570], eax
jmp 0x1015adb
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x56c], eax
mov eax, dword [ebp - 0x570]
test eax, eax
jne 0x1015b51
cmp dword [ebp - 0x56c], 0
je 0x1015b1b
push 5
pop esi
cmp dword [ebp - 0x56c], esi
jne 0x1015b0d
call fcn.0100f5eb
mov dword [eax], 9
call fcn.0100f603
mov dword [eax], esi
jmp 0x1015b4c
push dword [ebp - 0x56c]
call fcn.0100f61b
pop ecx
jmp 0x1015b4c
mov eax, dword [ebp - 0x580]
mov eax, dword [eax]
test byte [ebx + eax + 4], 0x40
je 0x1015b39
mov eax, dword [ebp - 0x574]
cmp byte [eax], 0x1a
jne 0x1015b39
xor eax, eax
jmp 0x1015b57
call fcn.0100f5eb
mov dword [eax], 0x1c
call fcn.0100f603
and dword [eax], 0
or eax, 0xffffffff
jmp 0x1015b57
sub eax, dword [ebp - 0x578]
pop ebx
mov ecx, dword [ebp - 4]
pop edi
xor ecx, ebp
pop esi
call fcn.0100c443
leave
ret