// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_hints_insert_resconf
unsigned dns_hints_insert_resconf(struct dns_hints *H, const char *zone, const struct dns_resolv_conf *resconf, int *error_) {
	unsigned i, n, p;
	int error;

	for (i = 0, n = 0, p = 1; i < lengthof(resconf->nameserver) && resconf->nameserver[i].ss_family != AF_UNSPEC; i++, n++) {
		union { struct sockaddr_in sin; } tmp;
		struct sockaddr *ns;

		/*
		 * dns_resconf_open initializes nameserver[0] to INADDR_ANY.
		 *
		 * Traditionally the semantics of 0.0.0.0 meant the default
		 * interface, which evolved to mean the loopback interface.
		 * See comment block preceding resolv/res_init.c:res_init in
		 * glibc 2.23. As of 2.23, glibc no longer translates
		 * 0.0.0.0 despite the code comment, but it does default to
		 * 127.0.0.1 when no nameservers are present.
		 *
		 * BIND9 as of 9.10.3 still translates 0.0.0.0 to 127.0.0.1.
		 * See lib/lwres/lwconfig.c:lwres_create_addr and the
		 * convert_zero flag. 127.0.0.1 is also the default when no
		 * nameservers are present.
		 */
		if (dns_hints_isinaddr_any(&resconf->nameserver[i])) {
			memcpy(&tmp.sin, &resconf->nameserver[i], sizeof tmp.sin);
			tmp.sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
			ns = (struct sockaddr *)&tmp.sin;
		} else {
			ns = (struct sockaddr *)&resconf->nameserver[i];
		}

		if ((error = dns_hints_insert(H, zone, ns, p)))
			goto error;

		p += !resconf->options.rotate;
	}

	return n;
error:
	*error_ = error;

	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
cmpq $0x3, %rcx
movb %al, -0x51(%rbp)
jae 0x3c2a7
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movzwl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x3c2b3
jmp 0x3c35e
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %eax
shlq $0x7, %rax
addq %rax, %rdi
callq 0x3c700
testb $0x1, %al
jne 0x3c2cc
jmp 0x3c300
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq %rcx, -0x48(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x7f000001, %edi       # imm = 0x7F000001
callq 0xfa60
movl %eax, -0x44(%rbp)
leaq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x3c312
movq -0x20(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x50(%rbp), %rdx
movl -0x34(%rbp), %ecx
callq 0xf9c0
movl %eax, -0x38(%rbp)
cmpl $0x0, %eax
je 0x3c330
jmp 0x3c366
movq -0x20(%rbp), %rax
movb 0x5c0(%rax), %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x3c27d
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3c375
movl -0x38(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop