// File: /workspace/github_c_makefile_star2_O1/wahern[P]cqueues/src/lib/dns.c
// Function: dns_opt_parse
int dns_opt_parse(struct dns_opt *opt, struct dns_rr *rr, struct dns_packet *P) {
	const struct dns_buf src = DNS_B_FROM(&P->data[rr->rd.p], rr->rd.len);
	struct dns_buf dst = DNS_B_INTO(opt->data, opt->size);
	int error;

	opt->rcode = 0xfff & ((rr->ttl >> 20) | dns_header(P)->rcode);
	opt->version = 0xff & (rr->ttl >> 16);
	opt->flags = 0xffff & rr->ttl;
	opt->maxudp = 0xffff & rr->class;

	while (src.p < src.pe) {
		int code, len;

		if (-1 == (code = dns_b_get16(&src, -1)))
			return src.error;
		if (-1 == (len = dns_b_get16(&src, -1)))
			return src.error;

		switch (code) {
		default:
			dns_b_put16(&dst, code);
			dns_b_put16(&dst, len);
			if ((error = dns_b_move(&dst, &src, len)))
				return error;
			break;
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movzwl 0x14(%rsi), %eax
leaq (%rdx,%rax), %r8
leaq 0x5c(%rdx,%rax), %rcx
movzwl 0x16(%rsi), %eax
leaq (%rax,%r8), %r10
addq $0x5c, %r10
leaq 0x20(%rdi), %rbp
movq 0x10(%rdi), %r11
addq %rbp, %r11
movl 0x10(%rsi), %eax
movl %eax, %r8d
shrl $0x14, %r8d
movzbl 0x5f(%rdx), %edx
andl $0xf, %edx
orl %r8d, %edx
movl %edx, (%rdi)
movl %eax, %edx
shrl $0x10, %edx
movb %dl, 0x4(%rdi)
movw %ax, 0x6(%rdi)
movzwl 0xc(%rsi), %eax
movw %ax, 0x8(%rdi)
movq $0x0, (%rsp)
xorl %r15d, %r15d
xorl %eax, %eax
movq %r11, 0x10(%rsp)
movq %r10, 0x18(%rsp)
cmpq %r10, %rcx
jae 0x2a656
leaq 0x1(%rcx), %r14
cmpq %r10, %r14
jae 0x2a4c5
leaq 0x2(%rcx), %r14
movzbl 0x1(%rcx), %esi
jmp 0x2a4d0
incq %rax
movl $0x9b918cc1, %r15d      # imm = 0x9B918CC1
xorl %esi, %esi
testq %rax, %rax
je 0x2a4da
xorl %r8d, %r8d
jmp 0x2a52e
cmpq %r10, %r14
jae 0x2a4ee
movzbl (%r14), %edx
incq %r14
shll $0x8, %edx
movq %rax, %r12
jmp 0x2a4fc
movl $0x1, %r12d
movl $0x9b918cc1, %r15d      # imm = 0x9B918CC1
xorl %edx, %edx
cmpq %r10, %r14
jae 0x2a50a
movzbl (%r14), %edi
incq %r14
jmp 0x2a515
incq %r12
movl $0x9b918cc1, %r15d      # imm = 0x9B918CC1
xorl %edi, %edi
xorl %r8d, %r8d
movq %r12, %r9
negq %r9
movl $0x0, %ebx
sbbq %rbx, %rbx
testq %r12, %r12
je 0x2a542
movq %r12, %rax
movl %r15d, %r13d
movq %r14, %rcx
testb %r8b, %r8b
jne 0x2a4a9
jmp 0x2a659
movzbl (%rcx), %ecx
shll $0x8, %ecx
movzwl %si, %esi
orl %ecx, %esi
negq %rax
movl $0x0, %eax
sbbl %eax, %eax
orl %esi, %eax
cmpq %r11, %rbp
jae 0x2a566
movb %ah, (%rbp)
incq %rbp
jmp 0x2a56f
movl $0x9b918cc0, %ecx       # imm = 0x9B918CC0
movq %rcx, (%rsp)
cmpq %r11, %rbp
jae 0x2a57c
movb %al, (%rbp)
incq %rbp
jmp 0x2a585
movl $0x9b918cc0, %eax       # imm = 0x9B918CC0
movq %rax, (%rsp)
orq %rdx, %rdi
orq %rdi, %rbx
cmpq %r11, %rbp
jae 0x2a598
movb %bh, (%rbp)
incq %rbp
jmp 0x2a5a1
movl $0x9b918cc0, %eax       # imm = 0x9B918CC0
movq %rax, (%rsp)
cmpq %r11, %rbp
movl %r13d, 0xc(%rsp)
movq %r12, %r8
movl %r15d, %r13d
jae 0x2a5b9
movb %bl, (%rbp)
incq %rbp
jmp 0x2a5c2
movl $0x9b918cc0, %eax       # imm = 0x9B918CC0
movq %rax, (%rsp)
movl %ebx, %eax
movq %r10, %rcx
subq %r14, %rcx
cmpq %rax, %rcx
movq %rax, %rbx
cmovbq %rcx, %rbx
movq 0x10(%rsp), %r15
subq %rbp, %r15
cmpq %rbx, %r15
cmovaeq %rbx, %r15
movl $0x9b918cc0, %edx       # imm = 0x9B918CC0
movq (%rsp), %rsi
cmovbl %edx, %esi
movq %rsi, (%rsp)
cmpq %rax, %rcx
movq %rbp, %r12
movl %esi, %ebp
movl $0x9b918cc1, %esi       # imm = 0x9B918CC1
cmovbl %esi, %ebp
movq %rax, %rdx
subq %rbx, %rdx
cmpq %rax, %rcx
cmovbl %esi, %r13d
cmovbq %rdx, %r8
movq %r8, 0x20(%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xfa60
movq 0x18(%rsp), %r10
addq %r15, %r12
movl %r13d, %r15d
movq 0x10(%rsp), %r11
addq %rbx, %r14
testl %ebp, %ebp
sete %r8b
movl 0xc(%rsp), %r13d
cmovnel %ebp, %r13d
movq %r12, %rbp
movq 0x20(%rsp), %rax
jmp 0x2a531
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq