// File: yueww[P]TSR/test.c
// Function: main
int main(int argc,char *argv[]){
    if(argc<3){
        printf("not enough arguments!\n");
        exit(0);
    }
    if(argc==4){
        if(strcmp(argv[3],"-t")==0){
            printf("please input host:");
            scanf("%s",host);
            printf("please input user:");
            scanf("%s",user);
            printf("please input password:");
            scanf("%s",password);
            printf("please input database:");
            scanf("%s",database);
            printf("please input port:");
            scanf("%u",&port);
            fflush(stdin);
            mysql_init(&mysql);
            if(!mysql_real_connect(&mysql,host,user,password,database,port,NULL,0)){
                printf("mysql_real_connect failed!\n");
                return 0;
            }
            useDb=true;
        }else{
            printf("unknown option:%s\n",argv[3]);
            return 0;
        }
    }
    if(argc>4){
        printf("too much arguments!\n");
        return 0;
    }
    /*
    set a share memory,use it to check whether export process is running. 
    */
    if((shmid=shmget(IPC_PRIVATE,SHM_SIZE,IPC_CREAT|0666))==-1){
        printf("shmget error!\n");
        exit(0);
    }
    if((shmptr=shmat(shmid,(const void *)0,0))==(void *)-1){
        printf("shmat error!\n");
        exit(0);
    }
    *(int *)shmptr=0;
    /*
    initiate correlative data structure. 
    */
    unusedChainHead=&flowNodeBuf[0];
    unusedChainTail=&flowNodeBuf[LINKNODEBUFSIZE-1];
    int i;
    for(i=0;i<LINKNODEBUFSIZE-1;i++){
        flowNodeBuf[i].next=&flowNodeBuf[i+1];
    }
    flowNodeBuf[i].next=NULL;
    srcIpRootNode=&srcIpInnerNodeBuf[0];
    currUsedSrcIpInnerNodes++;
    dstIpRootNode=&dstIpInnerNodeBuf[0];
    currUsedDstIpInnerNodes++;
    for(i=0;i<FLOWAMOUNTINMEM;i++){
        srcIpIndexNodeBuf[i].indexNum=i;
        srcPortIndexNodeBuf[i].indexNum=i;
        dstIpIndexNodeBuf[i].indexNum=i;
        dstPortIndexNodeBuf[i].indexNum=i;
    }
    genAllParas(VECTORDIM,W);
    pthread_t proc;
    int createRes=pthread_create(&proc,0,processFunc,0);
    if(createRes!=0){
        printf("fail to create storage process,exit system!\n");
        exit(0);
    }
    char *command=processCommand(argv[1],argv[2]);
    if(!command){
        exit(0);
    }
    int exeRes=system(command);
    free(command);
    if(exeRes==127){
        printf("fail to launch probe because of exec error!\n");
        exit(0);
    }else if(exeRes==-1){
        printf("fail to launch probe because of fork error!\n");
        exit(0);
    }else{
        char flag;
        while(1){
            printf("input q to stop emitting flows!\n");
            scanf("%c",&flag);
            if(flag=='q'){
                int res=system("ps aux | grep fprobe | grep -v grep | cut -c 9-15 | xargs kill -9");
                while(res==-1||res==127){
                    res=system("ps aux | grep fprobe | grep -v grep | cut -c 9-15 | xargs kill -9");
                }
                break;
            }else{
                continue;
            }
        }
        printf("emit process terminated!\n");
        sleep(1);
        while(*(int *)shmptr){
            
        }
        int canRes=pthread_cancel(pro);
        if(canRes!=0){
            printf("fail to cancel process which receive flows!\n");
        }
        threadpool_destroy(pThreadPool);
        canRes=pthread_cancel(con);
        if(canRes!=0){
            printf("fail to cancel process which index flows!\n");
        }
        /*
         resort left flowRecord in cache(flowBlock).left flowRecords are fewer than 40, so
         we can not resort them by call resort().
        */
        int k;
        tuple4vec vec;
        int key;
        for(k=0;k<n;k++){
            extractTuple4(&vec,flowBlock[out+k]);
            key=myHash(vec);
            insertFlowsToBucket(flowBlock[out+k],key);
        }
        /*
        flush the hashTable which is used in resort,because the left flowRecord can not satisfy the 
        old rule,they can not be exported automatically.
        */
        int i;
        flowRecordNode *pF;
        for(i=0;i<TABLESIZE;i++){
            if(hashTable[i].currNum>0){
                pF=&hashTable[i].head;
                int j;
                for(j=0;j<hashTable[i].currNum;j++){
                    pF=pF->next;
                    memcpy(&flowWaitExport[inBase++],&(pF->rec),FLOWSIZE);
                }
            }
        }
        /*
        index();
        int *exportRes=exportDataAndIndex();
        FILE *fp=fopen("./exportRecord.log","a+");
        */
        FILE *fp=fopen("./exportRecord.log","a+");
        while(outBase<inBase){
            int exportFlag=index();
            if(exportFlag){
                int *exportRes=exportDataAndIndex();
                int writeRes[6];
                writeRes[0]=fprintf(fp,"export %d flows.\n",exportRes[0]/48);
                writeRes[1]=fprintf(fp,"data take up %d bytes\n",exportRes[0]);
                writeRes[2]=fprintf(fp,"srcIp take up %d bytes\n",exportRes[1]);
                writeRes[3]=fprintf(fp,"dstIp take up %d bytes\n",exportRes[2]);
                writeRes[4]=fprintf(fp,"srcPort take up %d bytes\n",exportRes[3]);
                writeRes[5]=fprintf(fp,"dstPort take up %d bytes\n",exportRes[4]);
                if(writeRes[0]<0 || writeRes[1]<0 || writeRes[2]<0 || writeRes[3]<0 ||writeRes[4]<0 ||writeRes[5]<0){
                    printf("error in write log!\n");
                } 
                free(exportRes);
                memcpy(flowWaitExport,flowWaitExport+outBase,(inBase-outBase)*FLOWSIZE);
                int i;
                for(i=0;i<outBase;i++){
                    srcIpIndexNodeBuf[i].next=NULL;
                    dstIpIndexNodeBuf[i].next=NULL;
                    srcPortIndexNodeBuf[i].next=NULL;
                    dstPortIndexNodeBuf[i].next=NULL;
                }
                memset(srcIpInnerNodeBuf,0,sizeof(innerNode)*currUsedSrcIpInnerNodes);
                memset(dstIpInnerNodeBuf,0,sizeof(innerNode)*currUsedDstIpInnerNodes);
                memset(srcIpLeafNodeBuf,0,sizeof(leafNode)*currUsedSrcIpLeafNodes);
                memset(dstIpLeafNodeBuf,0,sizeof(leafNode)*currUsedDstIpLeafNodes);
                memset(&srcPortIndexTable,0,sizeof(portIndexTable));
                memset(&dstPortIndexTable,0,sizeof(portIndexTable));
                srcIpRootNode=&srcIpInnerNodeBuf[0];
                dstIpRootNode=&dstIpInnerNodeBuf[0];
                inBase-=outBase;
                outBase=0;
                currUsedSrcIpInnerNodes=1;
                currUsedDstIpInnerNodes=1;
                currUsedSrcIpLeafNodes=0;
                currUsedDstIpLeafNodes=0;
                currUsedSrcIpIndexNodes=0;
                currUsedDstIpIndexNodes=0;
                currUsedSrcPortIndexNodes=0;
                currUsedDstPortIndexNodes=0;
            }
        }
        int *exportRes=exportDataAndIndex();
        int writeRes[6];
        writeRes[0]=fprintf(fp,"export %d flows.\n",exportRes[0]/48);
        writeRes[1]=fprintf(fp,"data take up %d bytes\n",exportRes[0]);
        writeRes[2]=fprintf(fp,"srcIp take up %d bytes\n",exportRes[1]);
        writeRes[3]=fprintf(fp,"dstIp take up %d bytes\n",exportRes[2]);
        writeRes[4]=fprintf(fp,"srcPort take up %d bytes\n",exportRes[3]);
        writeRes[5]=fprintf(fp,"dstPort take up %d bytes\n",exportRes[4]);
        if(writeRes[0]<0 || writeRes[1]<0 || writeRes[2]<0 || writeRes[3]<0 ||writeRes[4]<0 ||writeRes[5]<0){
            printf("error in write log!\n");
        } 
        free(exportRes);
    }
    mysql_close(&mysql);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
jge 0x8cd4
leaq 0x1831(%rip), %rdi      # 0xa4f7
movb $0x0, %al
callq 0x2040
xorl %edi, %edi
callq 0x2390
cmpl $0x4, -0x8(%rbp)
jne 0x8e54
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
leaq 0x1821(%rip), %rsi      # 0xa50e
callq 0x2410
cmpl $0x0, %eax
jne 0x8e30
leaq 0x180f(%rip), %rdi      # 0xa511
movb $0x0, %al
callq 0x2040
leaq 0x1814(%rip), %rdi      # 0xa524
leaq 0x6ab3c159(%rip), %rsi  # 0x6ab44e70
movb $0x0, %al
callq 0x2330
leaq 0x1802(%rip), %rdi      # 0xa527
movb $0x0, %al
callq 0x2040
leaq 0x17f1(%rip), %rdi      # 0xa524
leaq 0x6ab3c236(%rip), %rsi  # 0x6ab44f70
movb $0x0, %al
callq 0x2330
leaq 0x17f2(%rip), %rdi      # 0xa53a
movb $0x0, %al
callq 0x2040
leaq 0x17ce(%rip), %rdi      # 0xa524
leaq 0x6ab3c293(%rip), %rsi  # 0x6ab44ff0
movb $0x0, %al
callq 0x2330
leaq 0x17e6(%rip), %rdi      # 0xa551
movb $0x0, %al
callq 0x2040
leaq 0x17ab(%rip), %rdi      # 0xa524
leaq 0x6ab3c2f0(%rip), %rsi  # 0x6ab45070
movb $0x0, %al
callq 0x2330
leaq 0x17da(%rip), %rdi      # 0xa568
movb $0x0, %al
callq 0x2040
leaq 0x17df(%rip), %rdi      # 0xa57b
leaq 0x6ab3c34d(%rip), %rsi  # 0x6ab450f0
movb $0x0, %al
callq 0x2330
movq 0x622f(%rip), %rax      # 0xefe0
movq (%rax), %rdi
callq 0x2350
leaq 0x6ab3c338(%rip), %rdi  # 0x6ab450f8
callq 0x2120
movl 0x6ab3c324(%rip), %r9d  # 0x6ab450f0
leaq 0x6ab3c325(%rip), %rdi  # 0x6ab450f8
leaq 0x6ab3c096(%rip), %rsi  # 0x6ab44e70
leaq 0x6ab3c18f(%rip), %rdx  # 0x6ab44f70
leaq 0x6ab3c208(%rip), %rcx  # 0x6ab44ff0
leaq 0x6ab3c281(%rip), %r8   # 0x6ab45070
xorl %eax, %eax
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x2150
cmpq $0x0, %rax
jne 0x8e27
leaq 0x176a(%rip), %rdi      # 0xa57e
movb $0x0, %al
callq 0x2040
movl $0x0, -0x4(%rbp)
jmp 0x9906
movb $0x1, 0x6ab3c752(%rip)  # 0x6ab45580
jmp 0x8e52
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
leaq 0x175b(%rip), %rdi      # 0xa59a
movb $0x0, %al
callq 0x2040
movl $0x0, -0x4(%rbp)
jmp 0x9906
jmp 0x8e54
cmpl $0x4, -0x8(%rbp)
jle 0x8e74
leaq 0x174c(%rip), %rdi      # 0xa5ad
movb $0x0, %al
callq 0x2040
movl $0x0, -0x4(%rbp)
jmp 0x9906
xorl %edi, %edi
movl $0x1000, %esi           # imm = 0x1000
movl $0x3b6, %edx            # imm = 0x3B6
callq 0x2180
movl %eax, 0x6ab3c6f9(%rip)  # 0x6ab45584
cmpl $-0x1, %eax
jne 0x8ea5
leaq 0x172b(%rip), %rdi      # 0xa5c2
movb $0x0, %al
callq 0x2040
xorl %edi, %edi
callq 0x2390
movl 0x6ab3c6d9(%rip), %edi  # 0x6ab45584
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x23f0
movq %rax, 0x6ab3c6cb(%rip)  # 0x6ab45588
movq $-0x1, %rcx
cmpq %rcx, %rax
jne 0x8ede
leaq 0x1701(%rip), %rdi      # 0xa5d1
movb $0x0, %al
callq 0x2040
xorl %edi, %edi
callq 0x2390
movq 0x6ab3c6a3(%rip), %rax  # 0x6ab45588
movl $0x0, (%rax)
leaq 0xed35dce(%rip), %rax   # 0xed3ecc0
leaq 0x1275dc7(%rip), %rcx   # 0x127ecc0
movq %rcx, (%rax)
leaq 0xed35dc5(%rip), %rax   # 0xed3ecc8
leaq 0x1275db6(%rip), %rcx   # 0x127ecc0
addq $0xdabffc8, %rcx        # imm = 0xDABFFC8
movq %rcx, (%rax)
movl $0x0, -0x14(%rbp)
cmpl $0x3e7fff, -0x14(%rbp)  # imm = 0x3E7FFF
jge 0x8f5a
movl -0x14(%rbp), %eax
addl $0x1, %eax
cltq
leaq 0x1275d8d(%rip), %rcx   # 0x127ecc0
imulq $0x38, %rax, %rax
addq %rax, %rcx
movslq -0x14(%rbp), %rdx
leaq 0x1275d7b(%rip), %rax   # 0x127ecc0
imulq $0x38, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8f1b
movslq -0x14(%rbp), %rcx
leaq 0x1275d5b(%rip), %rax   # 0x127ecc0
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
leaq 0x651d3566(%rip), %rax  # 0x651dc4e0
leaq 0x5195355f(%rip), %rcx  # 0x5195c4e0
movq %rcx, (%rax)
leaq 0x653d357d(%rip), %rax  # 0x653dc508
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x653d3571(%rip), %rax  # 0x653dc508
movl %ecx, (%rax)
leaq 0x651d3548(%rip), %rax  # 0x651dc4e8
leaq 0x54063539(%rip), %rcx  # 0x5406c4e0
movq %rcx, (%rax)
leaq 0x653d355f(%rip), %rax  # 0x653dc510
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x653d3553(%rip), %rax  # 0x653dc510
movl %ecx, (%rax)
movl $0x0, -0x14(%rbp)
cmpl $0x989680, -0x14(%rbp)  # imm = 0x989680
jge 0x9036
movl -0x14(%rbp), %ecx
movslq -0x14(%rbp), %rdx
leaq 0x2b6f9503(%rip), %rax  # 0x2b7024e0
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %ecx
movslq -0x14(%rbp), %rdx
leaq 0x3e8264ec(%rip), %rax  # 0x3e82f4e0
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %ecx
movslq -0x14(%rbp), %rdx
leaq 0x34f8fcd5(%rip), %rax  # 0x34f98ce0
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %ecx
movslq -0x14(%rbp), %rdx
leaq 0x480bccbe(%rip), %rax  # 0x480c5ce0
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8fc6
movl $0xa, %edi
movsd 0x1085(%rip), %xmm0     # 0xa0c8
callq 0x3640
leaq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
leaq 0x8c9(%rip), %rdx       # 0x9920
movq %rcx, %rsi
callq 0x2520
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x907d
leaq 0x1570(%rip), %rdi      # 0xa5df
movb $0x0, %al
callq 0x2040
xorl %edi, %edi
callq 0x2390
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x99e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x90a4
xorl %edi, %edi
callq 0x2390
movq -0x30(%rbp), %rdi
callq 0x2270
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2370
cmpl $0x7f, -0x34(%rbp)
jne 0x90d4
leaq 0x1546(%rip), %rdi      # 0xa60c
movb $0x0, %al
callq 0x2040
xorl %edi, %edi
callq 0x2390
cmpl $-0x1, -0x34(%rbp)
jne 0x90ef
leaq 0x1558(%rip), %rdi      # 0xa639
movb $0x0, %al
callq 0x2040
xorl %edi, %edi
callq 0x2390
jmp 0x90f1
leaq 0x156e(%rip), %rdi      # 0xa666
movb $0x0, %al
callq 0x2040
leaq 0x1581(%rip), %rdi      # 0xa687
leaq -0x35(%rbp), %rsi
movb $0x0, %al
callq 0x2330
movsbl -0x35(%rbp), %eax
cmpl $0x71, %eax
jne 0x9163
leaq 0x1569(%rip), %rdi      # 0xa68a
callq 0x2270
movl %eax, -0x3c(%rbp)
movb $0x1, %al
cmpl $-0x1, -0x3c(%rbp)
movb %al, -0x151(%rbp)
je 0x9144
cmpl $0x7f, -0x3c(%rbp)
sete %al
movb %al, -0x151(%rbp)
movb -0x151(%rbp), %al
testb $0x1, %al
jne 0x9150
jmp 0x9161
leaq 0x1533(%rip), %rdi      # 0xa68a
callq 0x2270
movl %eax, -0x3c(%rbp)
jmp 0x9129
jmp 0x9165
jmp 0x90f1
leaq 0x1560(%rip), %rdi      # 0xa6cc
movb $0x0, %al
callq 0x2040
movl $0x1, %edi
callq 0x21e0
movq 0x6ab3c404(%rip), %rax  # 0x6ab45588
cmpl $0x0, (%rax)
je 0x918b
jmp 0x917d
movq 0x6ab3c3fe(%rip), %rdi  # 0x6ab45590
callq 0x2400
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x91ae
leaq 0x153f(%rip), %rdi      # 0xa6e6
movb $0x0, %al
callq 0x2040
leaq 0x6123(%rip), %rax      # 0xf2d8
movq (%rax), %rdi
callq 0x2ca0
movq 0x6ab3c3d4(%rip), %rdi  # 0x6ab45598
callq 0x2400
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
je 0x91e0
leaq 0x153a(%rip), %rdi      # 0xa713
movb $0x0, %al
callq 0x2040
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
leaq 0x60e3(%rip), %rcx      # 0xf2d4
cmpl (%rcx), %eax
jge 0x92f7
leaq 0x6ab0ce30(%rip), %rax  # 0x6ab16030
movl (%rax), %eax
addl -0x44(%rbp), %eax
movl %eax, %eax
leaq 0x16172(%rip), %rsi     # 0x1f380
imulq $0x30, %rax, %rax
addq %rax, %rsi
leaq -0x90(%rbp), %rdi
movl $0x30, %edx
callq 0x2260
movups -0x90(%rbp), %xmm0
movups -0x80(%rbp), %xmm1
movups -0x70(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq -0x58(%rbp), %rdi
callq 0x52b0
movq -0x58(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x98(%rbp)
leaq -0xa8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rax), %eax
movl %eax, 0x10(%rsp)
callq 0x36c0
movl %eax, -0x5c(%rbp)
leaq 0x6ab0cd98(%rip), %rax  # 0x6ab16030
movl (%rax), %eax
addl -0x44(%rbp), %eax
movl %eax, %eax
leaq 0x160da(%rip), %rsi     # 0x1f380
imulq $0x30, %rax, %rax
addq %rax, %rsi
leaq -0xd8(%rbp), %rdi
movl $0x30, %edx
callq 0x2260
movl -0x5c(%rbp), %edi
movups -0xd8(%rbp), %xmm0
movups -0xc8(%rbp), %xmm1
movups -0xb8(%rbp), %xmm2
movq %rsp, %rax
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0x5370
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x91e7
movl $0x0, -0xdc(%rbp)
cmpl $0x400, -0xdc(%rbp)     # imm = 0x400
jge 0x93ee
movslq -0xdc(%rbp), %rcx
leaq 0x12659a1(%rip), %rax   # 0x126ecc0
shlq $0x6, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jle 0x93d8
movslq -0xdc(%rbp), %rcx
leaq 0x1265983(%rip), %rax   # 0x126ecc0
shlq $0x6, %rcx
addq %rcx, %rax
addq $0x8, %rax
movq %rax, -0xe8(%rbp)
movl $0x0, -0xec(%rbp)
movl -0xec(%rbp), %eax
movslq -0xdc(%rbp), %rdx
leaq 0x1265953(%rip), %rcx   # 0x126ecc0
shlq $0x6, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jge 0x93d6
movq -0xe8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xe8(%rbp)
leaq 0x653d3160(%rip), %rax  # 0x653dc4f0
movl (%rax), %eax
movl %eax, %edx
addl $0x1, %edx
leaq 0x653d3152(%rip), %rcx  # 0x653dc4f0
movl %edx, (%rcx)
cltq
leaq 0xed35937(%rip), %rdi   # 0xed3ece0
imulq $0x30, %rax, %rax
addq %rax, %rdi
movq -0xe8(%rbp), %rsi
addq $0x8, %rsi
movl $0x30, %edx
callq 0x2260
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x9359
jmp 0x93d8
jmp 0x93da
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x9301
leaq 0x104a(%rip), %rdi      # 0xa43f
leaq 0x1056(%rip), %rsi      # 0xa452
callq 0x2360
movq %rax, -0xf8(%rbp)
leaq 0x653d30e5(%rip), %rax  # 0x653dc4f4
movl (%rax), %eax
leaq 0x653d30d8(%rip), %rcx  # 0x653dc4f0
cmpl (%rcx), %eax
jge 0x97af
callq 0x5670
movzbl %al, %eax
movl %eax, -0xfc(%rbp)
cmpl $0x0, -0xfc(%rbp)
je 0x97aa
callq 0x68c0
movq %rax, -0x108(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl (%rax), %eax
movl $0x30, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq 0xfed(%rip), %rsi       # 0xa455
movb $0x0, %al
callq 0x2420
movl %eax, -0x120(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl (%rax), %edx
leaq 0xfdb(%rip), %rsi       # 0xa467
movb $0x0, %al
callq 0x2420
movl %eax, -0x11c(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0xfcd(%rip), %rsi       # 0xa47e
movb $0x0, %al
callq 0x2420
movl %eax, -0x118(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0xfc0(%rip), %rsi       # 0xa496
movb $0x0, %al
callq 0x2420
movl %eax, -0x114(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl 0xc(%rax), %edx
leaq 0xfb3(%rip), %rsi       # 0xa4ae
movb $0x0, %al
callq 0x2420
movl %eax, -0x110(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x108(%rbp), %rax
movl 0x10(%rax), %edx
leaq 0xfa8(%rip), %rsi       # 0xa4c8
movb $0x0, %al
callq 0x2420
movl %eax, -0x10c(%rbp)
cmpl $0x0, -0x120(%rbp)
jl 0x9563
cmpl $0x0, -0x11c(%rbp)
jl 0x9563
cmpl $0x0, -0x118(%rbp)
jl 0x9563
cmpl $0x0, -0x114(%rbp)
jl 0x9563
cmpl $0x0, -0x110(%rbp)
jl 0x9563
cmpl $0x0, -0x10c(%rbp)
jge 0x9571
leaq 0xf78(%rip), %rdi       # 0xa4e2
movb $0x0, %al
callq 0x2040
movq -0x108(%rbp), %rdi
callq 0x2370
leaq 0x653d2f70(%rip), %rax  # 0x653dc4f4
movslq (%rax), %rax
leaq 0xed35752(%rip), %rsi   # 0xed3ece0
imulq $0x30, %rax, %rax
addq %rax, %rsi
leaq 0x653d2f54(%rip), %rax  # 0x653dc4f0
movl (%rax), %eax
leaq 0x653d2f4f(%rip), %rcx  # 0x653dc4f4
subl (%rcx), %eax
imull $0x30, %eax, %eax
movslq %eax, %rdx
leaq 0xed3572c(%rip), %rdi   # 0xed3ece0
callq 0x2260
movl $0x0, -0x124(%rbp)
movl -0x124(%rbp), %eax
leaq 0x653d2f24(%rip), %rcx  # 0x653dc4f4
cmpl (%rcx), %eax
jge 0x9660
movslq -0x124(%rbp), %rcx
leaq 0x2b6f8efa(%rip), %rax  # 0x2b7024e0
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movslq -0x124(%rbp), %rcx
leaq 0x34f8f6dd(%rip), %rax  # 0x34f98ce0
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movslq -0x124(%rbp), %rcx
leaq 0x3e825ec0(%rip), %rax  # 0x3e82f4e0
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movslq -0x124(%rbp), %rcx
leaq 0x480bc6a3(%rip), %rax  # 0x480c5ce0
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x95c3
leaq 0x653d2ea1(%rip), %rax  # 0x653dc508
movslq (%rax), %rdx
shlq $0xb, %rdx
leaq 0x51952e6b(%rip), %rdi  # 0x5195c4e0
xorl %esi, %esi
callq 0x2170
leaq 0x653d2e8d(%rip), %rax  # 0x653dc510
movslq (%rax), %rdx
shlq $0xb, %rdx
leaq 0x54062e4f(%rip), %rdi  # 0x5406c4e0
xorl %esi, %esi
callq 0x2170
leaq 0x653d2e6d(%rip), %rax  # 0x653dc50c
movslq (%rax), %rdx
shlq $0xc, %rdx
leaq 0x56772e33(%rip), %rdi  # 0x5677c4e0
xorl %esi, %esi
callq 0x2170
leaq 0x653d2e59(%rip), %rax  # 0x653dc514
movslq (%rax), %rdx
shlq $0xc, %rdx
leaq 0x5dca2e17(%rip), %rdi  # 0x5dcac4e0
xorl %esi, %esi
callq 0x2170
leaq 0x651d2e19(%rip), %rdi  # 0x651dc4f0
xorl %esi, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x2170
leaq 0x652d2e06(%rip), %rdi  # 0x652dc4f0
xorl %esi, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x2170
leaq 0x651d2de3(%rip), %rax  # 0x651dc4e0
leaq 0x51952ddc(%rip), %rcx  # 0x5195c4e0
movq %rcx, (%rax)
leaq 0x651d2dda(%rip), %rax  # 0x651dc4e8
leaq 0x54062dcb(%rip), %rcx  # 0x5406c4e0
movq %rcx, (%rax)
leaq 0x653d2dd5(%rip), %rax  # 0x653dc4f4
movl (%rax), %eax
leaq 0x653d2dc8(%rip), %rcx  # 0x653dc4f0
movl (%rcx), %ecx
subl %eax, %ecx
leaq 0x653d2dbd(%rip), %rax  # 0x653dc4f0
movl %ecx, (%rax)
leaq 0x653d2db8(%rip), %rax  # 0x653dc4f4
movl $0x0, (%rax)
leaq 0x653d2dbf(%rip), %rax  # 0x653dc508
movl $0x1, (%rax)
leaq 0x653d2dba(%rip), %rax  # 0x653dc510
movl $0x1, (%rax)
leaq 0x653d2da9(%rip), %rax  # 0x653dc50c
movl $0x0, (%rax)
leaq 0x653d2da4(%rip), %rax  # 0x653dc514
movl $0x0, (%rax)
leaq 0x653d2d7b(%rip), %rax  # 0x653dc4f8
movl $0x0, (%rax)
leaq 0x653d2d72(%rip), %rax  # 0x653dc4fc
movl $0x0, (%rax)
leaq 0x653d2d69(%rip), %rax  # 0x653dc500
movl $0x0, (%rax)
leaq 0x653d2d60(%rip), %rax  # 0x653dc504
movl $0x0, (%rax)
jmp 0x9408
callq 0x68c0
movq %rax, -0x130(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x130(%rbp), %rax
movl (%rax), %eax
movl $0x30, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq 0xc79(%rip), %rsi       # 0xa455
movb $0x0, %al
callq 0x2420
movl %eax, -0x150(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x130(%rbp), %rax
movl (%rax), %edx
leaq 0xc67(%rip), %rsi       # 0xa467
movb $0x0, %al
callq 0x2420
movl %eax, -0x14c(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x130(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0xc59(%rip), %rsi       # 0xa47e
movb $0x0, %al
callq 0x2420
movl %eax, -0x148(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x130(%rbp), %rax
movl 0x8(%rax), %edx
leaq 0xc4c(%rip), %rsi       # 0xa496
movb $0x0, %al
callq 0x2420
movl %eax, -0x144(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x130(%rbp), %rax
movl 0xc(%rax), %edx
leaq 0xc3f(%rip), %rsi       # 0xa4ae
movb $0x0, %al
callq 0x2420
movl %eax, -0x140(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x130(%rbp), %rax
movl 0x10(%rax), %edx
leaq 0xc34(%rip), %rsi       # 0xa4c8
movb $0x0, %al
callq 0x2420
movl %eax, -0x13c(%rbp)
cmpl $0x0, -0x150(%rbp)
jl 0x98d7
cmpl $0x0, -0x14c(%rbp)
jl 0x98d7
cmpl $0x0, -0x148(%rbp)
jl 0x98d7
cmpl $0x0, -0x144(%rbp)
jl 0x98d7
cmpl $0x0, -0x140(%rbp)
jl 0x98d7
cmpl $0x0, -0x13c(%rbp)
jge 0x98e5
leaq 0xc04(%rip), %rdi       # 0xa4e2
movb $0x0, %al
callq 0x2040
movq -0x130(%rbp), %rdi
callq 0x2370
jmp 0x98f3
leaq 0x6ab3b7fe(%rip), %rdi  # 0x6ab450f8
callq 0x23b0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw %cs:(%rax,%rax)