// File: qema[P]orca-py/liborca.cpp
// Function: motif_counts(char const*, int, char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int motif_counts(const char* orbit_type, int graphlet_size, 
        const char* input_str, const char* output_filename, string &out_str) {
    common2.clear();
    common3.clear();
    bool use_adj_matrix;
    //fstream fin; // input and output files
    stringstream fin(input_str);
    // open input, output files
    if (strcmp(orbit_type, "node")!=0 && strcmp(orbit_type, "edge")!=0) {
        cerr << "Incorrect orbit type '" << orbit_type << "'. Should be 'node' or 'edge'." << endl;
        return 0;
    }
    if (graphlet_size!=4 && graphlet_size!=5) {
        cerr << "Incorrect graphlet size " << graphlet_size << ". Should be 4 or 5." << endl;
        return 0;
    }
    //fin.open(input_filename, fstream::in);
    if (fin.fail()) {
        //cerr << "Failed to open file " << input_filename << endl;
        cerr << "Failed to open string stream" << endl;
        return 0;
    }
    // read input graph
    fin >> n >> m;
    //cout << n << " " << m;
    int d_max=0;
    edges = (PAIR*)malloc(m*sizeof(PAIR));
    deg = (int*)calloc(n,sizeof(int));
    for (int i=0;i<m;i++) {
        int a,b;
        fin >> a >> b;
        if (!(0<=a && a<n) || !(0<=b && b<n)) {
            cerr << "Node ids should be between 1 and n-1." << endl;
            return 0;
        }
        if (a==b) {
            cerr << "Self loops (edge from x to x) are not allowed." << endl;
            return 0;
        }
        deg[a]++; deg[b]++;
        edges[i]=PAIR(a,b);
    }
    for (int i=0;i<n;i++) d_max=max(d_max,deg[i]);
    //printf("nodes: %d\n",n);
    //printf("edges: %d\n",m);
    //printf("max degree: %d\n",d_max);
    //fin.close();
    if ((int)(set<PAIR>(edges,edges+m).size())!=m) {
        cerr << "Input file contains duplicate undirected edges." << endl;
        return 0;
    }
    // set up adjacency matrix if it's smaller than 100MB
    if ((int64)n*n < 100LL*1024*1024*8) {
        use_adj_matrix = true;
        adjacent = adjacent_matrix;
        adj_matrix = (int*)calloc((n*n)/adj_chunk+1,sizeof(int));
        for (int i=0;i<m;i++) {
            int a=edges[i].a, b=edges[i].b;
            adj_matrix[(a*n+b)/adj_chunk]|=(1<<((a*n+b)%adj_chunk));
            adj_matrix[(b*n+a)/adj_chunk]|=(1<<((b*n+a)%adj_chunk));
        }
    } else {
        use_adj_matrix = false;
        adjacent = adjacent_list;
    }
    // set up adjacency, incidence lists
    adj = (int**)malloc(n*sizeof(int*));
    for (int i=0;i<n;i++) adj[i] = (int*)malloc(deg[i]*sizeof(int));
    inc = (PII**)malloc(n*sizeof(PII*));
    for (int i=0;i<n;i++) inc[i] = (PII*)malloc(deg[i]*sizeof(PII));
    int *d = (int*)calloc(n,sizeof(int));
    for (int i=0;i<m;i++) {
        int a=edges[i].a, b=edges[i].b;
        adj[a][d[a]]=b; adj[b][d[b]]=a;
        inc[a][d[a]]=PII(b,i); inc[b][d[b]]=PII(a,i);
        d[a]++; d[b]++;
    }
    for (int i=0;i<n;i++) {
        sort(adj[i],adj[i]+deg[i]);
        sort(inc[i],inc[i]+deg[i]);
    }
    // initialize orbit counts
    orbit = (int64**)malloc(n*sizeof(int64*));
    for (int i=0;i<n;i++) orbit[i] = (int64*)calloc(73,sizeof(int64));
    // initialize edge orbit counts
    eorbit = (int64**)malloc(m*sizeof(int64*));
    for (int i=0;i<m;i++) eorbit[i] = (int64*)calloc(68,sizeof(int64));

    if (strcmp(orbit_type,"node") == 0) {
        //printf("Counting NODE orbits of graphlets on %d nodes.\n\n",graphlet_size);
        if (graphlet_size==4) count4();
        if (graphlet_size==5) count5();
        if (strcmp(output_filename, "std") == 0) {
            cout << "orbit counts: \n" << writeResultsString(graphlet_size) << endl;
        } else {
            //out_str = writeResults(graphlet_size, output_filename);
            out_str = writeResultsString(graphlet_size);
        }
    } else {
        //printf("Counting EDGE orbits of graphlets on %d nodes.\n\n",graphlet_size);
        if (graphlet_size==4) ecount4();
        if (graphlet_size==5) ecount5();
        if (strcmp(output_filename, "std") == 0) {
            cout << "orbit counts: \n" << writeEdgeResultsString(graphlet_size) << endl;
        } else {
            //out_str = writeEdgeResults(graphlet_size, output_filename);
            out_str = writeEdgeResultsString(graphlet_size);
        }
    }

    free(edges);
    free(deg);
    free(d);
    if (use_adj_matrix) {
        free(adj_matrix);
    } else {
        for (int i=0;i<n;i++) free(adj[i]);
        free(adj);
    }
    for (int i=0;i<n;i++) free(inc[i]);
    free(inc);
    for (int i=0;i<n;i++) free(orbit[i]);
    free(orbit);
    for (int i=0;i<m;i++) free(eorbit[i]);
    free(eorbit);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq 0xe37b(%rip), %rdi      # 0x2dfb0
callq 0x21350
movq 0xe337(%rip), %rdi      # 0x2df78
callq 0x21370
movq -0x20(%rbp), %rax
movq %rax, -0x330(%rbp)
leaq -0x1e1(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x103a0
movq -0x330(%rbp), %rsi
movq -0x328(%rbp), %rdx
leaq -0x1e0(%rbp), %rdi
callq 0x212a0
jmp 0x1fc80
movl $0x10, %edi
movl $0x8, %esi
callq 0x21280
movl %eax, -0x334(%rbp)
jmp 0x1fc97
movl -0x334(%rbp), %edx
leaq -0x1c0(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x10350
jmp 0x1fcb2
leaq -0x1e0(%rbp), %rdi
callq 0x103e8
leaq -0x1e1(%rbp), %rdi
callq 0x10260
movq -0x10(%rbp), %rdi
leaq 0x8360(%rip), %rsi      # 0x28035
callq 0x10310
cmpl $0x0, %eax
je 0x1fdd2
movq -0x10(%rbp), %rdi
leaq 0x834c(%rip), %rsi      # 0x2803a
callq 0x10310
cmpl $0x0, %eax
je 0x1fdd2
movq 0xe2ed(%rip), %rdi      # 0x2dff0
leaq 0x8335(%rip), %rsi      # 0x2803f
callq 0x10200
movq %rax, -0x340(%rbp)
jmp 0x1fd18
movq -0x340(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x10200
movq %rax, -0x348(%rbp)
jmp 0x1fd31
movq -0x348(%rbp), %rdi
leaq 0x8317(%rip), %rsi      # 0x28056
callq 0x10200
movq %rax, -0x350(%rbp)
jmp 0x1fd4d
movq -0x350(%rbp), %rdi
movq 0xe205(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x1fd62
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0x20b81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
jmp 0x1fdaa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x103e8
leaq -0x1e1(%rbp), %rdi
callq 0x10260
jmp 0x20ba5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
jmp 0x20b99
cmpl $0x4, -0x14(%rbp)
je 0x1fe5d
cmpl $0x5, -0x14(%rbp)
je 0x1fe5d
movq 0xe207(%rip), %rdi      # 0x2dff0
leaq 0x8285(%rip), %rsi      # 0x28075
callq 0x10200
movq %rax, -0x358(%rbp)
jmp 0x1fdfe
movq -0x358(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x10380
movq %rax, -0x360(%rbp)
jmp 0x1fe16
movq -0x360(%rbp), %rdi
leaq 0x826a(%rip), %rsi      # 0x2808e
callq 0x10200
movq %rax, -0x368(%rbp)
jmp 0x1fe32
movq -0x368(%rbp), %rdi
movq 0xe120(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x1fe47
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0x20b81
movq -0x1c0(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x1c0(%rbp,%rax), %rdi
callq 0x10030
movb %al, -0x369(%rbp)
jmp 0x1fe7d
movb -0x369(%rbp), %al
testb $0x1, %al
jne 0x1fe89
jmp 0x1fed0
movq 0xe160(%rip), %rdi      # 0x2dff0
leaq 0x820b(%rip), %rsi      # 0x280a2
callq 0x10200
movq %rax, -0x378(%rbp)
jmp 0x1fea5
movq -0x378(%rbp), %rdi
movq 0xe0ad(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x1feba
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0x20b81
movq 0xe0c9(%rip), %rsi      # 0x2dfa0
leaq -0x1c0(%rbp), %rdi
callq 0x100f0
movq %rax, -0x380(%rbp)
jmp 0x1feec
movq -0x380(%rbp), %rdi
movq 0xe04e(%rip), %rsi      # 0x2df48
callq 0x100f0
jmp 0x1ff01
movl $0x0, -0x1fc(%rbp)
movq 0xe036(%rip), %rax      # 0x2df48
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x102f0
movq %rax, %rcx
movq 0xe090(%rip), %rax      # 0x2dfb8
movq %rcx, (%rax)
movq 0xe06e(%rip), %rax      # 0x2dfa0
movslq (%rax), %rdi
movl $0x4, %esi
callq 0x10110
movq %rax, %rcx
movq 0xe07f(%rip), %rax      # 0x2dfc8
movq %rcx, (%rax)
movl $0x0, -0x200(%rbp)
movl -0x200(%rbp), %eax
movq 0xdfe5(%rip), %rcx      # 0x2df48
cmpl (%rcx), %eax
jge 0x200e3
leaq -0x1c0(%rbp), %rdi
leaq -0x204(%rbp), %rsi
callq 0x100f0
movq %rax, -0x388(%rbp)
jmp 0x1ff87
movq -0x388(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x100f0
jmp 0x1ff9c
xorl %eax, %eax
cmpl -0x204(%rbp), %eax
jg 0x1ffd2
movl -0x204(%rbp), %eax
movq 0xdfed(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x1ffd2
xorl %eax, %eax
cmpl -0x208(%rbp), %eax
jg 0x1ffd2
movl -0x208(%rbp), %eax
movq 0xdfd2(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jl 0x20019
movq 0xe017(%rip), %rdi      # 0x2dff0
leaq 0x80df(%rip), %rsi      # 0x280bf
callq 0x10200
movq %rax, -0x390(%rbp)
jmp 0x1ffee
movq -0x390(%rbp), %rdi
movq 0xdf64(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x20003
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0x20b81
movl -0x204(%rbp), %eax
cmpl -0x208(%rbp), %eax
jne 0x2006e
movq 0xdfc2(%rip), %rdi      # 0x2dff0
leaq 0x80b0(%rip), %rsi      # 0x280e5
callq 0x10200
movq %rax, -0x398(%rbp)
jmp 0x20043
movq -0x398(%rbp), %rdi
movq 0xdf0f(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x20058
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0x20b81
movq 0xdf53(%rip), %rax      # 0x2dfc8
movq (%rax), %rcx
movslq -0x204(%rbp), %rdx
movl (%rcx,%rdx,4), %esi
incl %esi
movl %esi, (%rcx,%rdx,4)
movq (%rax), %rax
movslq -0x208(%rbp), %rcx
movl (%rax,%rcx,4), %edx
incl %edx
movl %edx, (%rax,%rcx,4)
movl -0x204(%rbp), %esi
movl -0x208(%rbp), %edx
leaq -0x210(%rbp), %rdi
callq 0x20fb0
jmp 0x200b3
movq 0xdefe(%rip), %rax      # 0x2dfb8
movq (%rax), %rax
movslq -0x200(%rbp), %rcx
movq -0x210(%rbp), %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x200(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x200(%rbp)
jmp 0x1ff56
movl $0x0, -0x214(%rbp)
movl -0x214(%rbp), %eax
movq 0xdea6(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x20148
movq 0xdec3(%rip), %rax      # 0x2dfc8
movq (%rax), %rax
movslq -0x214(%rbp), %rcx
leaq (%rax,%rcx,4), %rsi
leaq -0x1fc(%rbp), %rdi
callq 0x21390
movq %rax, -0x3a0(%rbp)
jmp 0x20128
movq -0x3a0(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1fc(%rbp)
movl -0x214(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x214(%rbp)
jmp 0x200ed
movq 0xde69(%rip), %rax      # 0x2dfb8
movq (%rax), %rsi
movq 0xddef(%rip), %rax      # 0x2df48
movslq (%rax), %rax
leaq (%rsi,%rax,8), %rdx
leaq -0x248(%rbp), %rdi
callq 0x213d0
jmp 0x2016e
leaq -0x248(%rbp), %rdi
callq 0x21440
movl %eax, -0x3a4(%rbp)
movq 0xddc1(%rip), %rax      # 0x2df48
movl (%rax), %eax
movl %eax, -0x3a8(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x21460
movl -0x3a8(%rbp), %ecx
movl -0x3a4(%rbp), %eax
cmpl %ecx, %eax
je 0x201f2
movq 0xde3e(%rip), %rdi      # 0x2dff0
leaq 0x7f5b(%rip), %rsi      # 0x28114
callq 0x10200
movq %rax, -0x3b0(%rbp)
jmp 0x201c7
movq -0x3b0(%rbp), %rdi
movq 0xdd8b(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x201dc
movl $0x0, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
jmp 0x20b81
movq 0xdda7(%rip), %rax      # 0x2dfa0
movslq (%rax), %rax
movq 0xdd9d(%rip), %rcx      # 0x2dfa0
movslq (%rcx), %rcx
imulq %rcx, %rax
cmpq $0x32000000, %rax       # imm = 0x32000000
jge 0x203b5
movb $0x1, -0x31(%rbp)
movq 0xdd87(%rip), %rax      # 0x2dfa8
leaq -0xfa68(%rip), %rcx     # 0x107c0
movq %rcx, (%rax)
movq 0xdd6e(%rip), %rax      # 0x2dfa0
movl (%rax), %eax
movq 0xdd65(%rip), %rcx      # 0x2dfa0
imull (%rcx), %eax
movl $0x20, %ecx
cltd
idivl %ecx
addl $0x1, %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x10110
movq %rax, %rcx
movq 0xdd20(%rip), %rax      # 0x2df80
movq %rcx, (%rax)
movl $0x0, -0x24c(%rbp)
movl -0x24c(%rbp), %eax
movq 0xdcce(%rip), %rcx      # 0x2df48
cmpl (%rcx), %eax
jge 0x203b3
movq 0xdd2f(%rip), %rax      # 0x2dfb8
movq (%rax), %rax
movslq -0x24c(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl %eax, -0x250(%rbp)
movq 0xdd15(%rip), %rax      # 0x2dfb8
movq (%rax), %rax
movslq -0x24c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, -0x254(%rbp)
movl -0x250(%rbp), %eax
movq 0xdcdc(%rip), %rcx      # 0x2dfa0
imull (%rcx), %eax
addl -0x254(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl %edx, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x3cc(%rbp)
movq 0xdc95(%rip), %rax      # 0x2df80
movq (%rax), %rax
movq %rax, -0x3c8(%rbp)
movl -0x250(%rbp), %eax
movq 0xdc9e(%rip), %rcx      # 0x2dfa0
imull (%rcx), %eax
addl -0x254(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl -0x3cc(%rbp), %edx
movl %eax, %ecx
movq -0x3c8(%rbp), %rax
movslq %ecx, %rcx
orl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x254(%rbp), %eax
movq 0xdc68(%rip), %rcx      # 0x2dfa0
imull (%rcx), %eax
addl -0x250(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl %edx, %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x3bc(%rbp)
movq 0xdc21(%rip), %rax      # 0x2df80
movq (%rax), %rax
movq %rax, -0x3b8(%rbp)
movl -0x254(%rbp), %eax
movq 0xdc2a(%rip), %rcx      # 0x2dfa0
imull (%rcx), %eax
addl -0x250(%rbp), %eax
movl $0x20, %ecx
cltd
idivl %ecx
movl -0x3bc(%rbp), %edx
movl %eax, %ecx
movq -0x3b8(%rbp), %rax
movslq %ecx, %rcx
orl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl -0x24c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24c(%rbp)
jmp 0x2026d
jmp 0x203ca
movb $0x0, -0x31(%rbp)
movq 0xdbe8(%rip), %rax      # 0x2dfa8
leaq -0xfc67(%rip), %rcx     # 0x10760
movq %rcx, (%rax)
movq 0xdbcf(%rip), %rax      # 0x2dfa0
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x102f0
movq %rax, %rcx
movq 0xdba9(%rip), %rax      # 0x2df90
movq %rcx, (%rax)
movl $0x0, -0x258(%rbp)
movl -0x258(%rbp), %eax
movq 0xdb9f(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x2044c
movq 0xdbbc(%rip), %rax      # 0x2dfc8
movq (%rax), %rax
movslq -0x258(%rbp), %rcx
movslq (%rax,%rcx,4), %rdi
shlq $0x2, %rdi
callq 0x102f0
movq %rax, %rdx
movq 0xdb63(%rip), %rax      # 0x2df90
movq (%rax), %rax
movslq -0x258(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x258(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x258(%rbp)
jmp 0x203f4
movq 0xdb4d(%rip), %rax      # 0x2dfa0
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x102f0
movq %rax, %rcx
movq 0xdb1f(%rip), %rax      # 0x2df88
movq %rcx, (%rax)
movl $0x0, -0x25c(%rbp)
movl -0x25c(%rbp), %eax
movq 0xdb1d(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x204ce
movq 0xdb3a(%rip), %rax      # 0x2dfc8
movq (%rax), %rax
movslq -0x25c(%rbp), %rcx
movslq (%rax,%rcx,4), %rdi
shlq $0x3, %rdi
callq 0x102f0
movq %rax, %rdx
movq 0xdad9(%rip), %rax      # 0x2df88
movq (%rax), %rax
movslq -0x25c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x25c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x25c(%rbp)
jmp 0x20476
movq 0xdacb(%rip), %rax      # 0x2dfa0
movslq (%rax), %rdi
movl $0x4, %esi
callq 0x10110
movq %rax, -0x268(%rbp)
movl $0x0, -0x26c(%rbp)
movl -0x26c(%rbp), %eax
movq 0xda48(%rip), %rcx      # 0x2df48
cmpl (%rcx), %eax
jge 0x20665
movq 0xdaa9(%rip), %rax      # 0x2dfb8
movq (%rax), %rcx
movslq -0x26c(%rbp), %rdx
movl (%rcx,%rdx,8), %ecx
movl %ecx, -0x270(%rbp)
movq (%rax), %rax
movslq -0x26c(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, -0x274(%rbp)
movl -0x274(%rbp), %esi
movq 0xda4d(%rip), %rax      # 0x2df90
movq (%rax), %rcx
movslq -0x270(%rbp), %rdi
movq (%rcx,%rdi,8), %rcx
movq -0x268(%rbp), %rdx
movslq (%rdx,%rdi,4), %rdx
movl %esi, (%rcx,%rdx,4)
movl -0x270(%rbp), %edx
movq (%rax), %rax
movslq -0x274(%rbp), %rsi
movq (%rax,%rsi,8), %rax
movq -0x268(%rbp), %rcx
movslq (%rcx,%rsi,4), %rcx
movl %edx, (%rax,%rcx,4)
leaq -0x27c(%rbp), %rdi
leaq -0x274(%rbp), %rsi
leaq -0x26c(%rbp), %rdx
callq 0x20f50
jmp 0x2059d
movq 0xd9e4(%rip), %rax      # 0x2df88
movq (%rax), %rax
movslq -0x270(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq -0x268(%rbp), %rcx
movslq (%rcx,%rdx,4), %rcx
leaq (%rax,%rcx,8), %rdi
leaq -0x27c(%rbp), %rsi
callq 0x20f80
leaq -0x284(%rbp), %rdi
leaq -0x270(%rbp), %rsi
leaq -0x26c(%rbp), %rdx
callq 0x20f50
jmp 0x205e9
movq 0xd998(%rip), %rax      # 0x2df88
movq (%rax), %rax
movslq -0x274(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x268(%rbp), %rax
movslq -0x274(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
shlq $0x3, %rax
addq %rax, %rdi
leaq -0x284(%rbp), %rsi
callq 0x20f80
movq -0x268(%rbp), %rax
movslq -0x270(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movq -0x268(%rbp), %rax
movslq -0x274(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
movl -0x26c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x26c(%rbp)
jmp 0x204f3
movl $0x0, -0x288(%rbp)
movl -0x288(%rbp), %eax
movq 0xd924(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x206ef
movq 0xd909(%rip), %rax      # 0x2df90
movq (%rax), %rax
movslq -0x288(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0xd92c(%rip), %rax      # 0x2dfc8
movq (%rax), %rax
movslq (%rax,%rcx,4), %rax
leaq (%rdi,%rax,4), %rsi
callq 0x21480
jmp 0x206ae
movq 0xd8d3(%rip), %rax      # 0x2df88
movq (%rax), %rax
movslq -0x288(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0xd8fe(%rip), %rax      # 0x2dfc8
movq (%rax), %rax
movslq (%rax,%rcx,4), %rax
leaq (%rdi,%rax,8), %rsi
callq 0x214c0
jmp 0x206dc
jmp 0x206de
movl -0x288(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x288(%rbp)
jmp 0x2066f
movq 0xd8aa(%rip), %rax      # 0x2dfa0
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x102f0
movq %rax, %rcx
movq 0xd82c(%rip), %rax      # 0x2df38
movq %rcx, (%rax)
movl $0x0, -0x28c(%rbp)
movl -0x28c(%rbp), %eax
movq 0xd87a(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x20762
movl $0x49, %edi
movl $0x8, %esi
callq 0x10110
movq %rax, %rdx
movq 0xd7f5(%rip), %rax      # 0x2df38
movq (%rax), %rax
movslq -0x28c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x28c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28c(%rbp)
jmp 0x20719
movq 0xd7df(%rip), %rax      # 0x2df48
movslq (%rax), %rdi
shlq $0x3, %rdi
callq 0x102f0
movq %rax, %rcx
movq 0xd7d9(%rip), %rax      # 0x2df58
movq %rcx, (%rax)
movl $0x0, -0x290(%rbp)
movl -0x290(%rbp), %eax
movq 0xd7af(%rip), %rcx      # 0x2df48
cmpl (%rcx), %eax
jge 0x207d5
movl $0x44, %edi
movl $0x8, %esi
callq 0x10110
movq %rax, %rdx
movq 0xd7a2(%rip), %rax      # 0x2df58
movq (%rax), %rax
movslq -0x290(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x290(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x290(%rbp)
jmp 0x2078c
movq -0x10(%rbp), %rdi
leaq 0x7855(%rip), %rsi      # 0x28035
callq 0x10310
cmpl $0x0, %eax
jne 0x208e6
cmpl $0x4, -0x14(%rbp)
jne 0x207fd
callq 0x108e0
jmp 0x207fb
jmp 0x207fd
cmpl $0x5, -0x14(%rbp)
jne 0x2080c
callq 0x12c40
jmp 0x2080a
jmp 0x2080c
movq -0x28(%rbp), %rdi
leaq 0x792d(%rip), %rsi      # 0x28144
callq 0x10310
cmpl $0x0, %eax
jne 0x208b4
movq 0xd794(%rip), %rdi      # 0x2dfc0
leaq 0x7915(%rip), %rsi      # 0x28148
callq 0x10200
movq %rax, -0x3d8(%rbp)
jmp 0x20841
movl -0x14(%rbp), %esi
leaq -0x2b0(%rbp), %rdi
callq 0x1f5a0
jmp 0x20852
movq -0x3d8(%rbp), %rdi
leaq -0x2b0(%rbp), %rsi
callq 0x101c0
movq %rax, -0x3e0(%rbp)
jmp 0x2086e
movq -0x3e0(%rbp), %rdi
movq 0xd6e4(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x20883
leaq -0x2b0(%rbp), %rdi
callq 0x103e8
jmp 0x208e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x103e8
jmp 0x20b99
movl -0x14(%rbp), %esi
leaq -0x2d0(%rbp), %rdi
callq 0x1f5a0
jmp 0x208c5
movq -0x30(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x102b0
leaq -0x2d0(%rbp), %rdi
callq 0x103e8
jmp 0x209db
cmpl $0x4, -0x14(%rbp)
jne 0x208f5
callq 0x117e0
jmp 0x208f3
jmp 0x208f5
cmpl $0x5, -0x14(%rbp)
jne 0x20904
callq 0x18d30
jmp 0x20902
jmp 0x20904
movq -0x28(%rbp), %rdi
leaq 0x7835(%rip), %rsi      # 0x28144
callq 0x10310
cmpl $0x0, %eax
jne 0x209ac
movq 0xd69c(%rip), %rdi      # 0x2dfc0
leaq 0x781d(%rip), %rsi      # 0x28148
callq 0x10200
movq %rax, -0x3e8(%rbp)
jmp 0x20939
movl -0x14(%rbp), %esi
leaq -0x2f0(%rbp), %rdi
callq 0x1f9d0
jmp 0x2094a
movq -0x3e8(%rbp), %rdi
leaq -0x2f0(%rbp), %rsi
callq 0x101c0
movq %rax, -0x3f0(%rbp)
jmp 0x20966
movq -0x3f0(%rbp), %rdi
movq 0xd5ec(%rip), %rsi      # 0x2df60
callq 0x10240
jmp 0x2097b
leaq -0x2f0(%rbp), %rdi
callq 0x103e8
jmp 0x209d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1f0(%rbp)
movl %eax, -0x1f4(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x103e8
jmp 0x20b99
movl -0x14(%rbp), %esi
leaq -0x310(%rbp), %rdi
callq 0x1f9d0
jmp 0x209bd
movq -0x30(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x102b0
leaq -0x310(%rbp), %rdi
callq 0x103e8
jmp 0x209db
movq 0xd5d6(%rip), %rax      # 0x2dfb8
movq (%rax), %rdi
callq 0x102a0
movq 0xd5d7(%rip), %rax      # 0x2dfc8
movq (%rax), %rdi
callq 0x102a0
movq -0x268(%rbp), %rdi
callq 0x102a0
testb $0x1, -0x31(%rbp)
je 0x20a1c
movq 0xd56e(%rip), %rax      # 0x2df80
movq (%rax), %rdi
callq 0x102a0
jmp 0x20a71
movl $0x0, -0x314(%rbp)
movl -0x314(%rbp), %eax
movq 0xd56d(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x20a62
movq 0xd552(%rip), %rax      # 0x2df90
movq (%rax), %rax
movslq -0x314(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x102a0
movl -0x314(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x314(%rbp)
jmp 0x20a26
movq 0xd527(%rip), %rax      # 0x2df90
movq (%rax), %rdi
callq 0x102a0
movl $0x0, -0x318(%rbp)
movl -0x318(%rbp), %eax
movq 0xd518(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x20ab7
movq 0xd4f5(%rip), %rax      # 0x2df88
movq (%rax), %rax
movslq -0x318(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x102a0
movl -0x318(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x318(%rbp)
jmp 0x20a7b
movq 0xd4ca(%rip), %rax      # 0x2df88
movq (%rax), %rdi
callq 0x102a0
movl $0x0, -0x31c(%rbp)
movl -0x31c(%rbp), %eax
movq 0xd4c3(%rip), %rcx      # 0x2dfa0
cmpl (%rcx), %eax
jge 0x20b0c
movq 0xd450(%rip), %rax      # 0x2df38
movq (%rax), %rax
movslq -0x31c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x102a0
movl -0x31c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x31c(%rbp)
jmp 0x20ad0
movq 0xd425(%rip), %rax      # 0x2df38
movq (%rax), %rdi
callq 0x102a0
movl $0x0, -0x320(%rbp)
movl -0x320(%rbp), %eax
movq 0xd416(%rip), %rcx      # 0x2df48
cmpl (%rcx), %eax
jge 0x20b61
movq 0xd41b(%rip), %rax      # 0x2df58
movq (%rax), %rax
movslq -0x320(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x102a0
movl -0x320(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x320(%rbp)
jmp 0x20b25
movq 0xd3f0(%rip), %rax      # 0x2df58
movq (%rax), %rdi
callq 0x102a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0x1f8(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x10160
movl -0x4(%rbp), %eax
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
leaq -0x1c0(%rbp), %rdi
callq 0x10160
movq -0x1f0(%rbp), %rdi
callq 0x10390
nopw %cs:(%rax,%rax)