// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_rr_cmp
int dns_rr_cmp(struct dns_rr *r0, struct dns_packet *P0, struct dns_rr *r1, struct dns_packet *P1) {
	char host0[DNS_D_MAXNAME + 1], host1[DNS_D_MAXNAME + 1];
	union dns_any any0, any1;
	int cmp, error;
	size_t len;

	if ((cmp = r0->type - r1->type))
		return cmp;

	if ((cmp = r0->class - r1->class))
		return cmp;

	/*
	 * FIXME: Do label-by-label comparison to handle illegally long names?
	 */

	if (!(len = dns_d_expand(host0, sizeof host0, r0->dn.p, P0, &error))
	||  len >= sizeof host0)
		return -1;

	if (!(len = dns_d_expand(host1, sizeof host1, r1->dn.p, P1, &error))
	||  len >= sizeof host1)
		return 1;

	if ((cmp = strcasecmp(host0, host1)))
		return cmp;

	if (DNS_S_QD & (r0->section | r1->section)) {
		if (r0->section == r1->section)
			return 0;

		return (r0->section == DNS_S_QD)? -1 : 1;
	}

	if ((error = dns_any_parse(&any0, r0, P0)))
		return -1;

	if ((error = dns_any_parse(&any1, r1, P1)))
		return 1;

	return dns_any_cmp(&any0, r0->type, &any1, r1->type);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa60, %rsp            # imm = 0xA60
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x20(%rbp), %rcx
subl 0x8(%rcx), %eax
movl %eax, -0xa54(%rbp)
cmpl $0x0, %eax
je 0x32702
movl -0xa54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x328ac
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movq -0x20(%rbp), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0xa54(%rbp)
cmpl $0x0, %eax
je 0x32729
movl -0xa54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x328ac
leaq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movw 0x4(%rax), %ax
movq -0x18(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq -0xa58(%rbp), %r8
movzwl %ax, %edx
callq 0xffd0
movq %rax, -0xa60(%rbp)
cmpq $0x0, %rax
je 0x3276a
cmpq $0x100, -0xa60(%rbp) # imm = 0x100
jb 0x32776
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x328ac
leaq -0x230(%rbp), %rdi
movq -0x20(%rbp), %rax
movw 0x4(%rax), %ax
movq -0x28(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq -0xa58(%rbp), %r8
movzwl %ax, %edx
callq 0xffd0
movq %rax, -0xa60(%rbp)
cmpq $0x0, %rax
je 0x327b7
cmpq $0x100, -0xa60(%rbp) # imm = 0x100
jb 0x327c3
movl $0x1, -0x4(%rbp)
jmp 0x328ac
leaq -0x130(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0xff50
movl %eax, -0xa54(%rbp)
cmpl $0x0, %eax
je 0x327ef
movl -0xa54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x328ac
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
orl (%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x32838
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq -0x20(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x3281d
movl $0x0, -0x4(%rbp)
jmp 0x328ac
movq -0x10(%rbp), %rax
movl (%rax), %edx
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x328ac
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x640(%rbp), %rdi
callq 0xff80
movl %eax, -0xa58(%rbp)
cmpl $0x0, %eax
je 0x32860
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x328ac
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0xa50(%rbp), %rdi
callq 0xff80
movl %eax, -0xa58(%rbp)
cmpl $0x0, %eax
je 0x32888
movl $0x1, -0x4(%rbp)
jmp 0x328ac
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
movq -0x20(%rbp), %rax
movl 0x8(%rax), %ecx
leaq -0x640(%rbp), %rdi
leaq -0xa50(%rbp), %rdx
callq 0xfda0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa60, %rsp            # imm = 0xA60
popq %rbp
retq
nopl (%rax,%rax)