// File: /workspace/github_c_makefile_star2_O2/heltilda[P]cicada/intrpt.c
// Function: storageSizeData
void storageSizeData(view *theView, void *dataSize, void *ssMode)
{
    ccInt loopWindowNum, mode = *(ccInt *) ssMode;
    window *loopWindow;
    pinned_LL *windowsPLL = &(theView->windowPtr->variable_ptr->windows);
    
    if (mode == 1)  {
        if (isBusy(theView->windowPtr, busy_SS_flag))  return;      }
    
    else if (mode == 2)  {
        ccBool firstBusyWindow = ccFalse;
        ccInt windowTop, toAdd, bestOffset, bestTop, prevOffset = -1, prevTop = 0;
        
        for (loopWindowNum = 1; loopWindowNum <= windowsPLL->data.elementNum; loopWindowNum++)  {
            loopWindow = (window *) element(&(windowsPLL->data), loopWindowNum);
            if (isBusy(loopWindow, busy_SS_flag))  {
                firstBusyWindow = (loopWindow == theView->windowPtr);
                break;
        }   }
        
        if (firstBusyWindow)  {
        while (ccTrue)  {
            window *bestWindow = NULL;
            bestTop = prevTop;
            bestOffset = ccIntMax;
            
            for (loopWindowNum = 1; loopWindowNum <= windowsPLL->data.elementNum; loopWindowNum++)  {
                loopWindow = (window *) element(&(windowsPLL->data), loopWindowNum);
                if (isBusy(loopWindow, busy_SS_flag))  {
                    windowTop = loopWindow->offset+loopWindow->width;
                    if ( ((loopWindow->offset > prevOffset) && (loopWindow->offset <= prevTop) && (windowTop > bestTop))  
                                || ((loopWindow->offset < bestOffset) && (bestOffset > prevTop) && (windowTop > prevTop)) )  {
                        bestWindow = loopWindow;
                        bestOffset = loopWindow->offset;
                        bestTop = windowTop;
            }   }   }
            
            if (bestWindow == NULL)  break;
            
            if (bestOffset <= prevTop)  toAdd = bestTop-prevTop;
            else  toAdd = bestTop-bestOffset;
            
            *(ccInt *) dataSize += toAdd*bestWindow->variable_ptr->mem.data.elementSize;
            
            prevOffset = bestOffset;
            prevTop = bestTop;
    }   }}
    
    if (mode == 1)  setBusy(theView->windowPtr, busy_SS_flag);
    else if (mode == 3)  clearBusy(theView->windowPtr, busy_SS_flag);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x10(%rsp)
movl (%rdx), %ecx
movq (%rdi), %rax
cmpl $0x1, %ecx
je 0xd033
cmpl $0x3, %ecx
je 0xd02d
cmpl $0x2, %ecx
jne 0xd041
movq %rdi, %r15
movq 0x10(%rax), %r14
addq $0x30, %r14
pushq $0x1
popq %rbp
cmpl (%r14), %ebp
jg 0xd041
movq %r14, %rdi
movl %ebp, %esi
callq 0x9088
incl %ebp
testb $0x1, 0x24(%rax)
je 0xcf54
cmpq (%r15), %rax
jne 0xd041
xorl %r12d, %r12d
pushq $-0x1
popq %rbx
xorl %r13d, %r13d
movl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
pushq $0x1
popq %rbp
movq $0x0, 0x8(%rsp)
cmpl (%r14), %ebp
jg 0xcffc
movq %r14, %rdi
movl %ebp, %esi
callq 0x9088
testb $0x1, 0x24(%rax)
je 0xcff8
movl 0x18(%rax), %ecx
movl 0x1c(%rax), %edx
addl %ecx, %edx
cmpl %ebx, %ecx
setg %sil
cmpl %r12d, %ecx
setle %dil
cmpl %r13d, %edx
setg %r8b
andb %sil, %r8b
testb %dil, %r8b
jne 0xcfed
cmpl %r15d, %ecx
setl %sil
cmpl %r12d, %r15d
setg %dil
cmpl %r12d, %edx
setg %r8b
andb %sil, %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0xcff8
movl %ecx, %r15d
movl %edx, %r13d
movq %rax, 0x8(%rsp)
incl %ebp
jmp 0xcf93
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0xd041
cmpl %r12d, %r15d
cmovgl %r15d, %r12d
movl %r13d, %eax
subl %r12d, %eax
movq 0x10(%rcx), %rcx
imull 0x20(%rcx), %eax
movq 0x10(%rsp), %rcx
addl %eax, (%rcx)
movl %r15d, %ebx
movl %r13d, %r12d
jmp 0xcf81
andb $-0x2, 0x24(%rax)
jmp 0xd041
movl 0x24(%rax), %ecx
testb $0x1, %cl
jne 0xd041
orl $0x1, %ecx
movl %ecx, 0x24(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq