// File: /workspace/github_cpp_makefile_star2_O1/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 0x2a1e
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 0x2a40
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 0x2a61
movq -0x108(%rbp), %rdx
testq %rdx, %rdx
je 0x31da
movq -0x110(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
je 0x294a
cmpl $0x23, %eax
je 0x294a
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 0x31ea
leaq -0x40(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0xe0(%rax), %rsi
movq 0xe8(%rax), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3428
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
callq 0x32f2
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2a11
callq 0x2180
movq %r13, %rdi
callq 0x33cc
jmp 0x294a
movq 0x45cb(%rip), %rdi      # 0x6ff0
leaq 0x25d8(%rip), %rsi      # 0x5004
movl $0x5a, %edx
callq 0x21e0
movl $0x1, %ebx
jmp 0x31c6
movq 0x45a9(%rip), %rdi      # 0x6ff0
leaq 0x2611(%rip), %rsi      # 0x505f
movl $0x28, %edx
callq 0x21e0
movq 0x8(%rbx), %rbx
jmp 0x2b95
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 0x2b79
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 0x2bf6
movq -0xe8(%rbp), %rdx
testq %rdx, %rdx
je 0x31da
movq -0xf0(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xa, %eax
je 0x2aa9
cmpl $0x23, %eax
je 0x2aa9
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 0x31fd
leaq -0x40(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0xe0(%rax), %rsi
movq 0xe8(%rax), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x3428
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32f2
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x2b6c
callq 0x2180
movq %r12, %rdi
callq 0x33cc
jmp 0x2aa9
movq 0x4470(%rip), %rdi      # 0x6ff0
leaq 0x2504(%rip), %rsi      # 0x508b
movl $0x29, %edx
callq 0x21e0
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x2bb6
movq %rbx, %rdi
callq 0x20c0
movq 0x4447(%rip), %rdi      # 0x6ff0
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2bd4
movq 0x4433(%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 0x4410(%rip), %rdi      # 0x6ff0
leaq 0x24a1(%rip), %rsi      # 0x5088
movl $0x2, %edx
callq 0x21e0
jmp 0x313e
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 0x2c73
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 0x37af
movq %rbx, %rdi
movq %r14, %rsi
callq 0x38a0
movq -0x90(%rbp), %rbx
movq -0x88(%rbp), %r14
cmpq %r14, %rbx
je 0x2cb3
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 0x37af
movq %rbx, %rdi
movq %r14, %rsi
callq 0x38a0
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
leaq -0x50(%rbp), %r8
callq 0x3fbc
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x88(%rbp), %rcx
leaq -0x70(%rbp), %r8
callq 0x403f
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movq -0xa8(%rbp), %rcx
leaq -0xd0(%rbp), %r8
callq 0x403f
leaq -0x2a0(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2d76
leaq 0x2379(%rip), %rsi      # 0x50b5
leaq -0x310(%rbp), %rdi
movl $0x1b, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x2dba
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2ddb
movq 0x4273(%rip), %rbx      # 0x6ff0
leaq 0x2379(%rip), %rsi      # 0x50fd
movl $0x23, %edx
movq %rbx, %rdi
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x2e1c
movq %r14, %rdi
callq 0x20c0
movq 0x4243(%rip), %rdi      # 0x6ff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2e33
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 0x22ef(%rip), %rsi      # 0x50d1
leaq -0x310(%rbp), %rdi
movl $0x5, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x2e55
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2e76
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 0x41b1(%rip), %rdi      # 0x6ff0
leaq 0x2242(%rip), %rsi      # 0x5088
movl $0x2, %edx
callq 0x21e0
jmp 0x3120
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 0x225a(%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 0x2204(%rip), %rsi      # 0x50db
leaq -0x310(%rbp), %rdi
movl $0x14, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x2f11
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2f32
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 0x21b7(%rip), %rsi      # 0x50f0
leaq -0x310(%rbp), %rdi
movl $0xc, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x2f73
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x2f94
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 0x213c(%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 0x20e6(%rip), %rsi      # 0x50db
leaq -0x310(%rbp), %rdi
movl $0x14, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rbx
testq %rbx, %rbx
je 0x302f
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x3050
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 0x2099(%rip), %rsi      # 0x50f0
leaq -0x310(%rbp), %rdi
movl $0xc, %edx
callq 0x21e0
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rbx
testq %rbx, %rbx
je 0x3091
movq %rbx, %rdi
callq 0x20c0
leaq -0x310(%rbp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21e0
jmp 0x30b2
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 0x201e(%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 0x33cc
leaq -0x70(%rbp), %rdi
callq 0x33cc
leaq -0x50(%rbp), %rdi
callq 0x33cc
leaq -0x90(%rbp), %rdi
callq 0x33cc
leaq -0xb0(%rbp), %rdi
callq 0x33cc
movq 0x3e73(%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 0x31b5
callq 0x2180
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x31c6
callq 0x2180
movl %ebx, %eax
addq $0x6f8, %rsp            # imm = 0x6F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1f84(%rip), %rdi      # 0x5165
xorl %esi, %esi
xorl %eax, %eax
callq 0x2230
leaq 0x1fb8(%rip), %rdi      # 0x51a9
movl $0x7, %esi
xorl %eax, %eax
callq 0x2230
leaq 0x1fa5(%rip), %rdi      # 0x51a9
movl $0x7, %esi
xorl %eax, %eax
callq 0x2230
movq %rax, %rbx
jmp 0x32a2
movq %rax, %rbx
jmp 0x32ae
movq %rax, %rbx
jmp 0x32ba
jmp 0x3234
jmp 0x327b
jmp 0x3234
jmp 0x3239
jmp 0x327b
jmp 0x3234
movq %rax, %rbx
jmp 0x324e
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x324e
callq 0x2180
leaq -0x70(%rbp), %rdi
callq 0x33cc
jmp 0x327e
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x33cc
leaq -0x70(%rbp), %rdi
callq 0x33cc
leaq -0x50(%rbp), %rdi
jmp 0x3252
jmp 0x327b
jmp 0x327b
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x33cc
leaq -0xb0(%rbp), %rdi
callq 0x33cc
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 0x32d2
callq 0x2180
movq -0x110(%rbp), %rdi
leaq -0x100(%rbp), %rax
cmpq %rax, %rdi
je 0x32ea
callq 0x2180
movq %rbx, %rdi
callq 0x2290