// File: 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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x20(%rbp), %rdi
leaq 0x1a6c1(%rip), %rsi     # 0x1f648
movsd 0x14291(%rip), %xmm0    # 0x19220
leaq 0x14465(%rip), %rdx     # 0x193fb
movl $0x76a, %ecx            # imm = 0x76A
callq 0x6370
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %ecx
movl 0x1a6a0(%rip), %edx     # 0x1f650
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x39(%rbp)
jge 0x4fdb
movq -0x8(%rbp), %rax
movq 0x1a694(%rip), %rcx     # 0x1f658
movslq -0x24(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
cmpq %rcx, %rax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x4fe4
jmp 0x4ff1
jmp 0x4fe6
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x4fa7
movl -0x24(%rbp), %eax
movl 0x1a656(%rip), %ecx     # 0x1f650
cmpl %ecx, %eax
jne 0x5042
movq -0x8(%rbp), %rcx
leaq 0x1441f(%rip), %rdx     # 0x19428
xorl %eax, %eax
movl $0x3, %edi
movl $0x1, %esi
callq 0x5740
jmp 0x501c
movl $0x1, -0x38(%rbp)
jmp 0x5171
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x6390
jmp 0x5180
movq 0x1a60f(%rip), %rcx     # 0x1f658
movslq -0x24(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movl 0x8(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x8(%rcx)
cmpl $0x0, %eax
jle 0x506e
movl $0x1, -0x38(%rbp)
jmp 0x5171
movq 0x1a5e3(%rip), %rax     # 0x1f658
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
cmpl $0x0, %eax
je 0x50a4
movq 0x1a5c9(%rip), %rax     # 0x1f658
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdi
callq 0x9b20
jmp 0x50a2
jmp 0x50c0
movq 0x1a5ad(%rip), %rax     # 0x1f658
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rdi
callq 0x9cb0
jmp 0x50be
jmp 0x50c0
movq 0x1a591(%rip), %rax     # 0x1f658
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
movq 0x10(%rax,%rcx), %rdi
callq 0xa000
jmp 0x50db
movq 0x1a576(%rip), %rax     # 0x1f658
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rdi
callq 0xa000
jmp 0x50f6
movq 0x1a55b(%rip), %rax     # 0x1f658
movslq -0x24(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x1a549(%rip), %rcx     # 0x1f658
movl 0x1a53b(%rip), %edx     # 0x1f650
addl $-0x1, %edx
movl %edx, 0x1a532(%rip)     # 0x1f650
movslq %edx, %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x18(%rax)
movl 0x1a504(%rip), %eax     # 0x1f650
cmpl $0x0, %eax
jne 0x516a
movq 0x1a500(%rip), %rdi     # 0x1f658
callq 0xa000
jmp 0x515f
movq $0x0, 0x1a4ee(%rip) # 0x1f658
movl $0x0, -0x38(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x6390
addq $0x40, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x24f0
nopl (%rax)