Function at 0x46c450
Capabilities:
Create http request
Download and write a file
Get http content length
Read data from internet
Receive and write data from server to client
Receive data
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x424
mov eax, dword [0x4c56f0]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
push esi
mov esi, dword [ebp + 8]
push edi
push 0
push 0
push 0
push 1
push 0
mov dword [ebp - 0x408], eax
call dword [sym.imp.WININET.dll_InternetOpenA]
mov edi, eax
test edi, edi
jne 0x46c4ad
push 0x1b2
push str.libfm::fm_impl::download_song_file
call fcn.0040a540
add esp, 8
pop edi
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0046eadd
mov esp, ebp
pop ebp
ret 8
cmp dword [esi + 0x14], 0x10
jb 0x46c4b5
mov esi, dword [esi]
push 0
push 0x102
push 0
push 0
push esi
push edi
call dword [sym.imp.WININET.dll_InternetOpenUrlA]
mov esi, eax
test esi, esi
jne 0x46c4fb
push 0x1ba
push str.libfm::fm_impl::download_song_file
call fcn.0040a540
add esp, 8
push edi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
pop edi
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0046eadd
mov esp, ebp
pop ebp
ret 8
mov edi, dword [sym.imp.WININET.dll_HttpQueryInfoA]
push ebx
push 0
lea ecx, [ebp - 0x41c]
push ecx
lea edx, [ebp - 0x414]
push edx
push 0x20000013
mov ebx, 4
push esi
mov dword [ebp - 0x41c], ebx
call edi
test eax, eax
je 0x46c542
mov eax, dword [ebp - 0x414]
push eax
push 0x1c2
push str.libfm::fm_impl::download_song_file
call fcn.0040a540
add esp, 0xc
mov dword [ebp - 0x420], ebx
xor ebx, ebx
push ebx
lea ecx, [ebp - 0x420]
push ecx
lea edx, [ebp - 0x418]
push edx
push 0x20000005
push esi
call edi
test eax, eax
je 0x46c57e
mov eax, dword [ebp - 0x418]
push eax
push 0x1c8
push str.libfm::fm_impl::download_song_file
call fcn.0040a540
add esp, 0xc
mov eax, dword [ebp - 0x408]
cmp dword [eax + 0x14], 0x10
jb 0x46c58c
mov eax, dword [eax]
push ebx
push 0x80
push 2
push ebx
push ebx
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x408], eax
cmp eax, 0xffffffff
jne 0x46c5be
push esi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
push 0x1cf
jmp 0x46c6d3
push 0x400
lea ecx, [ebp - 0x404]
push ebx
push ecx
mov dword [ebp - 0x40c], ebx
mov dword [ebp - 0x410], ebx
xor edi, edi
call fcn.00475cb0
mov ebx, dword [sym.imp.WININET.dll_InternetReadFile]
add esp, 0xc
lea edx, [ebp - 0x40c]
push edx
push 0x400
lea eax, [ebp - 0x404]
push eax
push esi
call ebx
mov ecx, dword [ebp - 0x40c]
test ecx, ecx
je 0x46c67f
jmp 0x46c610
add dword [ebp - 0x410], ecx
mov eax, 0x66666667
imul edi
sar edx, 2
mov edi, edx
shr edi, 0x1f
add edi, edx
jne 0x46c616
push edi
lea edx, [ebp - 0x424]
push edx
push ecx
mov ecx, dword [ebp - 0x408]
lea eax, [ebp - 0x404]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x46c6c1
push 0x400
lea edx, [ebp - 0x404]
push edi
push edx
call fcn.00475cb0
add esp, 0xc
lea eax, [ebp - 0x40c]
push eax
push 0x400
lea ecx, [ebp - 0x404]
push ecx
push esi
call ebx
mov ecx, dword [ebp - 0x40c]
test ecx, ecx
jne 0x46c610
mov edx, dword [ebp - 0x408]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push esi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
mov eax, dword [ebp - 0x410]
push eax
push 0x1ef
push str.libfm::fm_impl::download_song_file
call fcn.0040a540
add esp, 0xc
pop ebx
pop edi
mov al, 1
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0046eadd
mov esp, ebp
pop ebp
ret 8
mov ecx, dword [ebp - 0x408]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0x1e9
push str.libfm::fm_impl::download_song_file
call fcn.0040a540
mov ecx, dword [ebp - 4]
add esp, 8
pop ebx
pop edi
xor ecx, ebp
xor al, al
pop esi
call fcn.0046eadd
mov esp, ebp
pop ebp
ret 8