// File: /workspace/github_c_makefile_star2_O0/heltilda[P]cicada/intrpt.c
// Function: findMemberIndex
ccInt findMemberIndex(variable *theVariable, ccInt currentOffset, ccInt soughtMemberIndex,
        member **soughtMember, ccInt *memberNumber, ccInt *entryOffset, ccBool allowAddMember)
{
    ccInt indexCounter, rtrn;
    
    if (soughtMemberIndex <= 0)  return invalid_index_err;
    
    
        // if it's a composite variable, return the Nth member
    
    if (theVariable->type == composite_type)  {
        *entryOffset = 0;
        indexCounter = 0;
        for (*memberNumber = 1; *memberNumber <= theVariable->mem.members.elementNum; (*memberNumber)++)  {
            *soughtMember = LL_member(theVariable, *memberNumber);
            if (!(*soughtMember)->ifHidden)  {
                indexCounter++;
                if (indexCounter == soughtMemberIndex)  return passed;
        }   }
        
        if ((!allowAddMember) || (indexCounter != soughtMemberIndex-1))  {
            *entryOffset = *memberNumber;
            return invalid_index_err;         }
        
        else  {
            *memberNumber = theVariable->mem.members.elementNum + 1;
            rtrn = addMember(theVariable, *memberNumber, 1, soughtMember, ccFalse, 1, ccTrue);
            if (rtrn == passed)  (*soughtMember)->memberID = 0;
            return rtrn;
    }   }
    
    
        // if it's an array or string variable, return the Nth index of the first member
    
    if (theVariable->type == string_type)
        *memberNumber = currentOffset+1;
    else  *memberNumber = 1;
    *soughtMember = LL_member(theVariable, *memberNumber);
    
    
    if (soughtMemberIndex > (*soughtMember)->indices)  {
        *entryOffset = (*soughtMember)->indices+1;
        return invalid_index_err;    }
    
    *entryOffset = soughtMemberIndex - 1;
    return passed;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb 0x10(%rbp), %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x0, -0x18(%rbp)
jg 0x12923
movl $0x1e, -0x4(%rbp)
jmp 0x12ab9
movq -0x10(%rbp), %rax
cmpl $0x5, 0xc0(%rax)
jne 0x12a39
movq -0x30(%rbp), %rax
movl $0x0, (%rax)
movl $0x0, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movq -0x28(%rbp), %rax
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jg 0x129b6
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x28(%rbp), %rax
movl (%rax), %esi
callq 0x9700
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpb $0x0, 0x40(%rax)
jne 0x129a7
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0x129a5
movl $0x0, -0x4(%rbp)
jmp 0x12ab9
jmp 0x129a7
jmp 0x129a9
movq -0x28(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x1294f
cmpb $0x0, 0x10(%rbp)
je 0x129c9
movl -0x34(%rbp), %eax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
je 0x129e1
movq -0x28(%rbp), %rax
movl (%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x1e, -0x4(%rbp)
jmp 0x12ab9
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movl (%rax), %esi
movq -0x20(%rbp), %rcx
movl $0x1, %r9d
xorl %r8d, %r8d
movl %r9d, %edx
movl $0x1, (%rsp)
callq 0x127d0
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0x12a2e
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl $0x0, 0x8(%rax)
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x12ab9
movq -0x10(%rbp), %rax
cmpl $0x4, 0xc0(%rax)
jne 0x12a54
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
jmp 0x12a5e
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
movq -0x28(%rbp), %rax
movl (%rax), %esi
callq 0x9700
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl -0x18(%rbp), %eax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0xc(%rcx), %eax
jle 0x12aa6
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x1e, -0x4(%rbp)
jmp 0x12ab9
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)