// File: /workspace/github_cpp_makefile_star2_O1/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 0x7076
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 0x5bcb(%rip), %rdi      # 0xc40e
callq 0x3400
leaq 0x5a1b(%rip), %rdx      # 0xc26a
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 0x6b54
leaq 0x130(%rsp), %r14
leaq 0x58f1(%rip), %r13      # 0xc188
leaq 0x120(%rsp), %r12
leaq 0x59df(%rip), %rbp      # 0xc285
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 0x6986
leaq 0x5782(%rip), %rdx      # 0xc060
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x96ca(%rip), %rax      # 0xffb8
movq (%rax), %rdi
movq %r13, %rsi
callq 0x3420
movq %rax, %rbx
leaq 0x5974(%rip), %rdi      # 0xc277
xorl %eax, %eax
callq 0x3050
testq %rbx, %rbx
je 0x6977
movq %r14, 0x120(%rsp)
movq %rbx, %rdi
callq 0x3130
leaq (%rax,%rbx), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x7976
leaq 0x60(%rsp), %rdi
movq %r12, %rsi
callq 0x82a4
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x6958
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 0x690f
movl $0xa, %edi
callq 0x33a0
jmp 0x6b33
cmpl $0x4d, %eax
jne 0x6b33
movq 0x9622(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movq %rax, 0x28(%rsp)
movl $0x10, %edx
movq 0x9621(%rip), %rdi      # 0xffd0
leaq 0x58e5(%rip), %rsi      # 0xc29b
callq 0x3310
movq 0x960e(%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 0x6b33
movq 0x95b6(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movq %rax, 0x38(%rsp)
movl $0xd, %edx
movq 0x95b5(%rip), %rdi      # 0xffd0
leaq 0x588a(%rip), %rsi      # 0xc2ac
callq 0x3310
movq 0x95a2(%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 0x6b33
movq 0x954a(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movl %eax, 0x24(%rsp)
movl $0x6, %edx
movq 0x954a(%rip), %rdi      # 0xffd0
leaq 0x582d(%rip), %rsi      # 0xc2ba
callq 0x3310
movq 0x9537(%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 0x6b33
movq 0x94e3(%rip), %rax      # 0xffb8
movq (%rax), %rdi
callq 0x3410
movl %eax, 0x20(%rsp)
movl $0x11, %edx
movq 0x94e3(%rip), %rdi      # 0xffd0
leaq 0x5795(%rip), %rsi      # 0xc289
callq 0x3310
movq 0x94d0(%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 0x5729(%rip), %rdx      # 0xc26a
callq 0x30a0
shll $0x18, %eax
cmpl $0xff000000, %eax       # imm = 0xFF000000
jne 0x68c8
leaq 0x58d1(%rip), %rdi      # 0xc42c
callq 0x3400
callq 0x3925
movq 0x60(%rsp), %rax
cmpq 0x68(%rsp), %rax
je 0x7013
leaq 0xf0(%rsp), %r14
leaq 0xd0(%rsp), %r15
movq %rax, %rdx
movq 0x28(%rsp), %rax
leal 0x1(%rax), %r13d
leaq 0xe0(%rsp), %r12
leaq 0x5a9f(%rip), %rbx      # 0xc63f
leaq 0xa0(%rsp), %rdi
leaq 0x5712(%rip), %rsi      # 0xc2c1
movq %rdx, 0x30(%rsp)
callq 0x723b
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
movq 0x9400(%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 0x5845(%rip), %rdi      # 0xc44b
callq 0x3400
movq 0xa0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
movl $0x1, %edx
movl $0x1, %ecx
callq 0xaca0
testl %eax, %eax
jne 0x707b
leaq 0x5820(%rip), %rdi      # 0xc459
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 0x8bbb
leaq 0x57fb(%rip), %rdi      # 0xc46b
callq 0x3400
leaq 0x168(%rsp), %rdi
movq %rbp, %rsi
callq 0x3715
movl $0xa, %edx
movq 0x933f(%rip), %rdi      # 0xffd0
leaq 0x5634(%rip), %rsi      # 0xc2cc
callq 0x3310
movq 0x100(%rsp), %rsi
movq 0x9324(%rip), %rdi      # 0xffd0
callq 0x3270
movq %rax, %rbp
movl $0x9, %edx
movq %rax, %rdi
leaq 0x5614(%rip), %rsi      # 0xc2d7
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 0x73bc
movq 0x80(%rsp), %rdi
callq 0x34f0
movq %rax, %rdi
leaq 0x539e(%rip), %rsi      # 0xc0e3
callq 0x3420
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
leaq 0x120(%rsp), %rdx
callq 0x719a
movl $0x8, %edx
movq 0x9265(%rip), %rdi      # 0xffd0
leaq 0x556f(%rip), %rsi      # 0xc2e1
callq 0x3310
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq 0x9248(%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 0x6ea9
movl 0x20(%rsp), %ebp
movq %r14, 0xe0(%rsp)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x73bc
movq %r15, 0xc0(%rsp)
leaq 0xc0(%rsp), %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x7976
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 0x431b
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x6e48
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x6e65
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 0x6dca
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 0x86aa
movups 0x1a8(%rsp), %xmm0
movups 0x1b8(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x8830
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 0x8830
leaq 0x140(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x8830
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x6fb5
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x6fda
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x6fff
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x30(%rsp), %rdx
addq $0x20, %rdx
cmpq 0x68(%rsp), %rdx
jne 0x6ba0
leaq 0x1c8(%rsp), %rdi
callq 0x33b0
leaq 0x60(%rsp), %rdi
callq 0x72f4
movq 0x8f97(%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 0x67dc
movl $0x1, %edi
callq 0x3350
jmp 0x7099
movq %rax, %rbx
jmp 0x7131
jmp 0x7099
jmp 0x70c4
jmp 0x70c4
jmp 0x70c4
jmp 0x7099
movq %rax, %rbx
jmp 0x717b
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r14, %rdi
je 0x717b
movq 0x130(%rsp), %rsi
jmp 0x7173
jmp 0x70c4
movq %rax, %rbx
jmp 0x7156
jmp 0x7112
movq %rax, %rbx
jmp 0x70f3
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
cmpq %r15, %rdi
je 0x70f3
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xe0(%rsp), %rdi
cmpq %r14, %rdi
je 0x7115
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x32d0
jmp 0x7115
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x7131
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x7156
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x717b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x32d0
leaq 0x60(%rsp), %rdi
callq 0x72f4
leaq 0x1c8(%rsp), %rdi
callq 0x33e0
movq %rbx, %rdi
callq 0x34c0