Function at 0x406340
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x428
mov eax, dword [0x5f3418]
xor eax, ebp
mov dword [ebp - 0x10], eax
mov dword [ecx], 0x5d6424
lea ebx, [ecx + 8]
mov dword [ebp - 0x424], ecx
add ecx, 0xc
lea esi, [ebp - 0x410]
mov dword [ebp - 0x434], ecx
push esi
call fcn.004f73a0
movzx eax, byte [esi + 0xb]
mov ecx, eax
and ecx, 0x7f
mov dword [ebp - 0x430], ecx
test al, al
jns 0x406399
mov eax, dword [ebp - 0x40c]
mov dword [ebp - 0x430], eax
jns 0x4063a9
push dword [ebp - 0x410]
call fcn.0050fc7c
add esp, 4
mov eax, dword [ebx]
mov eax, dword [eax + 4]
mov eax, dword [ebx + eax + 0x1c]
lea ecx, [ebp - 0x410]
mov dword [ecx], eax
lock inc dword [eax + 4]
push 0x6bedb0
call fcn.00506190
mov edi, eax
mov eax, dword [eax]
mov esi, dword [eax + 0x1c]
mov ecx, esi
call dword [section..00cfg]
mov ecx, edi
push 0xa
call esi
lea ecx, [ebp - 0x410]
mov edi, dword [ecx]
xor esi, esi
dec esi
mov ecx, esi
lock xadd dword [edi + 4], ecx
test ecx, ecx
je 0x406521
movsx eax, al
mov ecx, ebx
push eax
call fcn.00406910
mov ecx, ebx
call fcn.004067c0
lea edi, [ebp - 0x41c]
mov dword [edi], esi
mov dword [edi + 4], esi
mov dword [edi + 8], esi
mov ecx, dword [ebp - 0x434]
push edi
call fcn.004f73a0
test byte [0x5f54e0], 0x19
jne 0x40654b
mov eax, dword [ebp - 0x424]
cmp dword [eax + 4], 3
je 0x406566
call fcn.00547520
test al, al
je 0x406482
lea eax, [ebp - 0x41c]
movzx ecx, byte [eax + 0xb]
mov edx, ecx
and edx, 0x7f
test cl, cl
cmovs edx, dword [eax + 4]
mov dword [ebp - 0x410], 0xffffffff
cmovs eax, dword [eax]
push 0
lea ecx, [ebp - 0x410]
push ecx
push edx
push eax
push dword [0x6bedf0]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp - 0x424]
cmp dword [eax + 4], 3
je 0x4065c5
cmp byte [ebp - 0x411], 0
jns 0x4064a9
push dword [ebp - 0x41c]
call fcn.0050fc7c
add esp, 4
mov edi, dword [ebp - 0x424]
push dword [edi + 0xa0]
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov esi, dword [edi + 0x9c]
call fcn.00510cbf
mov dword [eax], esi
mov eax, dword [edi + 8]
mov eax, dword [eax + 4]
mov dword [edi + eax + 8], 0x5d6c64
mov dword [edi + 0xc], 0x5d6c70
cmp byte [edi + 0x37], 0
jns 0x4064ee
push dword [edi + 0x2c]
call fcn.0050fc7c
add esp, 4
add edi, 0x40
mov esi, dword [ebp - 0x434]
mov ecx, esi
call fcn.004f7350
mov ecx, esi
call fcn.004ee170
mov ecx, edi
call fcn.004f7230
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00512ee3
add esp, 0x428
pop esi
pop edi
pop ebx
pop ebp
ret
mov ecx, dword [edi]
mov ecx, dword [ecx + 4]
mov dword [ebp - 0x42c], ecx
mov byte [ebp - 0x428], al
call dword [section..00cfg]
mov ecx, edi
call dword [ebp - 0x42c]
mov al, byte [ebp - 0x428]
jmp 0x4063f7
lea ecx, [ebp - 0x410]
mov eax, dword [ebp - 0x424]
mov dword [ecx], eax
mov dword [ecx + 4], edi
call fcn.005684b0
jmp 0x406430
cmp byte [0x6bee08], 0
jne 0x406440
mov byte [0x6bee08], 1
mov eax, dword [0x6bee10]
mov ecx, dword [0x5f75b4]
mov edx, dword fs:[0x2c]
mov ecx, dword [edx + ecx*4]
cmp eax, dword [ecx + 4]
jg 0x406765
mov ecx, dword [ebp - 0x424]
lea edx, [ebp - 0x410]
call fcn.00568140
movzx eax, byte [ebp - 0x405]
test al, al
jns 0x4065e8
mov ecx, dword [ebp - 0x410]
mov eax, dword [ebp - 0x40c]
jmp 0x4065f1
mov ecx, dword [0x6bede4]
test ecx, ecx
je 0x40662e
movzx eax, byte [ebp - 0x411]
test al, al
jns 0x406624
mov edi, dword [ebp - 0x41c]
mov eax, dword [ebp - 0x418]
jmp 0x406627
and eax, 0x7f
lea ecx, [ebp - 0x410]
push eax
push ecx
push dword [0x6bee0c]
call fcn.004ee170
add esp, 0xc
cmp byte [ebp - 0x405], 0
jns 0x406618
push dword [ebp - 0x410]
call fcn.0050fc7c
add esp, 4
mov byte [0x6bee08], 0
jmp 0x406440
and eax, 0x7f
push eax
push edi
call fcn.005669f0
mov esi, 0x400
push esi
push 0xff
lea eax, [ebp - 0x410]
push eax
call fcn.005191b0
add esp, 0xc
cmp byte [ebp - 0x411], 0
jns 0x406659
mov eax, dword [ebp - 0x41c]
jmp 0x40665f
lea eax, [ebp - 0x41c]
push esi
push eax
lea esi, [ebp - 0x410]
push esi
call fcn.0050ec70
add esp, 0xc
push esi
call fcn.004ee170
add esp, 4
call fcn.00568040
mov eax, dword [0x6bedfc]
cmp eax, dword [0x6bee00]
je 0x4067a8
mov dword [ebp - 0x420], 0xffffffff
call fcn.00568040
mov eax, dword [0x6bee00]
test eax, eax
mov ecx, dword [0x6bedf8]
cmove eax, ecx
dec eax
cmp ecx, eax
jb 0x4067ab
shl eax, 2
add eax, dword [0x6bedf4]
lea esi, [ebp - 0x420]
mov ecx, esi
push eax
call fcn.0050ea20
cmp dword [esi], 0
jne 0x4066e3
lea ecx, [ebp - 0x420]
call fcn.0050e9f0
jmp 0x406492
cmp byte [ebp - 0x411], 0
jns 0x4066f4
mov eax, dword [ebp - 0x41c]
jmp 0x4066fa
lea eax, [ebp - 0x41c]
mov dword [ebp - 0x428], eax
mov ebx, dword [ebp - 0x428]
add ebx, dword [ebp - 0x430]
je 0x4067ae
push ebx
call fcn.005338e0
add esp, 4
mov dword [ebp - 0x42c], eax
mov eax, dword [ebp - 0x424]
mov ecx, dword [eax + 0x90]
mov esi, dword [ebp - 0x430]
sub esi, ecx
mov edi, dword [ebp - 0x428]
add edi, ecx
mov edx, dword [eax + 0x94]
lea ecx, [ebp - 0x420]
push dword [ebp - 0x42c]
push ebx
push esi
push edi
push dword [eax + 0x98]
call fcn.005680a0
add esp, 0x14
jmp 0x4066d3
push 0x6bee10
call fcn.00510c6d
add esp, 4
cmp dword [0x6bee10], 0xffffffff
jne 0x40659b
push 0x400
push str.LOG_FATAL
call fcn.00406900
add esp, 8
mov dword [0x6bee0c], eax
push 0x6bee10
call fcn.00510d9d
add esp, 4
jmp 0x40659b
int3
int3
int3