Function at 0x40bd30
Capabilities:
Write file on windows

Disassembly:
sub esp, 0xa0
mov eax, dword [0x45bb34]
push ebx
push ebp
push esi
push edi
xor edi, edi
mov dword [esp + 0xac], eax
mov dword [esp + 0x10], edi
call fcn.0040b5d0
mov dword [esp + 0x18], eax
call fcn.0040b5d0
mov dword [esp + 0x30], eax
call fcn.0040b5d0
mov ebx, dword [esp + 0xb4]
mov eax, dword [ebx + 0x14c]
mov edx, dword [esp + 0xbc]
mov dword [esp + 0x1c], edi
mov eax, dword [eax + 0x2a]
lea ecx, [eax + eax*4]
mov eax, dword [ebx + 0x154]
lea ecx, [eax + ecx*4]
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0xc4]
test ch, 2
mov dword [esp + 0x4c], 0xffffffff
mov dword [esp + 0x48], edi
mov dword [esp + 0x34], edi
mov dword [esp + 0x28], edi
mov dword [esp + 0x38], edx
je 0x40bdbf
mov eax, 8
mov dword [esp + 0x30], eax
mov dword [esp + 0x18], eax
test ch, 1
je 0x40be00
mov eax, dword [esp + 0xcc]
cmp eax, edi
jne 0x40bdde
mov eax, dword [0x458920]
mov dword [esp + 0x30], eax
mov dword [esp + 0x18], eax
jmp 0x40be00
cmp eax, 1
jne 0x40be00
mov eax, dword [esp + 0xc8]
mov esi, dword [eax*4 + 0x458930]
mov eax, dword [eax*4 + 0x458924]
mov dword [esp + 0x30], esi
mov dword [esp + 0x4c], eax
cmp edx, 4
jae 0x40be12
and ecx, 0xfffcffff
mov dword [esp + 0xc4], ecx
cmp edx, 0x20
jae 0x40be24
and ecx, 0xffff00ff
mov dword [esp + 0xc4], ecx
mov esi, dword [esp + 0xc0]
mov eax, esi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x40be30
sub eax, edx
add eax, 0x50
push eax
call fcn.0042a10c
mov ebp, eax
add esp, 4
cmp ebp, edi
jne 0x40be58
mov dword [esp + 0x10], 8
jmp 0x40c22b
mov eax, esi
lea edx, [eax + 1]
lea ecx, [ecx]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x40be60
sub eax, edx
lea ecx, [eax + 0x50]
mov edx, ecx
shr ecx, 2
xor eax, eax
mov edi, ebp
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
xor eax, eax
mov ecx, 0x14
mov edi, ebp
rep stosd dword es:[edi], eax
mov ecx, ebp
sub ecx, esi
mov eax, esi
lea edx, [ecx + 0x4c]
mov cl, byte [eax]
mov byte [edx + eax], cl
inc eax
test cl, cl
jne 0x40be92
push esi
push ebx
mov dword [ebp + 4], ebx
call fcn.0040f170
add esp, 8
test eax, eax
mov dword [ebp + 8], eax
je 0x40bee8
mov ecx, dword [esp + 0xc4]
test ecx, ecx
js 0x40becc
mov dword [esp + 0x10], 0xb7
mov dword [ebp + 8], 0
jmp 0x40bf01
mov eax, dword [eax + 8]
lea edx, [eax + eax*4]
mov eax, dword [ebx + 0x154]
lea ecx, [eax + edx*4]
mov dword [ebp + 0xc], ecx
mov dword [esp + 0x48], 1
jmp 0x40bf01
push esi
push ebx
call fcn.0040f230
add esp, 8
test eax, eax
mov dword [ebp + 8], eax
jne 0x40bf01
mov dword [esp + 0x10], 0x27
mov edx, dword [ebx + 0x150]
mov ecx, dword [ebp + 8]
sub ecx, edx
mov eax, 0x2aaaaaab
imul ecx
sar edx, 1
mov eax, edx
shr eax, 0x1f
add eax, edx
mov dword [ebp + 0x44], eax
mov eax, dword [esp + 0x10]
test eax, eax
jne 0x40c22b
mov eax, dword [ebx + 0x14c]
mov ecx, dword [eax + 0x2a]
mov edi, dword [eax + 0x1e]
lea ecx, [ecx + ecx*4]
shl ecx, 2
xor edx, edx
add ecx, edi
adc edx, dword [eax + 0x22]
mov dword [ebp + 0x20], ecx
mov ecx, dword [esp + 0x20]
mov dword [ebp + 0x24], edx
mov eax, dword [ebx + 0x154]
xor edi, edi
cmp eax, ecx
mov dword [esp + 0x40], edi
jae 0x40bfb7
mov ecx, dword [esp + 0x40]
mov edx, dword [esp + 0x3c]
mov esi, dword [eax + 0x10]
test esi, esi
jns 0x40bf8d
mov esi, dword [eax]
mov edx, dword [eax + 8]
xor ecx, ecx
add edx, esi
adc ecx, dword [eax + 4]
cmp ecx, dword [ebp + 0x24]
jl 0x40bfa5
jg 0x40bf85
cmp edx, dword [ebp + 0x20]
jbe 0x40bfa5
mov dword [ebp + 0x20], edx
mov dword [ebp + 0x24], ecx
jmp 0x40bfa5
mov esi, dword [ebp + 0xc]
test esi, esi
jne 0x40bf97
mov dword [ebp + 0xc], eax
mov esi, edi
or esi, dword [esp + 0x40]
jne 0x40bfa5
mov edi, edx
mov dword [esp + 0x40], ecx
mov esi, dword [esp + 0x20]
add eax, 0x14
cmp eax, esi
jb 0x40bf66
mov esi, dword [esp + 0xc0]
mov ecx, dword [ebx + 0x110]
mov edx, dword [ebp + 0x20]
mov edi, dword [esp + 0xbc]
add ecx, edx
mov edx, dword [ebx + 0x114]
adc edx, dword [ebp + 0x24]
mov dword [ebp + 0x18], ecx
mov ecx, dword [ebp + 0xc]
test ecx, ecx
mov dword [ebp + 0x1c], edx
jne 0x40bfe2
mov dword [ebp + 0xc], eax
mov edx, dword [ebx + 0x154]
mov ecx, dword [ebp + 0xc]
sub ecx, edx
mov eax, 0x66666667
imul ecx
sar edx, 3
mov eax, edx
shr eax, 0x1f
add eax, edx
mov dword [ebp + 0x48], eax
mov ecx, dword [ebx + 0x14c]
cmp eax, dword [ecx + 0x26]
jb 0x40c019
mov dword [esp + 0x10], 0x27
jmp 0x40c22b
test dword [esp + 0xc4], 0x20000
je 0x40c05d
push 0x5c
push esi
call fcn.0042ba70
add esp, 8
test eax, eax
je 0x40c038
lea esi, [eax + 1]
push esi
call fcn.0040f120
mov ecx, dword [esp + 0xc8]
add esp, 4
test ecx, 0x10000
mov dword [ebp + 0x10], eax
je 0x40c05d
mov edx, dword [ebp + 0x20]
add edx, eax
xor edx, edi
mov dword [ebp + 0x10], edx
mov eax, dword [ebx + 0x190]
test eax, eax
je 0x40c0a5
mov eax, dword [eax + 8]
test eax, eax
je 0x40c077
mov ecx, dword [ebp + 0x48]
lea edx, [eax + ecx*4]
mov dword [ebp + 0x38], edx
mov eax, dword [ebx + 0x190]
mov eax, dword [eax + 0xc]
test eax, eax
je 0x40c08d
mov ecx, dword [ebp + 0x48]
lea edx, [eax + ecx*8]
mov dword [ebp + 0x3c], edx
mov eax, dword [ebx + 0x190]
mov eax, dword [eax + 0x10]
test eax, eax
je 0x40c0a5
mov ecx, dword [ebp + 0x48]
shl ecx, 4
add ecx, eax
mov dword [ebp + 0x40], ecx
xor edx, edx
mov eax, edi
div dword [ebx + 0x138]
xor edx, edx
lea ecx, [eax + 1]
mov eax, edi
mov dword [ebp + 0x2c], ecx
div dword [ebx + 0x138]
test edx, edx
je 0x40c0c7
inc ecx
mov dword [ebp + 0x2c], ecx
mov edx, dword [ebx + 0x138]
push edx
call fcn.0042a10c
mov edi, eax
add esp, 4
test edi, edi
mov dword [ebp + 0x34], edi
jne 0x40c0e9
mov dword [esp + 0x10], 8
jmp 0x40c0ff
mov ecx, dword [ebx + 0x138]
mov edx, ecx
shr ecx, 2
xor eax, eax
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [ebp + 0x34]
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x10]
test eax, eax
jne 0x40c22b
mov eax, dword [esp + 0xc4]
test ah, 0xff
je 0x40c1ab
mov ecx, dword [ebp + 0x2c]
lea edx, [ecx*8 + 8]
push edx
call fcn.0042a10c
mov dword [ebp + 0x28], eax
mov eax, dword [ebx + 0x138]
shl eax, 1
push eax
call fcn.0042a10c
mov edi, dword [ebp + 0x28]
add esp, 8
test edi, edi
mov edx, eax
mov dword [esp + 0x28], edx
je 0x40c157
test edx, edx
jne 0x40c15f
mov dword [esp + 0x10], 8
test edi, edi
je 0x40c17d
mov ecx, dword [ebp + 0x2c]
lea ecx, [ecx*8 + 8]
mov esi, ecx
shr ecx, 2
xor eax, eax
rep stosd dword es:[edi], eax
mov ecx, esi
and ecx, 3
rep stosb byte es:[edi], al
test edx, edx
je 0x40c19b
mov ecx, dword [ebx + 0x138]
shl ecx, 1
mov esi, ecx
shr ecx, 2
xor eax, eax
mov edi, edx
rep stosd dword es:[edi], eax
mov ecx, esi
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [esp + 0x10]
test eax, eax
mov dword [esp + 0x34], edx
jne 0x40c22b
mov ecx, dword [ebp + 0x18]
cmp ecx, dword [ebx + 0x128]
jne 0x40c1c1
mov edx, dword [ebp + 0x1c]
cmp edx, dword [ebx + 0x12c]
je 0x40c1ea
mov ecx, dword [ebp + 0x18]
mov edx, dword [ebx + 0x108]
push 0
lea eax, [ebp + 0x1c]
push eax
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [ebp + 0x18]
mov dword [ebx + 0x128], eax
mov ecx, dword [ebp + 0x1c]
mov dword [ebx + 0x12c], ecx
mov edx, dword [ebp + 8]
mov eax, dword [ebp + 0x48]
mov dword [edx + 8], eax
mov edx, dword [ebp + 0x20]
mov ecx, dword [ebp + 0xc]
mov dword [ecx], edx
mov eax, dword [ebp + 0x24]
mov edx, dword [esp + 0xbc]
mov dword [ecx + 4], eax
mov ecx, dword [ebp + 0xc]
mov dword [ecx + 0xc], edx
mov eax, dword [ebp + 0xc]
mov ecx, dword [esp + 0xc4]
mov dword [eax + 8], 0
mov edx, dword [ebp + 0xc]
or ecx, 0x80000000
mov dword [edx + 0x10], ecx
mov eax, dword [esp + 0x10]
xor esi, esi
test eax, eax
mov dword [esp + 0x2c], esi
jne 0x40c615
mov eax, dword [esp + 0xc4]
test ah, 0xff
je 0x40c2d8
mov esi, dword [ebp + 0x2c]
mov edi, dword [ebp + 0x28]
shl esi, 3
mov ecx, esi
mov edx, ecx
shr ecx, 2
xor eax, eax
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [ebp + 0x28]
push 0
lea ecx, [esp + 0x20]
push ecx
mov dword [eax], esi
mov edx, dword [ebp + 0x28]
mov eax, dword [ebx + 0x108]
push esi
push edx
push eax
mov dword [esp + 0x40], esi
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x1c]
mov ecx, dword [ebx + 0x128]
mov edi, dword [ebx + 0x12c]
mov edx, dword [ebx + 0x198]
add ecx, eax
adc edi, 0
or edx, 1
cmp eax, esi
mov dword [ebx + 0x128], ecx
mov dword [ebx + 0x12c], edi
mov dword [ebx + 0x198], edx
jne 0x40c2c6
mov eax, dword [ebp + 0xc]
add dword [eax + 8], esi
jmp 0x40c2d8
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
mov dword [esp + 0x10], eax
jne 0x40c615
lea ecx, [esp + 0x50]
push ecx
call fcn.00409c10
lea edx, [esp + 0x58]
push edx
call fcn.00409a00
mov eax, dword [esp + 0x20]
mov edx, dword [ebp + 0x2c]
mov ecx, dword [esp + 0xc0]
add esp, 8
dec edx
mov dword [esp + 0x44], eax
mov dword [esp + 0x20], ecx
mov dword [esp + 0x18], 0
je 0x40c504
mov eax, dword [ebx + 0x138]
mov ecx, dword [esp + 0x38]
cmp eax, ecx
jb 0x40c324
mov eax, ecx
test eax, eax
mov dword [esp + 0x14], eax
je 0x40c500
mov esi, dword [esp + 0x20]
mov edi, dword [ebp + 0x34]
mov edx, eax
mov ecx, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov esi, dword [esp + 0x20]
mov ecx, dword [esp + 0x38]
mov eax, dword [ebp + 0x38]
add esi, edx
sub ecx, edx
test eax, eax
mov dword [esp + 0x20], esi
mov dword [esp + 0x38], ecx
je 0x40c37a
mov ecx, edx
mov edx, dword [ebp + 0x34]
push ecx
push edx
lea eax, [esp + 0x58]
push eax
call fcn.00409c20
mov edx, dword [esp + 0x20]
add esp, 0xc
mov eax, dword [ebp + 0x40]
test eax, eax
je 0x40c39b
mov ecx, dword [esp + 0x14]
mov edx, dword [ebp + 0x34]
push ecx
push edx
lea eax, [esp + 0x5c]
push eax
call fcn.00409a30
mov edx, dword [esp + 0x20]
add esp, 0xc
mov ecx, dword [ebp + 0xc]
mov eax, dword [ecx + 0x10]
test ah, 0xff
mov esi, edx
je 0x40c473
mov eax, dword [ebx + 0x138]
shl eax, 1
mov dword [esp + 0x24], eax
mov dword [esp + 0x3c], 0
test dword [ecx + 0x10], 0x200
je 0x40c3f3
mov edx, dword [esp + 0x14]
mov eax, dword [ebp + 0x34]
push 0
lea ecx, [esp + 0x40]
push ecx
push edx
mov edx, dword [esp + 0x34]
push eax
lea ecx, [esp + 0x34]
push ecx
push edx
call fcn.0040f380
mov eax, dword [esp + 0x3c]
mov edx, dword [esp + 0x2c]
add esp, 0x18
mov ecx, dword [ebp + 0xc]
test dword [ecx + 0x10], 0x100
je 0x40c42e
mov edx, dword [esp + 0x4c]
mov eax, dword [esp + 0x44]
mov ecx, dword [esp + 0x14]
push edx
mov edx, dword [ebp + 0x34]
push 0
push eax
push ecx
mov ecx, dword [esp + 0x38]
push edx
lea eax, [esp + 0x38]
push eax
push ecx
call fcn.0040f980
mov eax, dword [esp + 0x40]
mov edx, dword [esp + 0x30]
add esp, 0x1c
cmp eax, edx
jl 0x40c44d
mov esi, dword [ebp + 0x34]
mov edi, dword [esp + 0x28]
mov ecx, edx
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov dword [esp + 0x24], eax
mov ecx, dword [ebp + 0x28]
mov edx, dword [esp + 0x18]
mov edi, dword [ecx + edx*8]
lea ecx, [ecx + edx*8]
mov esi, eax
xor edx, edx
add eax, edi
mov edi, dword [ecx + 4]
mov dword [ecx + 8], eax
mov eax, dword [esp + 0x30]
adc edx, edi
mov dword [ecx + 0xc], edx
mov dword [esp + 0x44], eax
mov ecx, dword [ebp + 0xc]
test dword [ecx + 0x10], 0x20000
je 0x40c495
mov edx, dword [ebp + 0x10]
add edx, dword [esp + 0x18]
mov eax, dword [esp + 0x34]
push edx
push esi
push eax
call fcn.0040ef60
add esp, 0xc
mov edx, dword [esp + 0x34]
mov eax, dword [ebx + 0x108]
push 0
lea ecx, [esp + 0x20]
push ecx
push esi
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov ecx, dword [esp + 0x1c]
cmp ecx, esi
jne 0x40c4f8
mov edi, dword [ebx + 0x128]
mov esi, dword [ebx + 0x12c]
add edi, ecx
adc esi, 0
mov dword [ebx + 0x128], edi
mov dword [ebx + 0x12c], esi
mov eax, dword [ebp + 0xc]
add dword [eax + 8], ecx
or dword [ebx + 0x198], 1
mov eax, dword [esp + 0x18]
mov ecx, dword [ebp + 0x2c]
inc eax
dec ecx
cmp eax, ecx
mov dword [esp + 0x18], eax
jb 0x40c314
jmp 0x40c500
mov dword [esp + 0x10], 0x70
mov esi, dword [esp + 0x2c]
mov eax, dword [ebp + 0x38]
test eax, eax
je 0x40c519
push eax
lea edx, [esp + 0x54]
push edx
call fcn.00409c60
add esp, 8
mov eax, dword [ebp + 0x40]
test eax, eax
je 0x40c52e
push eax
lea eax, [esp + 0x58]
push eax
call fcn.00409b00
add esp, 8
mov edi, dword [esp + 0x10]
test edi, edi
jne 0x40c615
mov ecx, dword [ebp + 0xc]
mov eax, dword [ecx + 0x10]
test ah, 0xff
je 0x40c5c1
test dword [esp + 0xc4], 0x20000
je 0x40c564
mov edx, dword [ebp + 0x10]
mov eax, dword [ebp + 0x28]
dec edx
push edx
push esi
push eax
call fcn.0040ef60
add esp, 0xc
mov edx, dword [ebp + 0x18]
mov eax, dword [ebx + 0x108]
push 0
lea ecx, [ebp + 0x1c]
push ecx
push edx
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [ebp + 0x28]
mov eax, dword [ebx + 0x108]
push 0
lea ecx, [esp + 0x20]
push ecx
push esi
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x1c]
cmp eax, esi
je 0x40c5a5
mov edi, 0x70
mov dword [esp + 0x10], edi
mov esi, dword [ebp + 0x18]
mov edx, dword [ebp + 0x1c]
xor ecx, ecx
add eax, esi
adc ecx, edx
test edi, edi
mov dword [ebx + 0x128], eax
mov dword [ebx + 0x12c], ecx
jne 0x40c615
xor eax, eax
mov dword [ebx + 0x13c], eax
mov dword [ebx + 0x140], eax
mov dword [ebx + 0x148], eax
mov eax, dword [ebx + 0x14c]
mov edx, dword [ebp + 0x48]
mov ecx, dword [eax + 0x2a]
cmp edx, ecx
jb 0x40c5e9
inc ecx
mov dword [eax + 0x2a], ecx
mov eax, dword [ebp + 0xc]
mov eax, dword [eax + 8]
mov esi, dword [ebp + 0x20]
mov edx, dword [ebp + 0x24]
xor ecx, ecx
add eax, esi
adc ecx, edx
mov edx, dword [ebx + 0x14c]
mov dword [ebx + 0x130], eax
mov dword [ebx + 0x134], ecx
mov dword [edx + 8], eax
mov dword [edx + 0xc], ecx
jmp 0x40c62b
test ebp, ebp
je 0x40c62b
mov eax, dword [ebp + 8]
test eax, eax
je 0x40c62b
or ecx, 0xffffffff
mov dword [eax], ecx
mov dword [eax + 4], ecx
mov dword [eax + 8], ecx
mov eax, dword [esp + 0x28]
test eax, eax
je 0x40c63c
push eax
call fcn.0042a11e
add esp, 4
mov eax, dword [esp + 0xd0]
test eax, eax
je 0x40c64d
mov edx, dword [esp + 0x48]
mov dword [eax], edx
test ebp, ebp
je 0x40c697
mov eax, dword [ebp]
cmp eax, 0xffffffff
je 0x40c660
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp + 0x28]
test eax, eax
je 0x40c677
push eax
call fcn.0042a11e
add esp, 4
mov dword [ebp + 0x28], 0
mov eax, dword [ebp + 0x34]
test eax, eax
je 0x40c68e
push eax
call fcn.0042a11e
add esp, 4
mov dword [ebp + 0x34], 0
push ebp
call fcn.0042a11e
add esp, 4
mov ecx, dword [esp + 0xac]
mov eax, dword [esp + 0x10]
pop edi
pop esi
pop ebp
pop ebx
call fcn.004296f9
add esp, 0xa0
ret