// File: /workspace/github_cpp_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x11351(%rip), %rsi     # 0x15348
leaq 0xb3fc(%rip), %rdx      # 0xf3fa
leaq 0x8(%rsp), %rdi
movsd 0xb205(%rip), %xmm0     # 0xf210
movl $0x728, %ecx            # imm = 0x728
callq 0x4ecc
leaq 0xb404(%rip), %rsi      # 0xf420
movq %rbx, %rdi
callq 0x22e0
testl %eax, %eax
je 0x403b
leaq 0xb3f4(%rip), %rsi      # 0xf423
movq %rbx, %rdi
callq 0x22e0
testl %eax, %eax
jne 0x4099
movq 0x11316(%rip), %r15     # 0x15358
cmpl $0x0, 0x11307(%rip)     # 0x15350
jle 0x4099
addq $0x18, %r15
xorl %r12d, %r12d
movq -0x8(%r15), %rdi
movq %r14, %rsi
callq 0x2400
testl %eax, %eax
jne 0x4086
testl %ebp, %ebp
sete %al
cmpl $0x0, -0xc(%r15)
setne %cl
cmpb %cl, %al
je 0x4086
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x22e0
testl %eax, %eax
je 0x4174
incq %r12
movslq 0x112c0(%rip), %rax     # 0x15350
addq $0x20, %r15
cmpq %rax, %r12
jl 0x4052
testl %ebp, %ebp
je 0x40aa
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6dc9
jmp 0x40b5
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6e04
movq %rax, %r15
testq %rax, %rax
je 0x4157
incl 0x11289(%rip)           # 0x15350
movq 0x1128a(%rip), %rdi     # 0x15358
movslq 0x1127b(%rip), %rsi     # 0x15350
shlq $0x5, %rsi
callq 0x2dcb
movq %rax, 0x11273(%rip)     # 0x15358
movslq 0x11264(%rip), %rcx     # 0x15350
shlq $0x5, %rcx
movq %r15, -0x20(%rax,%rcx)
movslq 0x11254(%rip), %rcx     # 0x15350
shlq $0x5, %rcx
movl $0x1, -0x18(%rax,%rcx)
movslq 0x11241(%rip), %rcx     # 0x15350
shlq $0x5, %rcx
movl %ebp, -0x14(%rax,%rcx)
movq %r14, %rdi
callq 0x2e41
movq 0x11232(%rip), %rcx     # 0x15358
movslq 0x11223(%rip), %rdx     # 0x15350
shlq $0x5, %rdx
movq %rax, -0x10(%rcx,%rdx)
movq %rbx, %rdi
callq 0x2e41
movq 0x11213(%rip), %rcx     # 0x15358
movslq 0x11204(%rip), %rdx     # 0x15350
shlq $0x5, %rdx
movq %rax, -0x8(%rcx,%rdx)
jmp 0x415a
xorl %r15d, %r15d
leaq 0x8(%rsp), %rdi
callq 0x4ece
movq %r15, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
incl -0x10(%r15)
movq -0x18(%r15), %r15
jmp 0x415a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4ece
movq %rbx, %rdi
callq 0x2500