Function at 0x406040
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push ebx
mov ebx, dword [0x43c648]
push esi
push edi
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov eax, dword [ebx + 0x2c]
mov dword [ebp - 4], 6
test eax, eax
je 0x4061b0
cmp byte [ebx + 1], 0
je 0x4061b0
mov byte [eax + 0x10], 0
mov esi, dword [ebx + 0x2c]
mov dword [ebp - 0x10], esi
test esi, esi
je 0x4061b0
mov ecx, esi
call fcn.004255b0
mov ecx, esi
call fcn.004257b0
lea ecx, [esi + 0x3c]
xor esi, esi
mov dword [ebp - 8], ecx
cmp dword [ecx], esi
jle 0x40612c
mov eax, dword [ecx + 8]
mov edi, dword [eax + esi*4]
test edi, edi
je 0x40611d
mov ecx, edi
call fcn.00427cc0
mov ecx, dword [0x43c648]
test ecx, ecx
je 0x40610c
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0xc], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x406102
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0xc]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
call edi
mov ecx, dword [ebp - 8]
add esp, 4
jmp 0x406123
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
inc esi
cmp esi, dword [ecx]
jl 0x4060a1
call fcn.00401d00
mov esi, dword [ebp - 0x10]
lea ecx, [esi + 0x54]
mov byte [esi + 0x18], 0
call fcn.00403780
lea ecx, [esi + 0x48]
call fcn.00403780
mov ecx, dword [ebp - 8]
call fcn.00403780
mov ecx, dword [0x43c648]
test ecx, ecx
je 0x4061aa
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x4061a0
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push esi
call edi
add esp, 4
lea ecx, [ebx + 0x3d28]
mov dword [ebx + 0x2c], 0
call fcn.00401d00
cmp byte [ebx], 0
je 0x4069cd
cmp byte [ebx + 0x5d9c], 0
je 0x406224
mov esi, dword [ebx + 0x20]
test esi, esi
je 0x406224
mov eax, dword [0x43c648]
lea ecx, [ebp - 8]
mov dword [ebp - 8], 0
mov dword [eax + 0x5da0], 0
call fcn.00418000
mov edx, 0x438750
mov ecx, esi
mov edi, eax
call fcn.00404700
mov esi, eax
test esi, esi
je 0x406224
push esi
push dword [ebp - 8]
push 1
push edi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fwrite]
push esi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 0x14
mov eax, dword [ebx + 0x5dd4]
mov esi, dword [ebx + 0x5ddc]
lea eax, [eax + eax*4]
lea edi, [esi + eax*4]
cmp esi, edi
je 0x406257
nop word [eax + eax]
cmp dword [esi + 4], 6
jne 0x406250
mov eax, dword [esi + 0xc]
push esi
push ebx
call eax
add esp, 8
add esi, 0x14
cmp esi, edi
jne 0x406240
lea ecx, [ebx + 0x3f40]
xor esi, esi
cmp dword [ecx], esi
jle 0x4062e7
mov eax, dword [ecx + 8]
mov edi, dword [eax + esi*4]
test edi, edi
je 0x4062e2
mov ecx, edi
call fcn.00407180
mov ecx, dword [0x43c648]
test ecx, ecx
je 0x4062d2
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x4062c8
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
lea ecx, [ebx + 0x3f40]
inc esi
cmp esi, dword [ecx]
jl 0x406267
call fcn.00401d00
lea ecx, [ebx + 0x3f4c]
call fcn.00401d00
lea ecx, [ebx + 0x3f58]
call fcn.00401d00
mov dword [ebx + 0x3f8c], 0
mov esi, dword [ebx + 0x3f6c]
test esi, esi
je 0x406391
mov ecx, dword [0x43c648]
mov dword [ebx + 0x3f68], 0
mov dword [ebx + 0x3f64], 0
test ecx, ecx
je 0x406379
movsx edx, word [ecx + 0x5ebc]
lea eax, [ecx + 0x5ec0]
mov edi, dword [ecx + 0x3f08]
lea eax, [eax + edx*8]
cmp dword [eax], edi
je 0x40636f
lea eax, [edx + 1]
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
xor edx, edx
lea eax, [ecx + eax*8]
mov dword [eax], edi
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push esi
mov esi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
call esi
add esp, 4
mov dword [ebx + 0x3f6c], 0
jmp 0x406397
mov esi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
lea ecx, [ebx + 0x3f70]
call fcn.00401d00
or eax, 0xffffffff
mov dword [ebx + 0x4a3c], 0
mov dword [ebx + 0x3f94], 0
lea edi, [ebx + 0x477c]
mov dword [ebx + 0x3f90], 0
mov ecx, 0x4d
mov dword [ebx + 0x400c], 0
mov dword [ebx + 0x3ff8], 0
mov dword [ebx + 0x3f98], 0
rep stosd dword es:[edi], eax
lea ecx, [ebx + 0x48b0]
call fcn.00401d00
lea ecx, [ebx + 0x48bc]
call fcn.00401d00
mov edi, dword [ebx + 0x49c8]
test edi, edi
je 0x40648c
mov ecx, dword [0x43c648]
mov dword [ebx + 0x49c4], 0
mov dword [ebx + 0x49c0], 0
test ecx, ecx
je 0x40647c
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x406472
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
call esi
add esp, 4
mov dword [ebx + 0x49c8], 0
mov edi, dword [ebx + 0x49d4]
test edi, edi
je 0x406514
mov ecx, dword [0x43c648]
mov dword [ebx + 0x49d0], 0
mov dword [ebx + 0x49cc], 0
test ecx, ecx
je 0x406504
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x4064fa
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
call esi
add esp, 4
mov dword [ebx + 0x49d4], 0
lea ecx, [ebx + 0x49d8]
call fcn.00401d00
lea ecx, [ebx + 0x4a08]
call fcn.00401d00
lea ecx, [ebx + 0x4a14]
call fcn.00401d00
mov edi, dword [ebx + 0x4a28]
test edi, edi
je 0x4065bd
mov ecx, dword [0x43c648]
mov dword [ebx + 0x4a24], 0
mov dword [ebx + 0x4a20], 0
test ecx, ecx
je 0x4065ad
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x4065a3
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
call esi
add esp, 4
mov dword [ebx + 0x4a28], 0
lea ecx, [ebx + 0x4a30]
call fcn.00419270
lea ecx, [ebx + 0x4d28]
call fcn.004190c0
mov edi, dword [ebx + 0x4d50]
test edi, edi
je 0x40665b
mov ecx, dword [0x43c648]
mov dword [ebx + 0x4d4c], 0
mov dword [ebx + 0x4d48], 0
test ecx, ecx
je 0x40664b
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x406641
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
call esi
add esp, 4
mov dword [ebx + 0x4d50], 0
mov edi, dword [ebx + 0x4d5c]
test edi, edi
je 0x4066e3
mov ecx, dword [0x43c648]
mov dword [ebx + 0x4d58], 0
mov dword [ebx + 0x4d54], 0
test ecx, ecx
je 0x4066d3
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x4066c9
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push edi
call esi
add esp, 4
mov dword [ebx + 0x4d5c], 0
xor edi, edi
lea eax, [ebx + 0x4cd0]
mov dword [ebp - 8], eax
cmp dword [ebx + 0x4cc8], edi
jle 0x406723
xor esi, esi
nop dword [eax + eax]
mov ecx, dword [eax]
add ecx, esi
call fcn.00401fc0
inc edi
lea eax, [ebx + 0x4cd0]
add esi, 0x1c
cmp edi, dword [ebx + 0x4cc8]
jl 0x406700
lea eax, [ebx + 0x4cd0]
jmp 0x406726
mov dword [ebp - 8], eax
mov esi, dword [eax]
test esi, esi
je 0x4067a6
mov ecx, dword [0x43c648]
mov dword [ebx + 0x4ccc], 0
mov dword [ebx + 0x4cc8], 0
test ecx, ecx
je 0x40678f
movsx edx, word [ecx + 0x5ebc]
lea eax, [ecx + 0x5ec0]
mov edi, dword [ecx + 0x3f08]
lea eax, [eax + edx*8]
cmp dword [eax], edi
je 0x406785
lea eax, [edx + 1]
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
xor edx, edx
lea eax, [ecx + eax*8]
mov dword [eax], edi
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
push esi
call edi
mov eax, dword [ebp - 8]
add esp, 4
mov dword [eax], 0
jmp 0x4067ac
mov edi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
lea ecx, [ebx + 0x4cec]
call fcn.004191a0
cmp dword [ebx + 0x4ce0], 0
mov dword [ebp - 8], 0
jle 0x406800
xor ecx, ecx
mov dword [ebp - 0xc], ecx
nop dword [eax]
mov esi, dword [ebx + 0x4ce8]
add esi, ecx
lea ecx, [esi + 0x14]
call fcn.00424f90
lea ecx, [esi + 0x1c]
call fcn.00403780
mov eax, dword [ebp - 8]
mov ecx, dword [ebp - 0xc]
inc eax
add ecx, 0x6c
mov dword [ebp - 8], eax
mov dword [ebp - 0xc], ecx
cmp eax, dword [ebx + 0x4ce0]
jl 0x4067d0
mov esi, dword [ebx + 0x4ce8]
test esi, esi
je 0x406888
mov ecx, dword [0x43c648]
mov dword [ebx + 0x4ce4], 0
mov dword [ebx + 0x4ce0], 0
test ecx, ecx
je 0x406878
movsx eax, word [ecx + 0x5ebc]
mov edx, dword [ecx + 0x3f08]
add eax, 0xbd8
mov dword [ebp - 0x10], edx
cmp dword [ecx + eax*8], edx
lea eax, [ecx + eax*8]
je 0x40686e
movsx eax, word [ecx + 0x5ebc]
inc eax
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov edx, dword [ebp - 0x10]
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
lea eax, [ecx + eax*8]
mov dword [eax], edx
xor edx, edx
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
push esi
call edi
add esp, 4
mov dword [ebx + 0x4ce8], 0
lea ecx, [ebx + 0x4d18]
call fcn.00401d00
lea ecx, [ebx + 0x5d04]
call fcn.00401d00
lea ecx, [ebx + 0x5d10]
call fcn.00401d00
lea ecx, [ebx + 0x4d98]
call fcn.00401d00
lea ecx, [ebx + 0x4da4]
call fcn.00401d00
lea ecx, [ebx + 0x4db0]
call fcn.00401d00
lea ecx, [ebx + 0x5c04]
mov dword [ebx + 0x5c00], 0
call fcn.00401d00
lea ecx, [ebx + 0x5dbc]
call fcn.00401d00
mov eax, dword [ebx + 0x5db8]
mov dword [ebp - 0x10], eax
test eax, eax
je 0x40696d
mov ecx, dword [0x43c648]
mov dword [ebx + 0x5db4], 0
mov dword [ebx + 0x5db0], 0
test ecx, ecx
je 0x40695d
movsx edx, word [ecx + 0x5ebc]
lea eax, [ecx + 0x5ec0]
mov esi, dword [ecx + 0x3f08]
lea eax, [eax + edx*8]
cmp dword [eax], esi
je 0x406950
lea eax, [edx + 1]
cdq
idiv dword [ebp - 4]
movzx eax, dx
mov word [ecx + 0x5ebc], ax
cwde
add eax, 0xbd8
xor edx, edx
lea eax, [ecx + eax*8]
mov dword [eax], esi
mov dword [eax + 4], edx
inc word [eax + 6]
inc dword [ecx + 0x5eb8]
mov eax, dword [ebp - 0x10]
push eax
call edi
add esp, 4
mov dword [ebx + 0x5db8], 0
cmp dword [ebx + 0x5e0c], 0
je 0x40699f
mov esi, dword [ebx + 0x5e0c]
push 1
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
cmp esi, eax
je 0x406995
push esi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
mov dword [ebx + 0x5e0c], 0
lea ecx, [ebx + 0x5e10]
call fcn.00401d00
lea ecx, [ebx + 0x5e3c]
call fcn.00401d00
lea ecx, [ebx + 0x5e48]
call fcn.00401d00
mov dword [ebx + 0x5e54], 0
mov byte [ebx], 0
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret