Function at 0x403a40
Capabilities:
Write file on windows

Disassembly:
sub esp, 0xb1c
mov eax, dword [0x40d2ac]
xor edx, edx
mov dword [esp + 0x15], edx
mov dword [esp + 0xc], ecx
mov cl, byte [0x40d2b0]
mov byte [esp + 0x19], dl
mov edx, dword [0x40d2a4]
mov dword [esp + 0x10], eax
mov eax, dword [0x40d29c]
mov byte [esp + 0x14], cl
mov ecx, dword [0x40d2a0]
mov dword [esp + 0x24], edx
xor edx, edx
mov dword [esp + 0x1a], eax
mov ax, word [0x40d2a8]
mov dword [esp + 0x1e], ecx
mov cl, byte [0x40d2aa]
mov word [esp + 0x2b], dx
mov byte [esp + 0x2d], dl
mov word [esp + 0x28], ax
mov eax, dword [0x40d294]
mov byte [esp + 0x2a], cl
mov cl, byte [0x40d298]
mov dword [esp + 0x33], edx
push ebx
push ebp
mov byte [esp + 0x3f], dl
mov dl, byte [0x40e508]
push edi
mov dword [esp + 0x3a], eax
mov byte [esp + 0x3e], cl
mov ecx, 0x18
xor eax, eax
lea edi, [esp + 0x2c1]
mov byte [esp + 0x2c0], dl
mov byte [esp + 0x44], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x18
xor eax, eax
lea edi, [esp + 0x45]
mov byte [esp + 0xa8], dl
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov ecx, 0x3f
xor eax, eax
lea edi, [esp + 0xa9]
mov dx, word [0x40d290]
rep stosd dword es:[edi], eax
mov bl, byte [0x40d292]
mov ecx, 0x18
stosw word es:[edi], ax
stosb byte es:[edi], al
xor eax, eax
lea edi, [esp + 0x1ab]
mov word [esp + 0x1a8], dx
mov byte [esp + 0x1aa], bl
rep stosd dword es:[edi], eax
stosb byte es:[edi], al
mov ecx, 0x18
xor eax, eax
lea edi, [esp + 0x20f]
mov word [esp + 0x20c], dx
mov byte [esp + 0x20e], bl
xor ebp, ebp
rep stosd dword es:[edi], eax
stosb byte es:[edi], al
mov eax, dword [esp + 0xb2c]
push 0x40d28c
push eax
mov word [esp + 0x36], bp
call dword [sym.imp.MSVCRT.dll_fopen]
add esp, 8
cmp eax, ebp
mov dword [esp + 0xc], eax
je 0x404338
push esi
push eax
lea ecx, [esp + 0x32c]
push 0x800
push ecx
call dword [sym.imp.MSVCRT.dll_fgets]
mov ebx, eax
add esp, 0xc
cmp ebx, ebp
je 0x40431b
mov esi, dword [sym.imp.MSVCRT.dll_fgets]
mov edi, dword [esp + 0x10]
mov al, byte [esp + 0x328]
cmp al, 0xa
je 0x403bc1
cmp al, 0xd
jne 0x403bdc
mov al, byte [esp + 0x1af]
test al, al
jne 0x403c99
mov al, byte [esp + 0x48]
test al, al
jne 0x403c99
push 0
push 0
push 0
push 0
push 0x22
lea edx, [esp + 0x33c]
push 0x40d280
lea eax, [esp + 0x1c6]
push edx
push eax
call fcn.00402610
add esp, 0x20
test eax, eax
jne 0x403c77
push eax
push eax
push 0x3b
push eax
push 0xa
lea ecx, [esp + 0x33c]
push 0x40d264
lea edx, [esp + 0x60]
push ecx
push edx
call fcn.00402610
add esp, 0x20
test eax, eax
jne 0x403c77
push eax
push eax
push 0x3b
push eax
push 0xa
lea eax, [esp + 0x33c]
push 0x40d254
lea ecx, [esp + 0x2dc]
push eax
push ecx
call fcn.00402610
add esp, 0x20
test eax, eax
jne 0x403c77
push eax
push eax
push eax
push eax
push 0x22
lea edx, [esp + 0x33c]
push 0x40d248
lea eax, [esp + 0xc4]
push edx
push eax
call fcn.00402610
add esp, 0x20
push edi
lea ecx, [esp + 0x32c]
push 0x800
push ecx
call esi
mov ebx, eax
add esp, 0xc
test ebx, ebx
jne 0x403bb2
jmp 0x40431b
test ebx, ebx
je 0x40431b
mov al, byte [esp + 0x1af]
mov dword [esp + 0x14], 0
test al, al
je 0x403dee
mov edx, dword [esp + 0x10]
lea eax, [esp + 0x328]
push edx
push 0x800
push eax
mov byte [esp + 0x2d0], 0
mov byte [esp + 0xb8], 0
mov byte [esp + 0x54], 0
call dword [sym.imp.MSVCRT.dll_fgets]
mov ebx, eax
add esp, 0xc
test ebx, ebx
je 0x40431b
cmp byte [esp + 0x328], 0xa
jne 0x403d26
mov al, byte [esp + 0x48]
test al, al
jne 0x403de6
mov al, byte [esp + 0x2c4]
test al, al
jne 0x403de6
mov al, byte [esp + 0xac]
test al, al
jne 0x403de6
push 0
push 0
push 0
push 0
push 0x22
lea ecx, [esp + 0x33c]
push 0x40d280
lea edx, [esp + 0x22a]
push ecx
push edx
call fcn.00402610
push 0
push 0
push 0x3b
push 0
push 0xa
lea eax, [esp + 0x35c]
push 0x40d254
lea ecx, [esp + 0x2fc]
push eax
push ecx
call fcn.00402610
add esp, 0x40
lea edx, [esp + 0x328]
lea eax, [esp + 0xac]
push 0
push 0
push 0
push 0
push 0x22
push 0x40d248
push edx
push eax
call fcn.00402610
push 0
push 0
push 0x3b
push 0
push 0xa
lea ecx, [esp + 0x35c]
push 0x40d264
lea edx, [esp + 0x80]
push ecx
push edx
call fcn.00402610
mov eax, dword [esp + 0x50]
add esp, 0x40
lea ecx, [esp + 0x328]
push eax
push 0x800
push ecx
call dword [sym.imp.MSVCRT.dll_fgets]
mov ebx, eax
add esp, 0xc
test ebx, ebx
je 0x40431b
jmp 0x403cf2
test ebx, ebx
je 0x40431b
mov al, byte [esp + 0x48]
xor ebp, ebp
test al, al
je 0x403e1e
xor esi, esi
lea edi, [esp + 0x20]
lea edx, [esp + 0x48]
push edi
push edx
call dword [sym.imp.MSVCRT.dll_strstr]
add esp, 8
test eax, eax
je 0x403e15
mov dword [esp + 0x14], esi
inc esi
add edi, 0xa
cmp esi, 4
jl 0x403dfe
mov al, byte [esp + 0xac]
test al, al
je 0x403ede
push 1
push 0
push 0
lea eax, [esp + 0xb8]
push 0x40d240
push eax
call fcn.00402500
add esp, 0x14
test eax, eax
je 0x403e8b
push 1
push 0
push 0
lea ecx, [esp + 0xb8]
push 0x40d240
push ecx
call fcn.00402500
mov edx, eax
mov edi, 0x40d238
or ecx, 0xffffffff
xor eax, eax
add esp, 0x14
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea edi, [esp + 0xac]
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x328]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
mov edx, dword [esp + 0xb34]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
lea eax, [esp + 0xac]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea ecx, [esp + 0x328]
push ecx
push edx
push 0x40d230
push eax
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0x10
jmp 0x403f1b
inc dword [0x40e504]
call fcn.00402320
mov ecx, dword [0x40e504]
push eax
push ecx
push 0
call dword [sym.imp.MSVCRT.dll_time]
mov edx, dword [esp + 0xb40]
add esp, 4
push eax
push edx
lea eax, [esp + 0xbc]
push 0x40d21c
push eax
call dword [sym.imp.MSVCRT.dll_sprintf]
add esp, 0x18
push 1
push 0
push 0
lea ecx, [esp + 0xb8]
push 0x40d238
push ecx
call fcn.00402500
add esp, 0x14
test eax, eax
je 0x403f5f
push 0
push 0xffffffffffffffff
lea edx, [esp + 0xb4]
push 0
push edx
call fcn.00404ed0
add esp, 0x10
test eax, eax
je 0x403f5f
push 0x7d0
call dword [sym.imp.KERNEL32.dll_Sleep]
mov eax, dword [esp + 0x14]
cmp eax, 3
ja case.default.0x403f6c
jmp dword [eax*4 + 0x404348]
lea eax, [esp + 0xac]
push 0x40d15c
push eax
call dword [sym.imp.MSVCRT.dll_fopen]
add esp, 8
mov dword [esp + 0x18], eax
test eax, eax
je 0x40431b
mov ebp, 1
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x328]
push ecx
push 0x800
push edx
call dword [sym.imp.MSVCRT.dll_fgets]
mov ebx, eax
add esp, 0xc
test ebx, ebx
je 0x4042e2
mov esi, dword [sym.imp.MSVCRT.dll_strstr]
lea eax, [esp + 0x1ac]
lea ecx, [esp + 0x328]
push eax
push ecx
call esi
add esp, 8
test eax, eax
jne 0x4042e2
mov al, byte [esp + 0x213]
test al, al
je 0x40400a
lea edx, [esp + 0x210]
lea eax, [esp + 0x328]
push edx
push eax
call esi
add esp, 8
test eax, eax
jne 0x4042e2
mov esi, 0x40d218
lea eax, [esp + 0x328]
mov dl, byte [eax]
mov cl, dl
cmp dl, byte [esi]
jne 0x40403a
test cl, cl
je 0x404036
mov dl, byte [eax + 1]
mov cl, dl
cmp dl, byte [esi + 1]
jne 0x40403a
add eax, 2
add esi, 2
test cl, cl
jne 0x404016
xor eax, eax
jmp 0x40403f
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x40416c
lea edi, [esp + 0x328]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
cmp byte [esp + ecx + 0x327], 0xa
jne 0x4040f9
cmp dword [esp + 0x14], 2
jne 0x4040f9
mov byte [esp + ecx + 0x327], 0
dec ecx
lea edx, [esp + 0x274]
push ecx
lea eax, [esp + 0x32c]
push edx
push eax
call fcn.00402a90
mov esi, eax
add esp, 0xc
test esi, esi
jle 0x40415f
lea ecx, [esp + 0x2c4]
push 0x40d20c
push ecx
call dword [sym.imp.MSVCRT.dll__stricmp]
add esp, 8
test eax, eax
jne 0x40413e
xor edx, edx
test esi, esi
jle 0x40412c
mov cl, byte [esp + edx + 0x274]
cmp cl, 0xd
jne 0x4040d7
cmp byte [esp + edx + 0x275], 0xa
jne 0x4040e6
cmp cl, 0xa
jne 0x40411f
cmp byte [esp + edx + 0x273], 0xd
je 0x40411f
mov byte [esp + eax + 0x328], 0xd
inc eax
mov byte [esp + eax + 0x328], 0xa
jmp 0x404126
cmp dword [esp + 0x14], 1
jne 0x40407a
push ecx
lea eax, [esp + 0x278]
lea ecx, [esp + 0x32c]
push eax
push ecx
call fcn.00402bd0
jmp 0x404090
mov byte [esp + eax + 0x328], cl
inc edx
inc eax
cmp edx, esi
jl 0x4040c1
mov edx, dword [esp + 0x18]
push edx
push 1
push eax
lea eax, [esp + 0x334]
push eax
jmp 0x40414e
mov ecx, dword [esp + 0x18]
lea edx, [esp + 0x274]
push ecx
push 1
push esi
push edx
call dword [sym.imp.MSVCRT.dll_fwrite]
mov ebp, eax
add esp, 0x10
dec ebp
neg ebp
sbb ebp, ebp
inc ebp
test ebp, ebp
jne 0x403f9a
jmp 0x4042e2
xor ebx, ebx
jmp 0x4042e2
mov al, byte [esp + 0xac]
test al, al
je 0x4041a0
lea ecx, [esp + 0xac]
push 0x40d15c
push ecx
call dword [sym.imp.MSVCRT.dll_fopen]
add esp, 8
mov dword [esp + 0x18], eax
test eax, eax
je 0x40431b
mov ebp, 1
mov edx, dword [esp + 0x10]
lea eax, [esp + 0x328]
push edx
push 0x800
push eax
call dword [sym.imp.MSVCRT.dll_fgets]
mov ebx, eax
add esp, 0xc
test ebx, ebx
je 0x4042d7
mov esi, dword [sym.imp.MSVCRT.dll_strstr]
lea ecx, [esp + 0x1ac]
lea edx, [esp + 0x328]
push ecx
push edx
call esi
add esp, 8
test eax, eax
jne 0x4042d7
mov al, byte [esp + 0x213]
test al, al
je 0x404215
lea eax, [esp + 0x210]
lea ecx, [esp + 0x328]
push eax
push ecx
call esi
add esp, 8
test eax, eax
jne 0x4042d7
mov esi, 0x40d218
lea eax, [esp + 0x328]
mov dl, byte [eax]
mov cl, dl
cmp dl, byte [esi]
jne 0x404245
test cl, cl
je 0x404241
mov dl, byte [eax + 1]
mov cl, dl
cmp dl, byte [esi + 1]
jne 0x404245
add eax, 2
add esi, 2
test cl, cl
jne 0x404221
xor eax, eax
jmp 0x40424a
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x4042d5
lea edi, [esp + 0x328]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov edx, ecx
cmp byte [esp + edx + 0x327], 0xa
jne 0x40429f
mov edi, 0x40d160
or ecx, 0xffffffff
xor eax, eax
inc edx
repne scasb al, byte es:[edi]
not ecx
lea esi, [esp + edx + 0x326]
sub edi, ecx
mov eax, ecx
mov dword [esp + 0x14], esi
mov esi, edi
mov edi, dword [esp + 0x14]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov al, byte [esp + 0xac]
test al, al
je 0x4042cb
mov ecx, dword [esp + 0x18]
push ecx
push 1
push edx
lea edx, [esp + 0x334]
push edx
call dword [sym.imp.MSVCRT.dll_fwrite]
mov ebp, eax
add esp, 0x10
dec ebp
neg ebp
sbb ebp, ebp
inc ebp
test ebp, ebp
jne 0x4041a5
jmp 0x4042d7
xor ebx, ebx
mov al, byte [esp + 0xac]
test al, al
je 0x4042f0
mov eax, dword [esp + 0x18]
push eax
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
test ebp, ebp
je case.default.0x403f6c
mov al, byte [esp + 0xac]
test al, al
je case.default.0x403f6c
mov edx, dword [esp + 0x1c]
lea ecx, [esp + 0xac]
push ecx
lea ecx, [edx + 4]
call fcn.00401590
test ebx, ebx
jne 0x403ca1
mov eax, dword [esp + 0x10]
push eax
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov eax, ebp
pop esi
pop edi
pop ebp
pop ebx
add esp, 0xb1c
ret 8
mov eax, ebp
pop edi
pop ebp
pop ebx
add esp, 0xb1c
ret 8