// File: /workspace/github_c_makefile_star2_O1/GangZhuo[P]dohclient/src/ns_msg.c
// Function: ns_set_ecs
int ns_set_ecs(ns_opt_t *opt, struct sockaddr *addr, int srcprefix, int scopeprefix)
{
	if (addr->sa_family == AF_INET) {
		return ns_set_ecs4(opt, (struct sockaddr_in*)addr, srcprefix, scopeprefix);
	}
	else if (addr->sa_family == AF_INET6) {
		return ns_set_ecs6(opt, (struct sockaddr_in6*)addr, srcprefix, scopeprefix);
	}
	else {
		loge("No support family %d\n", addr->sa_family);
		return -1;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %r15
movzwl (%rsi), %eax
cmpl $0xa, %eax
je 0x1bbc9
cmpl $0x2, %eax
jne 0x1bcd0
movl %ecx, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl 0x4(%r13), %eax
leal 0x7(%r14), %ecx
testl %r14d, %r14d
cmovnsl %r14d, %ecx
movl %ecx, %edx
sarl $0x3, %edx
andl $-0x8, %ecx
xorl %esi, %esi
movl %r14d, %ebp
subl %ecx, %ebp
setne %sil
addl %edx, %esi
cmpl $0x4, %esi
movl $0x4, %r12d
cmovll %esi, %r12d
movl %eax, 0x30(%rsp)
movq 0x8(%r15), %rdi
leal 0x4(%r12), %ebx
movslq %ebx, %rsi
callq 0x35b0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x1bd11
testl %ebp, %ebp
je 0x1bba8
movb $0x8, %cl
subb %bpl, %cl
movl $0xff, %edx
shll %cl, %edx
movslq %r12d, %rcx
leaq 0x30(%rsp), %rsi
andb %dl, -0x1(%rcx,%rsi)
movw %bx, 0x2(%r15)
movq %rax, 0x8(%r15)
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movzwl %bx, %eax
movl %eax, 0x10(%rdi)
movl $0x1, %esi
jmp 0x1bc6b
movl %ecx, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
leal 0x7(%r14), %eax
testl %r14d, %r14d
cmovnsl %r14d, %eax
movl %eax, %ecx
sarl $0x3, %ecx
andl $-0x8, %eax
xorl %edx, %edx
movl %r14d, %ebp
subl %eax, %ebp
setne %dl
addl %ecx, %edx
cmpl $0x10, %edx
movl $0x10, %r12d
cmovll %edx, %r12d
movq $0x0, 0x20(%rsp)
movq 0x8(%r15), %rdi
leal 0x4(%r12), %ebx
movslq %ebx, %rsi
callq 0x35b0
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x1bd11
movups 0x8(%r13), %xmm0
movaps %xmm0, 0x30(%rsp)
testl %ebp, %ebp
je 0x1bc4f
movb $0x8, %cl
subb %bpl, %cl
movl $0xff, %edx
shll %cl, %edx
movslq %r12d, %rcx
leaq 0x30(%rsp), %rsi
andb %dl, -0x1(%rcx,%rsi)
movw %bx, 0x2(%r15)
movq %rax, 0x8(%r15)
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movzwl %bx, %eax
movl %eax, 0x10(%rdi)
movl $0x2, %esi
movl $0x2, %edx
callq 0x1d916
cmpl $0x2, %eax
jne 0x1bd0c
leaq 0x10(%rsp), %rdi
movl %r14d, %esi
movl $0x1, %edx
callq 0x1d916
cmpl $0x1, %eax
jne 0x1bd0c
leaq 0x10(%rsp), %rdi
movl 0xc(%rsp), %esi
movl $0x1, %edx
callq 0x1d916
cmpl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jne 0x1bd11
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
movl %r12d, %edx
callq 0x1d7ad
xorl %ecx, %ecx
cmpl %r12d, %eax
setne %cl
negl %ecx
jmp 0x1bd11
xorl %eax, %eax
callq 0x17d59
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x3, (%rax)
jl 0x1bd11
movzwl (%r13), %r9d
leaq 0x8ee7(%rip), %rsi      # 0x24bd4
leaq 0x8fde(%rip), %rdx      # 0x24cd2
leaq 0x8fe2(%rip), %r8       # 0x24cdd
movl $0x3, %edi
movl $0x51f, %ecx            # imm = 0x51F
xorl %eax, %eax
callq 0x17d92
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq