// File: thunlp[P]KB2E/CTransR/Train_CTransR.cpp
// Function: Train::same_rel(double)
void same_rel(double rel)
    {
        double sum=0;
        for (int ii=0; ii<n; ii++)
            if (L1_flag)
                sum+=fabs(fb_relation_vec[cluster2fb[rel]][ii]-relation_vec[rel][ii]);
            else
                sum+=sqr(fb_relation_vec[cluster2fb[rel]][ii]-relation_vec[rel][ii]);
        if (sum>0)
        {
            double lambda = 0.001;
            res+=lambda*(sum);
            for (int ii=0; ii<n; ii++)
            {
                double x = 2*(fb_relation_vec[cluster2fb[rel]][ii]-relation_vec[rel][ii]);
                if (L1_flag)
                    if (x>0)
                        x=1;
                    else
                        x=-1;
                fb_relation_tmp[cluster2fb[rel]][ii]-=lambda*rate*x;
                relation_tmp[rel][ii]+=lambda*rate*x;
            }
        }
    }

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movsd %xmm0, 0x98(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x58(%rsp)
xorps %xmm0, %xmm0
movsd %xmm0, 0x90(%rsp)
movl $0x0, 0x8c(%rsp)
movq 0x58(%rsp), %rcx
movl 0x8c(%rsp), %eax
cmpl 0x68(%rcx), %eax
jge 0xc519
testb $0x1, 0x12ec8(%rip)     # 0x1f220
je 0xc435
movq 0x58(%rsp), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0x48(%rsp)
cvttsd2si 0x98(%rsp), %eax
movl %eax, 0x88(%rsp)
leaq 0x43c3b(%rip), %rdi     # 0x4ffc0
leaq 0x88(%rsp), %rsi
callq 0x10170
movq 0x48(%rsp), %rdi
movslq (%rax), %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3fb0
movq 0x58(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
addq $0xd8, %rdi
movsd 0x98(%rsp), %xmm0
movsd 0x9c7a(%rip), %xmm2     # 0x16050
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3fb0
movsd 0x50(%rsp), %xmm0
subsd (%rax), %xmm0
movaps 0x9c46(%rip), %xmm1     # 0x16060
pand %xmm1, %xmm0
addsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
jmp 0xc501
movq 0x58(%rsp), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0x38(%rsp)
cvttsd2si 0x98(%rsp), %eax
movl %eax, 0x84(%rsp)
leaq 0x43b64(%rip), %rdi     # 0x4ffc0
leaq 0x84(%rsp), %rsi
callq 0x10170
movq 0x38(%rsp), %rdi
movslq (%rax), %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3fb0
movq 0x58(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
addq $0xd8, %rdi
movsd 0x98(%rsp), %xmm0
movsd 0x9ba3(%rip), %xmm2     # 0x16050
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x8c(%rsp), %rsi
callq 0x3fb0
movsd 0x40(%rsp), %xmm0
subsd (%rax), %xmm0
callq 0x2a80
addsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
jmp 0xc503
movl 0x8c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8c(%rsp)
jmp 0xc33c
movsd 0x90(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xc795
movq 0x58(%rsp), %rax
movsd 0x9afc(%rip), %xmm0     # 0x16038
movsd %xmm0, 0x78(%rsp)
movsd 0x78(%rsp), %xmm0
movsd 0x90(%rsp), %xmm2
movsd 0x78(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rax)
movl $0x0, 0x74(%rsp)
movq 0x58(%rsp), %rcx
movl 0x74(%rsp), %eax
cmpl 0x68(%rcx), %eax
jge 0xc793
movq 0x58(%rsp), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0x28(%rsp)
cvttsd2si 0x98(%rsp), %eax
movl %eax, 0x64(%rsp)
leaq 0x43a1f(%rip), %rdi     # 0x4ffc0
leaq 0x64(%rsp), %rsi
callq 0x10170
movq 0x28(%rsp), %rdi
movslq (%rax), %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x74(%rsp), %rsi
callq 0x3fb0
movq 0x58(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
addq $0xd8, %rdi
movsd 0x98(%rsp), %xmm0
movsd 0x9a64(%rip), %xmm2     # 0x16050
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x74(%rsp), %rsi
callq 0x3fb0
movsd 0x30(%rsp), %xmm1
subsd (%rax), %xmm1
movsd 0x99e2(%rip), %xmm0     # 0x16010
mulsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
testb $0x1, 0x12be1(%rip)     # 0x1f220
je 0xc670
movsd 0x68(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xc660
movsd 0x99c8(%rip), %xmm0     # 0x16020
movsd %xmm0, 0x68(%rsp)
jmp 0xc66e
movsd 0x99b0(%rip), %xmm0     # 0x16018
movsd %xmm0, 0x68(%rsp)
jmp 0xc670
movq 0x58(%rsp), %rax
movsd 0x78(%rsp), %xmm0
movsd 0x80(%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
addq $0x150, %rax            # imm = 0x150
movq %rax, (%rsp)
cvttsd2si 0x98(%rsp), %eax
movl %eax, 0x60(%rsp)
leaq 0x43909(%rip), %rdi     # 0x4ffc0
leaq 0x60(%rsp), %rsi
callq 0x10170
movq (%rsp), %rdi
movslq (%rax), %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x74(%rsp), %rsi
callq 0x3fb0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
movq 0x58(%rsp), %rdi
movsd (%rax), %xmm0
mulsd %xmm2, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movsd 0x78(%rsp), %xmm0
movsd 0x80(%rdi), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
addq $0x120, %rdi            # imm = 0x120
movsd 0x98(%rsp), %xmm0
movsd 0x9919(%rip), %xmm2     # 0x16050
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rax
cvttsd2si %xmm0, %rsi
movq %rsi, %rcx
sarq $0x3f, %rcx
andq %rcx, %rax
orq %rax, %rsi
callq 0x8ce0
movq %rax, %rdi
movslq 0x74(%rsp), %rsi
callq 0x3fb0
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0xc56b
jmp 0xc795
addq $0xa8, %rsp
retq
nopl (%rax)