// File: yueww[P]TSR/exportDataAndIndex.cpp
// Function: exportPortIndexFile(portIndexTable*, int)
int exportPortIndexFile(portIndexTable *pit,int flag){
    int base=65536*sizeof(int);
    int i;
    for(i=0;i<65536;i++){
        if(pit->indexList[i]){
            portOffsetTable[i]=base+indexOffset*sizeof(unsigned);
            compressIndexLink(pit->indexList[i]);
        }
    }
    int id;
    int indexFileBytes;
    if(flag==1){
        id=countFiles("./index/","srcPortIndex");
        strcpy(srcPortIndexFileName,"srcPortIndex");
        char idStr[16];
        iToStr(id,idStr);
        strcat(srcPortIndexFileName,idStr);
        char path[128];
        strcpy(path,"./index/");
        strcat(path,srcPortIndexFileName);
        indexFileBytes=writePortIndexFile(path);
    }
    if(flag==2){
        id=countFiles("./index/","dstPortIndex");
        strcpy(dstPortIndexFileName,"dstPortIndex");
        char idStr[16];
        iToStr(id,idStr);
        strcat(dstPortIndexFileName,idStr);
        char path[128];
        strcpy(path,"./index/");
        strcat(path,dstPortIndexFileName);
        indexFileBytes=writePortIndexFile(path); 
    }
    memset(portOffsetTable,0,sizeof(int)*65536);
    memset(compressedIndexArr,0,sizeof(unsigned)*indexOffset);
    indexOffset=0;
    return indexFileBytes;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x40000, -0x10(%rbp)   # imm = 0x40000
movl $0x0, -0x14(%rbp)
cmpl $0x10000, -0x14(%rbp)   # imm = 0x10000
jge 0x6f6b
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x6f5e
movslq -0x10(%rbp), %rax
leaq 0x679fafed(%rip), %rcx  # 0x67a01f20
movslq (%rcx), %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movl %eax, %edx
movslq -0x14(%rbp), %rcx
leaq 0x6aacf046(%rip), %rax  # 0x6aad5f90
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x6160
jmp 0x6f60
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6f10
cmpl $0x1, -0xc(%rbp)
jne 0x6feb
leaq 0x3358(%rip), %rdi      # 0xa2d0
leaq 0x3370(%rip), %rsi      # 0xa2ef
callq 0x5f90
movl %eax, -0x18(%rbp)
leaq 0x6ab0f062(%rip), %rdi  # 0x6ab15ff0
leaq 0x335a(%rip), %rsi      # 0xa2ef
callq 0x22c0
movl -0x18(%rbp), %edi
leaq -0x30(%rbp), %rsi
callq 0x6040
leaq -0x30(%rbp), %rsi
leaq 0x6ab0f03f(%rip), %rdi  # 0x6ab15ff0
callq 0x2510
leaq -0xb0(%rbp), %rdi
leaq 0x330c(%rip), %rsi      # 0xa2d0
callq 0x22c0
leaq -0xb0(%rbp), %rdi
leaq 0x6ab0f019(%rip), %rsi  # 0x6ab15ff0
callq 0x2510
leaq -0xb0(%rbp), %rdi
callq 0x7180
movl %eax, -0x1c(%rbp)
cmpl $0x2, -0xc(%rbp)
jne 0x7075
leaq 0x32d4(%rip), %rdi      # 0xa2d0
leaq 0x32f9(%rip), %rsi      # 0xa2fc
callq 0x5f90
movl %eax, -0x18(%rbp)
leaq 0x6ab0effe(%rip), %rdi  # 0x6ab16010
leaq 0x32e3(%rip), %rsi      # 0xa2fc
callq 0x22c0
movl -0x18(%rbp), %edi
leaq -0xc0(%rbp), %rsi
callq 0x6040
leaq -0xc0(%rbp), %rsi
leaq 0x6ab0efd5(%rip), %rdi  # 0x6ab16010
callq 0x2510
leaq -0x140(%rbp), %rdi
leaq 0x3282(%rip), %rsi      # 0xa2d0
callq 0x22c0
leaq -0x140(%rbp), %rdi
leaq 0x6ab0efaf(%rip), %rsi  # 0x6ab16010
callq 0x2510
leaq -0x140(%rbp), %rdi
callq 0x7180
movl %eax, -0x1c(%rbp)
leaq 0x6aacef14(%rip), %rdi  # 0x6aad5f90
xorl %esi, %esi
movl $0x40000, %edx          # imm = 0x40000
callq 0x2170
leaq 0x679fae91(%rip), %rax  # 0x67a01f20
movslq (%rax), %rdx
shlq $0x2, %rdx
leaq 0x653d5483(%rip), %rdi  # 0x653dc520
xorl %esi, %esi
callq 0x2170
leaq 0x679fae75(%rip), %rax  # 0x67a01f20
movl $0x0, (%rax)
movl -0x1c(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax)