// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rdi, %r14
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 0x39654(%rip), %rsi     # 0x3cf48
movq %rdi, 0x30(%rsp)
callq 0x45b8
xorl %r15d, %r15d
movslq 0x39640(%rip), %rax     # 0x3cf48
cmpq %rax, %r15
jge 0x395d
imulq $0x18, %r15, %r12
movq 0x168(%r14), %rdi
addq %r12, %rdi
movslq 0x68(%r14), %rsi
callq 0x45ee
xorl %ebx, %ebx
movq %r14, %r13
xorl %r14d, %r14d
movslq 0x68(%r13), %rax
cmpq %rax, %r14
jge 0x3955
movq 0x168(%r13), %rax
movq (%rax,%r12), %rdi
addq %rbx, %rdi
movslq 0x6c(%r13), %rsi
callq 0x4624
incq %r14
addq $0x18, %rbx
jmp 0x392c
incq %r15
movq %r13, %r14
jmp 0x3901
leaq 0xd8(%r14), %rdi
movslq 0x395d5(%rip), %rsi     # 0x3cf40
movq %rdi, 0x10(%rsp)
callq 0x45ee
xorl %r12d, %r12d
pushq $0x18
popq %r15
movq 0xd8(%r14), %rdi
movq 0xe0(%r14), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %r12, %rax
jbe 0x39f2
imulq $0x18, %r12, %r13
addq %r13, %rdi
movslq 0x6c(%r14), %rsi
callq 0x4624
xorl %ebx, %ebx
movslq 0x6c(%r14), %rax
cmpq %rax, %rbx
jge 0x39ed
cvtsi2sd %eax, %xmm0
movsd 0x4662(%rip), %xmm3     # 0x8020
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd 0x465e(%rip), %xmm2     # 0x8030
callq 0x28d8
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax,%r13), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
jmp 0x39a9
incq %r12
jmp 0x397c
leaq 0x108(%r14), %r12
movslq 0x39548(%rip), %rsi     # 0x3cf48
movq %r12, %rdi
callq 0x45ee
xorl %ebp, %ebp
movq 0x108(%r14), %rdi
movq 0x110(%r14), %rax
subq %rdi, %rax
cqto
idivq %r15
cmpq %rbp, %rax
jbe 0x3a7c
imulq $0x18, %rbp, %r13
addq %r13, %rdi
movslq 0x6c(%r14), %rsi
callq 0x4624
xorl %ebx, %ebx
movslq 0x6c(%r14), %rax
cmpq %rax, %rbx
jge 0x3a77
cvtsi2sd %eax, %xmm0
movsd 0x45d4(%rip), %xmm3     # 0x8020
movapd %xmm3, %xmm1
divsd %xmm0, %xmm1
xorpd %xmm0, %xmm0
movsd 0x45d0(%rip), %xmm2     # 0x8030
callq 0x28d8
movq (%r12), %rax
movq (%rax,%r13), %rax
movsd %xmm0, (%rax,%rbx,8)
incq %rbx
jmp 0x3a37
incq %rbp
jmp 0x3a0a
movq %r15, %rbx
leaq 0xf0(%r14), %rdi
movslq 0x394b7(%rip), %rsi     # 0x3cf44
callq 0x45ee
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0xf0(%r14), %rdi
movq 0xf8(%r14), %rax
subq %rdi, %rax
cqto
idivq %rbx
cmpq %r15, %rax
jbe 0x3ac8
addq %r13, %rdi
movslq 0x68(%r14), %rsi
callq 0x4624
incq %r15
addq $0x18, %r13
jmp 0x3a98
leaq 0x46f6(%rip), %rdi      # 0x81c5
leaq 0x45e0(%rip), %rsi      # 0x80b6
callq 0x21f0
movq %rax, %r13
xorl %ecx, %ecx
movq %r12, 0x28(%rsp)
movslq 0x39458(%rip), %rax     # 0x3cf44
cmpq %rax, %rcx
jge 0x3b45
movq %rcx, %rbx
imulq $0x18, %rcx, %r15
xorl %ebp, %ebp
xorl %r12d, %r12d
movslq 0x68(%r14), %rax
movq 0xf0(%r14), %rsi
addq %r15, %rsi
cmpq %rax, %r12
jge 0x3b30
movq (%rsi), %rdx
addq %rbp, %rdx
movq %r13, %rdi
leaq 0x46bf(%rip), %rsi      # 0x81df
xorl %eax, %eax
callq 0x2300
incq %r12
addq $0x8, %rbp
jmp 0x3afd
movq %r14, %rdi
callq 0x4656
movq %rbx, %rcx
incq %rcx
movq 0x28(%rsp), %r12
jmp 0x3ae5
movq %r13, %rdi
callq 0x21a0
leaq 0x468f(%rip), %rdi      # 0x81e3
leaq 0x455b(%rip), %rsi      # 0x80b6
callq 0x21f0
movq %rax, %r13
leaq 0x4675(%rip), %rbp      # 0x81df
xorl %ecx, %ecx
movq %r14, 0x18(%rsp)
movslq 0x393d0(%rip), %rax     # 0x3cf48
cmpq %rax, %rcx
jge 0x3bc9
movq %rcx, 0x20(%rsp)
imulq $0x18, %rcx, %r15
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
movslq 0x68(%rax), %rax
cmpq %rax, %rbx
jge 0x3bba
movq (%r12), %rax
movq (%rax,%r15), %rdx
addq %r14, %rdx
movq %r13, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x2300
incq %rbx
addq $0x8, %r14
jmp 0x3b8b
movq 0x20(%rsp), %rcx
incq %rcx
movq 0x18(%rsp), %r14
jmp 0x3b71
movq %r13, %rdi
callq 0x21a0
xorl %eax, %eax
leaq 0x39376(%rip), %r13     # 0x3cf50
leaq 0xc(%rsp), %rbp
movl %eax, 0xc(%rsp)
cmpl 0x39357(%rip), %eax     # 0x3cf40
jge 0x3c3b
xorl %r15d, %r15d
movslq 0x68(%r14), %rcx
cmpq %rcx, %r15
jge 0x3c37
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3736
movslq (%rax), %rax
movq (%r12), %rcx
imulq $0x18, %rax, %rax
movq (%rcx,%rax), %rax
movsd (%rax,%r15,8), %xmm0
movslq 0xc(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
imulq $0x18, %rax, %rdx
movq (%rcx,%rdx), %rcx
movsd %xmm0, (%rcx,%r15,8)
incq %r15
jmp 0x3bee
incl %eax
jmp 0x3bdf
leaq 0x45bd(%rip), %rdi      # 0x81ff
leaq 0x446d(%rip), %rsi      # 0x80b6
callq 0x21f0
movq %rax, %r15
leaq 0x4587(%rip), %r12      # 0x81df
xorl %ecx, %ecx
movslq 0x392e7(%rip), %rax     # 0x3cf48
cmpq %rax, %rcx
jge 0x3cd8
movq %rcx, 0x20(%rsp)
imulq $0x18, %rcx, %rbp
xorl %ecx, %ecx
movslq 0x6c(%r14), %rax
cmpq %rax, %rcx
jge 0x3cce
movq %rcx, 0x10(%rsp)
imulq $0x18, %rcx, %r13
xorl %r14d, %r14d
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
movslq 0x68(%rax), %rax
cmpq %rax, %rbx
jge 0x3cbf
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbp), %rax
movq (%rax,%r13), %rdx
addq %r14, %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x2300
incq %rbx
addq $0x8, %r14
jmp 0x3c88
movq 0x10(%rsp), %rcx
incq %rcx
movq 0x18(%rsp), %r14
jmp 0x3c71
movq 0x20(%rsp), %rcx
incq %rcx
jmp 0x3c5a
movq %r15, %rdi
callq 0x21a0
movq %r14, %rdi
callq 0x4696
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq