// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]kivaloo/liball/../libcperciva/util/sock.c
// Function: sock_resolve
struct sock_addr **
sock_resolve(const char * addr)
{
	struct sock_addr ** res;
	char * s;
	char * ports;
	char * ips;
	long p;

	/* Check syntax. */
	if (sock_addr_validate(addr))
		goto err0;

	/* If the address starts with '/', it's a Unix domain socket. */
	if (addr[0] == '/') {
		res = sock_resolve_unix(addr);
		goto done0;
	}

	/* Copy the address so that we can mangle it. */
	if ((s = strdup(addr)) == NULL)
		goto err0;

	/* The address should end with :port.  Look for the last ':'. */
	if ((ports = strrchr(s, ':')) == NULL) {
		warn0("Address must contain port number: %s", s);
		goto err1;
	}
	*ports++ = '\0';

	/* If the address doesn't start with '[', it's a host name. */
	if (s[0] != '[') {
		res = sock_resolve_host(s, ports);
		goto done1;
	}

	/* The address (sans :port) should end with ']'. */
	if (s[strlen(s) - 1] != ']') {
		warn0("Invalid [IP address]: %s", s);
		goto err1;
	}

	/* Extract the IP address string. */
	ips = &s[1];
	ips[strlen(ips) - 1] = '\0';

	/* Parse the port number in base 10, no trailing characters. */
	if (PARSENUM_EX(&p, ports, 1, 65535, 10, 0)) {
		warn0("Invalid port number: %s", ports);
		goto err1;
	}

	/* If the IP address contains ':', it's IPv6; otherwise, IPv4. */
	if (strchr(ips, ':') != NULL)
		res = sock_resolve_ipv6(ips, (in_port_t)p);
	else
		res = sock_resolve_ipv4(ips, (in_port_t)p);

done1:
	/* Free string allocated by strdup. */
	free(s);
done0:
	/* Return result from sock_resolve_foo. */
	return (res);

err1:
	free(s);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
callq 0x4e12
testl %eax, %eax
jne 0x407c
cmpb $0x2f, (%r14)
jne 0x3eeb
movl $0x1, %edi
movl $0x6e, %esi
callq 0x21c0
testq %rax, %rax
je 0x407c
movq %rax, %rbx
movw $0x1, (%rax)
movq %r14, %rdi
callq 0x2120
cmpq $0x6c, %rax
jb 0x3f83
leaq 0x36b6(%rip), %rdi      # 0x7587
movq %r14, %rsi
xorl %eax, %eax
callq 0x5017
callq 0x2090
movl $0x0, (%rax)
jmp 0x4074
movq %r14, %rdi
callq 0x2300
testq %rax, %rax
je 0x407c
movq %rax, %rbx
movq %rax, %rdi
movl $0x3a, %esi
callq 0x2150
testq %rax, %rax
je 0x3fe7
movq %rax, %r14
incq %r14
movb $0x0, (%rax)
cmpb $0x5b, (%rbx)
jne 0x3ff0
movq %rbx, %rdi
callq 0x2120
cmpb $0x5d, -0x1(%rbx,%rax)
jne 0x4053
movq %rbx, %r15
incq %r15
movq %r15, %rdi
callq 0x2120
movb $0x0, (%rbx,%rax)
callq 0x2090
movq %rax, %r12
movl $0x0, (%rax)
movq %r14, %rdi
callq 0x420a
cmpl $0x0, (%r12)
je 0x4164
leaq 0x3495(%rip), %rdi      # 0x7409
movq %r14, %rsi
xorl %eax, %eax
callq 0x5017
jmp 0x406c
movq %rbx, %rdi
addq $0x2, %rdi
movq %r14, %rsi
callq 0x20b0
movl $0x18, %edi
callq 0x2220
testq %rax, %rax
je 0x4074
movq %rax, %r15
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, (%r15)
movq %rbx, 0x8(%r15)
movl $0x6e, 0x10(%r15)
movl $0x10, %edi
callq 0x2220
testq %rax, %rax
je 0x4091
movq %rax, %r14
movq %r15, (%rax)
movq $0x0, 0x8(%rax)
jmp 0x407f
leaq 0x33c2(%rip), %rdi      # 0x73b0
jmp 0x405a
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movabsq $0x600000001, %rax      # imm = 0x600000001
movq %rax, 0x8(%rdx)
leaq 0x8(%rsp), %rcx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22f0
testl %eax, %eax
je 0x409b
movl %eax, %edi
callq 0x2140
leaq 0x356d(%rip), %rdi      # 0x75a0
xorl %r14d, %r14d
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x5017
callq 0x2090
movl $0x0, (%rax)
jmp 0x41de
leaq 0x337b(%rip), %rdi      # 0x73d5
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5017
callq 0x2090
movq %rax, %r12
movl $0x0, (%r12)
movq %rbx, %rdi
callq 0x2040
xorl %r14d, %r14d
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x2040
jmp 0x4074
movq 0x8(%rsp), %r15
xorl %eax, %eax
testq %r15, %r15
je 0x40e2
movq %r15, %rcx
movq 0x28(%rcx), %rcx
decq %rax
testq %rcx, %rcx
jne 0x40aa
cmpq $0x1, %rax
je 0x41eb
negq %rax
movabsq $0x1fffffffffffffff, %rcx # imm = 0x1FFFFFFFFFFFFFFF
cmpq %rcx, %rax
jb 0x40e2
callq 0x2090
movl $0xc, (%rax)
jmp 0x41d3
leaq 0x8(,%rax,8), %rdi
callq 0x2220
testq %rax, %rax
je 0x41d3
movq %rax, %r14
testq %r15, %r15
movq %r15, (%rsp)
je 0x4191
xorl %ebp, %ebp
movl $0x18, %edi
callq 0x2220
movq %rax, (%r14,%rbp,8)
testq %rax, %rax
je 0x41ae
movq %rax, %r12
movq 0x4(%r15), %rax
movq %rax, (%r12)
movl 0x10(%r15), %r13d
movl %r13d, 0x10(%r12)
movq %r13, %rdi
callq 0x2220
movq %rax, 0x8(%r12)
testq %rax, %rax
je 0x41a6
movq 0x18(%r15), %rsi
movq %rax, %rdi
movq %r13, %rdx
callq 0x21e0
incq %rbp
movq 0x28(%r15), %r15
testq %r15, %r15
jne 0x410a
jmp 0x4193
movq %rax, %r13
movq %r15, %rdi
movl $0x3a, %esi
callq 0x2130
movzwl %r13w, %esi
movq %r15, %rdi
testq %rax, %rax
je 0x4187
callq 0x428b
jmp 0x418c
callq 0x4351
movq %rax, %r14
jmp 0x41de
xorl %ebp, %ebp
movq $0x0, (%r14,%rbp,8)
movq (%rsp), %rdi
callq 0x2350
jmp 0x41de
movq %r12, %rdi
callq 0x2040
testq %rbp, %rbp
movq (%rsp), %r15
je 0x41cb
movq -0x8(%r14,%rbp,8), %rdi
callq 0x456a
decq %rbp
jne 0x41b7
movq 0x8(%rsp), %r15
movq %r14, %rdi
callq 0x2040
movq %r15, %rdi
callq 0x2350
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x2040
jmp 0x407f
leaq 0x33c6(%rip), %rdi      # 0x75b8
leaq 0x31f5(%rip), %rsi      # 0x73ee
leaq 0x33c5(%rip), %rcx      # 0x75c5
movl $0x63, %edx
callq 0x2160