// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/socket.c
// Function: sa_ntop
char *sa_ntop(char *dst, size_t lim, const void *src, const char *def, int *_error) {
	union sockaddr_any *any = (void *)src;
	const char *unspec = "0.0.0.0";
	char text[SA_ADDRSTRLEN];
	int error;

	switch (*sa_family(&any->sa)) {
	case AF_INET:
		unspec = "0.0.0.0";

		if (!inet_ntop(AF_INET, &any->sin.sin_addr, text, sizeof text))
			goto syerr;

		break;
	case AF_INET6:
		unspec = "::";

		if (!inet_ntop(AF_INET6, &any->sin6.sin6_addr, text, sizeof text))
			goto syerr;

		break;
#if SA_UNIX
	case AF_UNIX:
		unspec = "/nonexistent";

		memset(text, 0, sizeof text);
		memcpy(text, any->sun.sun_path, SO_MIN(sizeof text - 1, sizeof any->sun.sun_path));

		break;
#endif
	default:
		error = EAFNOSUPPORT;

		goto error;
	} /* switch() */

	if (dns_strlcpy(dst, text, lim) >= lim) {
		error = ENOSPC;

		goto error;
	}

	return dst;
syerr:
	error = so_syerr();
error:
	if (_error)
		*_error = error;

	/*
	 * NOTE: Always write something in case caller ignores errors, such
	 * as when caller is using the sa_ntoa() macro.
	 */
	dns_strlcpy(dst, (def)? def : unspec, lim);

	return (char *)def;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq 0x1e0cc(%rip), %rax     # 0x49c3a
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x2bd10
movzwl (%rax), %eax
movl %eax, -0xc4(%rbp)
subl $0x1, %eax
je 0x2bc23
jmp 0x2bb9d
movl -0xc4(%rbp), %eax
subl $0x2, %eax
je 0x2bbba
jmp 0x2bbaa
movl -0xc4(%rbp), %eax
subl $0xa, %eax
je 0x2bbf0
jmp 0x2bc5c
leaq 0x1e079(%rip), %rax     # 0x49c3a
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rsi
addq $0x4, %rsi
leaq -0xb0(%rbp), %rdx
movl $0x2, %edi
movl $0x6d, %ecx
callq 0xfeb0
cmpq $0x0, %rax
jne 0x2bbee
jmp 0x2bc98
jmp 0x2bc68
leaq 0x1e04b(%rip), %rax     # 0x49c42
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rsi
addq $0x8, %rsi
leaq -0xb0(%rbp), %rdx
movl $0xa, %edi
movl $0x6d, %ecx
callq 0xfeb0
cmpq $0x0, %rax
jne 0x2bc21
jmp 0x2bc98
jmp 0x2bc68
leaq 0x1e01b(%rip), %rax     # 0x49c45
movq %rax, -0x40(%rbp)
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x6d, %edx
callq 0xf7d0
leaq -0xb0(%rbp), %rdi
movq -0x38(%rbp), %rsi
addq $0x2, %rsi
movl $0x6c, %edx
callq 0xfb40
jmp 0x2bc68
movl $0x61, -0xb4(%rbp)
jmp 0x2bca5
movq -0x10(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xf520
cmpq -0x18(%rbp), %rax
jb 0x2bc8e
movl $0x1c, -0xb4(%rbp)
jmp 0x2bca5
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2bd01
callq 0xf0a0
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2bcb8
movl -0xb4(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x2bcd7
movq -0x28(%rbp), %rax
movq %rax, -0xd8(%rbp)
jmp 0x2bce2
movq -0x40(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xf520
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xe0, %rsp
popq %rbp
retq
nop