Function at 0x513940
Capabilities:
Convert ip address from string
Get local ipv4 addresses
Get socket information

Disassembly:
sub esp, 0x29c
mov eax, dword [0x6218c0]
xor eax, esp
mov dword [esp + 0x298], eax
mov eax, dword [esp + 0x2a4]
push ebx
push esi
push edi
mov edi, dword [esp + 0x2ac]
mov dword [esp + 0x18], eax
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
movzx eax, word [edi + 0x18a]
mov ebx, dword [edi + 0x504]
movzx esi, word [edi + 0x188]
mov dword [esp + 0x20], eax
test ebx, ebx
jne 0x5139b4
test si, si
jne 0x5139b4
pop edi
pop esi
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x298]
xor ecx, esp
call fcn.0057029b
add esp, 0x29c
ret
push ebp
push 0x80
lea eax, [esp + 0x2c]
push 0
push eax
call fcn.00572a00
add esp, 0xc
test ebx, ebx
je 0x513ccd
mov ecx, ebx
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x5139d6
sub ecx, edx
cmp ecx, 0xff
jae 0x513ccd
push 0xff
mov byte [esp + 0xac], al
lea eax, [esp + 0xad]
push 0
push eax
call fcn.00572a00
mov edx, dword [0x6214f4]
add esp, 0xc
mov ecx, edx
mov byte [esp + 0x13], 0
lea ebp, [ecx + 1]
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x513a20
sub ecx, ebp
push ecx
push ebx
push edx
call fcn.00587120
mov ebp, dword [esp + 0x2c8]
add esp, 0xc
test eax, eax
jne 0x513acd
mov ecx, dword [0x6214f4]
lea edx, [ecx + 1]
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x513a50
sub ecx, edx
mov byte [esp + 0x13], 1
add ebx, ecx
mov ecx, dword [esp + 0x1c]
lea eax, [esp + 0xa8]
push 0x100
push eax
push ebx
push dword [ecx + 0x464]
push dword [esp + 0x2d0]
push ebp
call fcn.004d8350
add esp, 0x18
sub eax, 0
je 0x513ba3
sub eax, 1
je 0x513c61
sub eax, 1
je 0x513b14
cmp byte [esp + 0x13], 0
jne 0x513cad
mov ecx, dword [esp + 0x1c]
mov al, byte [ecx + 0x470]
mov byte [esp + 0x13], al
cmp ebp, 2
jne 0x513bc7
mov byte [ecx + 0x470], 1
jmp 0x513bd3
mov edx, dword [str.host_]
mov ecx, edx
lea eax, [ecx + 1]
mov dword [esp + 0x20], eax
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x513ae0
sub ecx, dword [esp + 0x20]
push ecx
push ebx
push edx
call fcn.00587120
add esp, 0xc
test eax, eax
jne 0x513a60
mov ecx, dword [str.host_]
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x513b07
sub ecx, edx
add ebx, ecx
jmp 0x513aaa
push ebp
lea eax, [esp + 0xac]
push eax
push ebx
push str.Local_Interface__s_is_ip__s_using_address_family__i
push edi
call fcn.004e1030
add esp, 0x14
cmp ebp, 0x17
jne 0x513c6b
lea eax, [esp + 0xa8]
push 0x25
push eax
call fcn.005748c0
mov ebx, eax
add esp, 8
test ebx, ebx
je 0x513b51
mov byte [ebx], 0
inc ebx
lea eax, [esp + 0x30]
push eax
lea eax, [esp + 0xac]
push eax
push 0x17
call dword [sym.imp.WS2_32.dll_inet_pton]
test eax, eax
jle 0x513b95
mov eax, 0x17
push esi
mov word [esp + 0x2c], ax
call dword [sym.imp.WS2_32.dll_htons]
mov word [esp + 0x2a], ax
test ebx, ebx
je 0x513b95
push 0xa
push 0
push ebx
call fcn.0058d66f
add esp, 0xc
mov dword [esp + 0x40], eax
mov eax, 0x1c
mov dword [esp + 0x18], eax
jmp 0x513cfc
cmp byte [esp + 0x13], 0
je 0x513aaa
push ebx
push str.Couldnt_bind_to_interface__s
push edi
call fcn.004e0f60
add esp, 0xc
mov eax, 0x2d
jmp 0x513e30
cmp ebp, 0x17
jne 0x513bd3
mov byte [ecx + 0x470], 2
lea eax, [esp + 0x14]
push eax
push 0
push 0x50
push ebx
push edi
call fcn.004e0390
add esp, 0x14
cmp eax, 1
jne 0x513bf9
lea eax, [esp + 0x14]
push eax
push edi
call fcn.004feb40
add esp, 8
mov ecx, dword [esp + 0x1c]
mov al, byte [esp + 0x13]
mov byte [ecx + 0x470], al
mov eax, dword [esp + 0x14]
test eax, eax
je 0x513cad
push 0x100
lea ecx, [esp + 0xac]
push ecx
push dword [eax]
call fcn.004e0340
mov eax, dword [esp + 0x20]
mov eax, dword [eax]
push dword [eax + 4]
lea eax, [esp + 0xb8]
push eax
push ebp
push ebx
push str.Name__s_family__i_resolved_to__s_family__i
push edi
call fcn.004e1030
push dword [esp + 0x38]
push edi
call fcn.004e0930
mov eax, dword [esp + 0x40]
add esp, 0x2c
mov eax, dword [eax]
cmp ebp, dword [eax + 4]
je 0x513b2c
mov eax, 1
jmp 0x513e30
cmp ebp, 2
jne 0x513cfa
lea eax, [esp + 0x2c]
push eax
lea eax, [esp + 0xac]
push eax
push ebp
call dword [sym.imp.WS2_32.dll_inet_pton]
test eax, eax
jle 0x513cfa
mov eax, 2
push esi
mov word [esp + 0x2c], ax
call dword [sym.imp.WS2_32.dll_htons]
mov word [esp + 0x2a], ax
mov eax, 0x10
mov dword [esp + 0x18], eax
jmp 0x513cfc
push ebx
push str.Couldnt_bind_to__s
push edi
mov byte [edi + 0xd57], 0
call fcn.004e0f60
add esp, 0xc
mov eax, 0x2d
jmp 0x513e30
mov eax, dword [esp + 0x2bc]
cmp eax, 0x17
jne 0x513cf5
push esi
mov word [esp + 0x2c], ax
call dword [sym.imp.WS2_32.dll_htons]
mov word [esp + 0x2a], ax
mov eax, 0x1c
mov dword [esp + 0x18], eax
jmp 0x513cfc
cmp eax, 2
je 0x513c8c
xor eax, eax
mov ebp, dword [esp + 0x2b8]
push eax
lea eax, [esp + 0x2c]
push eax
push ebp
call dword [sym.imp.WS2_32.dll_bind]
test eax, eax
jns 0x513d6a
mov ebx, dword [sym.imp.WS2_32.dll_ntohs]
nop word [eax + eax]
mov eax, dword [esp + 0x24]
dec eax
mov dword [esp + 0x24], eax
test eax, eax
jle 0x513dd9
inc esi
test si, si
je 0x513dd9
movzx eax, si
dec eax
push eax
push str.Bind_to_local_port__d_failed__trying_next
push edi
call fcn.004e1030
add esp, 0xc
push esi
call ebx
push dword [esp + 0x18]
mov word [esp + 0x2e], ax
lea eax, [esp + 0x2c]
push eax
push ebp
call dword [sym.imp.WS2_32.dll_bind]
test eax, eax
js 0x513d20
push 0x80
lea eax, [esp + 0xac]
mov dword [esp + 0x24], 0x80
push 0
push eax
call fcn.00572a00
add esp, 0xc
lea eax, [esp + 0x20]
push eax
lea eax, [esp + 0xac]
push eax
push ebp
call dword [sym.imp.WS2_32.dll_getsockname]
test eax, eax
jns 0x513e11
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov esi, eax
lea eax, [esp + 0x1a8]
push 0x100
push eax
push esi
mov dword [edi + 0x934], esi
call fcn.004ddac0
push eax
push esi
push str.getsockname___failed_with_errno__d:__s
push edi
call fcn.004e0f60
add esp, 0x1c
mov eax, 0x2d
jmp 0x513e30
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov esi, eax
lea eax, [esp + 0xa8]
push 0x100
push eax
push esi
mov dword [edi + 0x934], esi
call fcn.004ddac0
push eax
push esi
push str.bind_failed_with_errno__d:__s
push edi
call fcn.004e0f60
add esp, 0x1c
mov eax, 0x2d
jmp 0x513e30
movzx eax, si
push eax
push str.Local_port:__hu
push edi
call fcn.004e1030
mov eax, dword [esp + 0x28]
add esp, 0xc
mov byte [eax + 0x1f6], 1
xor eax, eax
mov ecx, dword [esp + 0x2a8]
pop ebp
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.0057029b
add esp, 0x29c
ret