// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x40(%rbp), %rdi
xorl %esi, %esi
movl $0x24, %edx
callq 0xf7d0
movq -0x10(%rbp), %rdi
callq 0x10680
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x4ed(%rbp)
jne 0x3ad22
movq -0x10(%rbp), %rdi
callq 0x10b00
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x4ed(%rbp)
movb -0x4ed(%rbp), %al
testb $0x1, %al
jne 0x3ad31
jmp 0x3b029
leaq -0x4e0(%rbp), %rdi
callq 0x3b060
movq -0x10(%rbp), %rsi
leaq 0xe3d9(%rip), %rdi      # 0x49121
callq 0x3b0a0
movq -0x10(%rbp), %rdx
leaq -0x4e0(%rbp), %rdi
leaq 0x12800(%rip), %rsi     # 0x4d55f
leaq -0x4ec(%rbp), %rcx
callq 0x3b110
cmpq $0x0, %rax
jne 0x3ad76
jmp 0x3b014
movq -0x4e0(%rbp), %rdi
callq 0x3b1f0
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
je 0x3ad92
jmp 0x3b014
leaq -0x4e0(%rbp), %rdi
callq 0x3b270
movq -0x10(%rbp), %rsi
leaq 0x127ba(%rip), %rdi     # 0x4d563
callq 0x3b0a0
cmpq $0x0, %rax
jne 0x3adb9
jmp 0x3b014
leaq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movb $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rdx
leaq -0x4e0(%rbp), %rdi
leaq 0x12788(%rip), %rsi     # 0x4d55f
leaq -0x4ec(%rbp), %rcx
callq 0x3b110
cmpq $0x0, %rax
je 0x3b012
movq -0x10(%rbp), %rsi
leaq 0x12771(%rip), %rdi     # 0x4d569
callq 0x3b0a0
movq -0x10(%rbp), %rdi
callq 0x3b2e0
movl %eax, %ecx
movl $0x5b, %eax
cmpl %ecx, %eax
jne 0x3aec0
movq -0x10(%rbp), %rsi
leaq 0x12747(%rip), %rdi     # 0x4d567
callq 0x3b0a0
movq -0x10(%rbp), %rdx
leaq -0x4e0(%rbp), %rdi
leaq 0x12728(%rip), %rsi     # 0x4d55f
leaq -0x4ec(%rbp), %rcx
callq 0x3b110
cmpq $0x0, %rax
je 0x3aeb0
movq -0x10(%rbp), %rsi
leaq 0x12718(%rip), %rdi     # 0x4d56c
callq 0x3b0a0
movq -0x10(%rbp), %rdx
leaq -0x4e0(%rbp), %rdi
leaq 0x126f4(%rip), %rsi     # 0x4d55f
leaq -0x4ec(%rbp), %rcx
callq 0x3b110
cmpq $0x0, %rax
jne 0x3ae9b
leaq -0x4e0(%rbp), %rdi
callq 0x3b270
movq -0x10(%rbp), %rsi
leaq 0x126dc(%rip), %rdi     # 0x4d570
callq 0x3b0a0
jmp 0x3aeb0
movq -0x10(%rbp), %rsi
leaq 0x126c3(%rip), %rdi     # 0x4d569
callq 0x3b0a0
jmp 0x3ae25
movq -0x10(%rbp), %rsi
leaq 0x126bb(%rip), %rdi     # 0x4d576
callq 0x3b0a0
leaq -0x40(%rbp), %rax
addq $0x24, %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl -0x460(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x3aee4
jmp 0x3affa
movq -0x4e0(%rbp), %rdi
callq 0x3b1f0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $-0x8, %eax
subl $0x2, %eax
ja 0x3af1d
jmp 0x3af00
movl -0x14(%rbp), %edi
callq 0x3b310
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
jmp 0x3af22
jmp 0x3affa
movq $0x1, -0x4e8(%rbp)
movq -0x4e8(%rbp), %rax
addq $0x1, %rax
movl -0x460(%rbp), %ecx
cmpq %rcx, %rax
jae 0x3aff8
movq -0x4e8(%rbp), %rax
movq -0x4e0(%rbp,%rax,8), %rdi
callq 0x3b1f0
movl %eax, -0x18(%rbp)
movq -0x4e8(%rbp), %rax
movq -0x4d8(%rbp,%rax,8), %rdi
callq 0x3b1f0
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
addl $-0x2, %eax
subl $0x3, %eax
ja 0x3af9f
jmp 0x3af82
movl -0x18(%rbp), %edi
callq 0x3b310
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
jmp 0x3afa1
jmp 0x3afe1
movl -0x1c(%rbp), %eax
addl $-0x6, %eax
subl $0x1, %eax
ja 0x3afb0
jmp 0x3afae
jmp 0x3afc6
movl -0x18(%rbp), %edx
movl $0x6, %eax
movl $0x7, %ecx
cmpl $0x2, %edx
cmovel %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
callq 0x3b310
movb %al, %cl
movq -0x48(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x48(%rbp)
movb %cl, (%rax)
movq -0x4e8(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x4e8(%rbp)
jmp 0x3af2d
jmp 0x3affa
movq -0x48(%rbp), %rax
movb $0x0, (%rax)
leaq -0x4e0(%rbp), %rdi
callq 0x3b060
jmp 0x3adc5
jmp 0x3b014
movq -0x10(%rbp), %rsi
leaq 0x1255b(%rip), %rdi     # 0x4d57a
callq 0x3b0a0
jmp 0x3acf3
cmpb $0x0, -0x40(%rbp)
je 0x3b048
movq -0x8(%rbp), %rdi
addq $0x580, %rdi            # imm = 0x580
leaq -0x40(%rbp), %rsi
movl $0x24, %edx
callq 0xf700
xorl %eax, %eax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
nopw %cs:(%rax,%rax)