// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %r15
movzwl (%rsi), %eax
cmpl $0xa, %eax
je 0x1a11f
cmpl $0x2, %eax
jne 0x1a200
movl %ecx, 0x4(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movl 0x4(%r13), %eax
movl %eax, 0x20(%rsp)
pushq $0x8
popq %rcx
movl %r14d, %eax
cltd
idivl %ecx
movl %edx, %ebp
cmpl $0x1, %edx
sbbl $-0x1, %eax
cmpl $0x4, %eax
pushq $0x4
popq %r12
cmovll %eax, %r12d
movq 0x8(%r15), %rdi
leal 0x4(%r12), %ebx
movslq %ebx, %rsi
callq 0x35c0
pushq $-0x1
popq %rcx
testq %rax, %rax
je 0x1a246
movl %ecx, %r13d
testl %ebp, %ebp
je 0x1a0b9
movb $0x8, %cl
subb %bpl, %cl
movl $0xff, %edx
shll %cl, %edx
movslq %r12d, %rcx
leaq 0x20(%rsp), %rsi
andb %dl, -0x1(%rcx,%rsi)
movw %bx, 0x2(%r15)
movq %rax, 0x8(%r15)
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movzwl %bx, %eax
movl %eax, 0x10(%rdi)
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
callq 0x1bbcd
cmpl $0x2, %eax
jne 0x1a23e
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rdx
movl %r14d, %esi
callq 0x1bbcd
cmpl $0x1, %eax
jne 0x1a23e
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rdx
movl 0x4(%rsp), %esi
callq 0x1bbcd
cmpl $0x1, %eax
movl %r13d, %ecx
je 0x1a1e2
jmp 0x1a246
movl %ecx, 0x4(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
pushq $0x8
popq %rcx
movl %r14d, %eax
cltd
idivl %ecx
movl %edx, %ebp
cmpl $0x1, %edx
sbbl $-0x1, %eax
cmpl $0x10, %eax
pushq $0x10
popq %r12
cmovll %eax, %r12d
movq 0x8(%r15), %rdi
leal 0x4(%r12), %ebx
movslq %ebx, %rsi
callq 0x35c0
pushq $-0x1
popq %rcx
testq %rax, %rax
je 0x1a246
movups 0x8(%r13), %xmm0
movaps %xmm0, 0x20(%rsp)
testl %ebp, %ebp
je 0x1a18a
movb $0x8, %cl
subb %bpl, %cl
movl $0xff, %edx
shll %cl, %edx
movslq %r12d, %rcx
leaq 0x20(%rsp), %rsi
andb %dl, -0x1(%rcx,%rsi)
movw %bx, 0x2(%r15)
movq %rax, 0x8(%r15)
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movzwl %bx, %eax
movl %eax, 0x10(%rdi)
pushq $0x2
popq %rdx
movl %edx, %esi
callq 0x1bbcd
cmpl $0x2, %eax
jne 0x1a243
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rdx
movl %r14d, %esi
callq 0x1bbcd
cmpl $0x1, %eax
jne 0x1a243
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rdx
movl 0x4(%rsp), %esi
callq 0x1bbcd
cmpl $0x1, %eax
pushq $-0x1
popq %rcx
jne 0x1a246
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl %r12d, %edx
callq 0x1ba37
xorl %ecx, %ecx
cmpl %r12d, %eax
setne %cl
negl %ecx
jmp 0x1a246
xorl %eax, %eax
callq 0x165f5
pushq $-0x1
popq %rcx
cmpl $0x3, (%rax)
jl 0x1a246
movzwl (%r13), %r9d
leaq 0x89e9(%rip), %rsi      # 0x22c04
leaq 0x8ae0(%rip), %rdx      # 0x22d02
leaq 0x8ae4(%rip), %r8       # 0x22d0d
pushq $0x3
popq %rdi
movl %ecx, %ebx
movl $0x51f, %ecx            # imm = 0x51F
xorl %eax, %eax
callq 0x1662e
movl %ebx, %ecx
jmp 0x1a246
movl %r13d, %ecx
jmp 0x1a246
pushq $-0x1
popq %rcx
movl %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq