// File: /workspace/github_c_makefile_star2_O3/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 0x27c8e8
testq %r13, %r13
je 0x27d1b2
testl %eax, %eax
je 0x27d1b2
movslq 0x28(%rbx), %rax
testq %rax, %rax
jle 0x27d11e
movq 0x20(%rbx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x27d115
movq (%rsi), %rdi
movq 0x8(%rsi), %rsi
movq %rdi, 0x8(%rsi)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x27d100
movq %r13, 0x20(%rsp)
movq %r14, 0x28(%rsp)
movl %r12d, 0x18(%rsp)
movl %ebp, 0x1c(%rsp)
movq %r15, 0x30(%rsp)
movq 0x70(%rsp), %rax
movb $0x1, %cl
movl 0x18(%rsp), %r14d
movq 0x28(%rsp), %r13
movq 0x20(%rsp), %rbp
movl %ecx, 0x14(%rsp)
movq %rax, (%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movl %r14d, %edx
movl 0x1c(%rsp), %ecx
movq 0x30(%rsp), %r8
movq %r13, %r9
movq %rax, %r12
callq 0x2a5710
movl %eax, %r15d
movq %r12, %rax
cmpl $0x201, %r15d           # imm = 0x201
je 0x27d150
cmpl $0x11, %r15d
jne 0x27d1e0
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x29bacb
movq %r12, %rax
testb $0x1, 0x14(%rsp)
movl $0x0, %ecx
jne 0x27d14c
cmpb $0x0, 0x61(%rbx)
jne 0x27d1f5
movl 0x54(%rbx), %r15d
andl $0x11, %r15d
jmp 0x27d203
leaq 0x158a12(%rip), %rsi    # 0x3d5bcb
leaq 0x15d287(%rip), %rdx    # 0x3da447
leaq 0x15886a(%rip), %r8     # 0x3d5a31
movl $0x15, %r15d
movl $0x15, %edi
movl $0x1f831, %ecx          # imm = 0x1F831
xorl %eax, %eax
callq 0x274d08
jmp 0x27d203
cmpl $0xc0a, %r15d           # imm = 0xC0A
je 0x27d1f5
cmpb $0x0, 0x61(%rbx)
jne 0x27d1f5
andl 0x54(%rbx), %r15d
jmp 0x27d203
movq %rbx, %rdi
callq 0x28fd56
movl $0x7, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq