// File: /workspace/github_cpp_makefile_star2_O3/thunlp[P]KB2E/CTransR/Test_CTransR.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;
		fb_relation_num++;
	}


	FILE* f_kb_train = fopen("../data/train.txt","r");
	FILE* f_train_cluster = fopen("../cluster/output/train_cluster.txt","r");
	while (fscanf(f_kb_train,"%s",buf)==1)
    {
        string s1=buf;
        fscanf(f_kb_train,"%s",buf);
        string s2=buf;
        fscanf(f_kb_train,"%s",buf);
        string s3=buf;
        int rel_fb = relation2id[s3];
        int rel;
        fscanf(f_train_cluster,"%d",&rel);
        if (cluster2fb.count(rel)==0)
        {
            relation_num+=1;
            cluster2fb[rel]=rel_fb;
            fb2cluster[rel_fb].push_back(rel);
        }
        else
        if (cluster2fb[rel]!=rel_fb)
        {
            cout<<"not map:"<<entity2id[s1]<<" "<<entity2id[s2]<<" "<<rel<<' '<<rel_fb<<endl;
            exit(-1);
        }
        test.add(entity2id[s1],entity2id[s2],relation2id[s3],false);
    }

    fclose(f_train_cluster);
    fclose(f_kb_train);

    FILE* f_kb_test = fopen("../data/test.txt","r");
	while (fscanf(f_kb_test,"%s",buf)==1)
    {
        string s1=buf;
        fscanf(f_kb_test,"%s",buf);
        string s2=buf;
        fscanf(f_kb_test,"%s",buf);
        string s3=buf;
        test.add(entity2id[s1],entity2id[s2],relation2id[s3],true);
    }
    fclose(f_kb_test);

    FILE* f_kb_valid = fopen("../data/valid.txt","r");
	while (fscanf(f_kb_valid,"%s",buf)==1)
    {
        string s1=buf;
        fscanf(f_kb_valid,"%s",buf);
        string s2=buf;
        fscanf(f_kb_valid,"%s",buf);
        string s3=buf;
        test.add(entity2id[s1],entity2id[s2],relation2id[s3],false);
    }
    fclose(f_kb_valid);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq 0x56ee(%rip), %rdi      # 0x8094
