// File: /workspace/github_c_makefile_star2_O3/wahern[P]cqueues/src/lib/dns.c
// Function: dns_rr_grep
unsigned dns_rr_grep(struct dns_rr *rr, unsigned lim, struct dns_rr_i *i, struct dns_packet *P, int *error_) {
	unsigned count	= 0;
	int error;

	switch (i->state.exec) {
	case 0:
		if (!i->sort)
			i->sort	= &dns_rr_i_packet;

		i->state.next	= dns_rr_i_start(i, P);
		i->state.exec++;

		/* FALL THROUGH */
	case 1:
		while (count < lim && i->state.next < P->end) {
			if ((error = dns_rr_parse(rr, i->state.next, P)))
				goto error;

			rr->section	= dns_rr_section(i->state.next, P);

			rr++;
			count++;
			i->state.count++;

			i->state.next	= dns_rr_i_skip(i->state.next, i, P);
		} /* while() */

		break;
	} /* switch() */

	return count;
error:
	*error_	= error;

	return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, 0x60(%rsp)
movq %rcx, %r14
movq %rdx, %r12
movl %esi, 0xc(%rsp)
movq %rdi, %r13
movl 0x3c(%rdx), %eax
xorl %ebp, %ebp
cmpl $0x1, %eax
je 0x26914
testl %eax, %eax
jne 0x26aea
cmpq $0x0, 0x28(%r12)
jne 0x267a1
movq 0x207ec(%rip), %rax     # 0x46f88
movq %rax, 0x28(%r12)
movl (%r12), %ecx
testb $0x1, %cl
je 0x267b4
movzwl 0x20(%r14), %eax
testw %ax, %ax
jne 0x267e5
testb $0x2, %cl
je 0x267c3
movzwl 0x24(%r14), %eax
testw %ax, %ax
jne 0x267e5
testb $0x4, %cl
je 0x267d2
movzwl 0x28(%r14), %eax
testw %ax, %ax
jne 0x267e5
testb $0x8, %cl
je 0x267e1
movzwl 0x2c(%r14), %eax
testw %ax, %ax
jne 0x267e5
movw $0xc, %ax
movzwl %ax, %edx
movq 0x50(%r14), %rcx
cmpq %rdx, %rcx
jbe 0x26909
leaq 0x10(%rsp), %rbx
movzwl %ax, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26831
movl %r15d, %edi
movq %r14, %rsi
callq 0x282e0
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x32fda
testb %al, %al
jne 0x2684d
movl %r15d, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %edx
movq 0x50(%r14), %rcx
cmpq %rdx, %rcx
ja 0x267fa
jmp 0x26909
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movups 0x10(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x28(%r12), %rax
cmpq 0x2071b(%rip), %rax     # 0x46f88
je 0x26904
movl %r15d, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %ecx
cmpq %rcx, 0x50(%r14)
jbe 0x26904
leaq 0x10(%rsp), %rbx
movzwl %ax, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x268f0
movl %r15d, %edi
movq %r14, %rsi
callq 0x282e0
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x32fda
testb %al, %al
je 0x268f0
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jns 0x268f0
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movups 0x10(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movl %r15d, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %ecx
cmpq %rcx, 0x50(%r14)
ja 0x2688c
movzwl 0x34(%rsp), %ecx
movw %cx, 0x38(%r12)
incl 0x3c(%r12)
cmpl $0x0, 0xc(%rsp)
je 0x26aea
movzwl 0x38(%r12), %ecx
leaq 0x48(%rsp), %r15
xorl %ebp, %ebp
movzwl %cx, %esi
cmpq %rsi, 0x50(%r14)
jbe 0x26aea
movq %r13, %rdi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26ae3
movzwl 0x38(%r12), %ebx
movl %ebx, %edi
movq %r14, %rsi
callq 0x282e0
movl %eax, (%r13)
incw 0x3a(%r12)
leaq 0x30(%rsp), %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
je 0x26983
movzwl 0x50(%r14), %ecx
jmp 0x26ac7
movl %ebx, %edi
movq %r14, %rsi
callq 0x282e0
movl %eax, 0x30(%rsp)
movw $0xc, %ax
movq 0x205ec(%rip), %rcx     # 0x46f88
cmpq %rcx, 0x28(%r12)
jne 0x269ad
movl %ebx, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %edx
movq 0x50(%r14), %rcx
cmpq %rdx, %rcx
jbe 0x26ac7
movzwl %ax, %ebx
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x269a3
movl %ebx, %edi
movq %r14, %rsi
callq 0x282e0
movl %eax, 0x48(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x32fda
testb %al, %al
je 0x269a3
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jle 0x269a3
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x20563(%rip), %rax     # 0x46f88
cmpq %rax, 0x28(%r12)
je 0x26ac2
movl %ebx, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %ecx
cmpq %rcx, 0x50(%r14)
jbe 0x26ac2
movzwl %ax, %ebx
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26a30
movl %ebx, %edi
movq %r14, %rsi
callq 0x282e0
movl %eax, 0x48(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x32fda
testb %al, %al
je 0x26a30
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jle 0x26a30
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jns 0x26a30
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
jmp 0x26a30
movzwl 0x14(%rsp), %ecx
addq $0x18, %r13
incl %ebp
movw %cx, 0x38(%r12)
cmpl 0xc(%rsp), %ebp
jne 0x2692c
movl 0xc(%rsp), %ebp
jmp 0x26aea
movq 0x60(%rsp), %rcx
movl %eax, (%rcx)
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq