// File: /workspace/github_cpp_makefile_star2_O2/thunlp[P]KB2E/TransE/Test_TransE.cpp
// Function: prepare()
void prepare()
{
    FILE* f1 = fopen("../data/entity2id.txt","r");
	FILE* f2 = fopen("../data/relation2id.txt","r");
	int x;
	while (fscanf(f1,"%s%d",buf,&x)==2)
	{
		string st=buf;
		entity2id[st]=x;
		id2entity[x]=st;
		mid2type[st]="None";
		entity_num++;
	}
	while (fscanf(f2,"%s%d",buf,&x)==2)
	{
		string st=buf;
		relation2id[st]=x;
		id2relation[x]=st;
		relation_num++;
	}
    FILE* f_kb = fopen("../data/test.txt","r");
	while (fscanf(f_kb,"%s",buf)==1)
    {
        string s1=buf;
        fscanf(f_kb,"%s",buf);
        string s2=buf;
        fscanf(f_kb,"%s",buf);
        string s3=buf;
        if (entity2id.count(s1)==0)
        {
            cout<<"miss entity:"<<s1<<endl;
        }
        if (entity2id.count(s2)==0)
        {
            cout<<"miss entity:"<<s2<<endl;
        }
        if (relation2id.count(s3)==0)
        {
        	cout<<"miss relation:"<<s3<<endl;
            relation2id[s3] = relation_num;
            relation_num++;
        }
        test.add(entity2id[s1],entity2id[s2],relation2id[s3],true);
    }
    fclose(f_kb);
    FILE* f_kb1 = fopen("../data/train.txt","r");
	while (fscanf(f_kb1,"%s",buf)==1)
    {
        string s1=buf;
        fscanf(f_kb1,"%s",buf);
        string s2=buf;
        fscanf(f_kb1,"%s",buf);
        string s3=buf;
        if (entity2id.count(s1)==0)
        {
            cout<<"miss entity:"<<s1<<endl;
        }
        if (entity2id.count(s2)==0)
        {
            cout<<"miss entity:"<<s2<<endl;
        }
        if (relation2id.count(s3)==0)
        {
            relation2id[s3] = relation_num;
            relation_num++;
        }

        entity2num[relation2id[s3]][entity2id[s1]]+=1;
        entity2num[relation2id[s3]][entity2id[s2]]+=1;
        e2num[entity2id[s1]]+=1;
        e2num[entity2id[s2]]+=1;
        test.add(entity2id[s1],entity2id[s2],relation2id[s3],false);
    }
    fclose(f_kb1);
    FILE* f_kb2 = fopen("../data/valid.txt","r");
	while (fscanf(f_kb2,"%s",buf)==1)
    {
        string s1=buf;
        fscanf(f_kb2,"%s",buf);
        string s2=buf;
        fscanf(f_kb2,"%s",buf);
        string s3=buf;
        if (entity2id.count(s1)==0)
        {
            cout<<"miss entity:"<<s1<<endl;
        }
        if (entity2id.count(s2)==0)
        {
            cout<<"miss entity:"<<s2<<endl;
        }
        if (relation2id.count(s3)==0)
        {
            relation2id[s3] = relation_num;
            relation_num++;
        }
        test.add(entity2id[s1],entity2id[s2],relation2id[s3],false);
    }
    fclose(f_kb2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
leaq 0x4851(%rip), %rdi      # 0x70a1
leaq 0x4860(%rip), %rbx      # 0x70b7
movq %rbx, %rsi
callq 0x21b0
movq %rax, %r14
leaq 0x4850(%rip), %rdi      # 0x70b9
movq %rbx, %rsi
callq 0x21b0
movq %rax, 0x50(%rsp)
leaq 0x8b33(%rip), %r12      # 0xb3b0
leaq 0xc(%rsp), %r13
leaq 0x30(%rsp), %rbp
leaq 0x4848(%rip), %r15      # 0x70d6
movq %r14, %rdi
leaq 0x4839(%rip), %rsi      # 0x70d1
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x2270
cmpl $0x2, %eax
jne 0x2916
movq %rbp, %rdi
movq %r12, %rsi
leaq 0x10(%rsp), %rdx
callq 0x3038
movl 0xc(%rsp), %ebx
leaq 0x8933(%rip), %rdi      # 0xb1f8
movq %rbp, %rsi
callq 0x30f6
movl %ebx, (%rax)
leaq 0x8952(%rip), %rdi      # 0xb228
movq %r13, %rsi
callq 0x315c
movq %rax, %rdi
movq %rbp, %rsi
callq 0x20c0
leaq 0x89c8(%rip), %rdi      # 0xb2b8
movq %rbp, %rsi
callq 0x31aa
movq %rax, %rdi
movq %r15, %rsi
callq 0x2280
incl 0x8aa3(%rip)            # 0xb3ac
movq %rbp, %rdi
callq 0x22a8
jmp 0x288e
leaq 0x8a93(%rip), %r15      # 0xb3b0
leaq 0xc(%rsp), %r12
leaq 0x30(%rsp), %r13
leaq 0x889a(%rip), %r14      # 0xb1c8
leaq 0x8923(%rip), %rbx      # 0xb258
movq 0x50(%rsp), %rdi
leaq 0x4790(%rip), %rsi      # 0x70d1
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x2270
cmpl $0x2, %eax
jne 0x299a
movq %r13, %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x3038
movl 0xc(%rsp), %ebp
movq %r14, %rdi
movq %r13, %rsi
callq 0x30f6
movl %ebp, (%rax)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x315c
movq %rax, %rdi
movq %r13, %rsi
callq 0x20c0
incl 0x8a18(%rip)            # 0xb3a8
movq %r13, %rdi
callq 0x22a8
jmp 0x2935
leaq 0x473a(%rip), %rdi      # 0x70db
leaq 0x470f(%rip), %rsi      # 0x70b7
callq 0x21b0
movq %rax, %rbx
leaq 0x4735(%rip), %r13      # 0x70ec
leaq 0x89f2(%rip), %r15      # 0xb3b0
leaq 0x58(%rsp), %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
cmpl $0x1, %eax
jne 0x2b73
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x3038
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x3038
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
movq %rbp, %rdi
movq %r15, %rsi
leaq 0xb(%rsp), %rdx
callq 0x3038
leaq 0x87c3(%rip), %rdi      # 0xb1f8
leaq 0x30(%rsp), %rsi
callq 0x3210
testq %rax, %rax
jne 0x2a6c
movq 0x858d(%rip), %rdi      # 0xafd8
leaq 0x469d(%rip), %rsi      # 0x70ef
callq 0x2150
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
leaq 0x8785(%rip), %rdi      # 0xb1f8
leaq 0x10(%rsp), %rsi
callq 0x3210
testq %rax, %rax
jne 0x2aaa
movq 0x854f(%rip), %rdi      # 0xafd8
leaq 0x465f(%rip), %rsi      # 0x70ef
callq 0x2150
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
leaq 0x8717(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x3210
testq %rax, %rax
jne 0x2b03
movq 0x8513(%rip), %rdi      # 0xafd8
leaq 0x4630(%rip), %rsi      # 0x70fc
callq 0x2150
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
movl 0x88bd(%rip), %r14d     # 0xb3a8
leaq 0x86d6(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
movl %r14d, (%rax)
incl 0x88a5(%rip)            # 0xb3a8
leaq 0x86ee(%rip), %rdi      # 0xb1f8
leaq 0x30(%rsp), %rsi
callq 0x30f6
movl (%rax), %r14d
leaq 0x86da(%rip), %rdi      # 0xb1f8
leaq 0x10(%rsp), %rsi
callq 0x30f6
movl (%rax), %r12d
leaq 0x8696(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
movl (%rax), %ecx
leaq 0x395ad(%rip), %rdi     # 0x3c0f0
movl %r14d, %esi
movl %r12d, %edx
pushq $0x1
popq %r8
callq 0x322a
movq %rbp, %rdi
callq 0x22a8
leaq 0x10(%rsp), %rdi
callq 0x22a8
leaq 0x30(%rsp), %rdi
callq 0x22a8
jmp 0x29c3
movq %rbx, %rdi
callq 0x2160
leaq 0x4589(%rip), %rdi      # 0x710b
leaq 0x452e(%rip), %rsi      # 0x70b7
callq 0x21b0
movq %rax, %r12
leaq 0x8818(%rip), %r15      # 0xb3b0
leaq 0x58(%rsp), %rbp
leaq 0x8654(%rip), %r14      # 0xb1f8
movq %r12, %rdi
leaq 0x453e(%rip), %rsi      # 0x70ec
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
cmpl $0x1, %eax
jne 0x2ddd
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x3038
movq %r12, %rdi
leaq 0x450f(%rip), %rsi      # 0x70ec
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x3038
movq %r12, %rdi
leaq 0x44eb(%rip), %rsi      # 0x70ec
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
movq %rbp, %rdi
movq %r15, %r13
movq %r15, %rsi
leaq 0xb(%rsp), %rdx
callq 0x3038
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x3210
testq %rax, %rax
jne 0x2c58
movq 0x83a1(%rip), %rdi      # 0xafd8
leaq 0x44b1(%rip), %rsi      # 0x70ef
callq 0x2150
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x3210
testq %rax, %rax
jne 0x2c92
movq 0x8367(%rip), %rdi      # 0xafd8
leaq 0x4477(%rip), %rsi      # 0x70ef
callq 0x2150
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
leaq 0x852f(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x3210
testq %rax, %rax
jne 0x2cc3
movl 0x86fc(%rip), %ebx      # 0xb3a8
leaq 0x8515(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
movl %ebx, (%rax)
incl 0x86e5(%rip)            # 0xb3a8
leaq 0x84fe(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
leaq 0x860f(%rip), %rdi      # 0xb2e8
movq %rax, %rsi
callq 0x32c0
movq %rax, %r15
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x30f6
movq %r15, %rdi
movq %rax, %rsi
callq 0x330e
incl (%rax)
leaq 0x84c3(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
leaq 0x85d4(%rip), %rdi      # 0xb2e8
movq %rax, %rsi
callq 0x32c0
movq %rax, %r15
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x30f6
movq %r15, %rdi
movq %rax, %rsi
callq 0x330e
incl (%rax)
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x30f6
leaq 0x85cb(%rip), %rdi      # 0xb318
movq %rax, %rsi
callq 0x330e
incl (%rax)
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x30f6
leaq 0x85ad(%rip), %rdi      # 0xb318
movq %rax, %rsi
callq 0x330e
incl (%rax)
movq %r14, %rdi
leaq 0x30(%rsp), %rsi
callq 0x30f6
movl (%rax), %r15d
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0x30f6
movl (%rax), %ebx
leaq 0x842d(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
movl (%rax), %ecx
leaq 0x39344(%rip), %rdi     # 0x3c0f0
movl %r15d, %esi
movl %ebx, %edx
xorl %r8d, %r8d
callq 0x322a
movq %rbp, %rdi
callq 0x22a8
leaq 0x10(%rsp), %rdi
callq 0x22a8
leaq 0x30(%rsp), %rdi
callq 0x22a8
movq %r13, %r15
jmp 0x2ba4
movq %r12, %rdi
callq 0x2160
leaq 0x4331(%rip), %rdi      # 0x711d
leaq 0x42c4(%rip), %rsi      # 0x70b7
callq 0x21b0
movq %rax, %rbx
leaq 0x42ea(%rip), %r13      # 0x70ec
leaq 0x85a7(%rip), %r15      # 0xb3b0
leaq 0x58(%rsp), %rbp
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
cmpl $0x1, %eax
jne 0x2f97
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
leaq 0x10(%rsp), %rdx
callq 0x3038
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x3038
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2270
movq %rbp, %rdi
movq %r15, %rsi
leaq 0xb(%rsp), %rdx
callq 0x3038
leaq 0x8378(%rip), %rdi      # 0xb1f8
leaq 0x30(%rsp), %rsi
callq 0x3210
testq %rax, %rax
jne 0x2eb7
movq 0x8142(%rip), %rdi      # 0xafd8
leaq 0x4252(%rip), %rsi      # 0x70ef
callq 0x2150
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
leaq 0x833a(%rip), %rdi      # 0xb1f8
leaq 0x10(%rsp), %rsi
callq 0x3210
testq %rax, %rax
jne 0x2ef5
movq 0x8104(%rip), %rdi      # 0xafd8
leaq 0x4214(%rip), %rsi      # 0x70ef
callq 0x2150
movq %rax, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
callq 0x20a0
leaq 0x82cc(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x3210
testq %rax, %rax
jne 0x2f28
movl 0x8498(%rip), %r14d     # 0xb3a8
leaq 0x82b1(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
movl %r14d, (%rax)
incl 0x8480(%rip)            # 0xb3a8
leaq 0x82c9(%rip), %rdi      # 0xb1f8
leaq 0x30(%rsp), %rsi
callq 0x30f6
movl (%rax), %r14d
leaq 0x82b5(%rip), %rdi      # 0xb1f8
leaq 0x10(%rsp), %rsi
callq 0x30f6
movl (%rax), %r12d
leaq 0x8271(%rip), %rdi      # 0xb1c8
movq %rbp, %rsi
callq 0x30f6
movl (%rax), %ecx
leaq 0x39188(%rip), %rdi     # 0x3c0f0
movl %r14d, %esi
movl %r12d, %edx
xorl %r8d, %r8d
callq 0x322a
movq %rbp, %rdi
callq 0x22a8
leaq 0x10(%rsp), %rdi
callq 0x22a8
leaq 0x30(%rsp), %rdi
callq 0x22a8
jmp 0x2e0e
movq %rbx, %rdi
callq 0x2160
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2fd8
jmp 0x2fd8
jmp 0x2fc8
jmp 0x2fc8
jmp 0x2fd1
jmp 0x2fd8
jmp 0x2fd8
jmp 0x2fd1
jmp 0x2fc8
jmp 0x2fc8
jmp 0x2fc8
jmp 0x2fd8
jmp 0x2fd1
movq %rax, %rbx
jmp 0x2fee
jmp 0x2fd8
jmp 0x2fd1
movq %rax, %rbx
jmp 0x3002
jmp 0x2fd8
movq %rax, %rbx
jmp 0x2ff8
jmp 0x2fe1
jmp 0x2fe1
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x22a8
leaq 0x10(%rsp), %rdi
callq 0x22a8
leaq 0x30(%rsp), %rdi
callq 0x22a8
movq %rbx, %rdi
callq 0x2240