Function at 0x40d980
Capabilities:
Download and write a file
Read data from internet
Receive and write data from server to client
Receive data
Write file on windows

Disassembly:
push 0x28
mov eax, 0x4585dc
call fcn.00446efc
mov ebx, ecx
mov esi, edx
mov eax, esi
call fcn.0040d853
test al, al
jne 0x40d9a8
mov eax, 0x80040007
call fcn.00446fd4
ret 0xc
call fcn.0040a515
cmp dword [ebp + 8], 0xffffffff
jne 0x40d9b7
push 6
jmp 0x40d9c8
cmp dword [ebp + 0xc], 0
jne 0x40d9cf
cmp byte [esi + 0x25], 0
jne 0x40d9cf
push 0x80070057
mov eax, esi
call fcn.0040d27a
mov eax, esi
call fcn.0040a7ac
test al, al
je 0x40d9df
mov eax, dword [esi + 0x10]
jmp 0x40d9a0
mov ecx, dword [ebp + 0x10]
test ecx, ecx
je 0x40d9ee
mov eax, dword [ecx]
call dword [eax]
test al, al
je 0x40d9da
mov edi, 0x47aa78
push edi
lea ecx, [ebp - 0x10]
call fcn.00402325
and dword [ebp - 4], 0
cmp byte [esi + 0x25], 0
jne 0x40dad1
mov eax, dword [ebp + 0xc]
lea eax, [ebx + eax - 1]
push eax
push ebx
lea eax, [ebp - 0x10]
push str.Range:bytes_d__d
push eax
call fcn.00402b47
mov ebx, dword [ebp - 0x10]
mov eax, dword [ebx - 0xc]
mov ecx, dword [esi + 0x20]
mov edx, dword [esi + 0x14]
mov edx, dword [edx + 0x18]
add esp, 0x10
push 0
push 0x4000000
push eax
push ebx
push ecx
push edx
call dword [sym.imp.WININET.dll_InternetOpenUrlW]
mov ebx, eax
test ebx, ebx
jne 0x40dad4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push esi
mov ecx, eax
call fcn.0040d18d
push dword [esi + 0xc]
lea ebx, [ebp + 0x10]
call fcn.0040ce08
pop ecx
push edi
lea ecx, [ebp + 0xc]
mov byte [ebp - 4], 1
call fcn.00402325
mov byte [ebp - 4], 2
push dword [ebp - 0x10]
lea eax, [ebp + 0xc]
push dword [ebp + 0x10]
push str.desc_s___s_
push eax
call fcn.00402b47
mov eax, dword [esi + 0x10]
mov edi, dword [ebp + 0xc]
add esp, 0x10
push str.shared::lite::data::CInternetResource::Save
push eax
push edi
call fcn.00429b80
mov ecx, eax
call fcn.00429e30
mov esi, dword [esi + 0x10]
lea ecx, [edi - 0x10]
call fcn.004034fb
mov ecx, dword [ebp + 0x10]
add ecx, 0xfffffff0
call fcn.004034fb
mov ecx, dword [ebp - 0x10]
add ecx, 0xfffffff0
call fcn.004034fb
mov eax, esi
jmp 0x40d9a0
mov ebx, dword [esi + 0x1c]
push 0x400
lea eax, [ebp - 0x34]
push eax
call fcn.0040b3fa
lea eax, [ebp - 0x34]
mov byte [ebp - 4], 3
call fcn.0040b5c8
test al, al
jne 0x40db0c
lea edi, [ebp - 0x2c]
call fcn.00405db9
mov esi, dword [esi + 0x10]
lea eax, [ebp - 0x34]
push eax
mov byte [ebp - 4], 0
call fcn.0040b42f
jmp 0x40dabf
and dword [ebp - 0x14], 0
and dword [ebp - 0x18], 0
mov edi, dword [ebp + 0x10]
test edi, edi
je 0x40db25
mov eax, dword [edi]
mov ecx, edi
call dword [eax]
test al, al
je 0x40db8f
lea eax, [ebp - 0x14]
push eax
push dword [ebp - 0x30]
push dword [ebp - 0x34]
push ebx
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
je 0x40db81
cmp dword [ebp - 0x14], 0
je 0x40db8f
test edi, edi
je 0x40db4e
mov eax, dword [edi]
mov ecx, edi
call dword [eax]
test al, al
je 0x40db8f
push 0
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0x14]
push dword [ebp - 0x34]
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40db81
test edi, edi
je 0x40db14
mov eax, dword [edi]
mov ecx, edi
call dword [eax]
test al, al
je 0x40db8f
push dword [ebp - 0x14]
mov eax, dword [edi]
mov ecx, edi
call dword [eax + 4]
jmp 0x40db14
call dword [sym.imp.KERNEL32.dll_GetLastError]
push esi
mov ecx, eax
call fcn.0040d18d
cmp byte [esi + 0x25], 0
jne 0x40dafa
push ebx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
jmp 0x40dafa