// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
addq $0x30, %rax
movq %rax, -0x30(%rbp)
cmpl $0x1, -0x20(%rbp)
jne 0x10642
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x24(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1063d
jmp 0x1080f
jmp 0x107d1
cmpl $0x2, -0x20(%rbp)
jne 0x107cf
movb $0x0, -0x31(%rbp)
movl $0xffffffff, -0x48(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x4c(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x106b1
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x9700
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x24(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x106a4
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
sete %al
andb $0x1, %al
movb %al, -0x31(%rbp)
jmp 0x106b1
jmp 0x106a6
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x10665
cmpb $0x0, -0x31(%rbp)
je 0x107cd
jmp 0x106bd
movq $0x0, -0x58(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x44(%rbp)
movl $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x1077e
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x9700
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0x24(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1076e
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x28(%rbp), %rcx
addl 0x1c(%rcx), %eax
movl %eax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x48(%rbp), %eax
jle 0x10738
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x4c(%rbp), %eax
jg 0x10738
movl -0x38(%rbp), %eax
cmpl -0x44(%rbp), %eax
jg 0x10754
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x40(%rbp), %eax
jge 0x1076c
movl -0x40(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jle 0x1076c
movl -0x38(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jle 0x1076c
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x40(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x1076e
jmp 0x10770
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x106d9
cmpq $0x0, -0x58(%rbp)
jne 0x10787
jmp 0x107cb
movl -0x40(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0x1079a
movl -0x44(%rbp), %eax
subl -0x4c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x107a3
movl -0x44(%rbp), %eax
subl -0x40(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rax
imull 0x20(%rax), %ecx
movq -0x10(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
movl -0x40(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x106bd
jmp 0x107cd
jmp 0x107cf
jmp 0x107d1
cmpl $0x1, -0x20(%rbp)
jne 0x107f0
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x24(%rax), %ecx
orl $0x1, %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl %ecx, 0x24(%rax)
jmp 0x1080f
cmpl $0x3, -0x20(%rbp)
jne 0x1080d
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x24(%rax), %ecx
andl $-0x2, %ecx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl %ecx, 0x24(%rax)
jmp 0x1080f
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)