// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3LockAndPrepare
static int sqlite3LockAndPrepare(
  sqlite3 *db,              /* Database handle. */
  const char *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  u32 prepFlags,            /* Zero or more SQLITE_PREPARE_* flags */
  Vdbe *pOld,               /* VM being reprepared */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const char **pzTail       /* OUT: End of parsed string */
){
  int rc;
  int cnt = 0;

#ifdef SQLITE_ENABLE_API_ARMOR
  if( ppStmt==0 ) return SQLITE_MISUSE_BKPT;
#endif
  *ppStmt = 0;
  if( !sqlite3SafetyCheckOk(db)||zSql==0 ){
    return SQLITE_MISUSE_BKPT;
  }
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);
  do{
    /* Make multiple attempts to compile the SQL, until it either succeeds
    ** or encounters a permanent error.  A schema problem after one schema
    ** reset is considered a permanent error. */
    rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
    assert( rc==SQLITE_OK || *ppStmt==0 );
  }while( rc==SQLITE_ERROR_RETRY
       || (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
  sqlite3BtreeLeaveAll(db);
  rc = sqlite3ApiExit(db, rc);
  assert( (rc&db->errMask)==rc );
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r14
movq %r8, %r15
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %rbx
movq $0x0, (%r9)
callq 0x2863de
testq %r13, %r13
je 0x286c14
testl %eax, %eax
je 0x286c14
movslq 0x28(%rbx), %rax
testq %rax, %rax
jle 0x286b63
movq 0x20(%rbx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x286b5a
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rdi, 0x8(%rsi)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x286b45
movq %r13, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movl %r12d, 0x8(%rsp)
movl %ebp, 0xc(%rsp)
movq %r15, 0x30(%rsp)
movq 0x70(%rsp), %rax
movq $0x0, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movl 0xc(%rsp), %r12d
movl 0x8(%rsp), %r14d
movq 0x28(%rsp), %r13
movq 0x20(%rsp), %rbx
movq %rax, (%rsp)
movq 0x18(%rsp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
movl %r12d, %ecx
movq 0x30(%rsp), %r8
movq %r13, %r9
movq %rax, %rbp
callq 0x2af27d
movl %eax, %r15d
movq %rbp, %rax
cmpl $0x201, %r15d           # imm = 0x201
je 0x286ba2
cmpl $0x11, %r15d
movq 0x18(%rsp), %rbx
jne 0x286bff
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x2a4bc6
movq 0x10(%rsp), %rcx
leal 0x1(%rcx), %eax
testl %ecx, %ecx
movq %rax, 0x10(%rsp)
movq %rbp, %rax
je 0x286b9d
cmpl $0xc0a, %r15d           # imm = 0xC0A
je 0x286c42
cmpb $0x0, 0x61(%rbx)
jne 0x286c42
andl 0x54(%rbx), %r15d
jmp 0x286c50
leaq 0x158704(%rip), %rsi    # 0x3df31f
leaq 0x15cf7a(%rip), %rdx    # 0x3e3b9c
leaq 0x15855c(%rip), %r8     # 0x3df185
movl $0x15, %r15d
movl $0x15, %edi
movl $0x1f831, %ecx          # imm = 0x1F831
xorl %eax, %eax
callq 0x27e637
jmp 0x286c50
movq %rbx, %rdi
callq 0x299b1a
movl $0x7, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq