// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_sa_cmp
static int dns_sa_cmp(void *a, void *b) {
	int cmp, af;

	if ((cmp = dns_sa_family(a) - dns_sa_family(b)))
		return cmp;

	switch ((af = dns_sa_family(a))) {
	case AF_INET: {
		struct in_addr *a4, *b4;

		if ((cmp = htons(*dns_sa_port(af, a)) - htons(*dns_sa_port(af, b))))
			return cmp;

		a4 = dns_sa_addr(af, a, NULL);
		b4 = dns_sa_addr(af, b, NULL);

		if (ntohl(a4->s_addr) < ntohl(b4->s_addr))
			return -1;
		if (ntohl(a4->s_addr) > ntohl(b4->s_addr))
			return 1;

		return 0;
	}
	case AF_INET6: {
		struct in6_addr *a6, *b6;
		size_t i;

		if ((cmp = htons(*dns_sa_port(af, a)) - htons(*dns_sa_port(af, b))))
			return cmp;

		a6 = dns_sa_addr(af, a, NULL);
		b6 = dns_sa_addr(af, b, NULL);

		/* XXX: do we need to use in6_clearscope()? */
		for (i = 0; i < sizeof a6->s6_addr; i++) {
			if ((cmp = a6->s6_addr[i] - b6->s6_addr[i]))
				return cmp;
		}

		return 0;
	}
#if DNS_HAVE_SOCKADDR_UN
	case AF_UNIX: {
		char a_path[DNS_SUNPATHMAX + 1], b_path[sizeof a_path];

		dns_strnlcpy(a_path, sizeof a_path, dns_sa_path(a, NULL), DNS_SUNPATHMAX);
		dns_strnlcpy(b_path, sizeof b_path, dns_sa_path(b, NULL), DNS_SUNPATHMAX);

		return strcmp(a_path, b_path);
	}
#endif
	default:
		return -1;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
movq -0x18(%rbp), %rcx
movzwl (%rcx), %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x44086
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4430b
movq -0x10(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x134(%rbp)
movl %eax, %ecx
subl $0x1, %ecx
movl %eax, -0x20(%rbp)
je 0x44284
jmp 0x440a3
movl -0x134(%rbp), %eax
subl $0x2, %eax
je 0x440c4
jmp 0x440b0
movl -0x134(%rbp), %eax
subl $0xa, %eax
je 0x441b2
jmp 0x44304
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3a1b0
movzwl (%rax), %edi
callq 0xf0e0
movzwl %ax, %eax
movl %eax, -0x138(%rbp)
movl -0x20(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x3a1b0
movzwl (%rax), %edi
callq 0xf0e0
movw %ax, %cx
movl -0x138(%rbp), %eax
movzwl %cx, %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x44116
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4430b
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3a110
movq %rax, -0x28(%rbp)
movl -0x20(%rbp), %edi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3a110
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0x101c0
movl %eax, -0x13c(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
callq 0x101c0
movl %eax, %ecx
movl -0x13c(%rbp), %eax
cmpl %ecx, %eax
jae 0x44172
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4430b
movq -0x28(%rbp), %rax
movl (%rax), %edi
callq 0x101c0
movl %eax, -0x140(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %edi
callq 0x101c0
movl %eax, %ecx
movl -0x140(%rbp), %eax
cmpl %ecx, %eax
jbe 0x441a6
movl $0x1, -0x4(%rbp)
jmp 0x4430b
movl $0x0, -0x4(%rbp)
jmp 0x4430b
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3a1b0
movzwl (%rax), %edi
callq 0xf0e0
movzwl %ax, %eax
movl %eax, -0x144(%rbp)
movl -0x20(%rbp), %edi
movq -0x18(%rbp), %rsi
callq 0x3a1b0
movzwl (%rax), %edi
callq 0xf0e0
movw %ax, %cx
movl -0x144(%rbp), %eax
movzwl %cx, %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x44204
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4430b
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3a110
movq %rax, -0x38(%rbp)
movl -0x20(%rbp), %edi
movq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3a110
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
cmpq $0x10, -0x48(%rbp)
jae 0x44278
movq -0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0x44268
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4430b
jmp 0x4426a
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x44234
movl $0x0, -0x4(%rbp)
jmp 0x4430b
leaq -0xc0(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x443b0
movq -0x158(%rbp), %rdi
movq %rax, %rdx
movl $0x6d, %esi
movl $0x6c, %ecx
callq 0x44320
leaq -0x130(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x443b0
movq -0x150(%rbp), %rdi
movq %rax, %rdx
movl $0x6d, %esi
movl $0x6c, %ecx
callq 0x44320
leaq -0xc0(%rbp), %rdi
leaq -0x130(%rbp), %rsi
callq 0x103a0
movl %eax, -0x4(%rbp)
jmp 0x4430b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw (%rax,%rax)