// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_rr_i_start
static unsigned short dns_rr_i_start(struct dns_rr_i *i, struct dns_packet *P) {
	unsigned short rp;
	struct dns_rr r0, rr;
	int error;

	if ((i->section & DNS_S_QD) && P->memo.qd.base)
		rp = P->memo.qd.base;
	else if ((i->section & DNS_S_AN) && P->memo.an.base)
		rp = P->memo.an.base;
	else if ((i->section & DNS_S_NS) && P->memo.ns.base)
		rp = P->memo.ns.base;
	else if ((i->section & DNS_S_AR) && P->memo.ar.base)
		rp = P->memo.ar.base;
	else
		rp = 12;

	for (; rp < P->end; rp = dns_rr_skip(rp, P)) {
		if ((error = dns_rr_parse(&rr, rp, P)))
			continue;

		rr.section = dns_rr_section(rp, P);

		if (!dns_rr_i_match(&rr, i, P))
			continue;

		r0 = rr;

		goto lower;
	}

	return P->end;
lower:
	if (i->sort == &dns_rr_i_packet)
		return dns_rr_offset(&r0);

	while ((rp = dns_rr_skip(rp, P)) < P->end) {
		if ((error = dns_rr_parse(&rr, rp, P)))
			continue;

		rr.section = dns_rr_section(rp, P);

		if (!dns_rr_i_match(&rr, i, P))
			continue;

		if (i->sort(&rr, &r0, i, P) < 0)
			r0 = rr;
	}

	return dns_rr_offset(&r0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3525c
movq -0x18(%rbp), %rax
movzwl 0x20(%rax), %eax
cmpl $0x0, %eax
je 0x3525c
movq -0x18(%rbp), %rax
movw 0x20(%rax), %ax
movw %ax, -0x1a(%rbp)
jmp 0x352e3
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x35285
movq -0x18(%rbp), %rax
movzwl 0x24(%rax), %eax
cmpl $0x0, %eax
je 0x35285
movq -0x18(%rbp), %rax
movw 0x24(%rax), %ax
movw %ax, -0x1a(%rbp)
jmp 0x352e1
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x352ae
movq -0x18(%rbp), %rax
movzwl 0x28(%rax), %eax
cmpl $0x0, %eax
je 0x352ae
movq -0x18(%rbp), %rax
movw 0x28(%rax), %ax
movw %ax, -0x1a(%rbp)
jmp 0x352df
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x352d7
movq -0x18(%rbp), %rax
movzwl 0x2c(%rax), %eax
cmpl $0x0, %eax
je 0x352d7
movq -0x18(%rbp), %rax
movw 0x2c(%rax), %ax
movw %ax, -0x1a(%rbp)
jmp 0x352dd
movw $0xc, -0x1a(%rbp)
jmp 0x352df
jmp 0x352e1
jmp 0x352e3
jmp 0x352e5
movzwl -0x1a(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x3536e
movw -0x1a(%rbp), %ax
movq -0x18(%rbp), %rdx
leaq -0x4c(%rbp), %rdi
movzwl %ax, %esi
callq 0xf790
movl %eax, -0x50(%rbp)
cmpl $0x0, %eax
je 0x35311
jmp 0x35355
movw -0x1a(%rbp), %ax
movq -0x18(%rbp), %rsi
movzwl %ax, %edi
callq 0x35470
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x4c(%rbp), %rdi
callq 0x432e0
testb $0x1, %al
jne 0x3533b
jmp 0x35355
movq -0x4c(%rbp), %rax
movq %rax, -0x34(%rbp)
movq -0x44(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x3c(%rbp), %rax
movq %rax, -0x24(%rbp)
jmp 0x3537f
movw -0x1a(%rbp), %ax
movq -0x18(%rbp), %rsi
movzwl %ax, %edi
callq 0xf320
movw %ax, -0x1a(%rbp)
jmp 0x352e5
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
movw %ax, -0x2(%rbp)
jmp 0x3545d
movq -0x10(%rbp), %rax
movq 0x26bf6(%rip), %rcx     # 0x5bf80
cmpq %rcx, 0x28(%rax)
jne 0x353a2
leaq -0x34(%rbp), %rdi
callq 0x43480
movw %ax, -0x2(%rbp)
jmp 0x3545d
jmp 0x353a4
movw -0x1a(%rbp), %ax
movq -0x18(%rbp), %rsi
movzwl %ax, %edi
callq 0xf320
movw %ax, -0x1a(%rbp)
movzwl %ax, %eax
movq -0x18(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x35450
movw -0x1a(%rbp), %ax
movq -0x18(%rbp), %rdx
leaq -0x4c(%rbp), %rdi
movzwl %ax, %esi
callq 0xf790
movl %eax, -0x50(%rbp)
cmpl $0x0, %eax
je 0x353e7
jmp 0x353a4
movw -0x1a(%rbp), %ax
movq -0x18(%rbp), %rsi
movzwl %ax, %edi
callq 0x35470
movl %eax, -0x4c(%rbp)
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x4c(%rbp), %rdi
callq 0x432e0
testb $0x1, %al
jne 0x35411
jmp 0x353a4
movq -0x10(%rbp), %rax
movq 0x28(%rax), %r8
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x4c(%rbp), %rdi
leaq -0x34(%rbp), %rsi
movb $0x0, %al
callq *%r8
cmpl $0x0, %eax
jge 0x3544b
movq -0x4c(%rbp), %rax
movq %rax, -0x34(%rbp)
movq -0x44(%rbp), %rax
movq %rax, -0x2c(%rbp)
movq -0x3c(%rbp), %rax
movq %rax, -0x24(%rbp)
jmp 0x353a4
leaq -0x34(%rbp), %rdi
callq 0x43480
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)