// File: /workspace/github_c_makefile_star2_O1/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 0x26b88
testl %eax, %eax
jne 0x26d5e
cmpq $0x0, 0x28(%r12)
jne 0x26a15
movq 0x20578(%rip), %rax     # 0x46f88
movq %rax, 0x28(%r12)
movl (%r12), %ecx
testb $0x1, %cl
je 0x26a28
movzwl 0x20(%r14), %eax
testw %ax, %ax
jne 0x26a59
testb $0x2, %cl
je 0x26a37
movzwl 0x24(%r14), %eax
testw %ax, %ax
jne 0x26a59
testb $0x4, %cl
je 0x26a46
movzwl 0x28(%r14), %eax
testw %ax, %ax
jne 0x26a59
testb $0x8, %cl
je 0x26a55
movzwl 0x2c(%r14), %eax
testw %ax, %ax
jne 0x26a59
movw $0xc, %ax
movzwl %ax, %edx
movq 0x50(%r14), %rcx
cmpq %rdx, %rcx
jbe 0x26b7d
leaq 0x10(%rsp), %rbx
movzwl %ax, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26aa5
movl %r15d, %edi
movq %r14, %rsi
callq 0x285b1
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x33601
testb %al, %al
jne 0x26ac1
movl %r15d, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %edx
movq 0x50(%r14), %rcx
cmpq %rdx, %rcx
ja 0x26a6e
jmp 0x26b7d
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movups 0x10(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x28(%r12), %rax
cmpq 0x204a7(%rip), %rax     # 0x46f88
je 0x26b78
movl %r15d, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %ecx
cmpq %rcx, 0x50(%r14)
jbe 0x26b78
leaq 0x10(%rsp), %rbx
movzwl %ax, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26b64
movl %r15d, %edi
movq %r14, %rsi
callq 0x285b1
movl %eax, 0x10(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x33601
testb %al, %al
je 0x26b64
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jns 0x26b64
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 0x26b00
movzwl 0x34(%rsp), %ecx
movw %cx, 0x38(%r12)
incl 0x3c(%r12)
cmpl $0x0, 0xc(%rsp)
je 0x26d5e
leaq 0x48(%rsp), %r15
xorl %ebp, %ebp
movzwl 0x38(%r12), %eax
cmpq %rax, 0x50(%r14)
jbe 0x26d5e
movzwl %ax, %esi
movq %r13, %rdi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26d57
movzwl 0x38(%r12), %ebx
movl %ebx, %edi
movq %r14, %rsi
callq 0x285b1
movl %eax, (%r13)
incw 0x3a(%r12)
leaq 0x30(%rsp), %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
je 0x26bf7
movzwl 0x50(%r14), %ecx
jmp 0x26d3b
movl %ebx, %edi
movq %r14, %rsi
callq 0x285b1
movl %eax, 0x30(%rsp)
movw $0xc, %ax
movq 0x20378(%rip), %rcx     # 0x46f88
cmpq %rcx, 0x28(%r12)
jne 0x26c21
movl %ebx, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %edx
movq 0x50(%r14), %rcx
cmpq %rdx, %rcx
jbe 0x26d3b
movzwl %ax, %ebx
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26c17
movl %ebx, %edi
movq %r14, %rsi
callq 0x285b1
movl %eax, 0x48(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x33601
testb %al, %al
je 0x26c17
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jle 0x26c17
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x202ef(%rip), %rax     # 0x46f88
cmpq %rax, 0x28(%r12)
je 0x26d36
movl %ebx, %edi
movq %r14, %rsi
callq 0xf2e0
movzwl %ax, %ecx
cmpq %rcx, 0x50(%r14)
jbe 0x26d36
movzwl %ax, %ebx
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
callq 0xf710
testl %eax, %eax
jne 0x26ca4
movl %ebx, %edi
movq %r14, %rsi
callq 0x285b1
movl %eax, 0x48(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x33601
testb %al, %al
je 0x26ca4
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jle 0x26ca4
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq *0x28(%r12)
testl %eax, %eax
jns 0x26ca4
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
movups 0x48(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
jmp 0x26ca4
movzwl 0x14(%rsp), %ecx
addq $0x18, %r13
incl %ebp
movw %cx, 0x38(%r12)
cmpl 0xc(%rsp), %ebp
jne 0x26b9a
movl 0xc(%rsp), %ebp
jmp 0x26d5e
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