// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_resconf_loadfile
int dns_resconf_loadfile(struct dns_resolv_conf *resconf, FILE *fp) {
	unsigned sa_count	= 0;
	char words[6][DNS_D_MAXNAME + 1];
	unsigned wp, wc, i, j, n;
	int ch, error;

	rewind(fp);

	do {
		memset(words, '\0', sizeof words);
		wp	= 0;
		wc	= 0;

		while (EOF != (ch = getc(fp)) && ch != '\n') {
			if (dns_resconf_issep(ch)) {
				if (wp > 0) {
					wp	= 0;

					if (++wc >= lengthof(words))
						goto skip;
				}
			} else if (dns_resconf_iscom(ch)) {
skip:
				do {
					ch	= getc(fp);
				} while (ch != EOF && ch != '\n');

				break;
			} else if (wp < sizeof words[wc] - 1) {
				words[wc][wp++] = ch;
			} else {
				wp = 0; /* drop word */
				goto skip;
			}
		}

		if (wp > 0)
			wc++;

		if (wc < 2)
			continue;

		switch (dns_resconf_keyword(words[0])) {
		case DNS_RESCONF_NAMESERVER:
			if (sa_count >= lengthof(resconf->nameserver))
				continue;

			if ((error = dns_resconf_pton(&resconf->nameserver[sa_count], words[1])))
				continue;

			sa_count++;

			break;
		case DNS_RESCONF_DOMAIN:
		case DNS_RESCONF_SEARCH:
			memset(resconf->search, '\0', sizeof resconf->search);

			for (i = 1, j = 0; i < wc && j < lengthof(resconf->search); i++, j++)
				dns_d_anchor(resconf->search[j], sizeof resconf->search[j], words[i], strlen(words[i]));

			break;
		case DNS_RESCONF_LOOKUP:
			for (i = 1, j = 0; i < wc && j < lengthof(resconf->lookup); i++) {
				switch (dns_resconf_keyword(words[i])) {
				case DNS_RESCONF_FILE:
					resconf->lookup[j++]	= 'f';

					break;
				case DNS_RESCONF_BIND:
					resconf->lookup[j++]	= 'b';

					break;
				case DNS_RESCONF_CACHE:
					resconf->lookup[j++]	= 'c';

					break;
				default:
					break;
				} /* switch() */
			} /* for() */

			break;
		case DNS_RESCONF_FAMILY:
			for (i = 1, j = 0; i < wc && j < lengthof(resconf->family); i++) {
				switch (dns_resconf_keyword(words[i])) {
				case DNS_RESCONF_INET4:
					resconf->family[j++]	= AF_INET;

					break;
				case DNS_RESCONF_INET6:
					resconf->family[j++]	= AF_INET6;

					break;
				default:
					break;
				}
			}

			break;
		case DNS_RESCONF_OPTIONS:
			for (i = 1; i < wc; i++) {
				switch (dns_resconf_keyword(words[i])) {
				case DNS_RESCONF_EDNS0:
					resconf->options.edns0	= 1;

					break;
				case DNS_RESCONF_NDOTS:
					for (j = sizeof "ndots:" - 1, n = 0; dns_isdigit(words[i][j]); j++) {
						n	*= 10;
						n	+= words[i][j] - '0';
					} /* for() */

					resconf->options.ndots	= n;

					break;
				case DNS_RESCONF_TIMEOUT:
					for (j = sizeof "timeout:" - 1, n = 0; dns_isdigit(words[i][j]); j++) {
						n	*= 10;
						n	+= words[i][j] - '0';
					} /* for() */

					resconf->options.timeout	= n;

					break;
				case DNS_RESCONF_ATTEMPTS:
					for (j = sizeof "attempts:" - 1, n = 0; dns_isdigit(words[i][j]); j++) {
						n	*= 10;
						n	+= words[i][j] - '0';
					} /* for() */

					resconf->options.attempts	= n;

					break;
				case DNS_RESCONF_ROTATE:
					resconf->options.rotate		= 1;

					break;
				case DNS_RESCONF_RECURSE:
					resconf->options.recurse	= 1;

					break;
				case DNS_RESCONF_SMART:
					resconf->options.smart		= 1;

					break;
				case DNS_RESCONF_TCP:
					resconf->options.tcp		= DNS_RESCONF_TCP_ONLY;

					break;
				case DNS_RESCONF_TCPx:
					switch (dns_resconf_keyword(&words[i][sizeof "tcp:" - 1])) {
					case DNS_RESCONF_ENABLE:
						resconf->options.tcp	= DNS_RESCONF_TCP_ENABLE;

						break;
					case DNS_RESCONF_ONE:
					case DNS_RESCONF_ONLY:
						resconf->options.tcp	= DNS_RESCONF_TCP_ONLY;

						break;
					case DNS_RESCONF_ZERO:
					case DNS_RESCONF_DISABLE:
						resconf->options.tcp	= DNS_RESCONF_TCP_DISABLE;

						break;
					default:
						break;
					} /* switch() */

					break;
				default:
					break;
				} /* switch() */
			} /* for() */

			break;
		case DNS_RESCONF_INTERFACE:
			for (i = 0, n = 0; dns_isdigit(words[2][i]); i++) {
				n	*= 10;
				n	+= words[2][i] - '0';
			}

			dns_resconf_setiface(resconf, words[1], n);

			break;
		default:
			break;
		} /* switch() */
	} while (ch != EOF);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x680, %rsp            # imm = 0x680
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf170
leaq -0x620(%rbp), %rdi
xorl %esi, %esi
movl $0x600, %edx            # imm = 0x600
callq 0xf7d0
movl $0x0, -0x624(%rbp)
movl $0x0, -0x628(%rbp)
movq -0x10(%rbp), %rdi
callq 0xf3a0
movl %eax, %edx
movl %edx, -0x638(%rbp)
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl %edx, %ecx
movb %al, -0x63d(%rbp)
je 0x3a27c
cmpl $0xa, -0x638(%rbp)
setne %al
movb %al, -0x63d(%rbp)
movb -0x63d(%rbp), %al
testb $0x1, %al
jne 0x3a28b
jmp 0x3a387
movl -0x638(%rbp), %eax
movzbl %al, %edi
callq 0x393a0
testb $0x1, %al
jne 0x3a2a6
cmpl $0x2c, -0x638(%rbp)
jne 0x3a2d9
cmpl $0x0, -0x624(%rbp)
jbe 0x3a2d4
movl $0x0, -0x624(%rbp)
movl -0x628(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x628(%rbp)
movl %eax, %eax
cmpq $0x6, %rax
jb 0x3a2d2
jmp 0x3a2ed
jmp 0x3a2d4
jmp 0x3a382
cmpl $0x23, -0x638(%rbp)
je 0x3a2eb
cmpl $0x3b, -0x638(%rbp)
jne 0x3a32b
jmp 0x3a2ed
jmp 0x3a2ef
movq -0x10(%rbp), %rdi
callq 0xf3a0
movl %eax, -0x638(%rbp)
xorl %eax, %eax
cmpl $-0x1, -0x638(%rbp)
movb %al, -0x63e(%rbp)
je 0x3a31f
cmpl $0xa, -0x638(%rbp)
setne %al
movb %al, -0x63e(%rbp)
movb -0x63e(%rbp), %al
testb $0x1, %al
jne 0x3a2ef
jmp 0x3a387
movl -0x624(%rbp), %eax
cmpq $0xff, %rax
jae 0x3a36f
movl -0x638(%rbp), %eax
movb %al, %dl
movl -0x628(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x624(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x624(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
jmp 0x3a37e
movl $0x0, -0x624(%rbp)
jmp 0x3a2ed
jmp 0x3a380
jmp 0x3a382
jmp 0x3a24a
cmpl $0x0, -0x624(%rbp)
jbe 0x3a39f
movl -0x628(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x628(%rbp)
cmpl $0x2, -0x628(%rbp)
jae 0x3a3ad
jmp 0x3aac9
leaq -0x620(%rbp), %rdi
callq 0x3aaf0
movl %eax, %ecx
movq %rcx, -0x648(%rbp)
subl $0x14, %eax
ja 0x3aac5
movq -0x648(%rbp), %rax
leaq 0xfaf7(%rip), %rcx      # 0x49ed0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x14(%rbp), %eax
cmpq $0x3, %rax
jb 0x3a3f0
jmp 0x3aac9
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
shlq $0x7, %rax
addq %rax, %rdi
leaq -0x620(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
callq 0x10b50
movl %eax, -0x63c(%rbp)
cmpl $0x0, %eax
je 0x3a421
jmp 0x3aac9
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3aac7
movq -0x8(%rbp), %rdi
addq $0x180, %rdi            # imm = 0x180
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0xf7d0
movl $0x1, -0x62c(%rbp)
movl $0x0, -0x630(%rbp)
movl -0x62c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x628(%rbp), %ecx
movb %al, -0x649(%rbp)
jae 0x3a483
movl -0x630(%rbp), %eax
cmpq $0x4, %rax
setb %al
movb %al, -0x649(%rbp)
movb -0x649(%rbp), %al
testb $0x1, %al
jne 0x3a492
jmp 0x3a524
movq -0x8(%rbp), %rax
addq $0x180, %rax            # imm = 0x180
movl -0x630(%rbp), %ecx
shlq $0x8, %rcx
addq %rcx, %rax
movq %rax, -0x660(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movq %rax, -0x658(%rbp)
movl -0x62c(%rbp), %eax
leaq -0x620(%rbp), %rdi
shlq $0x8, %rax
addq %rax, %rdi
callq 0xf5c0
movq -0x660(%rbp), %rdi
movq -0x658(%rbp), %rdx
movq %rax, %rcx
movl $0x100, %esi            # imm = 0x100
callq 0xfc50
movl -0x62c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x62c(%rbp)
movl -0x630(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x630(%rbp)
jmp 0x3a45a
jmp 0x3aac7
movl $0x1, -0x62c(%rbp)
movl $0x0, -0x630(%rbp)
movl -0x62c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x628(%rbp), %ecx
movb %al, -0x661(%rbp)
jae 0x3a566
movl -0x630(%rbp), %eax
cmpq $0x24, %rax
setb %al
movb %al, -0x661(%rbp)
movb -0x661(%rbp), %al
testb $0x1, %al
jne 0x3a575
jmp 0x3a630
movl -0x62c(%rbp), %eax
shlq $0x8, %rax
leaq -0x620(%rbp,%rax), %rdi
callq 0x3aaf0
movl %eax, %ecx
movl %ecx, -0x668(%rbp)
subl $0x4, %eax
je 0x3a5b5
jmp 0x3a59b
movl -0x668(%rbp), %eax
subl $0x5, %eax
je 0x3a5d6
jmp 0x3a5a8
movl -0x668(%rbp), %eax
subl $0x6, %eax
je 0x3a5f7
jmp 0x3a618
movq -0x8(%rbp), %rax
movl -0x630(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x630(%rbp)
movl %ecx, %ecx
movb $0x66, 0x580(%rax,%rcx)
jmp 0x3a61a
movq -0x8(%rbp), %rax
movl -0x630(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x630(%rbp)
movl %ecx, %ecx
movb $0x62, 0x580(%rax,%rcx)
jmp 0x3a61a
movq -0x8(%rbp), %rax
movl -0x630(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x630(%rbp)
movl %ecx, %ecx
movb $0x63, 0x580(%rax,%rcx)
jmp 0x3a61a
jmp 0x3a61a
jmp 0x3a61c
movl -0x62c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x62c(%rbp)
jmp 0x3a53d
jmp 0x3aac7
movl $0x1, -0x62c(%rbp)
movl $0x0, -0x630(%rbp)
movl -0x62c(%rbp), %ecx
xorl %eax, %eax
cmpl -0x628(%rbp), %ecx
movb %al, -0x669(%rbp)
jae 0x3a672
movl -0x630(%rbp), %eax
cmpq $0x3, %rax
setb %al
movb %al, -0x669(%rbp)
movb -0x669(%rbp), %al
testb $0x1, %al
jne 0x3a681
jmp 0x3a714
movl -0x62c(%rbp), %eax
shlq $0x8, %rax
leaq -0x620(%rbp,%rax), %rdi
callq 0x3aaf0
movl %eax, %ecx
movl %ecx, -0x670(%rbp)
subl $0x8, %eax
je 0x3a6b4
jmp 0x3a6a7
movl -0x670(%rbp), %eax
subl $0x9, %eax
je 0x3a6d8
jmp 0x3a6fc
movq -0x8(%rbp), %rax
movl -0x630(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x630(%rbp)
movl %ecx, %ecx
movl $0x2, 0x5a4(%rax,%rcx,4)
jmp 0x3a6fe
movq -0x8(%rbp), %rax
movl -0x630(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x630(%rbp)
movl %ecx, %ecx
movl $0xa, 0x5a4(%rax,%rcx,4)
jmp 0x3a6fe
jmp 0x3a6fe
jmp 0x3a700
movl -0x62c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x62c(%rbp)
jmp 0x3a649
jmp 0x3aac7
movl $0x1, -0x62c(%rbp)
movl -0x62c(%rbp), %eax
cmpl -0x628(%rbp), %eax
jae 0x3aa36
movl -0x62c(%rbp), %eax
shlq $0x8, %rax
leaq -0x620(%rbp,%rax), %rdi
callq 0x3aaf0
addl $-0xb, %eax
movl %eax, %ecx
movq %rcx, -0x678(%rbp)
subl $0x8, %eax
ja 0x3aa1e
movq -0x678(%rbp), %rax
leaq 0xf7b5(%rip), %rcx      # 0x49f24
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movb $0x1, 0x5b0(%rax)
jmp 0x3aa20
movl $0x6, -0x630(%rbp)
movl $0x0, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x630(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0x3a070
testb $0x1, %al
jne 0x3a7c7
jmp 0x3a814
imull $0xa, -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x630(%rbp), %ecx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x630(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x630(%rbp)
jmp 0x3a79c
movl -0x634(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x5b4(%rax)
jmp 0x3aa20
movl $0x8, -0x630(%rbp)
movl $0x0, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x630(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0x3a070
testb $0x1, %al
jne 0x3a868
jmp 0x3a8b5
imull $0xa, -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x630(%rbp), %ecx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x630(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x630(%rbp)
jmp 0x3a83d
movl -0x634(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x5b8(%rax)
jmp 0x3aa20
movl $0x9, -0x630(%rbp)
movl $0x0, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x630(%rbp), %ecx
movzbl (%rax,%rcx), %edi
callq 0x3a070
testb $0x1, %al
jne 0x3a909
jmp 0x3a956
imull $0xa, -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movl %eax, %ecx
leaq -0x620(%rbp), %rax
shlq $0x8, %rcx
addq %rcx, %rax
movl -0x630(%rbp), %ecx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
addl -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x630(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x630(%rbp)
jmp 0x3a8de
movl -0x634(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x5bc(%rax)
jmp 0x3aa20
movq -0x8(%rbp), %rax
movb $0x1, 0x5c0(%rax)
jmp 0x3aa20
movq -0x8(%rbp), %rax
movb $0x1, 0x5c1(%rax)
jmp 0x3aa20
movq -0x8(%rbp), %rax
movb $0x1, 0x5c2(%rax)
jmp 0x3aa20
movq -0x8(%rbp), %rax
movl $0x1, 0x5c4(%rax)
jmp 0x3aa20
movl -0x62c(%rbp), %eax
shlq $0x8, %rax
leaq -0x61c(%rbp,%rax), %rdi
callq 0x3aaf0
addl $-0x15, %eax
movl %eax, %ecx
movq %rcx, -0x680(%rbp)
subl $0x4, %eax
ja 0x3aa1a
movq -0x680(%rbp), %rax
leaq 0xf567(%rip), %rcx      # 0x49f48
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movl $0x0, 0x5c4(%rax)
jmp 0x3aa1c
movq -0x8(%rbp), %rax
movl $0x1, 0x5c4(%rax)
jmp 0x3aa1c
movq -0x8(%rbp), %rax
movl $0x2, 0x5c4(%rax)
jmp 0x3aa1c
jmp 0x3aa1c
jmp 0x3aa20
jmp 0x3aa20
jmp 0x3aa22
movl -0x62c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x62c(%rbp)
jmp 0x3a723
jmp 0x3aac7
movl $0x0, -0x62c(%rbp)
movl $0x0, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movzbl -0x420(%rbp,%rax), %edi
callq 0x3a070
testb $0x1, %al
jne 0x3aa68
jmp 0x3aaa3
imull $0xa, -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x62c(%rbp), %eax
movsbl -0x420(%rbp,%rax), %eax
subl $0x30, %eax
addl -0x634(%rbp), %eax
movl %eax, -0x634(%rbp)
movl -0x62c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x62c(%rbp)
jmp 0x3aa4f
movq -0x8(%rbp), %rdi
leaq -0x620(%rbp), %rsi
addq $0x100, %rsi            # imm = 0x100
movl -0x634(%rbp), %eax
movzwl %ax, %edx
callq 0xff90
jmp 0x3aac7
jmp 0x3aac7
jmp 0x3aac9
cmpl $-0x1, -0x638(%rbp)
jne 0x3a223
xorl %eax, %eax
addq $0x680, %rsp            # imm = 0x680
popq %rbp
retq
nopw %cs:(%rax,%rax)