// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: unixFullPathname
static int unixFullPathname(
  sqlite3_vfs *pVfs,            /* Pointer to vfs object */
  const char *zPath,            /* Possibly relative input path */
  int nOut,                     /* Size of output buffer in bytes */
  char *zOut                    /* Output buffer */
){
  int nByte;

  /* It's odd to simulate an io-error here, but really this is just
  ** using the io-error infrastructure to test that SQLite handles this
  ** function failing. This function could fail if, for example, the
  ** current working directory has been unlinked.
  */
  SimulateIOError( return SQLITE_ERROR );

  assert( pVfs->mxPathname==MAX_PATHNAME );
  UNUSED_PARAMETER(pVfs);

  /* Attempt to resolve the path as if it were a symbolic link. If it is
  ** a symbolic link, the resolved path is stored in buffer zOut[]. Or, if
  ** the identified file is not a symbolic link or does not exist, then
  ** zPath is copied directly into zOut. Either way, nByte is left set to
  ** the size of the string copied into zOut[] in bytes.  */
  nByte = osReadlink(zPath, zOut, nOut-1);
  if( nByte<0 ){
    if( errno!=EINVAL && errno!=ENOENT ){
      return unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zPath);
    }
    sqlite3_snprintf(nOut, zOut, "%s", zPath);
    nByte = sqlite3Strlen30(zOut);
  }else{
    zOut[nByte] = '\0';
  }

  /* If buffer zOut[] now contains an absolute path there is nothing more
  ** to do. If it contains a relative path, do the following:
  **
  **   * move the relative path string so that it is at the end of th
  **     zOut[] buffer.
  **   * Call getcwd() to read the path of the current working directory 
  **     into the start of the zOut[] buffer.
  **   * Append a '/' character to the cwd string and move the 
  **     relative path back within the buffer so that it immediately 
  **     follows the '/'.
  **
  ** This code is written so that if the combination of the CWD and relative
  ** path are larger than the allocated size of zOut[] the CWD is silently
  ** truncated to make it fit. This is Ok, as SQLite refuses to open any
  ** file for which this function returns a full path larger than (nOut-8)
  ** bytes in size.  */
  testcase( nByte==nOut-5 );
  testcase( nByte==nOut-4 );
  if( zOut[0]!='/' && nByte<nOut-4 ){
    int nCwd;
    int nRem = nOut-nByte-1;
    memmove(&zOut[nRem], zOut, nByte+1);
    zOut[nRem-1] = '\0';
    if( osGetcwd(zOut, nRem-1)==0 ){
      return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath);
    }
    nCwd = sqlite3Strlen30(zOut);
    assert( nCwd<=nRem-1 );
    zOut[nCwd] = '/';
    memmove(&zOut[nCwd+1], &zOut[nRem], nByte+1);
  }

  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movl %edx, %r13d
movq %rsi, %rbx
leal -0x1(%r13), %eax
movslq %eax, %rdx
movq %rsi, %rdi
movq %rcx, %rsi
callq *0x8304a(%rip)          # 0x91a08
movq %rax, %r12
testl %r12d, %r12d
js 0xea56
movl %r12d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movb $0x0, (%r15,%rax)
xorl %r14d, %r14d
cmpb $0x2f, (%r15)
je 0xeb5d
leal -0x4(%r13), %eax
cmpl %eax, %r12d
jge 0xeb5d
movl %r12d, %eax
notl %eax
addl %r13d, %eax
movslq %eax, %r14
leaq (%r15,%r14), %r13
incl %r12d
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xa450
movb $0x0, -0x1(%r15,%r14)
decq %r14
movq %r15, %rdi
movq %r14, %rsi
callq *0x82dba(%rip)          # 0x917e0
testq %rax, %rax
je 0xeaa8
movq %r15, %rdi
callq 0xa190
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
leaq (%r15,%rax), %rdi
incq %rdi
movb $0x2f, -0x1(%rdi)
movq %r13, %rsi
movq %r12, %rdx
callq 0xa450
xorl %r14d, %r14d
jmp 0xeb5d
callq 0xa0b0
movq %rax, %r12
movl (%rax), %eax
cmpl $0x2, %eax
je 0xea6e
cmpl $0x16, %eax
jne 0xeb00
leaq 0x6c91e(%rip), %rdx     # 0x7b393
xorl %r12d, %r12d
movl %r13d, %edi
movq %r15, %rsi
movq %rbx, %rcx
xorl %eax, %eax
callq 0xa350
testq %r15, %r15
je 0xe9d7
movq %r15, %rdi
callq 0xa190
movq %rax, %r12
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
jmp 0xe9d7
leaq 0x6c8e7(%rip), %rsi     # 0x7b396
leaq 0x6c6d7(%rip), %rcx     # 0x7b18d
movl $0xe, %r14d
movl $0xe, %edi
movl $0x810e, %edx           # imm = 0x810E
xorl %eax, %eax
callq 0xa4c0
callq 0xa0b0
movl (%rax), %ecx
testq %rbx, %rbx
leaq 0x6f5c3(%rip), %rax     # 0x7e0a1
cmoveq %rax, %rbx
movq %rax, (%rsp)
leaq 0x6c88a(%rip), %rsi     # 0x7b377
leaq 0x6c7aa(%rip), %r8      # 0x7b29e
movl $0xe, %edi
movl $0x810e, %edx           # imm = 0x810E
jmp 0xeb53
leaq 0x6c88f(%rip), %rsi     # 0x7b396
leaq 0x6c67f(%rip), %rcx     # 0x7b18d
movl $0xe, %r14d
movl $0xe, %edi
movl $0x80ee, %edx           # imm = 0x80EE
xorl %eax, %eax
callq 0xa4c0
movl (%r12), %ecx
testq %rbx, %rbx
leaq 0x6f56e(%rip), %rax     # 0x7e0a1
cmoveq %rax, %rbx
movq %rax, (%rsp)
leaq 0x6c835(%rip), %rsi     # 0x7b377
leaq 0x6c7f0(%rip), %r8      # 0x7b339
movl $0xe, %edi
movl $0x80ee, %edx           # imm = 0x80EE
movq %rbx, %r9
xorl %eax, %eax
callq 0xa4c0
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq