// File: /workspace/github_cpp_makefile_star2_O3/sjain12[P]CliqueCounting/tests/test_cliques_turan_shadow.cpp
// Function: main
int main(int argc, char *argv[])
{
    if(argc < 13) {
        usage();
        exit(1);
    }

    std::ofstream of; // output file
    std::vector<std::string> graphs; // input files
	srand (time(NULL));
    int min_clique_size = 0, max_clique_size = 0, runs = 0, i = 0;
    float start_threshold = 0.0, end_threshold = 0.0, threshold_interval = 0.0;
	int num_samples=0, full=0;
    char c;
    printf("*****************************\n");
    while ((c = getopt(argc, argv, "i:m:M:n:r:f:")) != -1) {
        switch (c) {
            case 'i': {
                // multiple input files
                char *token = std::strtok(optarg, ",");
                printf("Input Files: ");
                while (token != NULL) {
                    graphs.push_back(std::string(token));
                    printf("%s,",token);
                    token = std::strtok(NULL, ",");
                }
                printf("\n");
            }
            break;

            case 'm':
                min_clique_size = atoi(optarg);
                cout << "Min clique size: " << min_clique_size << endl;
            break;

            case 'M':
                max_clique_size = atoi(optarg);
                cout << "Max Clique Size:" << max_clique_size << endl;
            break;

            case 'n':
                num_samples = atoi(optarg);
                cout << "num_samples: " << num_samples << endl;
            break;

            case 'r':
                runs = atoi(optarg);
                cout << "Runs: " << runs << endl;
            break;

		}
    }
    printf("*****************************\n\n");
    
    populate_nCr();
    
    for (std::vector<std::string>::iterator it=graphs.begin(); it!=graphs.end(); ++it)
    {
        std::string fname = "../graphs/" + *it;
        std::cout << fname << std::endl;
        Graph g;
        printf("Loading graph\n");
        if (loadGraph(fname.c_str(), g, 1, IOFormat::escape))
            exit(1);

        printf("Converting to CSR\n");
        CGraph cg = makeCSR(g);

        printf("Creating DAG\n");
        CDAG dag = degreeOrdered(&cg);

        cout << "vertices: " << g.nVertices << " edges = " << g.nEdges << std::endl;

        string f = *it;
        char *token = std::strtok(strdup(f.c_str()), ".");
        string gname(token);
        cout << "GNAME = " << gname << endl;
        for(i=min_clique_size; i<=max_clique_size; i++)
        {
            turan_shadow(cg, dag, of, gname, "", runs, num_samples, i);
            of << std::endl;
        }
        of << std::endl;
        delGraph(g);
        delCGraph(cg);
        delCDAG(dag);
    }
    of.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x3c8, %rsp            # imm = 0x3C8
cmpl $0xc, %edi
jle 0x6fd6
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x1c8(%rsp), %rdi
callq 0x34a0
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq $0x0, 0x38(%rsp)
xorl %edi, %edi
callq 0x3250
movl %eax, %edi
callq 0x3280
leaq 0x5c7b(%rip), %rdi      # 0xc41e
callq 0x3400
leaq 0x5acb(%rip), %rdx      # 0xc27a
movl %ebp, 0x30(%rsp)
movl %ebp, %edi
movq %rbx, %r15
movq %rbx, %rsi
callq 0x30a0
shll $0x18, %eax
movl $0x0, 0x24(%rsp)
movl $0x0, %ecx
movq %rcx, 0x28(%rsp)
movl $0x0, 0x20(%rsp)
cmpl $0xff000000, %eax       # imm = 0xFF000000
je 0x6ab4
leaq 0x130(%rsp), %r14
leaq 0x59a1(%rip), %r13      # 0xc198
leaq 0x120(%rsp), %r12
leaq 0x5a8f(%rip), %rbp      # 0xc295
movl $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq $0x0, 0x38(%rsp)
sarl $0x18, %eax
leal -0x69(%rax), %ecx
cmpl $0x9, %ecx
ja 0x68e6
leaq 0x5832(%rip), %rdx      # 0xc070
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x976a(%rip), %rax      # 0xffb8
movq (%rax), %rdi
movq %r13, %rsi
callq 0x3420
movq %rax, %rbx
leaq 0x5a24(%rip), %rdi      # 0xc287
xorl %eax, %eax
callq 0x3050
testq %rbx, %rbx
je 0x68d7
movq %r14, 0x120(%rsp)
movq %rbx, %rdi
callq 0x3130
leaq (%rax,%rbx), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x78c6
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0x8206
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x68b8
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rbp, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3050
xorl %edi, %edi
movq %r13, %rsi
callq 0x3420
movq %rax, %rbx
testq %rax, %rax
jne 0x686f
movl $0xa, %edi
callq 0x33a0
jmp 0x6a93
cmpl $0x4d, %eax
jne 0x6a93
movq 0x96c2(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movq %rax, 0x28(%rsp)
movl $0x10, %edx
movq 0x96c1(%rip), %rdi      # 0xffd0
leaq 0x5995(%rip), %rsi      # 0xc2ab
callq 0x3310
movq 0x96ae(%rip), %rdi      # 0xffd0
movq 0x28(%rsp), %rsi
callq 0x34b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
jmp 0x6a93
movq 0x9656(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movq %rax, 0x38(%rsp)
movl $0xd, %edx
movq 0x9655(%rip), %rdi      # 0xffd0
leaq 0x593a(%rip), %rsi      # 0xc2bc
callq 0x3310
movq 0x9642(%rip), %rdi      # 0xffd0
movq 0x38(%rsp), %rsi
callq 0x34b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
jmp 0x6a93
movq 0x95ea(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movl %eax, 0x24(%rsp)
movl $0x6, %edx
movq 0x95ea(%rip), %rdi      # 0xffd0
leaq 0x58dd(%rip), %rsi      # 0xc2ca
callq 0x3310
movq 0x95d7(%rip), %rdi      # 0xffd0
movl 0x24(%rsp), %esi
callq 0x34b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
jmp 0x6a93
movq 0x9583(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movl %eax, 0x20(%rsp)
movl $0x11, %edx
movq 0x9583(%rip), %rdi      # 0xffd0
leaq 0x5845(%rip), %rsi      # 0xc299
callq 0x3310
movq 0x9570(%rip), %rdi      # 0xffd0
movl 0x20(%rsp), %esi
callq 0x34b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movl 0x30(%rsp), %edi
movq %r15, %rsi
leaq 0x57d9(%rip), %rdx      # 0xc27a
callq 0x30a0
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
jne 0x6828
leaq 0x5981(%rip), %rdi      # 0xc43c
callq 0x3400
callq 0x3948
movq 0x60(%rsp), %rax
cmpq 0x68(%rsp), %rax
je 0x6f73
leaq 0xf0(%rsp), %r14
leaq 0xd0(%rsp), %r15
movq %rax, %rdx
movq 0x28(%rsp), %rax
leal 0x1(%rax), %r13d
leaq 0xe0(%rsp), %r12
leaq 0x5b8f(%rip), %rbx      # 0xc68f
leaq 0xa0(%rsp), %rdi
leaq 0x57c2(%rip), %rsi      # 0xc2d1
movq %rdx, 0x30(%rsp)
callq 0x719b
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0x94a0(%rip), %rdi      # 0xffd0
callq 0x3310
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
leaq 0x58f5(%rip), %rdi      # 0xc45b
callq 0x3400
movq 0xa0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0xac38
testl %eax, %eax
jne 0x6fdb
leaq 0x58d0(%rip), %rdi      # 0xc469
callq 0x3400
movups 0x100(%rsp), %xmm0
movups 0x110(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x1a8(%rsp), %rbp
movq %rbp, %rdi
xorl %esi, %esi
callq 0x8afb
leaq 0x58ab(%rip), %rdi      # 0xc47b
callq 0x3400
leaq 0x168(%rsp), %rdi
movq %rbp, %rsi
callq 0x3715
movl $0xa, %edx
movq 0x93df(%rip), %rdi      # 0xffd0
leaq 0x56e4(%rip), %rsi      # 0xc2dc
callq 0x3310
movq 0x100(%rsp), %rsi
movq 0x93c4(%rip), %rdi      # 0xffd0
callq 0x3270
movq %rax, %rbp
movl $0x9, %edx
movq %rax, %rdi
leaq 0x56c4(%rip), %rsi      # 0xc2e7
callq 0x3310
movq 0x108(%rsp), %rsi
movq %rbp, %rdi
callq 0x3270
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
leaq 0x90(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0x7320
movq 0x80(%rsp), %rdi
callq 0x34f0
movq %rax, %rdi
leaq 0x544e(%rip), %rsi      # 0xc0f3
callq 0x3420
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
leaq 0x120(%rsp), %rdx
callq 0x70fa
movl $0x8, %edx
movq 0x9305(%rip), %rdi      # 0xffd0
leaq 0x561f(%rip), %rsi      # 0xc2f1
callq 0x3310
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x92e8(%rip), %rdi      # 0xffd0
callq 0x3310
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movq 0x28(%rsp), %rax
cmpl %eax, 0x20(%rsp)
jg 0x6e09
movl 0x20(%rsp), %ebp
movq %r14, 0xe0(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x7320
movq %r15, 0xc0(%rsp)
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x78c6
movl %ebp, 0x8(%rsp)
movq 0x38(%rsp), %rax
movl %eax, (%rsp)
leaq 0x1a8(%rsp), %rdi
leaq 0x168(%rsp), %rsi
movq %r12, %rcx
movl 0x24(%rsp), %r9d
callq 0x4295
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x6da8
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x6dc5
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x1c8(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x1c8(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
leaq 0x1c8(%rsp), %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
incl %ebp
cmpl %ebp, %r13d
jne 0x6d2a
movq 0x1c8(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x1c8(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %esi
leaq 0x1c8(%rsp), %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31b0
movups 0x100(%rsp), %xmm0
movups 0x110(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x8616
movups 0x1a8(%rsp), %xmm0
movups 0x1b8(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x879c
movups 0x168(%rsp), %xmm0
movups 0x178(%rsp), %xmm1
movups 0x188(%rsp), %xmm2
movups 0x198(%rsp), %xmm3
movaps %xmm3, 0x150(%rsp)
movaps %xmm2, 0x140(%rsp)
movaps %xmm1, 0x130(%rsp)
movaps %xmm0, 0x120(%rsp)
movups 0x168(%rsp), %xmm0
movups 0x178(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x879c
leaq 0x140(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x879c
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6f15
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x6f3a
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x6f5f
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x30(%rsp), %rdx
addq $0x20, %rdx
cmpq 0x68(%rsp), %rdx
jne 0x6b00
leaq 0x1c8(%rsp), %rdi
callq 0x33b0
leaq 0x60(%rsp), %rdi
callq 0x7254
movq 0x9037(%rip), %rax      # 0xffc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x1d0(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x1c8(%rsp,%rcx)
callq 0x3220
leaq 0x2c0(%rsp), %rdi
callq 0x3100
xorl %eax, %eax
addq $0x3c8, %rsp            # imm = 0x3C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x673c
movl $0x1, %edi
callq 0x3350
jmp 0x6ff9
movq %rax, %rbx
jmp 0x7091
jmp 0x6ff9
jmp 0x7024
jmp 0x7024
jmp 0x7024
jmp 0x6ff9
movq %rax, %rbx
jmp 0x70db
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x70db
movq 0x130(%rsp), %rsi
jmp 0x70d3
jmp 0x7024
movq %rax, %rbx
jmp 0x70b6
jmp 0x7072
movq %rax, %rbx
jmp 0x7053
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x7053
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x7075
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32d0
jmp 0x7075
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7091
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x70b6
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x70db
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x60(%rsp), %rdi
callq 0x7254
leaq 0x1c8(%rsp), %rdi
callq 0x33e0
movq %rbx, %rdi
callq 0x34c0