// File: /workspace/github_cpp_makefile_star2_O3/mshabbirhasan[P]ups-indel/src/ups_compare_uvcf_files.cpp
// Function: main
int main(int argc, char const ** argv){
    if (argc != 4){
        std::cerr << "USAGE: ups_compare_uvcf_files FIRST_UVCF_FILE.UVCF SECOND_UVCF_FILE.UVCF OUTPUT_FILE_NAME\n";
        return 1;
    }

	string firstUVCF_line, secondUVCF_line;

    ifstream firstUVCFFile(argv[1]); //first uvcf file
    ifstream secondUVCFFile(argv[2]); //second uvcf file
    ofstream outputFile(argv[3]); //output file

    vector<string> first;
    vector<string> second;

    if (firstUVCFFile.is_open()){
        while (getline(firstUVCFFile, firstUVCF_line)){
			if(firstUVCF_line.at(0)!='#' && firstUVCF_line.at(0)!='\n'){
				vector<string> tokens = split(firstUVCF_line, '\t');
                string value = tokens.at(7); // UPS-Coordinate column

                first.push_back(value);
			}
        }
        firstUVCFFile.close();
    }
    else{
        std::cerr << "ERROR: Can't open the first input file: "<<argv[1]<<".\n";
        return 1;
    }

    if(secondUVCFFile.is_open()){
        while (getline(secondUVCFFile, secondUVCF_line)){
			if(secondUVCF_line.at(0)!='#' && secondUVCF_line.at(0)!='\n'){
				vector<string> tokens = split(secondUVCF_line, '\t');
                string value = tokens.at(7); // UPS-Coordinate column

                second.push_back(value);
			}
        }
        secondUVCFFile.close();
    }
    else{
        std::cerr << "ERROR: Can't open the second input file: "<<argv[2]<<".\n";
        return 1;
    }

    vector<string> intersection;
    vector<string> in_first_not_in_second;
    vector<string> in_second_not_in_first;

    sort(first.begin(), first.end());
    sort(second.begin(), second.end());

    set_intersection(first.begin(), first.end(), second.begin(), second.end(), back_inserter(intersection));
    set_difference(first.begin(), first.end(), second.begin(), second.end(), back_inserter(in_first_not_in_second));
    set_difference(second.begin(), second.end(), first.begin(), first.end(), back_inserter(in_second_not_in_first));


    if(outputFile.is_open()){
        outputFile<<"Number of Common Indels in "<<argv[1]<<" and "<<argv[2]<<" : "<<intersection.size()<<endl;
        outputFile<<"Number of Indels in "<<argv[1]<<" but not in "<<argv[2]<<" : "<<in_first_not_in_second.size()<<endl;
        outputFile<<"Number of Indels in "<<argv[2]<<" but not in "<<argv[1]<<" : "<<in_second_not_in_first.size()<<endl;

        outputFile.close();
    }
    else{
        std::cerr << "ERROR: Can't open the output file: "<<argv[3]<<".\n";
        return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6f8, %rsp            # imm = 0x6F8
cmpl $0x4, %edi
jne 0x2a09
movq %rsi, %rbx
leaq -0x100(%rbp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq -0xe0(%rbp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
movq 0x8(%rsi), %rsi
leaq -0x720(%rbp), %r15
movq %r15, %rdi
movl $0x8, %edx
callq 0x22b0
movq 0x10(%rbx), %rsi
leaq -0x518(%rbp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x22b0
movq 0x18(%rbx), %rsi
leaq -0x310(%rbp), %rdi
movl $0x10, %edx
callq 0x21d0
xorps %xmm0, %xmm0
movaps %xmm0, -0xb0(%rbp)
xorl %eax, %eax
movq %rax, -0xa0(%rbp)
movq %rax, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
leaq -0x6a8(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2a2b
movq %rbx, -0x30(%rbp)
leaq -0x110(%rbp), %r12
leaq -0x70(%rbp), %r13
leaq -0x50(%rbp), %rbx
movq -0x720(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2a4c
cmpq $0x0, -0x108(%rbp)
je 0x31c9
movq -0x110(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
je 0x2937
cmpl $0x23, %eax
je 0x2937
movq %r13, %rdi
movq %r12, %rsi
movl $0x9, %edx
callq 0x2520
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq $0x7, %rdx
jbe 0x31db
leaq -0x40(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0xe0(%rax), %rsi
movq 0xe8(%rax), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3424
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
callq 0x32e4
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x29fc
callq 0x2180
movq %r13, %rdi
callq 0x33be
jmp 0x2937
movq 0x45e0(%rip), %rdi      # 0x6ff0
leaq 0x25ed(%rip), %rsi      # 0x5004
movl $0x5a, %edx
callq 0x21e0
movl $0x1, %ebx
jmp 0x31b5
movq 0x45be(%rip), %rdi      # 0x6ff0
leaq 0x2626(%rip), %rsi      # 0x505f
movl $0x28, %edx
callq 0x21e0
movq 0x8(%rbx), %rbx
jmp 0x2b7e
leaq -0x720(%rbp), %rdi
leaq -0x100(%rbp), %r12
leaq -0xe0(%rbp), %r13
callq 0x2050
movq -0x30(%rbp), %rbx
leaq -0x4a0(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2b62
leaq -0xf0(%rbp), %r15
leaq -0x70(%rbp), %r12
leaq -0x50(%rbp), %r13
leaq -0x90(%rbp), %rbx
movq -0x518(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x22c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2bdf
cmpq $0x0, -0xe8(%rbp)
je 0x31c9
movq -0xf0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
je 0x2a94
cmpl $0x23, %eax
je 0x2a94
movq %r12, %rdi
movq %r15, %rsi
movl $0x9, %edx
callq 0x2520
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rdx
subq %rax, %rdx
sarq $0x5, %rdx
cmpq $0x7, %rdx
jbe 0x31ee
leaq -0x40(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0xe0(%rax), %rsi
movq 0xe8(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3424
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32e4
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2b55
callq 0x2180
movq %r12, %rdi
callq 0x33be
jmp 0x2a94
movq 0x4487(%rip), %rdi      # 0x6ff0
leaq 0x251b(%rip), %rsi      # 0x508b
movl $0x29, %edx
callq 0x21e0
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x2b9f
movq %rbx, %rdi
callq 0x20c0
movq 0x445e(%rip), %rdi      # 0x6ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2bbd
movq 0x444a(%rip), %rax      # 0x6ff0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
leaq (%rax,%rcx), %rdi
movl 0x20(%rax,%rcx), %esi
orl $0x1, %esi
callq 0x2280
movl $0x1, %ebx
movq 0x4427(%rip), %rdi      # 0x6ff0
leaq 0x24b8(%rip), %rsi      # 0x5088
movl $0x2, %edx
callq 0x21e0
jmp 0x312d
leaq -0x518(%rbp), %rdi
leaq -0x100(%rbp), %r12
leaq -0xe0(%rbp), %r13
callq 0x2050
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
xorl %eax, %eax
movq %rax, -0x40(%rbp)
movq %rax, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movq %rax, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movq -0xb0(%rbp), %rbx
movq -0xa8(%rbp), %r14
cmpq %r14, %rbx
je 0x2c5c
movq %r14, %rax
subq %rbx, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x377d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3851
movq -0x90(%rbp), %r14
movq -0x88(%rbp), %rbx
cmpq %rbx, %r14
je 0x2caa
movq %rbx, %rax
subq %r14, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x377d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3851
movq -0x90(%rbp), %r14
movq -0x88(%rbp), %rbx
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
leaq -0x50(%rbp), %r8
movq %r14, %rdx
movq %rbx, %rcx
callq 0x3f47
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
leaq -0x70(%rbp), %r8
callq 0x3fca
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
leaq -0xd0(%rbp), %r8
callq 0x3fca
leaq -0x2a0(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2d65
leaq 0x238a(%rip), %rsi      # 0x50b5
leaq -0x310(%rbp), %rdi
movl $0x1b, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x2da9
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2dca
movq 0x4284(%rip), %rbx      # 0x6ff0
leaq 0x238a(%rip), %rsi      # 0x50fd
movl $0x23, %edx
movq %rbx, %rdi
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x2e0b
movq %r14, %rdi
callq 0x20c0
movq 0x4254(%rip), %rdi      # 0x6ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2e22
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2280
leaq 0x2300(%rip), %rsi      # 0x50d1
leaq -0x310(%rbp), %rdi
movl $0x5, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x2e44
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2e65
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x2280
movl $0x1, %ebx
movq 0x41c2(%rip), %rdi      # 0x6ff0
leaq 0x2253(%rip), %rsi      # 0x5088
movl $0x2, %edx
callq 0x21e0
jmp 0x310f
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2280
leaq 0x226b(%rip), %rsi      # 0x50d7
leaq -0x310(%rbp), %rdi
movl $0x3, %edx
callq 0x21e0
movq -0x48(%rbp), %rsi
subq -0x50(%rbp), %rsi
sarq $0x5, %rsi
leaq -0x310(%rbp), %rdi
callq 0x20e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq 0x2215(%rip), %rsi      # 0x50db
leaq -0x310(%rbp), %rdi
movl $0x14, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x2f00
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2f21
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2280
leaq 0x21c8(%rip), %rsi      # 0x50f0
leaq -0x310(%rbp), %rdi
movl $0xc, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x2f62
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2f83
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2280
leaq 0x214d(%rip), %rsi      # 0x50d7
leaq -0x310(%rbp), %rdi
movl $0x3, %edx
callq 0x21e0
movq -0x68(%rbp), %rsi
subq -0x70(%rbp), %rsi
sarq $0x5, %rsi
leaq -0x310(%rbp), %rdi
callq 0x20e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq 0x20f7(%rip), %rsi      # 0x50db
leaq -0x310(%rbp), %rdi
movl $0x14, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x301e
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x303f
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2280
leaq 0x20aa(%rip), %rsi      # 0x50f0
leaq -0x310(%rbp), %rdi
movl $0xc, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x3080
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x30a1
movq -0x310(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x310, %rdi           # imm = 0xFCF0
movl 0x20(%rdi), %esi
orl $0x1, %esi
callq 0x2280
leaq 0x202f(%rip), %rsi      # 0x50d7
leaq -0x310(%rbp), %rdi
movl $0x3, %edx
callq 0x21e0
movq -0xc8(%rbp), %rsi
subq -0xd0(%rbp), %rsi
sarq $0x5, %rsi
leaq -0x310(%rbp), %rdi
callq 0x20e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
xorl %ebx, %ebx
leaq -0x310(%rbp), %rdi
callq 0x2200
leaq -0xd0(%rbp), %rdi
callq 0x33be
leaq -0x70(%rbp), %rdi
callq 0x33be
leaq -0x50(%rbp), %rdi
callq 0x33be
leaq -0x90(%rbp), %rdi
callq 0x33be
leaq -0xb0(%rbp), %rdi
callq 0x33be
movq 0x3e84(%rip), %rax      # 0x6fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x308(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x310(%rbp,%rcx)
callq 0x2160
leaq -0x218(%rbp), %rdi
callq 0x2090
leaq -0x518(%rbp), %rdi
callq 0x2070
leaq -0x720(%rbp), %rdi
callq 0x2070
movq -0xf0(%rbp), %rdi
cmpq %r13, %rdi
je 0x31a4
callq 0x2180
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x31b5
callq 0x2180
movl %ebx, %eax
addq $0x6f8, %rsp            # imm = 0x6F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f95(%rip), %rdi      # 0x5165
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2230
leaq 0x1fc7(%rip), %rdi      # 0x51a9
movl $0x7, %esi
xorl %eax, %eax
callq 0x2230
leaq 0x1fb4(%rip), %rdi      # 0x51a9
movl $0x7, %esi
xorl %eax, %eax
callq 0x2230
movq %rax, %rbx
jmp 0x3293
movq %rax, %rbx
jmp 0x329f
movq %rax, %rbx
jmp 0x32ab
jmp 0x3225
jmp 0x326c
jmp 0x3225
jmp 0x322a
jmp 0x326c
jmp 0x3225
movq %rax, %rbx
jmp 0x323f
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x323f
callq 0x2180
leaq -0x70(%rbp), %rdi
callq 0x33be
jmp 0x326f
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x33be
leaq -0x70(%rbp), %rdi
callq 0x33be
leaq -0x50(%rbp), %rdi
jmp 0x3243
jmp 0x326c
jmp 0x326c
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x33be
leaq -0xb0(%rbp), %rdi
callq 0x33be
leaq -0x310(%rbp), %rdi
callq 0x2220
leaq -0x518(%rbp), %rdi
callq 0x2070
leaq -0x720(%rbp), %rdi
callq 0x2070
movq -0xf0(%rbp), %rdi
leaq -0xe0(%rbp), %rax
cmpq %rax, %rdi
je 0x32c3
callq 0x2180
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x32db
callq 0x2180
movq %rbx, %rdi
callq 0x2290
nop