Function at 0x40f240
Capabilities:
Check http status code
Create http request
Get http content length
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x52c63c
mov eax, dword fs:[0]
push eax
push ecx
mov eax, 0x104c
call fcn.004ec8c0
mov eax, dword [0x56fcac]
xor eax, esp
mov dword [esp + 0x1048], eax
push ebx
push esi
push edi
mov eax, dword [0x56fcac]
xor eax, esp
push eax
lea eax, [esp + 0x1060]
mov dword fs:[0], eax
mov eax, dword [ebp + 0xc]
mov ecx, dword [ebp + 0x10]
mov edx, dword [ebp + 0x14]
mov esi, dword [ebp + 8]
push 0
push 0
push 0
push 0
push 0
mov dword [esp + 0x40], eax
mov dword [esp + 0x44], ecx
mov dword [esp + 0x3c], edx
call dword [sym.imp.WININET.dll_InternetOpenW]
mov dword [esp + 0x20], eax
mov ebx, 4
push ebx
lea ecx, [esp + 0x1c]
push ecx
mov dword [esp + 0x1070], 0
mov edi, dword [sym.imp.WININET.dll_InternetSetOptionW]
push 2
push eax
mov dword [esp + 0x28], 0x7d0
call edi
mov eax, dword [esp + 0x20]
push ebx
lea edx, [esp + 0x1c]
push edx
push 3
push eax
mov dword [esp + 0x28], 3
call edi
cmp dword [esi + 0x18], 8
jb 0x40f2fc
mov esi, dword [esi + 4]
jmp 0x40f2fe
add esi, ebx
mov ecx, dword [esp + 0x20]
push 0
push 0x400000
push 0xffffffffffffffff
push 0
push esi
push ecx
call dword [sym.imp.WININET.dll_InternetOpenUrlW]
mov esi, eax
mov dword [esp + 0x24], esi
test esi, esi
mov byte [esp + 0x1068], 1
mov edi, dword [sym.imp.WININET.dll_HttpQueryInfoW]
mov dword [esp + 0x18], ebx
je 0x40f345
push 0
lea edx, [esp + 0x1c]
push edx
lea eax, [esp + 0x3c]
push eax
push 0x20000013
push esi
call edi
cmp dword [esp + 0x34], 0xc8
je 0x40f372
test esi, esi
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
je 0x40f360
mov ecx, dword [esp + 0x24]
push ecx
call esi
mov eax, dword [esp + 0x20]
test eax, eax
je 0x40f36b
push eax
call esi
xor al, al
jmp 0x40f601
mov dword [esp + 0x18], ebx
mov ebx, dword [esp + 0x24]
test esi, esi
mov esi, dword [ebp + 0x18]
mov byte [esp + 0x15], 0
mov dword [esp + 0x1c], 0
je 0x40f3ab
push 0
lea edx, [esp + 0x1c]
push edx
lea eax, [esp + 0x24]
push eax
push 0x20000005
push ebx
call edi
test eax, eax
setne al
test al, al
jne 0x40f3ee
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x2f76
jne 0x40f3fc
test esi, esi
mov byte [esp + 0x15], 1
jbe 0x40f3c9
mov eax, esi
mov dword [esp + 0x1c], eax
jmp 0x40f3f2
mov eax, 0x3200000
mov dword [esp + 0x1c], eax
test esi, esi
jbe 0x40f410
cmp eax, esi
je 0x40f410
test ebx, ebx
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
je 0x40f360
push ebx
jmp 0x40f35e
mov eax, dword [esp + 0x1c]
test eax, eax
jne 0x40f3d2
cmp byte [esp + 0x15], al
jne 0x40f3d2
test ebx, ebx
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
je 0x40f360
push ebx
jmp 0x40f35e
mov esi, dword [esp + 0x2c]
lea ecx, [esp + 0x38]
push esi
push ecx
call fcn.004090f0
lea edx, [esp + 0x40]
push edx
mov byte [esp + 0x1074], 2
call fcn.004069c0
add esp, 0xc
test al, al
jne 0x40f441
lea edi, [esp + 0x38]
call fcn.00407570
mov byte [esp + 0x1068], 3
cmp dword [esi + 0x18], 8
jb 0x40f454
mov eax, dword [esi + 4]
jmp 0x40f457
lea eax, [esi + 4]
xor edi, edi
push edi
push 0x80
push 2
push edi
push 3
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
mov dword [esp + 0x18], eax
jne 0x40f4b6
cmp dword [esp + 0x50], 8
jb 0x40f48d
mov eax, dword [esp + 0x3c]
push eax
call fcn.004aaa59
add esp, 4
cmp ebx, edi
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
mov dword [esp + 0x50], 7
mov dword [esp + 0x4c], edi
mov word [esp + 0x3c], di
je 0x40f4ab
push ebx
call esi
mov eax, dword [esp + 0x20]
cmp eax, edi
jmp 0x40f366
mov esi, dword [esp + 0x28]
cmp esi, edi
mov byte [esp + 0x17], 0
je 0x40f4cc
mov ecx, dword [esp + 0x1c]
mov dword [esi + 8], ecx
jmp 0x40f4f0
push 0x20
mov byte [esp + 0x1b], 1
call fcn.004aaa2e
mov esi, eax
add esp, 4
cmp esi, edi
je 0x40f4ec
mov eax, dword [esp + 0x1c]
call fcn.0040e9e0
jmp 0x40f4ee
xor eax, eax
mov esi, eax
mov edx, dword [esp + 0x1c]
xor ebx, ebx
cmp dword [esi + 0xc], edx
mov byte [esp + 0x16], 1
jae 0x40f58a
mov eax, dword [esp + 0x30]
test eax, eax
je 0x40f519
push 0
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
je 0x40f58a
cmp byte [esp + 0x15], 0
mov edx, 0x1000
jne 0x40f532
mov eax, dword [esp + 0x1c]
sub eax, dword [esi + 0xc]
cmp eax, edx
jae 0x40f532
mov edx, eax
lea eax, [esp + 0x54]
push eax
lea eax, [esp + 0x28]
call fcn.00445430
mov edi, eax
test edi, edi
jne 0x40f55b
cmp byte [esp + 0x15], al
jne 0x40f58a
push 0xa
call sub.KERNEL32.dll_Sleep
add ebx, 1
cmp ebx, 3
ja 0x40f58a
mov eax, dword [esp + 0x18]
push 0
lea ecx, [esp + 0x2c]
push ecx
push edi
lea edx, [esp + 0x60]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40f59a
cmp edi, dword [esp + 0x28]
jne 0x40f59a
mov ecx, dword [esi + 0xc]
cmp ecx, dword [esp + 0x1c]
jb 0x40f504
mov edx, dword [esp + 0x1c]
cmp dword [esi + 0xc], edx
je 0x40f59f
cmp byte [esp + 0x15], 0
jne 0x40f59f
mov byte [esp + 0x16], 0
cmp byte [esp + 0x17], 0
je 0x40f5af
push esi
call fcn.004aaa59
add esp, 4
mov eax, dword [esp + 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x50], 8
jb 0x40f5ce
mov ecx, dword [esp + 0x3c]
push ecx
call fcn.004aaa59
add esp, 4
mov eax, dword [esp + 0x24]
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
xor edi, edi
cmp eax, edi
mov dword [esp + 0x50], 7
mov dword [esp + 0x4c], edi
mov word [esp + 0x3c], di
je 0x40f5f2
push eax
call esi
mov eax, dword [esp + 0x20]
cmp eax, edi
je 0x40f5fd
push eax
call esi
mov al, byte [esp + 0x16]
mov ecx, dword [esp + 0x1060]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x1048]
xor ecx, esp
call fcn.004ead41
mov esp, ebp
pop ebp
ret