// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_hosts_loadfile
int dns_hosts_loadfile(struct dns_hosts *hosts, FILE *fp) {
	struct dns_hosts_entry ent;
	char word[DNS_PP_MAX(INET6_ADDRSTRLEN, DNS_D_MAXNAME) + 1];
	unsigned wp, wc, skip;
	int ch, error;

	rewind(fp);

	do {
		memset(&ent, '\0', sizeof ent);
		wc	= 0;
		skip	= 0;

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

			while (EOF != (ch = fgetc(fp)) && ch != '\n') {
				skip	|= !!dns_hosts_iscom(ch);

				if (skip)
					continue;

				if (dns_hosts_issep(ch))
					break;

				if (wp < sizeof word - 1)
					word[wp]	= ch;
				wp++;
			}

			if (!wp)
				continue;

			wc++;

			switch (wc) {
			case 0:
				break;
			case 1:
				ent.af	= (strchr(word, ':'))? AF_INET6 : AF_INET;
				skip	= (1 != dns_inet_pton(ent.af, word, &ent.addr));

				break;
			default:
				if (!wp)
					break;

				dns_d_anchor(ent.host, sizeof ent.host, word, wp);

				if ((error = dns_hosts_insert(hosts, ent.af, &ent.addr, ent.host, (wc > 2))))
					return error;

				break;
			} /* switch() */
		} while (ch != EOF && ch != '\n');
	} while (ch != EOF);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2b0, %rsp            # imm = 0x2B0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0xf170
leaq -0x188(%rbp), %rdi
xorl %esi, %esi
movl $0x170, %edx            # imm = 0x170
callq 0xf7d0
movl $0x0, -0x298(%rbp)
movl $0x0, -0x29c(%rbp)
leaq -0x290(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0xf7d0
movl $0x0, -0x294(%rbp)
movq -0x18(%rbp), %rdi
callq 0x106e0
movl %eax, %edx
movl %edx, -0x2a0(%rbp)
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl %edx, %ecx
movb %al, -0x2a5(%rbp)
je 0x39192
cmpl $0xa, -0x2a0(%rbp)
setne %al
movb %al, -0x2a5(%rbp)
movb -0x2a5(%rbp), %al
testb $0x1, %al
jne 0x391a1
jmp 0x39238
movb $0x1, %al
cmpl $0x23, -0x2a0(%rbp)
movb %al, -0x2a6(%rbp)
je 0x391c2
cmpl $0x3b, -0x2a0(%rbp)
sete %al
movb %al, -0x2a6(%rbp)
movb -0x2a6(%rbp), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
orl -0x29c(%rbp), %eax
movl %eax, -0x29c(%rbp)
cmpl $0x0, -0x29c(%rbp)
je 0x391eb
jmp 0x39160
movl -0x2a0(%rbp), %eax
movzbl %al, %edi
callq 0x393a0
testb $0x1, %al
jne 0x391ff
jmp 0x39201
jmp 0x39238
movl -0x294(%rbp), %eax
cmpq $0xff, %rax
jae 0x39224
movl -0x2a0(%rbp), %eax
movb %al, %cl
movl -0x294(%rbp), %eax
movb %cl, -0x290(%rbp,%rax)
movl -0x294(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x294(%rbp)
jmp 0x39160
cmpl $0x0, -0x294(%rbp)
jne 0x39246
jmp 0x3934e
movl -0x298(%rbp), %eax
incl %eax
movl %eax, -0x298(%rbp)
movl -0x298(%rbp), %eax
movl %eax, -0x2ac(%rbp)
testl %eax, %eax
je 0x39273
jmp 0x39266
movl -0x2ac(%rbp), %eax
subl $0x1, %eax
je 0x39278
jmp 0x392d6
jmp 0x3934c
leaq -0x290(%rbp), %rdi
movl $0x3a, %esi
callq 0xf530
movq %rax, %rdx
movl $0x2, %eax
movl $0xa, %ecx
cmpq $0x0, %rdx
cmovnel %ecx, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %edi
leaq -0x290(%rbp), %rsi
leaq -0x188(%rbp), %rdx
addq $0x150, %rdx            # imm = 0x150
callq 0x10b60
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x29c(%rbp)
jmp 0x3934c
cmpl $0x0, -0x294(%rbp)
jne 0x392e1
jmp 0x3934c
leaq -0x188(%rbp), %rdi
leaq -0x290(%rbp), %rdx
movl -0x294(%rbp), %eax
movl %eax, %ecx
movl $0x100, %esi            # imm = 0x100
callq 0xfc50
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %esi
leaq -0x188(%rbp), %rdx
addq $0x150, %rdx            # imm = 0x150
leaq -0x188(%rbp), %rcx
cmpl $0x2, -0x298(%rbp)
seta %al
movzbl %al, %r8d
andl $0x1, %r8d
callq 0xf7a0
movl %eax, -0x2a4(%rbp)
cmpl $0x0, %eax
je 0x3934a
movl -0x2a4(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x39393
jmp 0x3934c
jmp 0x3934e
xorl %eax, %eax
cmpl $-0x1, -0x2a0(%rbp)
movb %al, -0x2ad(%rbp)
je 0x3936f
cmpl $0xa, -0x2a0(%rbp)
setne %al
movb %al, -0x2ad(%rbp)
movb -0x2ad(%rbp), %al
testb $0x1, %al
jne 0x39143
jmp 0x3937f
cmpl $-0x1, -0x2a0(%rbp)
jne 0x3911c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2b0, %rsp            # imm = 0x2B0
popq %rbp
retq
nop