// File: /workspace/github_cpp_makefile_star2_O1/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, %ebx
movq %rdi, %r14
movq %rdi, -0x30(%rbp)
movq 0x6aacc56e(%rip), %rax  # 0x6aad0f50
movq 0x6aacc577(%rip), %rcx  # 0x6aad0f60
addq $-0x8, %rcx
cmpq %rcx, %rax
je 0x49ff
movq %r14, (%rax)
addq $0x8, 0x6aacc553(%rip)  # 0x6aad0f50
jmp 0x4a0f
leaq 0x6aacc51a(%rip), %rdi  # 0x6aad0f20
leaq -0x30(%rbp), %rsi
callq 0x51d8
movl %ebx, -0x34(%rbp)
xorl %eax, %eax
movq %r14, %rcx
xorl %edx, %edx
movq (%rcx,%rdx,8), %r14
testq %r14, %r14
jne 0x4a31
incq %rdx
cmpq $0x100, %rdx            # imm = 0x100
jne 0x4a19
movq %rcx, %r14
incl %eax
cmpl $0x3, %eax
jne 0x4a14
movq 0x6aacc4f1(%rip), %rax  # 0x6aad0f30
cmpq %rax, 0x6aacc50a(%rip)  # 0x6aad0f50
je 0x4b07
leaq 0x679f84cd(%rip), %rbx  # 0x679fcf20
leaq 0x6aacc4c6(%rip), %r15  # 0x6aad0f20
movq (%rax), %rax
cmpq %r14, %rax
je 0x4b07
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
movq %rbx, %r12
movq -0x30(%rbp), %rsi
movq (%rsi,%r13), %rax
testq %rax, %rax
je 0x4ad4
movl 0x679f848d(%rip), %ecx  # 0x679fcf10
movl %ecx, %edx
shll $0xa, %edx
addl $0x400, %edx            # imm = 0x400
movslq 0x679f847f(%rip), %rdi  # 0x679fcf14
shlq $0xa, %rdi
movl %edx, (%r12,%rdi)
incl %ecx
movl %ecx, 0x679f846b(%rip)  # 0x679fcf10
movq 0x6aacc4a4(%rip), %rcx  # 0x6aad0f50
movq 0x6aacc4ad(%rip), %rdx  # 0x6aad0f60
addq $-0x8, %rdx
cmpq %rdx, %rcx
je 0x4ac9
movq %rax, (%rcx)
addq $0x8, 0x6aacc489(%rip)  # 0x6aad0f50
jmp 0x4ad4
addq %r13, %rsi
movq %r15, %rdi
callq 0x51d8
addq $0x4, %r12
addq $0x8, %r13
cmpq $0x800, %r13            # imm = 0x800
jne 0x4a70
incl 0x679f8429(%rip)        # 0x679fcf14
movq %r15, %rdi
callq 0x53ea
movq 0x6aacc436(%rip), %rax  # 0x6aad0f30
cmpq %rax, 0x6aacc44f(%rip)  # 0x6aad0f50
jne 0x4a5a
movq 0x6aacc422(%rip), %rax  # 0x6aad0f30
cmpq %rax, 0x6aacc43b(%rip)  # 0x6aad0f50
je 0x4b96
movl 0x679f83f2(%rip), %r15d # 0x679fcf10
shll $0xa, %r15d
leaq 0x6aacc3f7(%rip), %r14  # 0x6aad0f20
leaq 0x679f83d0(%rip), %rbx  # 0x679fcf00
leaq 0x679f83e9(%rip), %r12  # 0x679fcf20
movq (%rax), %rax
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movq (%rax,%r13,2), %rdi
testq %rdi, %rdi
je 0x4b6b
movl (%rbx), %eax
leal (%r15,%rax,4), %eax
movslq 0x679f83b9(%rip), %rcx  # 0x679fcf14
shlq $0xa, %rcx
addq %r13, %rcx
movl %eax, (%r12,%rcx)
callq 0x42dc
addq $0x4, %r13
cmpq $0x400, %r13            # imm = 0x400
jne 0x4b41
incl 0x679f8396(%rip)        # 0x679fcf14
movq %r14, %rdi
callq 0x53ea
movq 0x6aacc3a3(%rip), %rax  # 0x6aad0f30
cmpq %rax, 0x6aacc3bc(%rip)  # 0x6aad0f50
jne 0x4b37
movl -0x34(%rbp), %ebx
cmpl $0x1, %ebx
jne 0x4c1b
leaq 0x2716(%rip), %rdi      # 0x72bb
leaq 0x2718(%rip), %rsi      # 0x72c4
callq 0x418c
movabsq $0x646e497049637273, %rcx # imm = 0x646E497049637273
movq %rcx, 0x6ab0c3ce(%rip)  # 0x6ab10f90
movl $0x786564, 0x6ab0c3cb(%rip) # imm = 0x786564
leaq 0x6ab0c3bd(%rip), %r14  # 0x6ab10f90
leaq -0x50(%rbp), %r15
movl %eax, %edi
movq %r15, %rsi
callq 0x4217
movq %r14, %rdi
movq %r15, %rsi
callq 0x24c0
movabsq $0x2f7865646e692f2e, %rax # imm = 0x2F7865646E692F2E
leaq -0xd0(%rbp), %r15
movq %rax, (%r15)
movb $0x0, 0x8(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x24c0
movq %r15, %rdi
callq 0x4eb0
movl %eax, %r14d
cmpl $0x2, %ebx
jne 0x4c9d
leaq 0x2694(%rip), %rdi      # 0x72bb
leaq 0x26a1(%rip), %rsi      # 0x72cf
callq 0x418c
movabsq $0x646e497049747364, %rcx # imm = 0x646E497049747364
movq %rcx, 0x6ab0c36c(%rip)  # 0x6ab10fb0
movl $0x786564, 0x6ab0c369(%rip) # imm = 0x786564
leaq 0x6ab0c35b(%rip), %rbx  # 0x6ab10fb0
leaq -0x50(%rbp), %r14
movl %eax, %edi
movq %r14, %rsi
callq 0x4217
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24c0
movabsq $0x2f7865646e692f2e, %rax # imm = 0x2F7865646E692F2E
leaq -0xd0(%rbp), %r14
movq %rax, (%r14)
movb $0x0, 0x8(%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x24c0
movq %r14, %rdi
callq 0x4eb0
movl %eax, %r14d
xorl %ebx, %ebx
movl %ebx, 0x679f826b(%rip)  # 0x679fcf10
movl %ebx, 0x679f8269(%rip)  # 0x679fcf14
leaq 0x679f824e(%rip), %r15  # 0x679fcf00
movslq (%r15), %rdx
shlq $0x2, %rdx
leaq 0x653d2840(%rip), %rdi  # 0x653d7500
xorl %esi, %esi
callq 0x2160
movl %ebx, (%r15)
movl %r14d, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq