// File: /workspace/github_cpp_makefile_star2_O2/thunlp[P]KB2E/TransE/Train_TransE.cpp
// Function: Train::run(int, double, double, int)
void run(int n_in,double rate_in,double margin_in,int method_in)
    {
        n = n_in;
        rate = rate_in;
        margin = margin_in;
        method = method_in;
        relation_vec.resize(relation_num);
		for (int i=0; i<relation_vec.size(); i++)
			relation_vec[i].resize(n);
        entity_vec.resize(entity_num);
		for (int i=0; i<entity_vec.size(); i++)
			entity_vec[i].resize(n);
        relation_tmp.resize(relation_num);
		for (int i=0; i<relation_tmp.size(); i++)
			relation_tmp[i].resize(n);
        entity_tmp.resize(entity_num);
		for (int i=0; i<entity_tmp.size(); i++)
			entity_tmp[i].resize(n);
        for (int i=0; i<relation_num; i++)
        {
            for (int ii=0; ii<n; ii++)
                relation_vec[i][ii] = randn(0,1.0/n,-6/sqrt(n),6/sqrt(n));
        }
        for (int i=0; i<entity_num; i++)
        {
            for (int ii=0; ii<n; ii++)
                entity_vec[i][ii] = randn(0,1.0/n,-6/sqrt(n),6/sqrt(n));
            norm(entity_vec[i]);
        }


        bfgs();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl %esi, 0x30(%rdi)
movsd %xmm0, 0x50(%rdi)
movsd %xmm1, 0x58(%rdi)
movl %edx, 0x34(%rdi)
leaq 0xc8(%rdi), %r15
movslq 0x37c45(%rip), %rsi     # 0x3af40
movq %r15, %rdi
callq 0x3e78
xorl %r14d, %r14d
pushq $0x18
popq %r12
xorl %r13d, %r13d
movq 0xc8(%rbx), %rdi
movq 0xd0(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %r13, %rax
jbe 0x333d
addq %r14, %rdi
movslq 0x30(%rbx), %rsi
callq 0x3eae
incq %r13
addq $0x18, %r14
jmp 0x330d
leaq 0xe0(%rbx), %r14
movslq 0x37bf9(%rip), %rsi     # 0x3af44
movq %r14, %rdi
callq 0x3e78
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0xe0(%rbx), %rdi
movq 0xe8(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x3388
addq %r13, %rdi
movslq 0x30(%rbx), %rsi
callq 0x3eae
incq %rbp
addq $0x18, %r13
jmp 0x3358
leaq 0xf8(%rbx), %rdi
movslq 0x37baa(%rip), %rsi     # 0x3af40
callq 0x3e78
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0xf8(%rbx), %rdi
movq 0x100(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x33d0
addq %r13, %rdi
movslq 0x30(%rbx), %rsi
callq 0x3eae
incq %rbp
addq $0x18, %r13
jmp 0x33a0
leaq 0x110(%rbx), %rdi
movslq 0x37b66(%rip), %rsi     # 0x3af44
callq 0x3e78
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x110(%rbx), %rdi
movq 0x118(%rbx), %rax
subq %rdi, %rax
cqto
idivq %r12
cmpq %rbp, %rax
jbe 0x3418
addq %r13, %rdi
movslq 0x30(%rbx), %rsi
callq 0x3eae
incq %rbp
addq $0x18, %r13
jmp 0x33e8
xorl %r12d, %r12d
movslq 0x37b1e(%rip), %rax     # 0x3af40
cmpq %rax, %r12
jge 0x34d2
imulq $0x18, %r12, %r13
xorl %ebp, %ebp
movslq 0x30(%rbx), %rax
cmpq %rax, %rbp
jge 0x34ca
cvtsi2sd %eax, %xmm0
ucomisd 0x2bee(%rip), %xmm0     # 0x6038
movsd %xmm0, 0x10(%rsp)
jb 0x3458
sqrtsd %xmm0, %xmm3
jmp 0x3461
callq 0x2130
movapd %xmm0, %xmm3
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x2bca(%rip), %xmm0     # 0x6038
jb 0x3476
sqrtsd %xmm0, %xmm0
jmp 0x3487
movsd %xmm3, 0x8(%rsp)
callq 0x2130
movsd 0x8(%rsp), %xmm3
movsd 0x2b89(%rip), %xmm1     # 0x6018
divsd 0x10(%rsp), %xmm1
movsd 0x2b8b(%rip), %xmm2     # 0x6028
divsd %xmm3, %xmm2
movsd 0x2b87(%rip), %xmm3     # 0x6030
divsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
callq 0x2774
movq (%r15), %rax
movq (%rax,%r13), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
jmp 0x3431
incq %r12
jmp 0x341b
xorl %r12d, %r12d
movslq 0x37a68(%rip), %rax     # 0x3af44
cmpq %rax, %r12
jge 0x35a0
imulq $0x18, %r12, %r15
xorl %r13d, %r13d
movslq 0x30(%rbx), %rax
cmpq %rax, %r13
jge 0x3586
cvtsi2sd %eax, %xmm0
ucomisd 0x2b33(%rip), %xmm0     # 0x6038
movsd %xmm0, 0x10(%rsp)
jb 0x3513
sqrtsd %xmm0, %xmm3
jmp 0x351c
callq 0x2130
movapd %xmm0, %xmm3
cvtsi2sdl 0x30(%rbx), %xmm0
ucomisd 0x2b0f(%rip), %xmm0     # 0x6038
jb 0x3531
sqrtsd %xmm0, %xmm0
jmp 0x3542
movsd %xmm3, 0x8(%rsp)
callq 0x2130
movsd 0x8(%rsp), %xmm3
movsd 0x2ace(%rip), %xmm1     # 0x6018
divsd 0x10(%rsp), %xmm1
movsd 0x2ad0(%rip), %xmm2     # 0x6028
divsd %xmm3, %xmm2
movsd 0x2acc(%rip), %xmm3     # 0x6030
divsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
callq 0x2774
movq (%r14), %rax
movq (%rax,%r15), %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
jmp 0x34ec
addq 0xe0(%rbx), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3ee0
incq %r12
jmp 0x34d5
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3f24