// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: sqlite3_wal_checkpoint_v2
SQLITE_STDCALL sqlite3_wal_checkpoint_v2(
  sqlite3 *db,                    /* Database handle */
  const char *zDb,                /* Name of attached database (or NULL) */
  int eMode,                      /* SQLITE_CHECKPOINT_* value */
  int *pnLog,                     /* OUT: Size of WAL log in frames */
  int *pnCkpt                     /* OUT: Total number of frames checkpointed */
){
#ifdef SQLITE_OMIT_WAL
  return SQLITE_OK;
#else
  int rc;                         /* Return code */
  int iDb = SQLITE_MAX_ATTACHED;  /* sqlite3.aDb[] index of db to checkpoint */

#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
#endif

  /* Initialize the output variables to -1 in case an error occurs. */
  if( pnLog ) *pnLog = -1;
  if( pnCkpt ) *pnCkpt = -1;

  assert( SQLITE_CHECKPOINT_PASSIVE==0 );
  assert( SQLITE_CHECKPOINT_FULL==1 );
  assert( SQLITE_CHECKPOINT_RESTART==2 );
  assert( SQLITE_CHECKPOINT_TRUNCATE==3 );
  if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){
    /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint
    ** mode: */
    return SQLITE_MISUSE;
  }

  sqlite3_mutex_enter(db->mutex);
  if( zDb && zDb[0] ){
    iDb = sqlite3FindDbName(db, zDb);
  }
  if( iDb<0 ){
    rc = SQLITE_ERROR;
    sqlite3ErrorWithMsg(db, SQLITE_ERROR, "unknown database: %s", zDb);
  }else{
    db->busyHandler.nBusy = 0;
    rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt);
    sqlite3Error(db, rc);
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r13
movl %edx, %r12d
movq %rsi, %rcx
movq %rdi, %rbx
testq %r13, %r13
je 0x1988a
movl $0xffffffff, (%r13)     # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x19896
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
movl $0x15, %r14d
cmpl $0x3, %r12d
ja 0x19976
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x198bb
movq %rcx, %r14
callq *0x79af0(%rip)          # 0x933a8
movq %r14, %rcx
movl $0xa, %esi
testq %rcx, %rcx
je 0x198dd
cmpb $0x0, (%rcx)
je 0x198dd
movq %rbx, %rdi
movq %rcx, %rsi
movq %rcx, %r14
callq 0x19988
movq %r14, %rcx
movl %eax, %esi
testl %esi, %esi
js 0x19920
movl $0x0, 0x2b8(%rbx)
movq %rbx, %rdi
movl %r12d, %edx
movq %r13, %rcx
movq %r15, %r8
callq 0x19a29
movl %eax, %r14d
movl %eax, 0x44(%rbx)
movq 0x140(%rbx), %rdi
testq %rdi, %rdi
je 0x19944
movzwl 0x8(%rdi), %eax
testl $0x2460, %eax           # imm = 0x2460
je 0x1993e
callq 0x2a646
jmp 0x19944
leaq 0x6387f(%rip), %rdx     # 0x7d1a6
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0xef6c
jmp 0x19944
movw $0x1, 0x8(%rdi)
cmpl $0xc0a, %r14d           # imm = 0xC0A
je 0x19959
cmpb $0x0, 0x51(%rbx)
jne 0x19959
andl 0x48(%rbx), %r14d
jmp 0x19967
movq %rbx, %rdi
callq 0x28aa8
movl $0x7, %r14d
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x19976
callq *0x79a42(%rip)          # 0x933b8
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq