Function at 0x402660
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x20
push ebx
push ebp
xor ebx, ebx
cmp dword [esp + 0x2c], ebx
mov ebp, ecx
push esi
mov dword [esp + 0x18], ebp
mov dword [esp + 0x10], ebx
je 0x402b74
mov esi, dword [esp + 0x34]
cmp esi, ebx
je 0x402b74
push edi
push 0x400
mov dword [esp + 0x1c], 0x400
call fcn.00412f17
mov edi, eax
add esp, 4
cmp edi, ebx
mov dword [esp + 0x10], edi
je 0x402935
test byte [ebp + 0x14], 1
mov ecx, dword [esp + 0x3c]
jne 0x4026da
test ecx, ecx
jle 0x4026da
lea ebx, [ecx*4]
mov edx, dword [0x42abb8]
mov dword [eax], edx
mov dl, byte [0x42abbc]
mov byte [eax + 4], dl
add eax, 4
sub ecx, 1
jne 0x4026c1
mov ecx, esi
call fcn.00401c70
push eax
lea eax, [ebx + edi]
push 0x42abb4
push eax
call fcn.00413e72
add esp, 0xc
add ebx, eax
cmp dword [esi + 0x20], 0
mov dword [esp + 0x20], 0
jle 0x4028a9
jmp 0x402710
mov edi, dword [esp + 0x20]
mov esi, dword [esp + 0x38]
mov eax, dword [esi + 0x1c]
add edi, edi
add edi, edi
mov ecx, dword [eax + edi]
add eax, edi
call fcn.00401bf0
push eax
call fcn.00402020
mov ebp, eax
add esp, 4
test ebp, ebp
je 0x4027ae
lea edx, [eax + 1]
jmp 0x402740
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x402740
mov ecx, dword [esp + 0x38]
sub eax, edx
mov esi, eax
mov eax, dword [ecx + 0x1c]
mov ecx, dword [eax + edi]
add eax, edi
call fcn.00401c70
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x402761
sub eax, edx
lea edx, [eax + esi + 0x14]
push edx
call fcn.00412f17
add esp, 4
mov esi, eax
test esi, esi
push ebp
je 0x4028e9
mov eax, dword [esp + 0x3c]
mov eax, dword [eax + 0x1c]
mov ecx, dword [eax + edi]
add eax, edi
call fcn.00401c70
push eax
push str.__s__s_
push esi
call fcn.00413e72
push ebp
mov edi, eax
call fcn.00412262
add esp, 0x14
jmp 0x402829
mov eax, dword [esi + 0x1c]
mov ecx, dword [eax + edi]
add eax, edi
call fcn.00401bf0
lea edx, [eax + 1]
mov edi, edi
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x4027c0
mov ebp, dword [esp + 0x38]
sub eax, edx
mov esi, eax
mov eax, dword [ebp + 0x1c]
mov ecx, dword [eax + edi]
add eax, edi
call fcn.00401c70
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x4027e1
sub eax, edx
lea ecx, [eax + esi + 0x14]
push ecx
call fcn.00412f17
mov esi, eax
add esp, 4
test esi, esi
je 0x402928
mov edx, dword [ebp + 0x1c]
mov ecx, dword [edi + edx]
add edi, edx
call fcn.00401bf0
mov ecx, dword [edi]
push eax
call fcn.00401c70
push eax
push str.__s__s_
push esi
call fcn.00413e72
add esp, 0x10
mov edi, eax
mov eax, dword [esp + 0x18]
lea ebp, [edi + ebx]
cmp ebp, eax
mov dword [esp + 0x28], ebp
jl 0x402861
mov ebp, dword [esp + 0x10]
lea edi, [edi + eax + 0x104]
push edi
push ebp
call fcn.004122f0
add esp, 8
test eax, eax
je 0x40290a
mov ebp, dword [esp + 0x28]
mov dword [esp + 0x18], edi
mov dword [esp + 0x10], eax
mov ecx, dword [esp + 0x10]
sub ebx, esi
mov eax, esi
lea edx, [ebx + ecx]
lea esp, [esp]
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x402870
push esi
mov ebx, ebp
call fcn.00412262
mov eax, dword [esp + 0x24]
mov edx, dword [esp + 0x3c]
add eax, 1
add esp, 4
cmp eax, dword [edx + 0x20]
mov dword [esp + 0x20], eax
jl 0x402710
mov edi, dword [esp + 0x10]
mov ebp, dword [esp + 0x1c]
mov esi, edx
mov eax, dword [esi + 0x30]
test eax, eax
mov dword [esp + 0x28], eax
jne 0x40296e
mov ecx, esi
call fcn.00401bf0
test eax, eax
jne 0x40296e
test byte [ebp + 0x14], 2
je 0x402944
mov edx, dword [esp + 0x34]
push eax
lea ecx, [esp + 0x30]
push ecx
mov dword [ebx + edi], 0x3e2f20
add ebx, 3
push ebx
push edi
push edx
jmp 0x402b41
call fcn.00412262
mov eax, dword [esp + 0x14]
push eax
call fcn.00412262
add esp, 8
pop edi
pop esi
pop ebp
mov eax, 0xe
pop ebx
add esp, 0x20
ret 0xc
push esi
call fcn.00412262
push ebp
call fcn.00412262
add esp, 8
pop edi
pop esi
pop ebp
mov eax, 0xe
pop ebx
add esp, 0x20
ret 0xc
mov ecx, dword [esp + 0x10]
push ecx
call fcn.00412262
add esp, 4
pop edi
pop esi
pop ebp
mov eax, 0xe
pop ebx
add esp, 0x20
ret 0xc
mov edx, dword [str.____r_n]
mov dword [ebx + edi], edx
mov ax, word [0x42aba4]
mov edx, dword [esp + 0x34]
push 0
lea ecx, [esp + 0x30]
push ecx
mov word [ebx + edi + 4], ax
add ebx, 5
push ebx
push edi
push edx
jmp 0x402b41
mov ecx, esi
call fcn.00401bf0
mov esi, eax
test esi, esi
mov dword [esp + 0x24], esi
je 0x402a1b
mov byte [ebx + edi], 0x3e
push esi
add ebx, 1
call fcn.00402020
add esp, 4
test eax, eax
mov dword [esp + 0x20], eax
je 0x4029a1
mov dword [esp + 0x24], eax
mov esi, eax
mov eax, esi
lea edx, [eax + 1]
mov cl, byte [eax]
add eax, 1
test cl, cl
jne 0x4029a6
sub eax, edx
lea ebp, [eax + ebx]
cmp ebp, dword [esp + 0x18]
jle 0x4029d7
mov eax, dword [esp + 0x18]
add eax, 0x104
push eax
push edi
call fcn.004122f0
add esp, 8
test eax, eax
je 0x402a04
mov edi, eax
mov dword [esp + 0x10], edi
lea edx, [ebx + edi]
mov eax, esi
sub edx, esi
mov edi, edi
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, 1
test cl, cl
jne 0x4029e0
cmp dword [esp + 0x20], 0
mov esi, ebp
je 0x402a3e
mov ecx, dword [esp + 0x20]
push ecx
call fcn.00412262
add esp, 4
jmp 0x402a3e
mov eax, dword [esp + 0x20]
test eax, eax
je 0x402a15
push eax
call fcn.00412262
add esp, 4
push edi
jmp 0x40292d
test byte [ebp + 0x14], 2
je 0x402a30
mov edx, dword [esp + 0x10]
mov word [ebx + edx], 0x3e
lea esi, [ebx + 1]
jmp 0x402a3e
mov eax, dword [esp + 0x10]
mov dword [ebx + eax], 0xa0d3e
lea esi, [ebx + 3]
mov edx, dword [esp + 0x10]
mov eax, dword [esp + 0x34]
push 0
lea ecx, [esp + 0x30]
push ecx
push esi
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x402a68
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
mov dword [esp + 0x14], eax
jne 0x402aaa
xor esi, esi
cmp dword [esp + 0x28], esi
jle 0x402aaa
mov edi, dword [esp + 0x3c]
mov ebp, dword [esp + 0x38]
mov ebx, dword [esp + 0x1c]
add edi, 1
nop
mov ecx, dword [ebp + 0x2c]
mov edx, dword [ecx + esi*4]
lea eax, [ecx + esi*4]
mov eax, dword [esp + 0x34]
push edi
push edx
push eax
mov ecx, ebx
call fcn.00402660
test eax, eax
mov dword [esp + 0x14], eax
jne 0x402ab2
add esi, 1
cmp esi, dword [esp + 0x28]
jl 0x402a80
jmp 0x402ab2
mov ebp, dword [esp + 0x38]
mov ebx, dword [esp + 0x1c]
mov ecx, dword [esp + 0x3c]
xor esi, esi
cmp dword [esp + 0x24], esi
jne 0x402af9
test byte [ebx + 0x14], 1
jne 0x402af9
test ecx, ecx
jle 0x402af9
mov eax, dword [esp + 0x10]
lea esi, [ecx*4]
jmp 0x402ae0
mov edx, dword [0x42abb8]
mov dword [eax], edx
mov dl, byte [0x42abbc]
mov byte [eax + 4], dl
add eax, 4
sub ecx, 1
jne 0x402ae0
test byte [ebx + 0x14], 2
mov ecx, ebp
je 0x402b16
call fcn.00401c70
mov edi, dword [esp + 0x10]
push eax
push str.___s_
lea eax, [esi + edi]
push eax
jmp 0x402b29
call fcn.00401c70
mov edi, dword [esp + 0x10]
push eax
push str.___s__r_n
lea ecx, [esi + edi]
push ecx
call fcn.00413e72
add esp, 0xc
push 0
lea edx, [esp + 0x30]
push edx
add eax, esi
push eax
mov eax, dword [esp + 0x40]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x402b55
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x10]
test eax, eax
je 0x402b66
push eax
call fcn.00412262
add esp, 4
mov eax, dword [esp + 0x14]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x20
ret 0xc
pop esi
pop ebp
mov eax, 0x57
pop ebx
add esp, 0x20
ret 0xc