leaq 0x56fd(%rip), %rbx      # 0x80aa
movq %rbx, %rsi
callq 0x21d0
movq %rax, %r14
leaq 0x56ed(%rip), %rdi      # 0x80ac
movq %rbx, %rsi
callq 0x21d0
movq %rax, 0x58(%rsp)
leaq 0x56f1(%rip), %rsi      # 0x80c4
leaq 0x9a56(%rip), %r15      # 0xc430
leaq 0xc(%rsp), %rcx
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x2, %eax
jne 0x2ab6
leaq 0x20(%rsp), %rbx
leaq 0x10(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %rbx, 0x10(%rsp)
movq %r15, %rdi
callq 0x20b0
leaq (%rax,%r15), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x6b9e
movl 0xc(%rsp), %ebp
leaq 0x97dd(%rip), %rdi      # 0xc208
movq %r12, %rsi
callq 0x34c6
movl %ebp, (%rax)
leaq 0x97fc(%rip), %rdi      # 0xc238
movq %r13, %rsi
callq 0x3542
movq %rax, %rdi
movq %r12, %rsi
callq 0x20e0
leaq 0x9872(%rip), %rdi      # 0xc2c8
movq %r12, %rsi
callq 0x35a8
movq 0x8(%rax), %rdx
movl $0x4, %r8d
movq %rax, %rdi
xorl %esi, %esi
leaq 0x5655(%rip), %rcx      # 0x80c9
callq 0x2210
incl 0x993d(%rip)            # 0xc3bc
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2a96
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %r14, %rdi
leaq 0x5624(%rip), %rsi      # 0x80c4
movq %r15, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x22a0
cmpl $0x2, %eax
je 0x2a04
leaq 0x5607(%rip), %rsi      # 0x80c4
leaq 0x996c(%rip), %r14      # 0xc430
leaq 0xc(%rsp), %rcx
movq 0x58(%rsp), %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x2, %eax
jne 0x2b7f
leaq 0x20(%rsp), %r12
leaq 0x10(%rsp), %r15
leaq 0xc(%rsp), %rbp
leaq 0x55cd(%rip), %rbx      # 0x80c4
movq %r12, 0x10(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x6b9e
movl 0xc(%rsp), %r13d
leaq 0x96b9(%rip), %rdi      # 0xc1d8
movq %r15, %rsi
callq 0x34c6
movl %r13d, (%rax)
leaq 0x9737(%rip), %rdi      # 0xc268
movq %rbp, %rsi
callq 0x3542
movq %rax, %rdi
movq %r15, %rsi
callq 0x20e0
incl 0x9876(%rip)            # 0xc3c0
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0x2b61
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x22a0
cmpl $0x2, %eax
je 0x2af7
leaq 0x5548(%rip), %rdi      # 0x80ce
leaq 0x551d(%rip), %r14      # 0x80aa
movq %r14, %rsi
callq 0x21d0
movq %rax, %rbp
leaq 0x5541(%rip), %rdi      # 0x80e0
movq %r14, %rsi
callq 0x21d0
movq %rax, 0x58(%rsp)
leaq 0x5551(%rip), %rsi      # 0x8104
leaq 0x9876(%rip), %r14      # 0xc430
movq %rbp, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
jne 0x2e0e
leaq 0x20(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x70(%rsp), %rbx
leaq 0x60(%rsp), %r13
movq %rbp, 0x80(%rsp)
movq %r15, 0x10(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x6b9e
movq %rbp, %rdi
leaq 0x54f0(%rip), %rsi      # 0x8104
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
movq %r12, 0x38(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x6b9e
movq %rbp, %rdi
leaq 0x54be(%rip), %rsi      # 0x8104
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
movq %rbx, 0x60(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x6b9e
movq %r13, %rsi
leaq 0x9562(%rip), %rdi      # 0xc1d8
callq 0x34c6
movl (%rax), %eax
movl %eax, 0x30(%rsp)
movq 0x58(%rsp), %rdi
leaq 0x5439(%rip), %rsi      # 0x80c6
leaq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x22a0
movq 0x9738(%rip), %rcx      # 0xc3d8
testq %rcx, %rcx
je 0x2cd8
movl 0x8(%rsp), %eax
leaq 0x9720(%rip), %rdx      # 0xc3d0
xorl %esi, %esi
cmpl %eax, 0x20(%rcx)
setl %sil
cmovgeq %rcx, %rdx
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x2cb0
leaq 0x9702(%rip), %rcx      # 0xc3d0
cmpq %rcx, %rdx
je 0x2cd8
cmpl 0x20(%rdx), %eax
jge 0x2d2f
incl 0x96da(%rip)            # 0xc3b8
movl 0x30(%rsp), %ebp
leaq 0x96df(%rip), %rdi      # 0xc3c8
leaq 0x8(%rsp), %rsi
callq 0x366c
movl %ebp, (%rax)
leaq 0x96fc(%rip), %rdi      # 0xc3f8
leaq 0x30(%rsp), %rsi
callq 0x36d2
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x2d20
movl 0x8(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x2d4c
movq %rax, %rdi
leaq 0x8(%rsp), %rdx
callq 0x6c34
jmp 0x2d4c
leaq 0x9692(%rip), %rdi      # 0xc3c8
leaq 0x8(%rsp), %rsi
callq 0x366c
movl (%rax), %eax
cmpl 0x30(%rsp), %eax
jne 0x316f
leaq 0x94b5(%rip), %rdi      # 0xc208
leaq 0x10(%rsp), %rsi
callq 0x34c6
movl (%rax), %r14d
leaq 0x94a1(%rip), %rdi      # 0xc208
leaq 0x38(%rsp), %rsi
callq 0x34c6
movl (%rax), %ebp
leaq 0x945e(%rip), %rdi      # 0xc1d8
movq %r13, %rsi
callq 0x34c6
movl (%rax), %ecx
leaq 0x3a3e5(%rip), %rdi     # 0x3d170
movl %r14d, %esi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0x3738
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2daf
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
leaq 0x20(%rsp), %r15
movq 0x80(%rsp), %rbp
leaq 0x9665(%rip), %r14      # 0xc430
je 0x2dda
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x2df1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbp, %rdi
leaq 0x5309(%rip), %rsi      # 0x8104
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
je 0x2bec
movq 0x58(%rsp), %rdi
callq 0x2180
movq %rbp, %rdi
callq 0x2180
leaq 0x52eb(%rip), %rdi      # 0x8112
leaq 0x527c(%rip), %rsi      # 0x80aa
callq 0x21d0
movq %rax, %rbx
leaq 0x52c7(%rip), %rsi      # 0x8104
leaq 0x95ec(%rip), %r14      # 0xc430
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
jne 0x2fb8
leaq 0x20(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x5299(%rip), %r12      # 0x8104
movq %r13, 0x10(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x6b9e
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
movq %rbp, 0x38(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x6b9e
movq %r14, %r13
movq %rbx, %r15
movq %rbx, %rdi
movq %r12, %rbx
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
leaq 0x70(%rsp), %rax
movq %rax, %r12
movq %rax, 0x60(%rsp)
movq %r13, %rdi
callq 0x20b0
leaq (%rax,%r13), %rdx
leaq 0x60(%rsp), %rdi
movq %r13, %r14
movq %r13, %rsi
callq 0x6b9e
leaq 0x9308(%rip), %rdi      # 0xc208
leaq 0x10(%rsp), %rsi
callq 0x34c6
movl (%rax), %r13d
leaq 0x92f4(%rip), %rdi      # 0xc208
leaq 0x38(%rsp), %rsi
callq 0x34c6
movl (%rax), %ebp
leaq 0x92b1(%rip), %rdi      # 0xc1d8
leaq 0x60(%rsp), %rsi
callq 0x34c6
movl (%rax), %ecx
leaq 0x3a236(%rip), %rdi     # 0x3d170
movl %r13d, %esi
movl %ebp, %edx
movl $0x1, %r8d
callq 0x3738
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x2f61
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rbp
cmpq %rbp, %rdi
leaq 0x20(%rsp), %r13
movq %rbx, %r12
je 0x2f85
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
movq %r15, %rbx
je 0x2f9f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
je 0x2e6b
movq %rbx, %rdi
callq 0x2180
leaq 0x515c(%rip), %rdi      # 0x8123
leaq 0x50dc(%rip), %rsi      # 0x80aa
callq 0x21d0
movq %rax, %rbx
leaq 0x5127(%rip), %rsi      # 0x8104
leaq 0x944c(%rip), %r14      # 0xc430
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
jne 0x3155
leaq 0x20(%rsp), %r13
leaq 0x48(%rsp), %rbp
leaq 0x50f9(%rip), %r12      # 0x8104
movq %r13, 0x10(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x6b9e
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
movq %rbp, 0x38(%rsp)
movq %r14, %rdi
callq 0x20b0
leaq (%rax,%r14), %rdx
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
callq 0x6b9e
movq %r14, %r13
movq %rbx, %r15
movq %rbx, %rdi
movq %r12, %rbx
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
leaq 0x70(%rsp), %rax
movq %rax, %r12
movq %rax, 0x60(%rsp)
movq %r13, %rdi
callq 0x20b0
leaq (%rax,%r13), %rdx
leaq 0x60(%rsp), %rdi
movq %r13, %r14
movq %r13, %rsi
callq 0x6b9e
leaq 0x9168(%rip), %rdi      # 0xc208
leaq 0x10(%rsp), %rsi
callq 0x34c6
movl (%rax), %r13d
leaq 0x9154(%rip), %rdi      # 0xc208
leaq 0x38(%rsp), %rsi
callq 0x34c6
movl (%rax), %ebp
leaq 0x9111(%rip), %rdi      # 0xc1d8
leaq 0x60(%rsp), %rsi
callq 0x34c6
movl (%rax), %ecx
leaq 0x3a096(%rip), %rdi     # 0x3d170
movl %r13d, %esi
movl %ebp, %edx
xorl %r8d, %r8d
callq 0x3738
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x30fe
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rbp
cmpq %rbp, %rdi
leaq 0x20(%rsp), %r13
movq %rbx, %r12
je 0x3122
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
movq %r15, %rbx
je 0x313c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
je 0x300b
movq %rbx, %rdi
callq 0x2180
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8e62(%rip), %rdi      # 0xbfd8
leaq 0x4f8a(%rip), %rsi      # 0x8107
movl $0x8, %edx
callq 0x21c0
leaq 0x907a(%rip), %rdi      # 0xc208
leaq 0x10(%rsp), %rsi
callq 0x34c6
movl (%rax), %esi
movq 0x8e37(%rip), %rdi      # 0xbfd8
callq 0x2260
movq %rax, %r14
leaq 0x4f60(%rip), %rsi      # 0x8110
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
leaq 0x9044(%rip), %rdi      # 0xc208
leaq 0x38(%rsp), %rsi
callq 0x34c6
movl (%rax), %esi
movq %r14, %rdi
callq 0x2260
movq %rax, %r14
leaq 0x4f2e(%rip), %rsi      # 0x8110
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
movl 0x8(%rsp), %esi
movq %r14, %rdi
callq 0x2260
leaq 0x37(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x21c0
movl 0x30(%rsp), %esi
movq %rax, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x20c0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x21e0
jmp 0x32ec
jmp 0x326d
jmp 0x323f
jmp 0x3244
jmp 0x324b
jmp 0x324b
jmp 0x326d
movq %rax, %r14
jmp 0x32be
movq %rax, %r14
jmp 0x32b9
jmp 0x324b
movq %rax, %r14
jmp 0x329d
jmp 0x326d
jmp 0x3254
movq %rax, %r14
jmp 0x3322
jmp 0x325e
movq %rax, %r14
jmp 0x330b
jmp 0x32ec
jmp 0x326d
movq %rax, %r14
jmp 0x32d5
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
jne 0x32c8
jmp 0x32d5
jmp 0x3283
movq %rax, %r14
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x329d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x32b9
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
leaq 0x20(%rsp), %r13
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x32d5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21a0
movq %r14, %rdi
callq 0x2270
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x32c8
jmp 0x32d5
movq %rax, %r14
movq 0x60(%rsp), %rdi
cmpq %rbx, %rdi
leaq 0x20(%rsp), %r15
je 0x330b
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x3322
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
jne 0x32c8
jmp 0x32d5