// File: rofl0r[P]ascc/cs_parser.cpp
// Function: find_member_sym(int, long*, int)
int find_member_sym(int structSym, long *memSym, int allowProtected) {
    int oriname = *memSym;
    const char *possname = get_member_full_name(structSym, oriname);

    oriname = sym.find(possname);
    if (oriname < 0) {
        if (sym.entries[structSym].extends > 0) {
            // walk the inheritance tree to find the member
            if (find_member_sym(sym.entries[structSym].extends, memSym, allowProtected) == 0)
                return 0;
            // the inherited member was not found, so fall through to
            // the error message
        }
        cc_error("'%s' is not a public member of '%s'. Are you sure you spelt it correctly (remember, capital letters are important)?",sym.get_friendly_name(*memSym).c_str(),sym.get_friendly_name(structSym).c_str());
        return -1;
    }
    if ((!allowProtected) && (sym.entries[oriname].flags & SFLG_PROTECTED)) {
        cc_error("Cannot access protected member '%s'", sym.get_friendly_name(oriname).c_str());
        return -1;
    }
    *memSym = oriname;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x18(%rbp)
movl -0x8(%rbp), %edi
movl -0x18(%rbp), %esi
callq 0x6770
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq 0x3a417(%rip), %rdi     # 0x42870
callq 0x1f050
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jge 0x857d
movslq -0x8(%rbp), %rsi
leaq 0x3a3fa(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movswl 0x50(%rax), %eax
cmpl $0x0, %eax
jle 0x84bf
movslq -0x8(%rbp), %rsi
leaq 0x3a3dd(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movswl 0x50(%rax), %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0x8420
cmpl $0x0, %eax
jne 0x84bd
movl $0x0, -0x4(%rbp)
jmp 0x8628
jmp 0x84bf
movq -0x10(%rbp), %rax
movl (%rax), %edx
leaq 0x3a3a4(%rip), %rsi     # 0x42870
movq %rsi, -0xa0(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x1f080
movq -0xa8(%rbp), %rdi
callq 0x41b0
movq -0xa0(%rbp), %rsi
movq %rax, -0x98(%rbp)
movl -0x8(%rbp), %edx
leaq -0x60(%rbp), %rdi
callq 0x1f080
jmp 0x850b
leaq -0x60(%rbp), %rdi
callq 0x41b0
movq -0x98(%rbp), %rsi
movq %rax, %rdx
leaq 0x294c0(%rip), %rdi     # 0x319e5
xorl %eax, %eax
callq 0x1bac0
jmp 0x852e
leaq -0x60(%rbp), %rdi
callq 0x4270
leaq -0x40(%rbp), %rdi
callq 0x4270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8628
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x856f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4270
leaq -0x40(%rbp), %rdi
callq 0x4270
jmp 0x8634
cmpl $0x0, -0x14(%rbp)
jne 0x8616
movslq -0x18(%rbp), %rsi
leaq 0x3a2de(%rip), %rdi     # 0x42870
addq $0x28, %rdi
callq 0x17e60
movq 0x28(%rax), %rax
andq $0x4000, %rax           # imm = 0x4000
cmpq $0x0, %rax
je 0x8616
movl -0x18(%rbp), %edx
leaq 0x3a2bb(%rip), %rsi     # 0x42870
leaq -0x90(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x1f080
movq -0xb0(%rbp), %rdi
callq 0x41b0
movq %rax, %rsi
leaq 0x2947b(%rip), %rdi     # 0x31a59
xorl %eax, %eax
callq 0x1bac0
jmp 0x85e7
leaq -0x90(%rbp), %rdi
callq 0x4270
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8628
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x4270
jmp 0x8634
movslq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x4670
nopl (%rax)