// File: /workspace/github_c_makefile_star2_O2/heltilda[P]cicada/intrpt.c
// Function: doReadWrite
void doReadWrite(view *theView, void *globalPtr, void *secondaryPtr, ccBool doInIndexOrder, ccBool skipBusyMembers, ccBool bundleStrings,
        void(*srwComposite)(view *, void *, void *),
        void(*srwData)(view *, void *, void *),
        void(*srwString)(view *, ccInt, void *, void *))
{
    view nextView;
    member *loopMember;
    variable *theVar = theView->windowPtr->variable_ptr;
    ccInt memberCounter, indexCounter;
    
    if (theVar->type >= composite_type)   {
        
        for (memberCounter = 1; memberCounter <= theVar->mem.members.elementNum; memberCounter++)  {
            loopMember = LL_member(theVar, memberCounter);
            
            if (isBusy(loopMember, busy_SRW_flag))  {
                if (!skipBusyMembers)  {
                    setError(self_reference_err, pcCodePtr-1);
                    return;
            }   }
            
            else  {
                setBusy(loopMember, busy_SRW_flag);
                
                if ((loopMember->memberWindow != NULL) && (!loopMember->ifHidden))      {
                    if (doInIndexOrder)  {
                    for (indexCounter = 0; indexCounter < theView->width*loopMember->indices; indexCounter++)  {
                        nextView.windowPtr = theView->windowPtr;
                        nextView.offset = theView->offset;
                        nextView.width = 1;
                        stepView(&nextView, loopMember, indexCounter, 1);
                        if (errCode == passed)  srwComposite(&nextView, globalPtr, secondaryPtr);
                        else  errCode = passed;
                    }}
                    
                    else  {
                        nextView = *theView;
                        stepView(&nextView, loopMember, 0, loopMember->indices);
                        if (errCode == passed)  srwComposite(&nextView, globalPtr, secondaryPtr);
                        else  errCode = passed;
                }   }
                
                clearBusy(loopMember, busy_SRW_flag);
                if (errCode != passed)  return;
    }   }   }
    
    else  {        // it's a primitive variable
        if (theVar->type == string_type)  {
            ccInt viewTop = theView->width;
            if (bundleStrings)  viewTop = 1;  
            
            for (indexCounter = 1; indexCounter <= viewTop; indexCounter++)  {
                srwString(theView, theView->offset+indexCounter, globalPtr, secondaryPtr);
                if (errCode != passed)  break;
        }   }
        else  srwData(theView, globalPtr, secondaryPtr);            }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, 0x1c(%rsp)
movl %ecx, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r15
movq (%rdi), %rax
movq 0x10(%rax), %r13
movl 0xc0(%r13), %eax
cmpl $0x5, %eax
jl 0xcddc
movq 0x80(%rsp), %rax
movq %rax, 0x28(%rsp)
addq $0x10, %r13
pushq $0x1
popq %rsi
leaq 0x17ac6(%rip), %rax     # 0x24760
leaq 0x30(%rsp), %rbx
movq %r13, 0x20(%rsp)
cmpl (%r13), %esi
jg 0xce6a
movq %rax, %r12
movq %r13, %rdi
movl %esi, 0x4(%rsp)
callq 0x9088
movq %rax, %r14
movl 0x44(%rax), %eax
testb $0x40, %al
jne 0xcd00
movq %rbx, %r13
orl $0x40, %eax
movl %eax, 0x44(%r14)
cmpq $0x0, (%r14)
je 0xccde
cmpb $0x0, 0x40(%r14)
je 0xcd16
movl 0x18(%r12), %eax
andl $-0x41, 0x44(%r14)
testl %eax, %eax
movq %r12, %rax
movq %r13, %rbx
movq 0x20(%rsp), %r13
movl 0x4(%rsp), %esi
je 0xcd12
jmp 0xce6a
cmpb $0x0, 0x1c(%rsp)
movq %r12, %rax
movl 0x4(%rsp), %esi
je 0xce57
incl %esi
jmp 0xcca4
cmpb $0x0, 0x18(%rsp)
je 0xcd7c
xorl %ebx, %ebx
movl 0xc(%r14), %eax
imull 0xc(%r15), %eax
cmpl %eax, %ebx
jge 0xccde
movq (%r15), %rax
movq %rax, 0x30(%rsp)
movl 0x8(%r15), %eax
movl %eax, 0x38(%rsp)
movl $0x1, 0x3c(%rsp)
movq %r13, %rbp
movq %r13, %rdi
movq %r14, %rsi
movl %ebx, %edx
pushq $0x1
popq %rcx
callq 0xcb03
cmpl $0x0, 0x18(%r12)
je 0xcd67
andl $0x0, 0x18(%r12)
jmp 0xcd78
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq *0x28(%rsp)
incl %ebx
jmp 0xcd1f
movq 0x10(%r15), %rax
movq %rax, 0x40(%rsp)
movups (%r15), %xmm0
movaps %xmm0, 0x30(%rsp)
movl 0xc(%r14), %ecx
movq %r13, %rbx
movq %r13, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0xcb03
cmpl $0x0, 0x18(%r12)
je 0xcdc6
movq %r12, %rax
andl $0x0, 0x18(%r12)
andb $-0x41, 0x44(%r14)
movq 0x20(%rsp), %r13
movl 0x4(%rsp), %esi
jmp 0xcd12
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq *0x28(%rsp)
jmp 0xccde
cmpl $0x4, %eax
jne 0xce32
movl 0xc(%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovgl %eax, %ecx
movq 0x90(%rsp), %rbx
incl %ecx
testb %r9b, %r9b
pushq $0x2
popq %rbp
cmovel %ecx, %ebp
pushq $0x1
popq %r14
leaq 0x17956(%rip), %r12     # 0x24760
cmpl %r14d, %ebp
je 0xce6a
movl 0x8(%r15), %esi
addl %r14d, %esi
movq %r15, %rdi
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq *%rbx
incl %r14d
cmpl $0x0, 0x18(%r12)
je 0xce0a
jmp 0xce6a
movq 0x88(%rsp), %rax
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movq 0xb8(%rax), %rsi
addq $-0x4, %rsi
pushq $0x2f
popq %rdi
callq 0xc7c2
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq