// File: /workspace/github_c_makefile_star2_O2/wahern[P]cqueues/src/lib/dns.c
// Function: dns_nssconf_loadfile
DNS_PRAGMA_POP


int dns_nssconf_loadfile(struct dns_resolv_conf *resconf, FILE *fp) {
	enum dns_nssconf_keyword source, status, action;
	char lookup[sizeof resconf->lookup] = "", *lp;
	struct dns_anyconf cf;
	size_t i;
	int error;

	while (!feof(fp) && !ferror(fp)) {
		dns_anyconf_reset(&cf);

		dns_anyconf_skip("%s", fp);

		if (!dns_anyconf_scan(&cf, "%w_", fp, &error))
			goto nextent;

		if (DNS_NSSCONF_HOSTS != dns_nssconf_keyword(cf.token[0]))
			goto nextent;

		dns_anyconf_pop(&cf);

		if (!dns_anyconf_skip(": \t", fp))
			goto nextent;

		*(lp = lookup) = '\0';

		while (dns_anyconf_scan(&cf, "%w_", fp, &error)) {
			dns_anyconf_skip(" \t", fp);

			if ('[' == dns_anyconf_peek(fp)) {
				dns_anyconf_skip("[! \t", fp);

				while (dns_anyconf_scan(&cf, "%w_", fp, &error)) {
					dns_anyconf_skip("= \t", fp);
					if (!dns_anyconf_scan(&cf, "%w_", fp, &error)) {
						dns_anyconf_pop(&cf); /* discard status */
						dns_anyconf_skip("^#;]\n", fp); /* skip to end of criteria */
						break;
					}
					dns_anyconf_skip(" \t", fp);
				}

				dns_anyconf_skip("] \t", fp);
			}

			if ((size_t)(endof(lookup) - lp) < cf.count + 1) /* +1 for '\0' */
				goto nextsrc;

			source = dns_nssconf_keyword(cf.token[0]);

			switch (source) {
			case DNS_NSSCONF_DNS:
			case DNS_NSSCONF_MDNS:
			case DNS_NSSCONF_FILES:
				*lp++ = dns_nssconf_k2c(source);
				break;
			default:
				goto nextsrc;
			}

			for (i = 1; i + 1 < cf.count; i += 2) {
				status = dns_nssconf_keyword(cf.token[i]);
				action = dns_nssconf_keyword(cf.token[i + 1]);

				switch (status) {
				case DNS_NSSCONF_SUCCESS:
				case DNS_NSSCONF_NOTFOUND:
				case DNS_NSSCONF_UNAVAIL:
				case DNS_NSSCONF_TRYAGAIN:
					*lp++ = dns_nssconf_k2c(status);
					break;
				default:
					continue;
				}

				switch (action) {
				case DNS_NSSCONF_CONTINUE:
				case DNS_NSSCONF_RETURN:
					break;
				default:
					action = (status == DNS_NSSCONF_SUCCESS)
					       ? DNS_NSSCONF_RETURN
					       : DNS_NSSCONF_CONTINUE;
					break;
				}

				*lp++ = dns_nssconf_k2c(action);
			}
nextsrc:
			*lp = '\0';
			dns_anyconf_reset(&cf);
		}
nextent:
		dns_anyconf_skip("^\n", fp);
	}

	if (*lookup)
		strncpy(resconf->lookup, lookup, sizeof resconf->lookup);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %rsi, %r14
movq %rdi, (%rsp)
xorps %xmm0, %xmm0
leaq 0x34(%rsp), %rbx
andl $0x0, -0x4(%rbx)
movaps %xmm0, -0x14(%rbx)
movaps %xmm0, -0x24(%rbx)
leaq 0x40(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r14, %rdi
callq 0x10590
testl %eax, %eax
jne 0x282df
movq %r14, %rdi
callq 0x109e0
testl %eax, %eax
jne 0x282df
andl $0x0, 0xc0(%rsp)
leaq 0xc4(%rsp), %rax
movq %rax, 0x4d0(%rsp)
movq %rax, 0x4c8(%rsp)
leaq 0x8e79(%rip), %rdi      # 0x30f4d
movq %r14, %rsi
callq 0x28312
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2835b
testq %rax, %rax
je 0x282cb
movq 0x40(%rsp), %rdi
callq 0x28445
cmpl $0x1, %eax
jne 0x282cb
movq %r12, %rdi
callq 0x2847c
leaq 0xbede(%rip), %rdi      # 0x33ff3
movq %r14, %rsi
callq 0x28312
testq %rax, %rax
je 0x282cb
movb $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rbp
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2835b
testq %rax, %rax
je 0x282cb
leaq 0xbeab(%rip), %rdi      # 0x33ff9
movq %r14, %rsi
callq 0x28312
movq %r14, %rdi
callq 0xf370
movl %eax, %r15d
movl %eax, %edi
movq %r14, %rsi
callq 0xf1b0
cmpl $0x5b, %r15d
jne 0x281e2
leaq 0xbe7f(%rip), %rdi      # 0x33ff7
movq %r14, %rsi
callq 0x28312
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2835b
testq %rax, %rax
je 0x281d3
leaq 0xbe62(%rip), %rdi      # 0x33ffc
movq %r14, %rsi
callq 0x28312
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2835b
leaq 0xbe42(%rip), %rdi      # 0x33ff9
testq %rax, %rax
jne 0x28178
movq %r12, %rdi
callq 0x2847c
leaq 0xbe35(%rip), %rdi      # 0x34000
movq %r14, %rsi
callq 0x28312
leaq 0xbe2c(%rip), %rdi      # 0x34006
movq %r14, %rsi
callq 0x28312
movq %rbx, %rax
subq %rbp, %rax
movl 0xc0(%rsp), %ecx
incl %ecx
cmpq %rcx, %rax
jb 0x282a2
movq 0x40(%rsp), %rdi
callq 0x28445
leal -0x8(%rax), %ecx
cmpl $0x2, %ecx
ja 0x282a2
movl %eax, %eax
leaq 0xb4f7(%rip), %rcx      # 0x33710
movb (%rax,%rcx), %al
movb %al, (%rbp)
incq %rbp
pushq $0x2
popq %rbx
movl 0xc0(%rsp), %eax
cmpq %rax, %rbx
jae 0x2829d
movq 0x38(%rsp,%rbx,8), %rdi
callq 0x28445
movl %eax, %r15d
movq 0x40(%rsp,%rbx,8), %rdi
callq 0x28445
leal -0x2(%r15), %ecx
cmpl $0x3, %ecx
ja 0x28297
movl %eax, %edx
andl $-0x2, %edx
xorl %ecx, %ecx
cmpl $0x2, %r15d
movl %r15d, %esi
leaq 0xb4aa(%rip), %rdi      # 0x33710
movb (%rsi,%rdi), %sil
sete %cl
orl $0x6, %ecx
cmpl $0x6, %edx
cmovel %eax, %ecx
movb %sil, (%rbp)
leal -0xb(%rcx), %edx
movb $0x3f, %al
cmpl $-0x9, %edx
jb 0x28290
movl %ecx, %eax
leaq 0xb483(%rip), %rcx      # 0x33710
movb (%rax,%rcx), %al
movb %al, 0x1(%rbp)
addq $0x2, %rbp
addq $0x2, %rbx
jmp 0x28225
leaq 0x34(%rsp), %rbx
andl $0x0, 0xc0(%rsp)
movb $0x0, (%rbp)
leaq 0xc4(%rsp), %rax
movq %rax, 0x4d0(%rsp)
movq %rax, 0x4c8(%rsp)
jmp 0x28130
leaq 0xbd38(%rip), %rdi      # 0x3400a
movq %r14, %rsi
callq 0x28312
jmp 0x2808d
cmpb $0x0, 0x10(%rsp)
je 0x282fe
movq (%rsp), %rdi
addq $0x580, %rdi            # imm = 0x580
leaq 0x10(%rsp), %rsi
pushq $0x24
popq %rdx
callq 0xf6c0
xorl %eax, %eax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq