// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/lib/dns.c
// Function: dns_resconf_dump
int dns_resconf_dump(struct dns_resolv_conf *resconf, FILE *fp) {
	unsigned i;
	int af;

	for (i = 0; i < lengthof(resconf->nameserver) && (af = resconf->nameserver[i].ss_family) != AF_UNSPEC; i++) {
		char addr[INET6_ADDRSTRLEN + 1]	= "[INVALID]";
		unsigned short port;

		dns_inet_ntop(af, dns_sa_addr(af, &resconf->nameserver[i], NULL), addr, sizeof addr);
		port = ntohs(*dns_sa_port(af, &resconf->nameserver[i]));

		if (port == 53)
			fprintf(fp, "nameserver %s\n", addr);
		else
			fprintf(fp, "nameserver [%s]:%hu\n", addr, port);
	}


	fprintf(fp, "search");

	for (i = 0; i < lengthof(resconf->search) && resconf->search[i][0]; i++)
		fprintf(fp, " %s", resconf->search[i]);

	fputc('\n', fp);


	fputs("; ", fp);
	dns_nssconf_dump(resconf, fp);

	fprintf(fp, "lookup");

	for (i = 0; i < lengthof(resconf->lookup) && resconf->lookup[i]; i++) {
		switch (resconf->lookup[i]) {
		case 'b':
			fprintf(fp, " bind"); break;
		case 'f':
			fprintf(fp, " file"); break;
		case 'c':
			fprintf(fp, " cache"); break;
		}
	}

	fputc('\n', fp);


	fprintf(fp, "options ndots:%u timeout:%u attempts:%u", resconf->options.ndots, resconf->options.timeout, resconf->options.attempts);

	if (resconf->options.edns0)
		fprintf(fp, " edns0");
	if (resconf->options.rotate)
		fprintf(fp, " rotate");
	if (resconf->options.recurse)
		fprintf(fp, " recurse");
	if (resconf->options.smart)
		fprintf(fp, " smart");

	switch (resconf->options.tcp) {
	case DNS_RESCONF_TCP_ENABLE:
		break;
	case DNS_RESCONF_TCP_ONLY:
		fprintf(fp, " tcp");
		break;
	case DNS_RESCONF_TCP_DISABLE:
		fprintf(fp, " tcp:disable");
		break;
	}

	fputc('\n', fp);


	if ((af = resconf->iface.ss_family) != AF_UNSPEC) {
		char addr[INET6_ADDRSTRLEN + 1]	= "[INVALID]";

		dns_inet_ntop(af, dns_sa_addr(af, &resconf->iface, NULL), addr, sizeof addr);

		fprintf(fp, "interface %s %hu\n", addr, ntohs(*dns_sa_port(af, &resconf->iface)));
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x4(%rdi), %r15
pushq $0x3
popq %r13
xorl %r12d, %r12d
subq $0x1, %r13
jb 0x28abc
movzwl -0x4(%r15), %edi
testl %edi, %edi
je 0x28abc
movups 0x9927(%rip), %xmm0     # 0x3232f
movups %xmm0, 0x1f(%rsp)
movaps 0x990c(%rip), %xmm0     # 0x32320
movaps %xmm0, 0x10(%rsp)
movaps 0x98f0(%rip), %xmm0     # 0x32310
movaps %xmm0, (%rsp)
cmpl $0x2, %edi
je 0x28a43
cmpl $0xa, %edi
jne 0x28a61
leaq 0x4(%r15), %rsi
movq %rsp, %rdx
pushq $0x2f
popq %rcx
callq 0xfe30
leaq -0x2(%r15), %rbp
jmp 0x28a75
movq %r12, %rbp
shlq $0x7, %rbp
addq %r14, %rbp
movq %r15, %rsi
movq %rsp, %rdx
pushq $0x2f
popq %rcx
callq 0xfe30
addq $0x2, %rbp
jmp 0x28a75
xorl %esi, %esi
movq %rsp, %rdx
pushq $0x2f
popq %rcx
callq 0xfe30
leaq 0x1dc4b(%rip), %rbp     # 0x466c0
movzwl (%rbp), %eax
cmpw $0x3500, %ax            # imm = 0x3500
jne 0x28a95
movq %rbx, %rdi
leaq 0xb58b(%rip), %rsi      # 0x34014
movq %rsp, %rdx
xorl %eax, %eax
callq 0x10380
jmp 0x28ab0
rolw $0x8, %ax
movzwl %ax, %ecx
movq %rbx, %rdi
leaq 0xb57d(%rip), %rsi      # 0x34023
movq %rsp, %rdx
xorl %eax, %eax
callq 0x10380
incq %r12
subq $-0x80, %r15
jmp 0x289ea
leaq 0x8995(%rip), %rdi      # 0x31458
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10ab0
movl $0x180, %r12d           # imm = 0x180
leaq 0x846e(%rip), %r15      # 0x30f4c
cmpq $0x580, %r12            # imm = 0x580
je 0x28b08
cmpb $0x0, (%r14,%r12)
je 0x28b08
leaq (%r14,%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10380
addq $0x100, %r12            # imm = 0x100
jmp 0x28ade
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x10090
leaq 0xb51e(%rip), %rdi      # 0x34038
movq %rbx, %rsi
callq 0xff30
movq %r14, %rdi
movq %rbx, %rsi
callq 0x10390
leaq 0x8938(%rip), %rdi      # 0x3146c
pushq $0x6
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
movq %rbx, %rcx
callq 0x10ab0
pushq $-0x24
popq %r15
pushq $0x5
popq %rbp
leaq 0xb4ed(%rip), %r13      # 0x34041
testq %r15, %r15
je 0x28ba2
movzbl 0x5a4(%r14,%r15), %eax
cmpl $0x62, %eax
je 0x28b83
cmpl $0x63, %eax
je 0x28b77
cmpl $0x66, %eax
je 0x28b8c
testl %eax, %eax
jne 0x28b9d
jmp 0x28ba2
leaq 0xb4c9(%rip), %rdi      # 0x34047
pushq $0x6
popq %rsi
jmp 0x28b92
leaq 0xb4b1(%rip), %rdi      # 0x3403b
jmp 0x28b8f
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x10ab0
incq %r15
jmp 0x28b54
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x10090
movl 0x5b4(%r14), %edx
movl 0x5b8(%r14), %ecx
movl 0x5bc(%r14), %r8d
leaq 0xb485(%rip), %rsi      # 0x3404e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10380
cmpb $0x1, 0x5b0(%r14)
jne 0x28bf2
leaq 0xb492(%rip), %rdi      # 0x34076
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10ab0
cmpb $0x1, 0x5c0(%r14)
jne 0x28c11
leaq 0xb47a(%rip), %rdi      # 0x3407d
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10ab0
cmpb $0x1, 0x5c1(%r14)
jne 0x28c30
leaq 0xb463(%rip), %rdi      # 0x34085
pushq $0x8
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10ab0
cmpb $0x1, 0x5c2(%r14)
jne 0x28c4f
leaq 0xb44d(%rip), %rdi      # 0x3408e
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10ab0
movl 0x5c4(%r14), %eax
cmpl $0x2, %eax
je 0x28c6b
cmpl $0x1, %eax
jne 0x28c80
leaq 0xb42e(%rip), %rdi      # 0x34095
pushq $0x4
jmp 0x28c74
leaq 0xb428(%rip), %rdi      # 0x3409a
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x10ab0
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x10090
movzwl 0x5c8(%r14), %edi
testl %edi, %edi
je 0x28d1f
movups 0x968d(%rip), %xmm0     # 0x3232f
movups %xmm0, 0x1f(%rsp)
movaps 0x9672(%rip), %xmm0     # 0x32320
movaps %xmm0, 0x10(%rsp)
movaps 0x9656(%rip), %xmm0     # 0x32310
movaps %xmm0, (%rsp)
cmpl $0x2, %edi
je 0x28cd1
cmpl $0xa, %edi
jne 0x28cec
leaq 0x5d0(%r14), %rsi
jmp 0x28cd8
leaq 0x5cc(%r14), %rsi
movq %rsp, %rdx
pushq $0x2f
popq %rcx
callq 0xfe30
addq $0x5ca, %r14            # imm = 0x5CA
jmp 0x28d00
movq %rsp, %rdx
pushq $0x2f
popq %rcx
xorl %esi, %esi
callq 0xfe30
leaq 0x1d9c0(%rip), %r14     # 0x466c0
movzwl (%r14), %eax
rolw $0x8, %ax
movzwl %ax, %ecx
leaq 0xb395(%rip), %rsi      # 0x340a7
movq %rsp, %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10380
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq