// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x5c, %rax
movq -0x18(%rbp), %rcx
movzwl 0x14(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
addq $0x5c, %rax
movq -0x18(%rbp), %rcx
movzwl 0x14(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
addq $0x5c, %rax
movq -0x18(%rbp), %rcx
movzwl 0x14(%rcx), %ecx
addq %rcx, %rax
movq -0x18(%rbp), %rcx
movzwl 0x16(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq -0x10(%rbp), %rcx
addq 0x10(%rcx), %rax
movq %rax, -0x60(%rbp)
movl $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
shrl $0x14, %ecx
movq -0x20(%rbp), %rax
movq 0x5c(%rax), %rax
shrq $0x18, %rax
andq $0xf, %rax
orl %eax, %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x4(%rax)
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x6(%rax)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %eax
andl $0xffff, %eax           # imm = 0xFFFF
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x8(%rax)
movq -0x40(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x37d42
leaq -0x48(%rbp), %rdi
movq $-0x1, %rsi
callq 0x37d60
movl %eax, %ecx
movl %ecx, -0x78(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x37cd6
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x37d49
leaq -0x48(%rbp), %rdi
movq $-0x1, %rsi
callq 0x37d60
movl %eax, %ecx
movl %ecx, -0x7c(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
jne 0x37cfc
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x37d49
movl -0x78(%rbp), %eax
leaq -0x70(%rbp), %rdi
movzwl %ax, %esi
callq 0x37dd0
movl -0x7c(%rbp), %eax
leaq -0x70(%rbp), %rdi
movzwl %ax, %esi
callq 0x37dd0
movslq -0x7c(%rbp), %rdx
leaq -0x70(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x37e10
movl %eax, -0x74(%rbp)
cmpl $0x0, %eax
je 0x37d3b
movl -0x74(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x37d49
jmp 0x37d3d
jmp 0x37ca2
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)