// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, %r14
leaq 0x8(%rdi), %r12
movl $0x3, %r13d
xorl %ebx, %ebx
movzwl -0x8(%r12), %ebp
testl %ebp, %ebp
je 0x2d0fe
movq %rbx, %r15
shlq $0x7, %r15
addq %r14, %r15
movups 0xa336(%rip), %xmm0     # 0x3737f
movups %xmm0, 0x2f(%rsp)
movaps 0xa31b(%rip), %xmm0     # 0x37370
movaps %xmm0, 0x20(%rsp)
movaps 0xa2ff(%rip), %xmm0     # 0x37360
movaps %xmm0, 0x10(%rsp)
cmpl $0x2, %ebp
je 0x2d075
cmpl $0xa, %ebp
jne 0x2d07b
movq %r12, %rsi
jmp 0x2d07d
leaq 0x4(%r15), %rsi
jmp 0x2d07d
xorl %esi, %esi
movl %ebp, %edi
leaq 0x10(%rsp), %rdx
movl $0x2f, %ecx
callq 0xfda0
cmpl $0x2, %ebp
je 0x2d0a6
leaq 0x1b5b6(%rip), %r15     # 0x48650
cmpl $0xa, %ebp
jne 0x2d0aa
leaq -0x6(%r12), %r15
jmp 0x2d0aa
addq $0x2, %r15
movzwl (%r15), %eax
cmpl $0x3500, %eax           # imm = 0x3500
jne 0x2d0cf
movq 0x8(%rsp), %rdi
leaq 0xbfa3(%rip), %rsi      # 0x39064
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x102e0
jmp 0x2d0ee
rolw $0x8, %ax
movzwl %ax, %ecx
movq 0x8(%rsp), %rdi
leaq 0xbf91(%rip), %rsi      # 0x39073
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x102e0
incq %rbx
subq $-0x80, %r12
decq %r13
jne 0x2d02a
leaq 0x938b(%rip), %rdi      # 0x36490
movl $0x6, %esi
movl $0x1, %edx
movq 0x8(%rsp), %rcx
callq 0x109d0
movl $0x180, %ebx            # imm = 0x180
leaq 0x8e4f(%rip), %r15      # 0x35f74
cmpb $0x0, (%r14,%rbx)
je 0x2d14f
leaq (%r14,%rbx), %rdx
movq 0x8(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x102e0
addq $0x100, %rbx            # imm = 0x100
cmpq $0x580, %rbx            # imm = 0x580
jne 0x2d125
movl $0xa, %edi
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x10000
leaq 0xbf20(%rip), %rdi      # 0x39088
movq %rbx, %rsi
callq 0xfea0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x102f0
leaq 0x9322(%rip), %rdi      # 0x364a4
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
xorl %ebp, %ebp
leaq 0xbeee(%rip), %r15      # 0x3908b
leaq 0xbef3(%rip), %r12      # 0x39097
leaq 0xbee6(%rip), %r13      # 0x39091
movzbl 0x580(%r14,%rbp), %eax
cmpl $0x62, %eax
jle 0x2d1d2
cmpl $0x63, %eax
je 0x2d1e3
cmpl $0x66, %eax
jne 0x2d1f8
movl $0x5, %esi
movl $0x1, %edx
movq %r13, %rdi
jmp 0x2d1f0
jne 0x2d203
movl $0x5, %esi
movl $0x1, %edx
movq %r15, %rdi
jmp 0x2d1f0
movl $0x6, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x109d0
incq %rbp
cmpq $0x24, %rbp
jne 0x2d1ab
jmp 0x2d207
testl %eax, %eax
jne 0x2d1f8
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10000
movl 0x5b4(%r14), %edx
movl 0x5b8(%r14), %ecx
movl 0x5bc(%r14), %r8d
leaq 0xbe6e(%rip), %rsi      # 0x3909e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x102e0
cmpb $0x1, 0x5b0(%r14)
jne 0x2d25d
leaq 0xbe7b(%rip), %rdi      # 0x390c6
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
cmpb $0x1, 0x5c0(%r14)
jne 0x2d280
leaq 0xbe5f(%rip), %rdi      # 0x390cd
movl $0x7, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
cmpb $0x1, 0x5c1(%r14)
jne 0x2d2a3
leaq 0xbe44(%rip), %rdi      # 0x390d5
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
cmpb $0x1, 0x5c2(%r14)
jne 0x2d2c6
leaq 0xbe2a(%rip), %rdi      # 0x390de
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
movl 0x5c4(%r14), %eax
cmpl $0x2, %eax
je 0x2d2e5
cmpl $0x1, %eax
jne 0x2d2fe
leaq 0xbe07(%rip), %rdi      # 0x390e5
movl $0x4, %esi
jmp 0x2d2f1
leaq 0xbdfe(%rip), %rdi      # 0x390ea
movl $0xc, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x109d0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x10000
movzwl 0x5c8(%r14), %ebp
testl %ebp, %ebp
je 0x2d3a9
movups 0xa05d(%rip), %xmm0     # 0x3737f
movups %xmm0, 0x2f(%rsp)
movaps 0xa042(%rip), %xmm0     # 0x37370
movaps %xmm0, 0x20(%rsp)
movaps 0xa026(%rip), %xmm0     # 0x37360
movaps %xmm0, 0x10(%rsp)
cmpl $0x2, %ebp
je 0x2d352
cmpl $0xa, %ebp
jne 0x2d35b
leaq 0x5d0(%r14), %rsi
jmp 0x2d35d
leaq 0x5cc(%r14), %rsi
jmp 0x2d35d
xorl %esi, %esi
leaq 0x10(%rsp), %rdx
movl %ebp, %edi
movl $0x2f, %ecx
callq 0xfda0
cmpl $0x2, %ebp
je 0x2d378
cmpl $0xa, %ebp
jne 0x2d381
addq $0x5ca, %r14            # imm = 0x5CA
jmp 0x2d388
leaq 0x1b2c8(%rip), %r14     # 0x48650
movzwl (%r14), %eax
rolw $0x8, %ax
movzwl %ax, %ecx
leaq 0xbd5d(%rip), %rsi      # 0x390f7
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x102e0
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq