Function at 0x4165d8
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
push ebx
push esi
mov esi, dword [ebp + 8]
test esi, esi
push edi
je 0x416f9a
cmp dword [ebp + 0xc], 0
je 0x416f9a
mov ecx, dword [ebp + 0x14]
test ecx, ecx
je 0x416f9a
cmp byte [ecx], 0
je 0x416f9a
test word [esi + 0x16c], 0x8000
jne 0x41661c
push 5
jmp 0x416f9c
xor eax, eax
inc eax
test byte [ebp + 0x18], al
je 0x416629
xor dword [ebp + 0x18], eax
jmp 0x41662b
xor eax, eax
push eax
push dword [0x46d630]
push ecx
push esi
call fcn.00415131
add esp, 0x10
test eax, eax
mov dword [ebp - 0x40], eax
je 0x416fa2
mov cl, byte [esi + 0x142]
mov ebx, dword [ebp + 0x10]
mov edi, 0x200
shl edi, cl
xor edx, edx
mov eax, ebx
and dword [ebp - 0x38], 0
div edi
mov dword [ebp - 8], ebx
mov dword [ebp - 4], edi
test edx, edx
mov dword [ebp - 0x14], eax
je 0x416671
inc dword [ebp - 0x14]
mov eax, dword [ebp + 0x18]
xor edi, edi
and eax, 0x200
mov dword [ebp - 0x2c], edi
mov dword [ebp - 0x24], eax
jne 0x41668b
test word [ebp + 0x18], 0x100
je 0x416698
mov edi, dword [ebp - 0x14]
lea edi, [edi*4 + 4]
mov dword [ebp - 0x2c], edi
push 4
push dword [0x468014]
lea eax, [esi + 0x124]
push eax
call fcn.00437d5b
add esp, 0xc
test eax, eax
lea eax, [edi + ebx]
mov dword [ebp - 0x20], eax
jne 0x416718
add eax, 0x144
push eax
mov dword [ebp - 0x38], 1
call fcn.00417b53
mov edi, eax
test edi, edi
mov dword [ebp - 0x34], edi
je 0x416fa2
push dword [ebp + 0x14]
mov byte [edi], 0x44
mov byte [edi + 1], 1
call fcn.00437cd0
pop ecx
mov ecx, 0x104
cmp eax, ecx
ja 0x416700
push eax
push dword [ebp + 0x14]
lea eax, [edi + 0x40]
push eax
call fcn.00437960
jmp 0x41670d
push ecx
push dword [ebp + 0x14]
lea eax, [edi + 0x40]
push eax
call fcn.004395f0
add esp, 0xc
lea eax, [edi + 0x144]
jmp 0x416721
push eax
call fcn.00417b53
mov edi, dword [ebp - 0x34]
test eax, eax
mov dword [ebp + 8], eax
mov ecx, 0x10000
mov edx, 0x20000
jne 0x41678c
test ebx, ebx
jne 0x416fa2
cmp dword [ebp - 0x24], 0
je 0x416747
xor dword [ebp + 0x18], 0x200
mov eax, pe_nt_image_headers32
test dword [ebp + 0x18], eax
je 0x416754
xor dword [ebp + 0x18], eax
test dword [ebp + 0x18], ecx
je 0x41675c
xor dword [ebp + 0x18], ecx
test dword [ebp + 0x18], edx
je 0x416764
xor dword [ebp + 0x18], edx
mov ebx, dword [ebp - 0x14]
mov eax, ebx
shl eax, 2
mov dword [ebp - 0x3c], eax
add eax, 4
push eax
call fcn.00417b53
test eax, eax
mov dword [ebp - 0x10], eax
jne 0x4167a1
push dword [ebp + 8]
call fcn.00413886
jmp 0x416fa2
test ebx, ebx
je 0x41673a
push ebx
push dword [ebp + 0xc]
push dword [ebp + 8]
call fcn.00437960
add esp, 0xc
jmp 0x416764
mov eax, dword [ebp + 0x18]
and eax, 0x200
mov dword [ebp - 0x24], eax
jne 0x4167e8
test word [ebp + 0x18], 0x100
jne 0x4167e8
lea edx, [ebx + 1]
xor eax, eax
test edx, edx
jbe 0x416a55
xor ecx, ecx
cmp eax, dword [ebp - 0x14]
mov ebx, dword [ebp - 0x10]
jae 0x4167d2
mov dword [ebx + eax*4], ecx
jmp 0x4167db
mov edi, dword [ebp + 0x10]
mov dword [ebx + eax*4], edi
mov edi, dword [ebp - 0x34]
add ecx, dword [ebp - 4]
inc eax
cmp eax, edx
jb 0x4167c5
jmp 0x416a55
and dword [ebp - 8], 0
test byte [ebp + 0x1c], 0xc0
push 8
pop ebx
je 0x416837
mov edi, dword [ebp + 8]
push 4
push dword [0x468018]
push edi
call fcn.00437d5b
add esp, 0xc
test eax, eax
jne 0x416830
push ebx
push dword [0x46801c]
lea eax, [edi + 8]
push eax
call fcn.00437d5b
add esp, 0xc
test eax, eax
jne 0x416830
cmp byte [edi + 0x14], 1
jne 0x416830
cmp byte [edi + 0x22], 0x10
je 0x416837
and dword [ebp + 0x20], 0
mov dword [ebp + 0x1c], ebx
mov eax, dword [ebp + 0x1c]
mov dword [ebp - 0x30], eax
and dword [ebp - 0x30], 0x40
jne 0x416871
test al, al
js 0x416871
test al, 9
jne 0x416869
cmp dword [ebp - 0x24], 0x200
je 0x41685c
test word [ebp + 0x18], 0x100
jne 0x416869
test al, 2
je 0x416890
mov dword [ebp - 8], 1
jmp 0x416890
mov eax, dword [ebp + 0x20]
mov dword [ebp - 8], eax
jmp 0x41687a
mov eax, dword [ebp + 0x20]
dec eax
je 0x416889
dec eax
je 0x416880
and dword [ebp + 0x20], 0
jmp 0x416890
mov dword [ebp + 0x20], 3
jmp 0x416890
mov dword [ebp + 0x20], 1
push dword [ebp - 4]
mov edi, dword [ebp - 0x2c]
call fcn.00417b53
mov ebx, eax
test ebx, ebx
jne 0x4168ae
push dword [ebp - 0x10]
call fcn.00413886
jmp 0x41677f
push dword [ebp - 4]
call fcn.00417b53
test eax, eax
mov dword [ebp - 0xc], eax
jne 0x4168c5
push ebx
call fcn.00413886
jmp 0x4168a1
push dword [ebp - 0x20]
call fcn.00417b53
test eax, eax
mov dword [ebp - 0x20], eax
jne 0x4168de
push dword [ebp - 0xc]
call fcn.00413886
jmp 0x4168bd
mov eax, dword [ebp - 0x14]
and dword [ebp - 0x18], 0
and dword [ebp - 0x1c], 0
test eax, eax
jbe 0x416a12
mov ecx, dword [ebp - 0x1c]
mov edx, dword [ebp - 0x10]
dec eax
cmp ecx, eax
mov dword [edx + ecx*4], edi
jne 0x41690e
mov eax, dword [ebp + 0x10]
xor edx, edx
div dword [ebp - 4]
test edx, edx
je 0x41690e
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
mov ecx, dword [ebp + 8]
push eax
mov dword [ebp + 0xc], eax
mov eax, dword [ebp - 0x18]
add eax, ecx
push eax
push ebx
call fcn.00437960
add esp, 0xc
cmp dword [ebp - 0x24], 0
je 0x416998
cmp dword [ebp - 0x1c], 0
jne 0x416947
cmp dword [ebp - 0x30], 0
jne 0x41693f
test byte [ebp + 0x1c], 0x80
je 0x416947
push 0
push 0
push 8
jmp 0x41697c
test byte [ebp + 0x1c], 0x34
je 0x416973
call fcn.00413f02
mov eax, dword [0x46d660]
test eax, eax
je 0x4169c9
push dword [ebp + 0x20]
lea ecx, [ebp + 0xc]
push dword [ebp - 8]
push dword [ebp + 0x1c]
push dword [ebp - 4]
push ebx
push ecx
push dword [ebp - 0xc]
call eax
jmp 0x41698c
push dword [ebp + 0x20]
push dword [ebp - 8]
push dword [ebp + 0x1c]
push dword [ebp - 4]
lea eax, [ebp + 0xc]
push ebx
push eax
push dword [ebp - 0xc]
call fcn.004173ad
test eax, eax
jne 0x4169c9
mov eax, dword [ebp - 4]
mov dword [ebp + 0xc], eax
jmp 0x4169c9
test word [ebp + 0x18], 0x100
je 0x4169c9
push 0
push dword [ebp - 8]
lea eax, [ebp + 0xc]
push 8
push dword [ebp - 4]
push ebx
push eax
push dword [ebp - 0xc]
call fcn.004173ad
test eax, eax
jne 0x4169c3
mov eax, dword [ebp - 4]
mov dword [ebp + 0xc], eax
jmp 0x4169d1
inc dword [ebp - 0xc]
dec dword [ebp + 0xc]
mov eax, dword [ebp + 0xc]
cmp eax, dword [ebp - 4]
jb 0x4169e8
push dword [ebp - 4]
mov eax, dword [ebp - 0x20]
add eax, edi
push ebx
push eax
call fcn.00437960
add esp, 0xc
add edi, dword [ebp - 4]
jmp 0x4169fd
push eax
mov eax, dword [ebp - 0x20]
push dword [ebp - 0xc]
add eax, edi
push eax
call fcn.00437960
add esp, 0xc
add edi, dword [ebp + 0xc]
mov eax, dword [ebp - 4]
add dword [ebp - 0x18], eax
inc dword [ebp - 0x1c]
mov eax, dword [ebp - 0x14]
cmp dword [ebp - 0x1c], eax
jb 0x4168f1
mov eax, dword [ebp - 0x10]
push dword [ebp - 0x2c]
mov ecx, dword [ebp - 0x3c]
push eax
push dword [ebp - 0x20]
mov dword [ebp - 8], edi
mov dword [ecx + eax], edi
call fcn.00437960
add esp, 0xc
push dword [ebp - 0xc]
call fcn.00413886
push ebx
call fcn.00413886
push edi
push dword [ebp - 0x20]
push dword [ebp + 8]
call fcn.00437960
add esp, 0xc
push dword [ebp - 0x20]
call fcn.00413886
mov edi, dword [ebp - 0x34]
cmp dword [ebp - 0x38], 1
jne 0x416a65
add dword [ebp - 8], 0x144
mov dword [ebp + 8], edi
mov ebx, dword [ebp - 0x40]
mov ecx, dword [ebx + 4]
mov eax, dword [esi + 0x13c]
and dword [ebp + 0x20], 0
shl eax, 4
and ecx, 0xfffffffe
cmp ecx, 0xfffffffe
mov dword [ebp + 0x1c], eax
jne 0x416ad7
add eax, 0x10
push eax
call fcn.00417b53
mov edi, eax
test edi, edi
je 0x41677f
mov eax, dword [esi + 0x11c]
test eax, eax
je 0x416ab4
mov ecx, dword [esi + 0x13c]
shl ecx, 4
push ecx
push eax
push edi
call fcn.00437960
add esp, 0xc
mov eax, dword [esi + 0x11c]
inc dword [esi + 0x13c]
test eax, eax
je 0x416aca
push eax
call fcn.00413886
mov dword [esi + 0x11c], edi
mov dword [ebp + 0x20], 1
mov eax, dword [ebx + 4]
mov edi, dword [esi + 0x13c]
mov ecx, eax
and ecx, 0xfffffffe
dec edi
cmp ecx, 0xfffffffe
jne 0x416b23
push 1
push dword [ebp + 0x14]
call fcn.00413d18
push 2
push dword [ebp + 0x14]
mov dword [ebx + 8], eax
call fcn.00413d18
mov dword [ebx + 0xc], eax
mov eax, dword [0x46d630]
mov dword [ebx], eax
mov dword [ebx + 4], edi
mov ecx, dword [esi + 0x11c]
mov eax, edi
shl eax, 4
add esp, 0x10
and dword [eax + ecx], 0
jmp 0x416b25
mov edi, eax
mov eax, dword [esi + 0x11c]
shl edi, 4
add eax, edi
mov ecx, dword [eax]
test ecx, ecx
je 0x416b42
mov ecx, dword [ebp - 8]
cmp dword [eax + 8], ecx
jae 0x416c41
mov ebx, dword [esi + 0x138]
mov edx, dword [esi + 0x130]
mov ecx, dword [esi + 0x12c]
shl ebx, 4
add ebx, edx
mov edx, ebx
mov ebx, dword [ebp + 0x1c]
add edx, ebx
cmp edx, ecx
jne 0x416bce
mov ebx, dword [eax + 8]
add ebx, dword [eax]
mov edx, dword [esi + 0x130]
cmp ebx, edx
jne 0x416baf
sub edx, dword [eax + 8]
mov ebx, dword [ebp - 8]
add edx, ebx
mov dword [esi + 0x130], edx
mov edx, ebx
sub edx, dword [eax + 8]
add dword [esi + 0x134], edx
sub ecx, dword [eax + 8]
add ecx, ebx
cmp dword [ebp + 0x20], 1
mov dword [esi + 0x12c], ecx
jne 0x416c41
add ecx, 0x10
mov dword [esi + 0x12c], ecx
jmp 0x416c41
mov dword [eax], edx
mov eax, dword [ebp - 8]
add dword [esi + 0x130], eax
add dword [esi + 0x134], eax
add dword [esi + 0x12c], eax
mov eax, dword [esi + 0x12c]
jmp 0x416c32
mov edx, dword [esi + 0x134]
add ebx, edx
cmp ebx, ecx
jne 0x416c04
mov ecx, dword [eax + 8]
add ecx, dword [eax]
cmp ecx, edx
jne 0x416bfd
sub edx, dword [eax + 8]
mov ecx, dword [ebp - 8]
add edx, dword [ebp - 8]
mov dword [esi + 0x134], edx
sub ecx, dword [eax + 8]
add dword [esi + 0x12c], ecx
jmp 0x416bc6
mov dword [eax], edx
mov eax, dword [ebp - 8]
jmp 0x416bba
mov edx, dword [eax + 8]
add edx, dword [eax]
cmp edx, ecx
jne 0x416c11
mov eax, dword [eax]
jmp 0x416c1c
mov dword [eax], ecx
mov eax, dword [esi + 0x11c]
mov eax, dword [eax + edi]
mov ecx, dword [ebp - 8]
add eax, ecx
mov ecx, dword [ebp + 0x1c]
mov dword [esi + 0x134], eax
add eax, ecx
mov dword [esi + 0x12c], eax
cmp dword [ebp + 0x20], 1
jne 0x416c41
add eax, 0x10
mov dword [esi + 0x12c], eax
mov eax, dword [esi + 0x11c]
mov ecx, dword [ebp - 8]
mov ebx, dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov dword [eax + edi + 8], ecx
mov eax, dword [esi + 0x11c]
mov ecx, dword [ebp + 0x10]
mov dword [eax + edi + 0xc], ecx
mov eax, dword [ebp + 0x18]
mov ecx, dword [esi + 0x11c]
push 0
or eax, 0x80000000
mov dword [ecx + edi + 4], eax
mov eax, dword [esi + 0x11c]
mov eax, dword [edi + eax]
push 0
push dword [esi + 0x15c]
mov dword [ebp + 0x10], eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
push dword [esi + 0x128]
lea eax, [esi + 0x124]
push eax
push dword [esi + 0x120]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test dword [ebp + 0x18], 0x10000
je 0x416d63
push 3
push dword [ebp + 0x14]
call fcn.00413d18
test dword [ebp + 0x18], 0x20000
pop ecx
pop ecx
mov dword [ebp + 0x20], eax
je 0x416ce8
mov eax, dword [esi + 0x11c]
add eax, edi
mov ecx, dword [eax]
add ecx, dword [ebp + 0x20]
xor ecx, dword [eax + 0xc]
mov dword [ebp + 0x20], ecx
mov cl, byte [esi + 0x142]
mov eax, 0x200
shl eax, cl
xor edx, edx
mov dword [ebp + 0x1c], eax
mov eax, dword [esi + 0x11c]
mov eax, dword [eax + edi + 0xc]
div dword [ebp + 0x1c]
test edx, edx
mov dword [ebp + 0x1c], eax
je 0x416d11
inc dword [ebp + 0x1c]
cmp dword [ebp - 0x24], 0x200
je 0x416d22
test word [ebp + 0x18], 0x100
je 0x416d35
mov eax, dword [ebp + 0x20]
dec eax
push eax
push dword [ebp - 0x2c]
push dword [ebp + 8]
call fcn.00413da1
add esp, 0xc
xor edi, edi
cmp dword [ebp + 0x1c], edi
jbe 0x416d63
mov ecx, dword [ebp - 0x10]
mov eax, dword [ecx + edi*4]
mov ecx, dword [ecx + edi*4 + 4]
push dword [ebp + 0x20]
sub ecx, eax
push ecx
mov ecx, dword [ebp + 8]
add eax, ecx
push eax
call fcn.00413da1
add esp, 0xc
inc dword [ebp + 0x20]
inc edi
cmp edi, dword [ebp + 0x1c]
jb 0x416d3c
push dword [ebp - 0x10]
call fcn.00413886
mov eax, dword [esi + 0x15c]
add eax, dword [ebp + 0x10]
xor edi, edi
push edi
push edi
push eax
push dword [esi + 0x120]
call ebx
push edi
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea eax, [ebp - 0x28]
push eax
push dword [ebp - 8]
push dword [ebp + 8]
push dword [esi + 0x120]
call edi
push dword [ebp + 8]
call fcn.00413886
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
call fcn.00417b53
mov dword [ebp + 8], eax
test eax, eax
mov eax, dword [esi + 0x138]
je 0x416e29
shl eax, 4
push eax
push dword [esi + 0x118]
push dword [ebp + 8]
call fcn.00437960
push dword [0x46d520]
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [ebp + 8]
call fcn.00413da1
mov eax, dword [esi + 0x130]
add eax, dword [esi + 0x15c]
add esp, 0x18
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [ebp + 8]
push dword [esi + 0x120]
call edi
push dword [ebp + 8]
call fcn.00413886
jmp 0x416e96
push dword [0x46d520]
shl eax, 4
push eax
push dword [esi + 0x118]
call fcn.00413da1
mov eax, dword [esi + 0x130]
add eax, dword [esi + 0x15c]
add esp, 0xc
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [esi + 0x118]
push dword [esi + 0x120]
call edi
push dword [0x46d520]
mov eax, dword [esi + 0x138]
shl eax, 4
push eax
push dword [esi + 0x118]
call fcn.00413e04
add esp, 0xc
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
call fcn.00417b53
mov dword [ebp + 8], eax
test eax, eax
mov eax, dword [esi + 0x13c]
je 0x416f1d
shl eax, 4
push eax
push dword [esi + 0x11c]
push dword [ebp + 8]
call fcn.00437960
push dword [0x46d524]
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [ebp + 8]
call fcn.00413da1
mov eax, dword [esi + 0x134]
add eax, dword [esi + 0x15c]
add esp, 0x18
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [ebp + 8]
push dword [esi + 0x120]
call edi
push dword [ebp + 8]
call fcn.00413886
jmp 0x416f8a
push dword [0x46d524]
shl eax, 4
push eax
push dword [esi + 0x11c]
call fcn.00413da1
mov eax, dword [esi + 0x134]
add eax, dword [esi + 0x15c]
add esp, 0xc
push 0
push 0
push eax
push dword [esi + 0x120]
call ebx
push 0
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [esi + 0x11c]
push dword [esi + 0x120]
call edi
push dword [0x46d524]
mov eax, dword [esi + 0x13c]
shl eax, 4
push eax
push dword [esi + 0x11c]
call fcn.00413e04
add esp, 0xc
push dword [ebp + 0x14]
push esi
call fcn.004156fb
pop ecx
xor eax, eax
pop ecx
inc eax
jmp 0x416fa4
push 0x57
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
pop edi
pop esi
pop ebx
leave
ret 0x1c