// File: /workspace/github_c_makefile_star2_O3/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
movl $0x3, %r13d
xorl %r12d, %r12d
movzwl -0x4(%r15), %edi
testl %edi, %edi
je 0x2cd2b
movups 0xa6c3(%rip), %xmm0     # 0x3732f
movups %xmm0, 0x1f(%rsp)
movaps 0xa6a8(%rip), %xmm0     # 0x37320
movaps %xmm0, 0x10(%rsp)
movaps 0xa68c(%rip), %xmm0     # 0x37310
movaps %xmm0, (%rsp)
cmpl $0x2, %edi
je 0x2cca9
cmpl $0xa, %edi
jne 0x2ccc9
leaq 0x4(%r15), %rsi
movq %rsp, %rdx
movl $0x2f, %ecx
callq 0xfda0
leaq -0x2(%r15), %rbp
jmp 0x2ccdf
movq %r12, %rbp
shlq $0x7, %rbp
addq %r14, %rbp
movq %r15, %rsi
movq %rsp, %rdx
movl $0x2f, %ecx
callq 0xfda0
addq $0x2, %rbp
jmp 0x2ccdf
xorl %esi, %esi
movq %rsp, %rdx
movl $0x2f, %ecx
callq 0xfda0
leaq 0x1b971(%rip), %rbp     # 0x48650
movzwl (%rbp), %eax
cmpl $0x3500, %eax           # imm = 0x3500
jne 0x2cd00
movq %rbx, %rdi
leaq 0xc330(%rip), %rsi      # 0x39024
movq %rsp, %rdx
xorl %eax, %eax
callq 0x102e0
jmp 0x2cd1b
rolw $0x8, %ax
movzwl %ax, %ecx
movq %rbx, %rdi
leaq 0xc322(%rip), %rsi      # 0x39033
movq %rsp, %rdx
xorl %eax, %eax
callq 0x102e0
incq %r12
subq $-0x80, %r15
decq %r13
jne 0x2cc58
leaq 0x9726(%rip), %rdi      # 0x36458
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
movl $0x180, %r12d           # imm = 0x180
leaq 0x91fb(%rip), %r15      # 0x35f4c
cmpb $0x0, (%r14,%r12)
je 0x2cd79
leaq (%r14,%r12), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x102e0
addq $0x100, %r12            # imm = 0x100
cmpq $0x580, %r12            # imm = 0x580
jne 0x2cd51
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10000
leaq 0xc2bb(%rip), %rdi      # 0x39048
movq %rbx, %rsi
callq 0xfea0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x102f0
leaq 0x96c5(%rip), %rdi      # 0x3646c
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
xorl %ebp, %ebp
leaq 0xc289(%rip), %r15      # 0x3904b
leaq 0xc28e(%rip), %r12      # 0x39057
leaq 0xc281(%rip), %r13      # 0x39051
movzbl 0x580(%r14,%rbp), %eax
cmpl $0x62, %eax
jle 0x2cdf7
cmpl $0x63, %eax
je 0x2ce08
cmpl $0x66, %eax
jne 0x2ce1d
movl $0x5, %esi
movl $0x1, %edx
movq %r13, %rdi
jmp 0x2ce15
jne 0x2ce28
movl $0x5, %esi
movl $0x1, %edx
movq %r15, %rdi
jmp 0x2ce15
movl $0x6, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x109d0
incq %rbp
cmpq $0x24, %rbp
jne 0x2cdd0
jmp 0x2ce2c
testl %eax, %eax
jne 0x2ce1d
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10000
movl 0x5b4(%r14), %edx
movl 0x5b8(%r14), %ecx
movl 0x5bc(%r14), %r8d
leaq 0xc209(%rip), %rsi      # 0x3905e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x102e0
cmpb $0x1, 0x5b0(%r14)
jne 0x2ce82
leaq 0xc216(%rip), %rdi      # 0x39086
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
cmpb $0x1, 0x5c0(%r14)
jne 0x2cea5
leaq 0xc1fa(%rip), %rdi      # 0x3908d
movl $0x7, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
cmpb $0x1, 0x5c1(%r14)
jne 0x2cec8
leaq 0xc1df(%rip), %rdi      # 0x39095
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
cmpb $0x1, 0x5c2(%r14)
jne 0x2ceeb
leaq 0xc1c5(%rip), %rdi      # 0x3909e
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
movl 0x5c4(%r14), %eax
cmpl $0x2, %eax
je 0x2cf0a
cmpl $0x1, %eax
jne 0x2cf23
leaq 0xc1a2(%rip), %rdi      # 0x390a5
movl $0x4, %esi
jmp 0x2cf16
leaq 0xc199(%rip), %rdi      # 0x390aa
movl $0xc, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10000
movzwl 0x5c8(%r14), %edi
testl %edi, %edi
je 0x2cfc8
movups 0xa3e8(%rip), %xmm0     # 0x3732f
movups %xmm0, 0x1f(%rsp)
movaps 0xa3cd(%rip), %xmm0     # 0x37320
movaps %xmm0, 0x10(%rsp)
movaps 0xa3b1(%rip), %xmm0     # 0x37310
movaps %xmm0, (%rsp)
cmpl $0x2, %edi
je 0x2cf76
cmpl $0xa, %edi
jne 0x2cf93
leaq 0x5d0(%r14), %rsi
jmp 0x2cf7d
leaq 0x5cc(%r14), %rsi
movq %rsp, %rdx
movl $0x2f, %ecx
callq 0xfda0
addq $0x5ca, %r14            # imm = 0x5CA
jmp 0x2cfa9
movq %rsp, %rdx
xorl %esi, %esi
movl $0x2f, %ecx
callq 0xfda0
leaq 0x1b6a7(%rip), %r14     # 0x48650
movzwl (%r14), %eax
rolw $0x8, %ax
movzwl %ax, %ecx
leaq 0xc0fc(%rip), %rsi      # 0x390b7
movq %rsp, %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x102e0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq