// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
leaq -0x30(%rbp), %rsi
movq %rdi, (%rsi)
leaq 0x6aacb8a3(%rip), %r14  # 0x6aacff10
movq %r14, %rdi
callq 0x4ddc
movq %r15, %rdi
callq 0x49df
movq %rax, %r15
leaq 0x679f7889(%rip), %r12  # 0x679fbf10
movq 0x6aacb8b2(%rip), %rcx  # 0x6aacff40
movq 0x6aacb88b(%rip), %rax  # 0x6aacff20
cmpq %rax, %rcx
je 0x4710
movq (%rax), %rdx
cmpq %r15, %rdx
je 0x4710
movq %rdx, -0x30(%rbp)
movq %r12, %r13
xorl %ebx, %ebx
cmpq $0x800, %rbx            # imm = 0x800
je 0x46fd
movq -0x30(%rbp), %rsi
cmpq $0x0, (%rsi,%rbx)
je 0x46f3
addq %rbx, %rsi
movl 0x679f7838(%rip), %eax  # 0x679fbf00
movl %eax, %ecx
shll $0xa, %ecx
addl $0x400, %ecx            # imm = 0x400
movslq 0x679f782a(%rip), %rdx  # 0x679fbf04
shlq $0xa, %rdx
movl %ecx, (%r13,%rdx)
incl %eax
movl %eax, 0x679f7815(%rip)  # 0x679fbf00
movq %r14, %rdi
callq 0x4ddc
addq $0x8, %rbx
addq $0x4, %r13
jmp 0x46ab
incl 0x679f7801(%rip)        # 0x679fbf04
movq %r14, %rdi
callq 0x5034
jmp 0x4687
movl 0x679f77e9(%rip), %r12d # 0x679fbf00
shll $0xa, %r12d
leaq 0x6aacb7ee(%rip), %r14  # 0x6aacff10
leaq 0x679f77c7(%rip), %r15  # 0x679fbef0
leaq 0x679f77e0(%rip), %r13  # 0x679fbf10
cmpq %rax, %rcx
je 0x4797
movq (%rax), %rax
movq %rax, -0x30(%rbp)
xorl %ebx, %ebx
cmpq $0x400, %rbx            # imm = 0x400
je 0x4779
movq -0x30(%rbp), %rax
movq (%rax,%rbx,2), %rdi
testq %rdi, %rdi
je 0x4773
movl (%r15), %eax
leal (%r12,%rax,4), %eax
movslq 0x679f77a2(%rip), %rcx  # 0x679fbf04
shlq $0xa, %rcx
addq %rbx, %rcx
movl %eax, (%r13,%rcx)
callq 0x407c
addq $0x4, %rbx
jmp 0x473e
incl 0x679f7785(%rip)        # 0x679fbf04
movq %r14, %rdi
callq 0x5034
movq 0x6aacb7b2(%rip), %rcx  # 0x6aacff40
movq 0x6aacb78b(%rip), %rax  # 0x6aacff20
jmp 0x4730
cmpl $0x1, -0x34(%rbp)
jne 0x47d4
leaq 0x1ae9(%rip), %rdi      # 0x628d
leaq 0x1aeb(%rip), %rsi      # 0x6296
callq 0x3f74
movabsq $0x646e497049637273, %rcx # imm = 0x646E497049637273
movq %rcx, 0x6ab0b7bf(%rip)  # 0x6ab0ff80
movl $0x786564, 0x6ab0b7bc(%rip) # imm = 0x786564
leaq 0x6ab0b7ae(%rip), %rbx  # 0x6ab0ff80
jmp 0x4809
leaq 0x1ab2(%rip), %rdi      # 0x628d
leaq 0x1abf(%rip), %rsi      # 0x62a1
callq 0x3f74
movabsq $0x646e497049747364, %rcx # imm = 0x646E497049747364
movq %rcx, 0x6ab0b7a8(%rip)  # 0x6ab0ffa0
movl $0x786564, 0x6ab0b7a5(%rip) # imm = 0x786564
leaq 0x6ab0b797(%rip), %rbx  # 0x6ab0ffa0
leaq -0x50(%rbp), %r14
movl %eax, %edi
movq %r14, %rsi
callq 0x3feb
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 0x4a12
movl %eax, %ebx
andl $0x0, 0x679f76a9(%rip)  # 0x679fbf00
andl $0x0, 0x679f76a6(%rip)  # 0x679fbf04
movslq (%r15), %rdx
shlq $0x2, %rdx
leaq 0x653d1c84(%rip), %rdi  # 0x653d64f0
xorl %esi, %esi
callq 0x2180
andl $0x0, (%r15)
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq