// File: /workspace/github_c_makefile_star2_O1/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 %rdi, %rbx
movl (%rdx), %r14d
movq (%rdi), %rax
cmpl $0x1, %r14d
jne 0xd9a7
testb $0x1, 0x24(%rax)
je 0xdab7
jmp 0xdad3
cmpl $0x2, %r14d
jne 0xdab7
movq 0x10(%rax), %r15
addq $0x30, %r15
cmpl $0x0, (%r15)
jle 0xdab7
movq %rsi, %r12
xorl %ebp, %ebp
incl %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x911c
testb $0x1, 0x24(%rax)
jne 0xd9e4
cmpl (%r15), %ebp
jl 0xd9c8
jmp 0xdab7
cmpq (%rbx), %rax
jne 0xdab7
xorl %ebp, %ebp
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
movq %rbx, 0x10(%rsp)
movl %r14d, (%rsp)
movq %r12, 0x8(%rsp)
cmpl $0x0, (%r15)
jle 0xda70
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r12d, %r12d
xorl %ebx, %ebx
movl %ebp, %r13d
incl %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x911c
testb $0x1, 0x24(%rax)
je 0xda69
movl 0x18(%rax), %edx
movl 0x1c(%rax), %ecx
addl %edx, %ecx
cmpl 0x4(%rsp), %edx
setg %sil
cmpl %ebp, %edx
setle %dil
cmpl %r13d, %ecx
setg %r8b
andb %sil, %r8b
testb %dil, %r8b
jne 0xda60
cmpl %r14d, %edx
jge 0xda69
cmpl %ebp, %r14d
jle 0xda69
cmpl %ebp, %ecx
jle 0xda69
movl %edx, %r14d
movl %ecx, %r13d
movq %rax, %rbx
cmpl (%r15), %r12d
jl 0xda19
jmp 0xda7b
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movl %ebp, %r13d
xorl %ebx, %ebx
testq %rbx, %rbx
je 0xdaa5
cmpl %ebp, %r14d
cmovgl %r14d, %ebp
movl %r13d, %eax
subl %ebp, %eax
movq 0x10(%rbx), %rcx
imull 0x20(%rcx), %eax
movq 0x8(%rsp), %r12
addl %eax, (%r12)
movl %r14d, 0x4(%rsp)
movl %r13d, %ebp
movl (%rsp), %r14d
testq %rbx, %rbx
movq 0x10(%rsp), %rbx
jne 0xda05
cmpl $0x1, %r14d
jne 0xdac6
movq (%rbx), %rax
orl $0x1, 0x24(%rax)
jmp 0xdad3
cmpl $0x3, %r14d
jne 0xdad3
movq (%rbx), %rax
andl $-0x2, 0x24(%rax)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq