// File: /workspace/github_c_makefile_star2_O3/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
movl (%rdx), %ecx
movq (%rdi), %rax
cmpl $0x3, %ecx
je 0xd7f4
cmpl $0x2, %ecx
je 0xd7c3
cmpl $0x1, %ecx
jne 0xd7f8
movl 0x24(%rax), %ecx
testb $0x1, %cl
jne 0xd7f8
orl $0x1, %ecx
movl %ecx, 0x24(%rax)
jmp 0xd7f8
movq %rsi, 0x10(%rsp)
movq 0x10(%rax), %r14
addq $0x30, %r14
cmpl $0x0, (%r14)
jle 0xd7f8
movq %rdi, %r15
xorl %ebp, %ebp
incl %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x91d8
testb $0x1, 0x24(%rax)
jne 0xd807
cmpl (%r14), %ebp
jl 0xd7db
jmp 0xd7f8
andb $-0x2, 0x24(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq (%r15), %rax
jne 0xd7f8
cmpl $0x0, (%r14)
jle 0xd7f8
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
xorl %r15d, %r15d
xorl %r12d, %r12d
movl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
incl %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x91d8
testb $0x1, 0x24(%rax)
je 0xd890
movl 0x18(%rax), %ecx
movl 0x1c(%rax), %edx
addl %ecx, %edx
cmpl %ebx, %ecx
setg %sil
cmpl %r15d, %ecx
setle %dil
cmpl %r12d, %edx
setg %r8b
andb %sil, %r8b
testb %dil, %r8b
jne 0xd885
cmpl %r13d, %ecx
setl %sil
cmpl %r15d, %r13d
setg %dil
cmpl %r15d, %edx
setg %r8b
andb %sil, %dil
andb %r8b, %dil
cmpb $0x1, %dil
jne 0xd890
movl %ecx, %r13d
movl %edx, %r12d
movq %rax, 0x8(%rsp)
cmpl (%r14), %ebp
jl 0xd82e
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0xd7f8
cmpl %r15d, %r13d
cmovgl %r13d, %r15d
movl %r12d, %eax
subl %r15d, %eax
movq 0x10(%rcx), %rcx
imull 0x20(%rcx), %eax
movq 0x10(%rsp), %rcx
addl %eax, (%rcx)
cmpl $0x0, (%r14)
movl %r12d, %r15d
movl %r13d, %ebx
jg 0xd81d
jmp 0xd7f8