// File: /workspace/github_cpp_makefile_star2_O3/yueww[P]TSR/exportDataAndIndex.cpp
// Function: exportIpIndexFile(innerNode*, int)
int exportIpIndexFile(innerNode *rootNode,int flag){
    void *pNode=rootNode;
    q.push(pNode);
    void *firstLeafNode=getFirstLeafNode(rootNode);
    int i;
    while((!q.empty())&&q.front()!=firstLeafNode){
        pNode=q.front();
        for(i=0;i<256;i++){
            if(((innerNode *)pNode)->nextLevelNodes[i]){
                trieNodeArr[trieNodeArrIndex].offset[i]=sizeof(trieNodeOffset)*(trieNodeNum+1);
                trieNodeNum++;
                q.push(((innerNode *)pNode)->nextLevelNodes[i]);
            }
        }
        trieNodeArrIndex++;
        q.pop();
    } 
    int base=sizeof(trieNodeOffset)*trieNodeNum;
    //printf("trie node consume %d bytes!\n",base);
    while(!q.empty()){
        pNode=q.front();
        for(i=0;i<256;i++){
            if(((leafNode *)pNode)->indexList[i]){
                trieNodeArr[trieNodeArrIndex].offset[i]=base+indexOffset*sizeof(unsigned);
                compressIndexLink(((leafNode *)pNode)->indexList[i]);
            } 
        }
        trieNodeArrIndex++;
        q.pop();
    }
    int id;
    int indexFileBytes;
    if(flag==1){
        id=countFiles("./index/","srcIpIndex");
        strcpy(srcIpIndexFileName,"srcIpIndex");
        char idStr[16];
        iToStr(id,idStr);
        strcat(srcIpIndexFileName,idStr);
        char path[128];
        strcpy(path,"./index/");
        strcat(path,srcIpIndexFileName);
        indexFileBytes=writeIpIndexFile(path);
    }
    if(flag==2){
        id=countFiles("./index/","dstIpIndex");
        strcpy(dstIpIndexFileName,"dstIpIndex");
        char idStr[16];
        iToStr(id,idStr);
        strcat(dstIpIndexFileName,idStr);
        char path[128];
        strcpy(path,"./index/");
        strcat(path,dstIpIndexFileName);
        indexFileBytes=writeIpIndexFile(path);  
    }
    trieNodeNum=0;
    trieNodeArrIndex=0;
    memset(trieNodeArr,0,sizeof(trieNodeOffset)*trieNodeNum);
    memset(compressedIndexArr,0,sizeof(unsigned)*indexOffset);
    indexOffset=0;
    return indexFileBytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %esi, -0x34(%rbp)
movq %rdi, %r14
movq %rdi, -0x30(%rbp)
movq 0x6aacc569(%rip), %rax  # 0x6aad0f40
movq 0x6aacc572(%rip), %rcx  # 0x6aad0f50
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x49f4
movq %r14, (%rax)
addq $0x8, 0x6aacc54e(%rip)  # 0x6aad0f40
jmp 0x4a04
leaq 0x6aacc515(%rip), %rdi  # 0x6aad0f10
leaq -0x30(%rbp), %rsi
callq 0x5140
xorl %eax, %eax
movq %r14, %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %r14
testq %r14, %r14
jne 0x4a23
incq %rdx
cmpq $0x100, %rdx            # imm = 0x100
jne 0x4a0b
movq %rcx, %r14
incl %eax
cmpl $0x3, %eax
jne 0x4a06
movq 0x6aacc50f(%rip), %rcx  # 0x6aad0f40
movq 0x6aacc4e8(%rip), %rax  # 0x6aad0f20
cmpq %rax, %rcx
je 0x4b07
movq (%rax), %rdx
cmpq %r14, %rdx
je 0x4b07
leaq 0x679f84bc(%rip), %rbx  # 0x679fcf10
leaq 0x6aacc4b5(%rip), %r15  # 0x6aad0f10
movq %rdx, -0x30(%rbp)
xorl %r13d, %r13d
movq %rbx, %r12
movq -0x30(%rbp), %rsi
movq (%rsi,%r13), %rax
testq %rax, %rax
je 0x4ac9
movl 0x679f8488(%rip), %ecx  # 0x679fcf00
movl %ecx, %edx
shll $0xa, %edx
addl $0x400, %edx            # imm = 0x400
movslq 0x679f847a(%rip), %rdi  # 0x679fcf04
shlq $0xa, %rdi
movl %edx, (%r12,%rdi)
incl %ecx
movl %ecx, 0x679f8466(%rip)  # 0x679fcf00
movq 0x6aacc49f(%rip), %rcx  # 0x6aad0f40
movq 0x6aacc4a8(%rip), %rdx  # 0x6aad0f50
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x4abe
movq %rax, (%rcx)
addq $0x8, 0x6aacc484(%rip)  # 0x6aad0f40
jmp 0x4ac9
addq %r13, %rsi
movq %r15, %rdi
callq 0x5140
addq $0x4, %r12
addq $0x8, %r13
cmpq $0x800, %r13            # imm = 0x800
jne 0x4a65
incl 0x679f8424(%rip)        # 0x679fcf04
movq %r15, %rdi
callq 0x5352
movq 0x6aacc451(%rip), %rcx  # 0x6aad0f40
movq 0x6aacc42a(%rip), %rax  # 0x6aad0f20
cmpq %rax, %rcx
je 0x4b07
movq (%rax), %rdx
cmpq %r14, %rdx
jne 0x4a5b
cmpq %rax, %rcx
je 0x4b8b
movl 0x679f83ed(%rip), %r15d # 0x679fcf00
shll $0xa, %r15d
leaq 0x6aacc3f2(%rip), %r14  # 0x6aad0f10
leaq 0x679f83cb(%rip), %rbx  # 0x679fcef0
leaq 0x679f83e4(%rip), %r12  # 0x679fcf10
movq (%rax), %rax
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movq (%rax,%r13,2), %rdi
testq %rdi, %rdi
je 0x4b60
movl (%rbx), %eax
leal (%r15,%rax,4), %eax
movslq 0x679f83b4(%rip), %rcx  # 0x679fcf04
shlq $0xa, %rcx
addq %r13, %rcx
movl %eax, (%r12,%rcx)
callq 0x42f0
addq $0x4, %r13
cmpq $0x400, %r13            # imm = 0x400
jne 0x4b36
incl 0x679f8391(%rip)        # 0x679fcf04
movq %r14, %rdi
callq 0x5352
movq 0x6aacc39e(%rip), %rax  # 0x6aad0f20
cmpq %rax, 0x6aacc3b7(%rip)  # 0x6aad0f40
jne 0x4b2c
cmpl $0x1, -0x34(%rbp)
jne 0x4bc8
leaq 0x2723(%rip), %rdi      # 0x72bb
leaq 0x2725(%rip), %rsi      # 0x72c4
callq 0x41a0
movabsq $0x646e497049637273, %rcx # imm = 0x646E497049637273
movq %rcx, 0x6ab0c3cb(%rip)  # 0x6ab10f80
movl $0x786564, 0x6ab0c3c8(%rip) # imm = 0x786564
leaq 0x6ab0c3ba(%rip), %rbx  # 0x6ab10f80
jmp 0x4bfd
leaq 0x26ec(%rip), %rdi      # 0x72bb
leaq 0x26f9(%rip), %rsi      # 0x72cf
callq 0x41a0
movabsq $0x646e497049747364, %rcx # imm = 0x646E497049747364
movq %rcx, 0x6ab0c3b4(%rip)  # 0x6ab10fa0
movl $0x786564, 0x6ab0c3b1(%rip) # imm = 0x786564
leaq 0x6ab0c3a3(%rip), %rbx  # 0x6ab10fa0
leaq -0x50(%rbp), %r14
movl %eax, %edi
movq %r14, %rsi
callq 0x422b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24b0
movabsq $0x2f7865646e692f2e, %rax # imm = 0x2F7865646E692F2E
leaq -0xd0(%rbp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24b0
movq %r14, %rdi
callq 0x4e0c
movl %eax, %ebx
xorl %r14d, %r14d
movl %r14d, 0x679f82b2(%rip) # 0x679fcf00
movl %r14d, 0x679f82af(%rip) # 0x679fcf04
leaq 0x679f8294(%rip), %r15  # 0x679fcef0
movslq (%r15), %rdx
shlq $0x2, %rdx
leaq 0x653d2886(%rip), %rdi  # 0x653d74f0
xorl %esi, %esi
callq 0x2160
movl %r14d, (%r15)
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq