// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
movq %rdi, %rbx
movslq 0x679f8c0f(%rip), %r14  # 0x679fcf00
leaq 0x1(%r14), %rax
movl %eax, 0x679f8c05(%rip)  # 0x679fcf00
leaq 0x653d31fe(%rip), %r15  # 0x653d7500
movl $0x0, (%r15,%r14,4)
movl (%rdi), %eax
leal 0x2(%r14), %ecx
movl %ecx, 0x679f8bea(%rip)  # 0x679fcf00
movl %eax, 0x4(%r15,%r14,4)
movl $0x40000000, %r12d      # imm = 0x40000000
movq 0x8(%rbx), %rax
xorl %ecx, %ecx
testq %rax, %rax
je 0x4356
movq %rax, %rsi
movq %rbx, %rdx
movq %rdx, %rdi
movq %rsi, %rdx
movl (%rsi), %esi
subl (%rdi), %esi
cmpl $0x3f, %esi
ja 0x4356
movq 0x8(%rdx), %rsi
incl %ecx
testq %rsi, %rsi
je 0x4356
cmpl $0x5, %ecx
jne 0x4332
movl $0x5, %ecx
cmpl $0x5, %ecx
jne 0x43c9
xorl %ecx, %ecx
testq %rax, %rax
je 0x437f
movq %rbx, %rdx
movq %rdx, %rsi
movq %rax, %rdx
movl (%rax), %eax
subl (%rsi), %eax
cmpl $0x1, %eax
ja 0x437f
incl %ecx
movq 0x8(%rdx), %rax
testq %rax, %rax
jne 0x4365
cmpl $0xa, %ecx
jl 0x43f4
movl (%rbx), %eax
movslq 0x679f8b73(%rip), %rdx  # 0x679fcf00
leaq 0x1(%rdx), %rsi
movl %esi, 0x679f8b69(%rip)  # 0x679fcf00
movl %eax, (%r15,%rdx,4)
leal 0x2(%rdx), %eax
movl %eax, 0x679f8b5c(%rip)  # 0x679fcf00
movl %ecx, 0x4(%r15,%rdx,4)
movl $0x1, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x454e
leal 0x1(%rax), %edx
cmpl %ecx, %eax
movl %edx, %eax
jl 0x43ae
jmp 0x454e
cmpl $0x3, %ecx
jl 0x441a
movq %rbx, %rdi
callq 0x4666
xorl %eax, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x454e
leal 0x1(%rax), %ecx
cmpl $0x2, %eax
movl %ecx, %eax
jb 0x43d8
jmp 0x454e
movq %rbx, %rdi
callq 0x460a
xorl %eax, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x454e
leal 0x1(%rax), %ecx
cmpl $0x4, %eax
movl %ecx, %eax
jb 0x43fe
jmp 0x454e
xorl %ecx, %ecx
testq %rax, %rax
je 0x444e
movq %rax, %rsi
movq %rbx, %rdx
movq %rdx, %rdi
movq %rsi, %rdx
movl (%rsi), %esi
subl (%rdi), %esi
cmpl $0x3ff, %esi            # imm = 0x3FF
ja 0x444e
movq 0x8(%rdx), %rsi
incl %ecx
testq %rsi, %rsi
je 0x444e
cmpl $0x3, %ecx
jne 0x4427
movl $0x3, %ecx
cmpl $0x2, %ecx
je 0x447e
cmpl $0x3, %ecx
jne 0x44a4
movq %rbx, %rdi
callq 0x4666
xorl %eax, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x454e
leal 0x1(%rax), %ecx
cmpl $0x2, %eax
movl %ecx, %eax
jb 0x4462
jmp 0x454e
movq %rbx, %rdi
callq 0x46fd
xorl %eax, %eax
movq 0x8(%rbx), %rbx
subl $0x1, %eax
setb %cl
testq %rbx, %rbx
je 0x454e
testb %cl, %cl
jne 0x4488
jmp 0x454e
xorl %ecx, %ecx
testq %rax, %rax
je 0x44d8
movq %rax, %rsi
movq %rbx, %rdx
movq %rdx, %rdi
movq %rsi, %rdx
movl (%rsi), %esi
subl (%rdi), %esi
cmpl $0x7fff, %esi           # imm = 0x7FFF
ja 0x44d8
movq 0x8(%rdx), %rsi
incl %ecx
testq %rsi, %rsi
je 0x44d8
cmpl $0x1, %ecx
je 0x44b1
movl $0x2, %ecx
cmpl $0x1, %ecx
je 0x4501
cmpl $0x2, %ecx
jne 0x452e
movq %rbx, %rdi
callq 0x46fd
xorl %eax, %eax
movq 0x8(%rbx), %rbx
subl $0x1, %eax
setb %cl
testq %rbx, %rbx
je 0x454e
testb %cl, %cl
jne 0x44ec
jmp 0x454e
movslq 0x679f89f8(%rip), %rdx  # 0x679fcf00
movl %r12d, (%r15,%rdx,4)
movl (%rax), %esi
subl (%rbx), %esi
leal 0x1(%rdx), %ecx
movl %ecx, 0x679f89e7(%rip)  # 0x679fcf00
orl %r12d, %esi
movl %esi, (%r15,%rdx,4)
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x4557
addl $0x2, %edx
jmp 0x453c
testq %rax, %rax
je 0x4557
movl 0x679f89c7(%rip), %ecx  # 0x679fcf00
leal 0x1(%rcx), %edx
movl (%rax), %esi
movl %edx, 0x679f89bc(%rip)  # 0x679fcf00
movslq %ecx, %rcx
movl %esi, (%r15,%rcx,4)
movq %rax, %rbx
testq %rbx, %rbx
jne 0x4321
movl 0x679f89a3(%rip), %eax  # 0x679fcf00
movl %r14d, %ecx
notl %ecx
addl %eax, %ecx
movl %ecx, (%r15,%r14,4)
subl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq