// File: /workspace/github_cpp_makefile_star2_O2/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLOpenShared
FILE *CPLOpenShared( const char *pszFilename, const char *pszAccess,
                     int bLarge )

{
    int i;
    int bReuse;
    CPLMutexHolderD( &hSharedFileMutex );

/* -------------------------------------------------------------------- */
/*      Is there an existing file we can use?                           */
/* -------------------------------------------------------------------- */
    bReuse = EQUAL(pszAccess,"rb") || EQUAL(pszAccess, "rb+");

    for( i = 0; bReuse && i < nSharedFileCount; i++ )
    {
        if( strcmp(pasSharedFileList[i].pszFilename,pszFilename) == 0 
            && !bLarge == !pasSharedFileList[i].bLarge
            && EQUAL(pasSharedFileList[i].pszAccess,pszAccess) )
        {
            pasSharedFileList[i].nRefCount++;
            return pasSharedFileList[i].fp;
        }
    }

/* -------------------------------------------------------------------- */
/*      Open the file.                                                  */
/* -------------------------------------------------------------------- */
    FILE *fp;

    if( bLarge )
        fp = VSIFOpenL( pszFilename, pszAccess );
    else
        fp = VSIFOpen( pszFilename, pszAccess );

    if( fp == NULL )
        return NULL;

/* -------------------------------------------------------------------- */
/*      Add an entry to the list.                                       */
/* -------------------------------------------------------------------- */
    nSharedFileCount++;

    pasSharedFileList = (CPLSharedFileInfo *)
        CPLRealloc( (void *) pasSharedFileList, 
                    sizeof(CPLSharedFileInfo) * nSharedFileCount );

    pasSharedFileList[nSharedFileCount-1].fp = fp;
    pasSharedFileList[nSharedFileCount-1].nRefCount = 1;
    pasSharedFileList[nSharedFileCount-1].bLarge = bLarge;
    pasSharedFileList[nSharedFileCount-1].pszFilename =CPLStrdup(pszFilename);
    pasSharedFileList[nSharedFileCount-1].pszAccess = CPLStrdup(pszAccess);

    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x11593(%rip), %rsi     # 0x15348
leaq 0xa63e(%rip), %rdx      # 0xe3fa
movq %rsp, %rdi
movsd 0xa449(%rip), %xmm0     # 0xe210
movl $0x728, %ecx            # imm = 0x728
callq 0x4c40
leaq 0xa648(%rip), %rsi      # 0xe420
movq %rbx, %rdi
callq 0x22e0
testl %eax, %eax
je 0x3ec4
leaq 0xa634(%rip), %rsi      # 0xe423
movq %rbx, %rdi
callq 0x22e0
testl %ebp, %ebp
sete %r15b
testl %eax, %eax
je 0x3eca
testb %r15b, %r15b
je 0x3e17
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6970
jmp 0x3e22
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6935
movq %rax, %r15
testq %rax, %rax
je 0x3f20
incl 0x1151c(%rip)           # 0x15350
movq 0x1151d(%rip), %rdi     # 0x15358
movslq 0x1150e(%rip), %rsi     # 0x15350
shlq $0x5, %rsi
callq 0x2d0a
movq %rax, 0x11506(%rip)     # 0x15358
movslq 0x114f7(%rip), %rcx     # 0x15350
shlq $0x5, %rcx
movq %r15, -0x20(%rax,%rcx)
movslq 0x114e7(%rip), %rcx     # 0x15350
shlq $0x5, %rcx
movl $0x1, -0x18(%rax,%rcx)
movslq 0x114d4(%rip), %rcx     # 0x15350
shlq $0x5, %rcx
movl %ebp, -0x14(%rax,%rcx)
movq %r14, %rdi
callq 0x2d77
movq 0x114c5(%rip), %rcx     # 0x15358
movslq 0x114b6(%rip), %rdx     # 0x15350
shlq $0x5, %rdx
movq %rax, -0x10(%rcx,%rdx)
movq %rbx, %rdi
callq 0x2d77
movq 0x114a6(%rip), %rcx     # 0x15358
movslq 0x11497(%rip), %rdx     # 0x15350
shlq $0x5, %rdx
movq %rax, -0x8(%rcx,%rdx)
jmp 0x3f2f
testl %ebp, %ebp
sete %r15b
movq 0x11487(%rip), %r12     # 0x15358
addq $0x18, %r12
xorl %r13d, %r13d
movslq 0x11471(%rip), %rax     # 0x15350
cmpq %rax, %r13
jge 0x3e05
movq -0x8(%r12), %rdi
movq %r14, %rsi
callq 0x2400
testl %eax, %eax
jne 0x3f17
cmpl $0x0, -0xc(%r12)
setne %al
cmpb %al, %r15b
je 0x3f17
movq (%r12), %rdi
movq %rbx, %rsi
callq 0x22e0
testl %eax, %eax
je 0x3f25
incq %r13
addq $0x20, %r12
jmp 0x3ed8
xorl %r15d, %r15d
jmp 0x3f2f
incl -0x10(%r12)
movq -0x18(%r12), %r15
movq %rsp, %rdi
callq 0x4c42
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4c42
movq %rbx, %rdi
callq 0x2500