// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/lib/dns.c
// Function: dns_soa_parse
int dns_soa_parse(struct dns_soa *soa, struct dns_rr *rr, struct dns_packet *P) {
	struct { void *dst; size_t lim; } dn[] =
		{ { soa->mname, sizeof soa->mname },
		  { soa->rname, sizeof soa->rname } };
	unsigned *ts[] =
		{ &soa->serial, &soa->refresh, &soa->retry, &soa->expire, &soa->minimum };
	unsigned short rp;
	unsigned i, j, n;
	int error;

	/* MNAME / RNAME */
	if ((rp = rr->rd.p) >= P->end)
		return DNS_EILLEGAL;

	for (i = 0; i < lengthof(dn); i++) {
		if (!(n = dns_d_expand(dn[i].dst, dn[i].lim, rp, P, &error)))
			return error;
		else if (n >= dn[i].lim)
			return DNS_EILLEGAL;

		if ((rp = dns_d_skip(rp, P)) >= P->end)
			return DNS_EILLEGAL;
	}

	/* SERIAL / REFRESH / RETRY / EXPIRE / MINIMUM */
	for (i = 0; i < lengthof(ts); i++) {
		for (j = 0; j < 4; j++, rp++) {
			if (rp >= P->end)
				return DNS_EILLEGAL;

			*ts[i]	<<= 8;
			*ts[i]	|= (0xff & P->data[rp]);
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq $0x100, -0x38(%rbp)     # imm = 0x100
movq -0x10(%rbp), %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, -0x30(%rbp)
movq $0x100, -0x28(%rbp)     # imm = 0x100
movq -0x10(%rbp), %rax
addq $0x200, %rax            # imm = 0x200
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
addq $0x204, %rax            # imm = 0x204
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
addq $0x208, %rax            # imm = 0x208
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
addq $0x20c, %rax            # imm = 0x20C
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
addq $0x210, %rax            # imm = 0x210
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movw 0x14(%rax), %ax
movw %ax, -0x72(%rbp)
movzwl %ax, %eax
movq -0x20(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jb 0x36e38
movl $0x9b918cc1, -0x4(%rbp) # imm = 0x9B918CC1
jmp 0x36f91
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpq $0x2, %rax
jae 0x36f04
movl -0x78(%rbp), %eax
movl %eax, %ecx
leaq -0x40(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movl -0x78(%rbp), %eax
movl %eax, %ecx
leaq -0x40(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movw -0x72(%rbp), %ax
movq -0x20(%rbp), %rcx
leaq -0x84(%rbp), %r8
movzwl %ax, %edx
callq 0xffd0
movl %eax, -0x80(%rbp)
cmpl $0x0, %eax
jne 0x36ea0
movl -0x84(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x36f91
movl -0x80(%rbp), %eax
movl -0x78(%rbp), %ecx
movl %ecx, %edx
leaq -0x40(%rbp), %rcx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jb 0x36ec5
movl $0x9b918cc1, -0x4(%rbp) # imm = 0x9B918CC1
jmp 0x36f91
jmp 0x36ec7
movw -0x72(%rbp), %ax
movq -0x20(%rbp), %rsi
movzwl %ax, %edi
callq 0x10400
movw %ax, -0x72(%rbp)
movzwl %ax, %eax
movq -0x20(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jb 0x36ef4
movl $0x9b918cc1, -0x4(%rbp) # imm = 0x9B918CC1
jmp 0x36f91
jmp 0x36ef6
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x36e3f
movl $0x0, -0x78(%rbp)
movl -0x78(%rbp), %eax
cmpq $0x5, %rax
jae 0x36f8a
movl $0x0, -0x7c(%rbp)
cmpl $0x4, -0x7c(%rbp)
jae 0x36f7d
movzwl -0x72(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jb 0x36f38
movl $0x9b918cc1, -0x4(%rbp) # imm = 0x9B918CC1
jmp 0x36f91
movl -0x78(%rbp), %eax
movq -0x70(%rbp,%rax,8), %rax
movl (%rax), %ecx
shll $0x8, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movzwl -0x72(%rbp), %ecx
movzbl 0x5c(%rax,%rcx), %ecx
andl $0xff, %ecx
movl -0x78(%rbp), %eax
movq -0x70(%rbp,%rax,8), %rax
orl (%rax), %ecx
movl %ecx, (%rax)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movw -0x72(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x72(%rbp)
jmp 0x36f1b
jmp 0x36f7f
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x36f0b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopl (%rax)