// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
leaq -0x30(%rbp), %rbx
movq %rdi, (%rbx)
movslq 0x679f7e55(%rip), %r12  # 0x679fbef0
leaq 0x1(%r12), %rax
movl %eax, 0x679f7e4a(%rip)  # 0x679fbef0
leaq 0x653d2443(%rip), %r14  # 0x653d64f0
andl $0x0, (%r14,%r12,4)
movl (%rdi), %eax
leal 0x2(%r12), %ecx
movl %ecx, 0x679f7e31(%rip)  # 0x679fbef0
movl %eax, 0x4(%r14,%r12,4)
pushq $0x3
popq %r15
testq %r13, %r13
je 0x41e1
movq %r13, %rdi
callq 0x4204
cmpl $0x5, %eax
jne 0x410f
movq %r13, %rdi
callq 0x4240
cmpl $0xa, %eax
jl 0x4136
movl (%r13), %ecx
movslq 0x679f7dfa(%rip), %rdx  # 0x679fbef0
movl %ecx, (%r14,%rdx,4)
leal 0x2(%rdx), %ecx
movl %ecx, 0x679f7ded(%rip)  # 0x679fbef0
movl %eax, 0x4(%r14,%rdx,4)
movq %rbx, %rdi
movl %eax, %esi
jmp 0x4165
cmpl $0x3, %eax
jge 0x4126
movq %r13, %rdi
callq 0x4340
cmpl $0x2, %eax
je 0x4157
cmpl $0x3, %eax
jne 0x4145
movq %r13, %rdi
callq 0x42e0
movq %rbx, %rdi
movl %r15d, %esi
jmp 0x4165
movq %r13, %rdi
callq 0x4280
movq %rbx, %rdi
pushq $0x5
jmp 0x4164
movq %r13, %rdi
callq 0x43df
cmpl $0x1, %eax
je 0x4173
cmpl $0x2, %eax
jne 0x41bb
movq %r13, %rdi
callq 0x437f
movq %rbx, %rdi
pushq $0x2
popq %rsi
callq 0x4261
movq -0x30(%rbp), %r13
jmp 0x40c8
movslq 0x679f7d76(%rip), %rcx  # 0x679fbef0
movl $0x40000000, %edi       # imm = 0x40000000
movl %edi, (%r14,%rcx,4)
movq 0x8(%r13), %rdx
movl (%rdx), %esi
subl (%r13), %esi
leal 0x1(%rcx), %eax
movl %eax, 0x679f7d5a(%rip)  # 0x679fbef0
orl %edi, %esi
movl %esi, (%r14,%rcx,4)
movq 0x8(%rdx), %rdx
movq %rdx, -0x30(%rbp)
testq %rdx, %rdx
je 0x41e7
movl (%rdx), %eax
leal 0x2(%rcx), %edx
movl %edx, 0x679f7d3c(%rip)  # 0x679fbef0
movl %eax, 0x4(%r14,%rcx,4)
jmp 0x416a
movq 0x8(%r13), %rcx
movq %rcx, -0x30(%rbp)
movl 0x679f7d27(%rip), %eax  # 0x679fbef0
testq %rcx, %rcx
je 0x41e7
cltq
movl (%rcx), %ecx
leal 0x1(%rax), %edx
movl %edx, 0x679f7d15(%rip)  # 0x679fbef0
movl %ecx, (%r14,%rax,4)
jmp 0x416a
movl 0x679f7d09(%rip), %eax  # 0x679fbef0
movl %r12d, %ecx
notl %ecx
addl %eax, %ecx
movl %ecx, (%r14,%r12,4)
subl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq