Function at 0x4039d7
Capabilities:
Check if file exists
Download and write a file
Receive and write data from server to client
Receive data
Receive data on socket
Send data
Send data on socket
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x68
mov dword [ebp - 0x18], 0
mov dword [esp + 4], 0x32
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0x1c], eax
mov dword [esp + 4], 0xf
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0x20], eax
mov dword [esp + 4], 0x105
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0x24], eax
mov eax, dword [ebp + 0xc]
lea edx, [eax + 3]
mov eax, dword [ebp + 8]
add eax, edx
mov dword [esp + 8], 3
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp + 0xc]
lea edx, [eax + 6]
mov eax, dword [ebp + 8]
add eax, edx
mov al, byte [eax]
cmp al, 0x2a
jne 0x403aec
mov eax, dword [ebp + 0xc]
lea edx, [eax + 7]
mov eax, dword [ebp + 8]
add eax, edx
mov dword [esp + 8], 1
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov dword [ebp - 0x10], 1
jmp 0x403ad1
mov edx, dword [ebp + 0xc]
mov eax, dword [ebp - 0x10]
add edx, eax
mov eax, dword [ebp + 8]
add eax, edx
mov al, byte [eax]
cmp al, 0x2b
je 0x403aeb
mov eax, dword [ebp - 0x10]
lea edx, [eax + 7]
mov eax, dword [ebp + 8]
add edx, eax
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x1c]
add eax, ecx
mov dword [esp + 8], 1
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
inc dword [ebp - 0x10]
mov edx, dword [ebp + 0xc]
mov eax, dword [ebp - 0x10]
add edx, eax
mov eax, dword [ebp + 8]
add eax, edx
mov al, byte [eax]
cmp al, 0x2b
setne al
test al, al
jne 0x403a94
jmp 0x403aec
nop
mov eax, dword [ebp + 8]
mov dword [esp], eax
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, dword [ebp - 0x10]
not edx
add edx, eax
mov eax, dword [ebp - 0x10]
lea ecx, [eax + 1]
mov eax, dword [ebp + 8]
add eax, ecx
mov dword [esp + 8], edx
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_atoi
mov dword [ebp - 0x28], eax
mov eax, dword [ebp - 0x1c]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x28]
add eax, 0x3e8
mov dword [esp + 4], eax
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0x28]
add eax, 0x3e8
mov dword [esp + 4], eax
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0x2c], eax
mov dword [esp + 4], 0x208
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0x30], eax
mov eax, dword [ebp - 0x20]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x24]
mov dword [esp + 8], eax
mov dword [esp + 4], str._s._s
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.USER32.dll_wsprintfA
mov eax, dword [ebp - 0x20]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x24]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov edx, dword [ebp - 0x28]
mov dword [esp + 8], edx
mov edx, dword [ebp - 0xc]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_recv
sub esp, 0x10
mov dword [ebp - 0x34], eax
cmp dword [ebp - 0x34], 0
jne 0x403c2c
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
jmp 0x404085
mov eax, dword [ebp - 0x34]
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x28]
cmp eax, dword [ebp - 0x34]
jne 0x403dc4
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 2
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0x40000000
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_CreateFileA
sub esp, 0x1c
mov dword [ebp - 0x38], eax
mov dword [esp + 0x10], 0
lea eax, [ebp - 0x3c]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x34]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x38]
mov dword [esp], eax
call sub.KERNEL32.dll_WriteFile
sub esp, 0x14
mov eax, dword [ebp - 0x38]
mov dword [esp], eax
call sub.KERNEL32.dll_CloseHandle
sub esp, 4
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.DLL_PathFileExistsA]
call eax
sub esp, 4
test eax, eax
setne al
test al, al
je 0x403d3b
mov dword [esp], str.___Archivo_recibido_con_exito__
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov dword [esp + 4], str.___Archivo_recibido_con_exito__
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov edx, dword [ebp - 0x30]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
jmp 0x403da3
mov dword [esp], str.___Se_produjo_un_error_al_recibir_archivo__
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov dword [esp + 4], str.___Se_produjo_un_error_al_recibir_archivo__
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov edx, dword [ebp - 0x30]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
jmp 0x404085
mov eax, dword [ebp - 0x34]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp - 0x34]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x28]
cmp eax, dword [ebp - 0x18]
jbe 0x403ea8
mov eax, dword [ebp - 0x28]
add eax, 0x3e8
mov dword [esp + 4], eax
mov dword [esp], 0x40
call sub.KERNEL32.dll_GlobalAlloc
sub esp, 8
mov dword [ebp - 0xc], eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov edx, dword [ebp - 0x28]
mov dword [esp + 8], edx
mov edx, dword [ebp - 0xc]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_recv
sub esp, 0x10
mov dword [ebp - 0x34], eax
cmp dword [ebp - 0x34], 1
ja 0x403e6b
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
jmp 0x404085
mov eax, dword [ebp - 0x14]
mov edx, dword [ebp - 0x2c]
add edx, eax
mov eax, dword [ebp - 0x34]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 4], eax
mov dword [esp], edx
call sub.msvcrt.dll_memcpy
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x34]
add dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x34]
add dword [ebp - 0x18], eax
jmp 0x403de3
nop
mov dword [esp + 0x18], 0
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 2
mov dword [esp + 0xc], 0
mov dword [esp + 8], 2
mov dword [esp + 4], 0x40000000
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_CreateFileA
sub esp, 0x1c
mov dword [ebp - 0x38], eax
cmp dword [ebp - 0x38], 0xffffffff
jne 0x403f2d
mov eax, dword [ebp - 0x38]
mov dword [esp], eax
call sub.KERNEL32.dll_CloseHandle
sub esp, 4
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
jmp 0x404085
mov dword [esp + 0x10], 0
lea eax, [ebp - 0x3c]
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x18]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x2c]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x38]
mov dword [esp], eax
call sub.KERNEL32.dll_WriteFile
sub esp, 0x14
mov eax, dword [ebp - 0x38]
mov dword [esp], eax
call sub.KERNEL32.dll_CloseHandle
sub esp, 4
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.DLL_PathFileExistsA]
call eax
sub esp, 4
test eax, eax
setne al
test al, al
je 0x403fe9
mov dword [esp], str.___Archivo_recibido_con_exito__
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov dword [esp + 4], str.___Archivo_recibido_con_exito__
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov edx, dword [ebp - 0x30]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
jmp 0x404051
mov dword [esp], str.___Se_produjo_un_error_al_recibir_archivo__
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov dword [esp + 4], str.___Se_produjo_un_error_al_recibir_archivo__
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_lstrlenA
sub esp, 4
mov edx, eax
mov eax, dword [0x42d1d0]
mov dword [esp + 0xc], 0
mov dword [esp + 8], edx
mov edx, dword [ebp - 0x30]
mov dword [esp + 4], edx
mov dword [esp], eax
call sub.WS2_32.dll_send
sub esp, 0x10
mov eax, dword [ebp - 0x30]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
mov eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sub.KERNEL32.dll_GlobalFree
sub esp, 4
jmp 0x404085
leave
ret