// File: /workspace/github_cpp_makefile_star2_O3/thunlp[P]KB2E/CTransR/Train_CTransR.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;
        m = n_in;
        rate = rate_in;
        margin = margin_in;
        method = method_in;
		A.resize(fb_relation_num);
		for (int i=0; i<fb_relation_num; i++)
		{
		    A[i].resize(n);
		    for (int jj=0; jj<n; jj++)
		        A[i][jj].resize(m);
		}

        relation_vec.resize(relation_num);
		for (int i=0; i<relation_vec.size(); i++)
        {
			relation_vec[i].resize(m);
			for (int ii=0; ii<m; ii++)
                relation_vec[i][ii] = randn(0,1.0/m,-1,1);
        }
        fb_relation_vec.resize(fb_relation_num);
		for (int i=0; i<fb_relation_vec.size(); i++)
        {
			fb_relation_vec[i].resize(m);
			for (int ii=0; ii<m; ii++)
                fb_relation_vec[i][ii] = randn(0,1.0/m,-1,1);
        }
        entity_vec.resize(entity_num);
		for (int i=0; i<entity_vec.size(); i++)
			entity_vec[i].resize(n);
        FILE* f1 = fopen("../TransR/entity2vec.unif","r");
        for (int i=0; i<entity_num; i++)
        {
            for (int ii=0; ii<n; ii++)
            	fscanf(f1,"%lf",&entity_vec[i][ii]);
            norm(entity_vec[i]);
        }
        fclose(f1);

		FILE* f2 = fopen("../TransR/relation2vec.unif","r");
        for (int i=0; i<fb_relation_num; i++)
        {
            for (int ii=0; ii<n; ii++)
            	fscanf(f2,"%lf",&fb_relation_vec[i][ii]);
        }
        fclose(f2);
        for (int i=0; i<relation_num; i++)
        {
            for (int ii=0; ii<n; ii++)
                relation_vec[i][ii] = fb_relation_vec[cluster2fb[i]][ii];
        }
        FILE* f3 = fopen("../TransR/A.unif","r");
        for (int i=0; i<fb_relation_num; i++)
            for (int jj=0; jj<m; jj++)
                for (int ii=0; ii<n; ii++)
                    fscanf(f3,"%lf",&A[i][jj][ii]);
        fclose(f3);
        bfgs();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl %esi, 0x68(%rdi)
movl %esi, 0x6c(%rdi)
movsd %xmm0, 0x80(%rdi)
movsd %xmm1, 0x88(%rdi)
movl %edx, 0x70(%rdi)
addq $0x168, %rdi            # imm = 0x168
movslq 0x3902a(%rip), %rsi     # 0x3cf48
callq 0x4b7e
cmpl $0x0, 0x3901e(%rip)     # 0x3cf48
jle 0x3f95
movl 0x68(%rbx), %eax
xorl %r14d, %r14d
leaq (%r14,%r14,2), %r15
leaq (,%r15,8), %rdi
addq 0x168(%rbx), %rdi
movslq %eax, %rsi
callq 0x4bfa
movl 0x68(%rbx), %eax
testl %eax, %eax
jle 0x3f86
movq %rbx, %r13
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x168(%r13), %rax
movq (%rax,%r15,8), %rdi
addq %rbx, %rdi
movslq 0x6c(%r13), %rsi
callq 0x4c36
incq %r12
movslq 0x68(%r13), %rax
addq $0x18, %rbx
cmpq %rax, %r12
jl 0x3f5c
movq %r13, %rbx
incq %r14
movslq 0x38fb8(%rip), %rcx     # 0x3cf48
cmpq %rcx, %r14
jl 0x3f32
leaq 0xd8(%rbx), %r14
movslq 0x38f9d(%rip), %rsi     # 0x3cf40
movq %r14, %rdi
callq 0x4bfa
movq 0xd8(%rbx), %rcx
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
cmpq %rcx, 0xe0(%rbx)
je 0x404b
movl 0x6c(%rbx), %eax
xorl %r12d, %r12d
leaq (%r12,%r12,2), %r13
leaq (%rcx,%r13,8), %rdi
movslq %eax, %rsi
callq 0x4c36
movl 0x6c(%rbx), %eax
testl %eax, %eax
jle 0x402e
xorl %ebp, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x4029(%rip), %xmm3     # 0x8020
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd 0x402d(%rip), %xmm2     # 0x8038
callq 0x298b
movq 0xd8(%rbx), %rcx
movq (%rcx,%r13,8), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
movslq 0x6c(%rbx), %rax
cmpq %rax, %rbp
jl 0x3fe8
jmp 0x4031
movq (%r14), %rcx
incq %r12
movq 0xe0(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r12, %rdx
ja 0x3fcf
leaq 0x108(%rbx), %r14
movslq 0x38eef(%rip), %rsi     # 0x3cf48
movq %r14, %rdi
callq 0x4bfa
movq 0x108(%rbx), %rcx
cmpq %rcx, 0x110(%rbx)
je 0x40f7
movl 0x6c(%rbx), %eax
xorl %r12d, %r12d
leaq (%r12,%r12,2), %r13
leaq (%rcx,%r13,8), %rdi
movslq %eax, %rsi
callq 0x4c36
movl 0x6c(%rbx), %eax
testl %eax, %eax
jle 0x40da
xorl %ebp, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x3f7d(%rip), %xmm3     # 0x8020
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd 0x3f81(%rip), %xmm2     # 0x8038
callq 0x298b
movq 0x108(%rbx), %rcx
movq (%rcx,%r13,8), %rax
movsd %xmm0, (%rax,%rbp,8)
incq %rbp
movslq 0x6c(%rbx), %rax
cmpq %rax, %rbp
jl 0x4094
jmp 0x40dd
movq (%r14), %rcx
incq %r12
movq 0x110(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r15, %rdx
cmpq %r12, %rdx
ja 0x407b
leaq 0xf0(%rbx), %rdi
movslq 0x38e3f(%rip), %rsi     # 0x3cf44
callq 0x4bfa
movq 0xf0(%rbx), %rdi
cmpq %rdi, 0xf8(%rbx)
je 0x4151
xorl %r14d, %r14d
xorl %r12d, %r12d
addq %r14, %rdi
movslq 0x68(%rbx), %rsi
callq 0x4c36
incq %r12
movq 0xf0(%rbx), %rdi
movq 0xf8(%rbx), %rax
subq %rdi, %rax
sarq $0x3, %rax
imulq %r15, %rax
addq $0x18, %r14
cmpq %r12, %rax
ja 0x4120
leaq 0x407d(%rip), %rdi      # 0x81d5
leaq 0x3f67(%rip), %rsi      # 0x80c6
callq 0x2210
movq %rax, %r14
cmpl $0x0, 0x38dd6(%rip)     # 0x3cf44
jle 0x41e7
leaq 0x4078(%rip), %r15      # 0x81ef
xorl %ecx, %ecx
cmpl $0x0, 0x68(%rbx)
movq %rcx, 0x10(%rsp)
leaq (%rcx,%rcx,2), %r12
movq %rbx, %r13
jle 0x41ba
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0xf0(%r13), %rax
movq (%rax,%r12,8), %rdx
addq %rbp, %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2320
incq %rbx
movslq 0x68(%r13), %rax
addq $0x8, %rbp
cmpq %rax, %rbx
jl 0x418f
shlq $0x3, %r12
addq 0xf0(%r13), %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c68
movq 0x10(%rsp), %rcx
incq %rcx
movslq 0x38d65(%rip), %rax     # 0x3cf44
cmpq %rax, %rcx
movq %r13, %rbx
jl 0x4179
movq %r14, %rdi
callq 0x21c0
leaq 0x3ffd(%rip), %rdi      # 0x81f3
leaq 0x3ec9(%rip), %rsi      # 0x80c6
callq 0x2210
movq %rax, %r14
movl 0x38d3d(%rip), %ecx     # 0x3cf48
testl %ecx, %ecx
jle 0x4275
movl 0x68(%rbx), %eax
leaq 0x3fd6(%rip), %r15      # 0x81ef
xorl %esi, %esi
testl %eax, %eax
jle 0x426a
movq %rsi, 0x10(%rsp)
leaq (%rsi,%rsi,2), %r13
xorl %ebp, %ebp
movq %rbx, %r12
xorl %ebx, %ebx
movq 0x108(%r12), %rax
movq (%rax,%r13,8), %rdx
addq %rbp, %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2320
incq %rbx
movslq 0x68(%r12), %rax
addq $0x8, %rbp
cmpq %rax, %rbx
jl 0x422f
movl 0x38ce6(%rip), %ecx     # 0x3cf48
movq %r12, %rbx
movq 0x10(%rsp), %rsi
incq %rsi
movslq %ecx, %rdx
cmpq %rdx, %rsi
jl 0x421b
movq %r14, %rdi
callq 0x21c0
movl $0x0, 0xc(%rsp)
movl 0x38cb5(%rip), %edx     # 0x3cf40
testl %edx, %edx
jle 0x4306
movl 0x68(%rbx), %ecx
xorl %eax, %eax
leaq 0x38cb5(%rip), %r14     # 0x3cf50
leaq 0xc(%rsp), %r15
testl %ecx, %ecx
jle 0x42fc
movq %rbx, %r12
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3c96
movslq (%rax), %rax
movq 0xd8(%r12), %rcx
movq 0x108(%r12), %rdx
leaq (%rax,%rax,2), %rax
movq (%rdx,%rax,8), %rax
movsd (%rax,%rbx,8), %xmm0
movslq 0xc(%rsp), %rax
leaq (%rax,%rax,2), %rdx
movq (%rcx,%rdx,8), %rcx
movsd %xmm0, (%rcx,%rbx,8)
incq %rbx
movslq 0x68(%r12), %rcx
cmpq %rcx, %rbx
jl 0x42a9
movl 0x38c47(%rip), %edx     # 0x3cf40
movq %r12, %rbx
incl %eax
movl %eax, 0xc(%rsp)
cmpl %edx, %eax
jl 0x42a0
leaq 0x3f02(%rip), %rdi      # 0x820f
leaq 0x3db2(%rip), %rsi      # 0x80c6
callq 0x2210
movq %rax, %r13
movl 0x38c26(%rip), %ecx     # 0x3cf48
testl %ecx, %ecx
jle 0x43d3
movl 0x6c(%rbx), %eax
leaq 0x3ebb(%rip), %r14      # 0x81ef
movq $0x0, 0x18(%rsp)
testl %eax, %eax
jle 0x43ba
movl 0x68(%rbx), %ecx
movq 0x18(%rsp), %rdx
leaq (%rdx,%rdx,2), %r12
xorl %r8d, %r8d
testl %ecx, %ecx
jle 0x43a9
movq %r8, 0x20(%rsp)
leaq (%r8,%r8,2), %rax
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
movq %rbx, %rbp
xorl %ebx, %ebx
movq 0x168(%rbp), %rax
movq (%rax,%r12,8), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rdx
addq %r15, %rdx
movq %r13, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2320
incq %rbx
movslq 0x68(%rbp), %rcx
addq $0x8, %r15
cmpq %rcx, %rbx
jl 0x436a
movl 0x6c(%rbp), %eax
movq %rbp, %rbx
movq 0x20(%rsp), %r8
incq %r8
movslq %eax, %rdx
cmpq %rdx, %r8
jl 0x4350
movl 0x38b8e(%rip), %ecx     # 0x3cf48
movq 0x18(%rsp), %r8
incq %r8
movslq %ecx, %rdx
movq %r8, 0x18(%rsp)
cmpq %rdx, %r8
jl 0x433d
movq %r13, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x4cf0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq