// File: /workspace/github_c_makefile_star2_O0/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_rdata_clone_opts
static ns_optlist_t* ns_rdata_clone_opts(const ns_rr_t* rr)
{
	ns_optlist_t* old = rr->rdata;
	ns_optlist_t* opts = (ns_optlist_t*)malloc(sizeof(ns_optlist_t));
	int i;
	if (opts) {
		opts->opts = (ns_opt_t*)malloc(sizeof(ns_opt_t) * old->optcount);
		if (!opts->opts) {
			free(opts);
			return NULL;
		}
		opts->optcount = old->optcount;
		for (i = 0; i < opts->optcount; i++) {
			opts->opts[i].code = old->opts[i].code;
			opts->opts[i].length = old->opts[i].length;
			opts->opts[i].data = malloc(opts->opts[i].length);
			if (!opts->opts[i].data) {
				for (; i >= 0; i--) {
					free(opts->opts[i].data);
				}
				free(opts->opts);
				free(opts);
				return NULL;
			}
			memcpy(opts->opts[i].data, old->opts[i].data, opts->opts[i].length);
		}
	}

	return opts;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x10, %edi
callq 0x34d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x2b35c
movq -0x18(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x4, %rdi
callq 0x34d0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2b1ec
movq -0x20(%rbp), %rdi
callq 0x3460
movq $0x0, -0x8(%rbp)
jmp 0x2b364
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x2b35a
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movw (%rax), %cx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movw 0x2(%rax), %cx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movw %cx, 0x2(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x2(%rax), %eax
movl %eax, %edi
callq 0x34d0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
jne 0x2b303
jmp 0x2b2b8
cmpl $0x0, -0x24(%rbp)
jl 0x2b2e4
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x3460
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2b2b8
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x3460
movq -0x20(%rbp), %rdi
callq 0x3460
movq $0x0, -0x8(%rbp)
jmp 0x2b364
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzwl 0x2(%rax), %eax
movl %eax, %edx
callq 0x32d0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x2b201
jmp 0x2b35c
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop