// File: /workspace/github_cpp_makefile_star2_O1/rurban[P]dgnlib/cpl_conv.cpp
// Function: CPLCloseShared
void CPLCloseShared( FILE * fp )

{
    CPLMutexHolderD( &hSharedFileMutex );
    int i;

/* -------------------------------------------------------------------- */
/*      Search for matching information.                                */
/* -------------------------------------------------------------------- */
    for( i = 0; i < nSharedFileCount && fp != pasSharedFileList[i].fp; i++ ){}

    if( i == nSharedFileCount )
    {
        CPLError( CE_Failure, CPLE_AppDefined, 
                  "Unable to find file handle %p in CPLCloseShared().",
                  fp );
        return;
    }

/* -------------------------------------------------------------------- */
/*      Dereference and return if there are still some references.      */
/* -------------------------------------------------------------------- */
    if( --pasSharedFileList[i].nRefCount > 0 )
        return;

/* -------------------------------------------------------------------- */
/*      Close the file, and remove the information.                     */
/* -------------------------------------------------------------------- */
    if( pasSharedFileList[i].bLarge )
        VSIFCloseL( pasSharedFileList[i].fp );
    else
        VSIFClose( pasSharedFileList[i].fp );

    CPLFree( pasSharedFileList[i].pszFilename );
    CPLFree( pasSharedFileList[i].pszAccess );

//    pasSharedFileList[i] = pasSharedFileList[--nSharedFileCount];
    memcpy( (void *) (pasSharedFileList + i), 
            (void *) (pasSharedFileList + --nSharedFileCount), 
            sizeof(CPLSharedFileInfo) );

    if( nSharedFileCount == 0 )
    {
        CPLFree( (void *) pasSharedFileList );
        pasSharedFileList = NULL;
    }
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x12109(%rip), %rsi     # 0x16348
leaq 0xc194(%rip), %rdx      # 0x103da
leaq 0x8(%rsp), %rdi
movsd 0xbfc5(%rip), %xmm0     # 0x10218
movl $0x76a, %ecx            # imm = 0x76A
callq 0x4f80
cmpl $0x0, 0x120ec(%rip)     # 0x16350
jle 0x428c
movq 0x120eb(%rip), %rcx     # 0x16358
xorl %eax, %eax
movq (%rcx), %rdx
cmpq %rbx, %rdx
je 0x428e
incq %rax
movslq 0x120cf(%rip), %rdx     # 0x16350
addq $0x20, %rcx
cmpq %rdx, %rax
jl 0x426f
jmp 0x428e
xorl %eax, %eax
cmpl 0x120bc(%rip), %eax     # 0x16350
jne 0x42b6
leaq 0xc16a(%rip), %rdx      # 0x10407
movl $0x3, %edi
movl $0x1, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x46dc
jmp 0x4352
movq 0x1209b(%rip), %rcx     # 0x16358
movl %eax, %ebx
shlq $0x5, %rbx
movl 0x8(%rcx,%rbx), %eax
leal -0x1(%rax), %edx
movl %edx, 0x8(%rcx,%rbx)
cmpl $0x1, %eax
jg 0x4352
cmpl $0x0, 0xc(%rcx,%rbx)
movq (%rcx,%rbx), %rdi
je 0x42e5
callq 0x6f0e
jmp 0x42ea
callq 0x6f49
movq 0x12067(%rip), %rax     # 0x16358
movq 0x10(%rax,%rbx), %rdi
callq 0x701d
movq 0x12056(%rip), %rax     # 0x16358
movq 0x18(%rax,%rbx), %rdi
callq 0x701d
movq 0x12045(%rip), %rdi     # 0x16358
movslq 0x12036(%rip), %rax     # 0x16350
decq %rax
movl %eax, 0x1202d(%rip)     # 0x16350
shlq $0x5, %rax
movups (%rdi,%rax), %xmm0
movups 0x10(%rdi,%rax), %xmm1
movups %xmm1, 0x10(%rdi,%rbx)
movups %xmm0, (%rdi,%rbx)
cmpl $0x0, 0x12010(%rip)     # 0x16350
jne 0x4352
callq 0x701d
movq $0x0, 0x12006(%rip) # 0x16358
leaq 0x8(%rsp), %rdi
callq 0x4f82
addq $0x20, %rsp
popq %rbx
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4f82
movq %rbx, %rdi
callq 0x2510