// File: yueww[P]TSR/compressIndex.cpp
// Function: compressIndexLink(indexNode*)
int compressIndexLink(indexNode *ptr){
    int base=indexOffset;
    compressedIndexArr[indexOffset++]=0;
    compressedIndexArr[indexOffset++]=ptr->indexNum;
    int testRes;
    while(ptr){
        testRes=isFive(ptr);
        if(testRes==5){
            int specialNum=isSpecial(ptr);
            if(specialNum>=10){
                compressedIndexArr[indexOffset++]=ptr->indexNum;
                compressedIndexArr[indexOffset++]=specialNum;
                moveToNext(&ptr,specialNum);
            }else{
                compress5(ptr);
                moveToNext(&ptr,5);
            }
        }else if(testRes>=3){
            compress3(ptr);
            moveToNext(&ptr,3);
        }else{
            testRes=isThree(ptr);
            if(testRes==3){
                compress3(ptr);
                moveToNext(&ptr,3);
            }else if(testRes==2){
                compress2(ptr);
                moveToNext(&ptr,2);
            }else{
                testRes=isTwo(ptr);
                if(testRes==2){
                    compress2(ptr);
                    moveToNext(&ptr,2);
                }else if(testRes==1){
                    compressedIndexArr[indexOffset]=UNIT2;
                    compressedIndexArr[indexOffset++]|=(ptr->next->indexNum-ptr->indexNum);
                    ptr=ptr->next->next;
                    if(!ptr) break;
                    compressedIndexArr[indexOffset++]=ptr->indexNum;
                }else{
                    ptr=ptr->next;
                    if(!ptr) break;
                    compressedIndexArr[indexOffset++]=ptr->indexNum;
                }
            }
        }
    }
    compressedIndexArr[base]=indexOffset-base-1;
    return indexOffset-base;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl 0x679fbdae(%rip), %eax  # 0x67a01f20
movl %eax, -0xc(%rbp)
movl 0x679fbda5(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbd9a(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d6390(%rip), %rax  # 0x653dc520
movl $0x0, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl 0x679fbd7d(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbd72(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d6368(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
cmpq $0x0, -0x8(%rbp)
je 0x63db
movq -0x8(%rbp), %rdi
callq 0x6410
movl %eax, -0x10(%rbp)
cmpl $0x5, -0x10(%rbp)
jne 0x625d
movq -0x8(%rbp), %rdi
callq 0x64a0
movl %eax, -0x14(%rbp)
cmpl $0xa, -0x14(%rbp)
jl 0x6241
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl 0x679fbd26(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbd1b(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d6311(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %edx
movl 0x679fbd05(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbcfa(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d62f0(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %esi
leaq -0x8(%rbp), %rdi
callq 0x6500
jmp 0x6258
movq -0x8(%rbp), %rdi
callq 0x6560
leaq -0x8(%rbp), %rdi
movl $0x5, %esi
callq 0x6500
jmp 0x63d6
cmpl $0x3, -0x10(%rbp)
jl 0x627f
movq -0x8(%rbp), %rdi
callq 0x6620
leaq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x6500
jmp 0x63d4
movq -0x8(%rbp), %rdi
callq 0x66e0
movl %eax, -0x10(%rbp)
cmpl $0x3, -0x10(%rbp)
jne 0x62ad
movq -0x8(%rbp), %rdi
callq 0x6620
leaq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x6500
jmp 0x63d2
cmpl $0x2, -0x10(%rbp)
jne 0x62cf
movq -0x8(%rbp), %rdi
callq 0x6770
leaq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x6500
jmp 0x63d0
movq -0x8(%rbp), %rdi
callq 0x6830
movl %eax, -0x10(%rbp)
cmpl $0x2, -0x10(%rbp)
jne 0x62fd
movq -0x8(%rbp), %rdi
callq 0x6770
leaq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x6500
jmp 0x63ce
cmpl $0x1, -0x10(%rbp)
jne 0x6393
movslq 0x679fbc12(%rip), %rcx  # 0x67a01f20
leaq 0x653d620b(%rip), %rax  # 0x653dc520
movl $0x40000000, (%rax,%rcx,4) # imm = 0x40000000
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %edx
movq -0x8(%rbp), %rax
subl (%rax), %edx
movl 0x679fbbee(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbbe3(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d61d9(%rip), %rax  # 0x653dc520
orl (%rax,%rcx,4), %edx
leaq 0x653d61cf(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x636d
jmp 0x63db
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl 0x679fbba7(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbb9c(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d6192(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
jmp 0x63cc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x63a8
jmp 0x63db
movq -0x8(%rbp), %rax
movl (%rax), %edx
movl 0x679fbb6c(%rip), %eax  # 0x67a01f20
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x679fbb61(%rip)  # 0x67a01f20
movslq %eax, %rcx
leaq 0x653d6157(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
jmp 0x63ce
jmp 0x63d0
jmp 0x63d2
jmp 0x63d4
jmp 0x63d6
jmp 0x61bb
movl 0x679fbb3f(%rip), %edx  # 0x67a01f20
subl -0xc(%rbp), %edx
subl $0x1, %edx
movslq -0xc(%rbp), %rcx
leaq 0x653d612e(%rip), %rax  # 0x653dc520
movl %edx, (%rax,%rcx,4)
movl 0x679fbb25(%rip), %eax  # 0x67a01f20
subl -0xc(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)