// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq 0xaf05a(%rip), %rax     # 0xbfb98
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
callq *%rax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x2c(%rbp)
jge 0x10bbe
callq 0xb0f0
cmpl $0x16, (%rax)
je 0x10b97
callq 0xb0f0
cmpl $0x2, (%rax)
je 0x10b97
movl $0x80ee, %edi           # imm = 0x80EE
callq 0x23970
movl %eax, %edi
movq -0x18(%rbp), %rdx
leaq 0x950dd(%rip), %rsi     # 0xa5c62
movl $0x80ee, %ecx           # imm = 0x80EE
callq 0x23900
movl %eax, -0x4(%rbp)
jmp 0x10cae
movl -0x1c(%rbp), %edi
movq -0x28(%rbp), %rsi
movq -0x18(%rbp), %rcx
leaq 0x95113(%rip), %rdx     # 0xa5cbc
movb $0x0, %al
callq 0xb480
movq -0x28(%rbp), %rdi
callq 0xc6c0
movl %eax, -0x2c(%rbp)
jmp 0x10bca
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x10ca7
movl -0x2c(%rbp), %eax
movl -0x1c(%rbp), %ecx
subl $0x4, %ecx
cmpl %ecx, %eax
jge 0x10ca7
movl -0x1c(%rbp), %eax
subl -0x2c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rdi
movslq -0x34(%rbp), %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
callq 0xb640
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq 0xaed44(%rip), %rax     # 0xbf970
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rsi
callq *%rax
cmpq $0x0, %rax
jne 0x10c67
movl $0x810e, %edi           # imm = 0x810E
callq 0x23970
movl %eax, %edi
movq -0x18(%rbp), %rdx
leaq 0x94f6f(%rip), %rsi     # 0xa5bc7
movl $0x810e, %ecx           # imm = 0x810E
callq 0x23900
movl %eax, -0x4(%rbp)
jmp 0x10cae
movq -0x28(%rbp), %rdi
callq 0xc6c0
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb $0x2f, (%rax,%rcx)
movq -0x28(%rbp), %rdi
movl -0x30(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movslq -0x34(%rbp), %rax
addq %rax, %rsi
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
callq 0xb640
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)