// File: /workspace/github_cpp_makefile_star2_O3/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 0x679f8beb(%rip), %r14  # 0x679fcef0
leaq 0x1(%r14), %rax
movl %eax, 0x679f8be1(%rip)  # 0x679fcef0
leaq 0x653d31da(%rip), %r15  # 0x653d74f0
movl $0x0, (%r15,%r14,4)
movl (%rdi), %eax
leal 0x2(%r14), %ecx
movl %ecx, 0x679f8bc6(%rip)  # 0x679fcef0
movl %eax, 0x4(%r15,%r14,4)
movl $0x40000000, %r12d      # imm = 0x40000000
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x4529
movl (%rbx), %ecx
xorl %edx, %edx
movl %ecx, %esi
movq %rax, %rdi
movl %esi, %r8d
movl (%rdi), %esi
movl %esi, %r9d
subl %r8d, %r9d
cmpl $0x3f, %r9d
ja 0x436e
movq 0x8(%rdi), %rdi
incl %edx
testq %rdi, %rdi
je 0x436e
cmpl $0x5, %edx
jne 0x434b
jmp 0x4373
cmpl $0x5, %edx
jne 0x43d0
xorl %edx, %edx
movl %ecx, %esi
movl %esi, %edi
movl (%rax), %esi
movl %esi, %r8d
subl %edi, %r8d
cmpl $0x1, %r8d
ja 0x4392
incl %edx
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x4377
cmpl $0xa, %edx
jl 0x43fb
movslq 0x679f8b52(%rip), %rax  # 0x679fcef0
movl %ecx, (%r15,%rax,4)
leal 0x2(%rax), %ecx
movl %ecx, 0x679f8b45(%rip)  # 0x679fcef0
movl %edx, 0x4(%r15,%rax,4)
movl $0x1, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x4520
leal 0x1(%rax), %ecx
cmpl %edx, %eax
movl %ecx, %eax
jl 0x43b5
jmp 0x4520
cmpl $0x2, %edx
jle 0x4421
movq %rbx, %rdi
callq 0x463a
xorl %eax, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x4520
leal 0x1(%rax), %ecx
cmpl $0x2, %eax
movl %ecx, %eax
jb 0x43df
jmp 0x4520
movq %rbx, %rdi
callq 0x45dc
xorl %eax, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x4520
leal 0x1(%rax), %ecx
cmpl $0x4, %eax
movl %ecx, %eax
jb 0x4405
jmp 0x4520
xorl %edx, %edx
movl %ecx, %esi
movq %rax, %rdi
movl %esi, %r8d
movl (%rdi), %esi
movl %esi, %r9d
subl %r8d, %r9d
cmpl $0x3ff, %r9d            # imm = 0x3FF
ja 0x444e
movq 0x8(%rdi), %rdi
incl %edx
testq %rdi, %rdi
je 0x444e
cmpl $0x3, %edx
jne 0x4428
jmp 0x4458
cmpl $0x2, %edx
je 0x44c1
cmpl $0x3, %edx
jne 0x447e
movq %rbx, %rdi
callq 0x463a
xorl %eax, %eax
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x4520
leal 0x1(%rax), %ecx
cmpl $0x2, %eax
movl %ecx, %eax
jb 0x4462
jmp 0x4520
xorl %edx, %edx
movb $0x1, %sil
movq %rax, %rdi
movl %ecx, %r8d
movl (%rdi), %ecx
movl %ecx, %r9d
subl %r8d, %r9d
cmpl $0x7fff, %r9d           # imm = 0x7FFF
ja 0x44b7
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x44b5
movl $0x1, %edx
testb $0x1, %sil
movl $0x0, %esi
jne 0x4486
jmp 0x44c1
incl %edx
cmpl $0x1, %edx
je 0x44d8
cmpl $0x2, %edx
jne 0x4505
movq %rbx, %rdi
callq 0x46d3
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x4520
movq 0x8(%rbx), %rbx
jmp 0x4520
movslq 0x679f8a11(%rip), %rdx  # 0x679fcef0
movl %r12d, (%r15,%rdx,4)
movl (%rax), %esi
subl (%rbx), %esi
leal 0x1(%rdx), %ecx
movl %ecx, 0x679f8a00(%rip)  # 0x679fcef0
orl %r12d, %esi
movl %esi, (%r15,%rdx,4)
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x4529
addl $0x2, %edx
jmp 0x450e
movl 0x679f89e5(%rip), %ecx  # 0x679fcef0
leal 0x1(%rcx), %edx
movl (%rax), %esi
movl %edx, 0x679f89da(%rip)  # 0x679fcef0
movslq %ecx, %rcx
movl %esi, (%r15,%rcx,4)
movq %rax, %rbx
testq %rbx, %rbx
jne 0x4335
movl 0x679f89c1(%rip), %eax  # 0x679fcef0
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