// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: vdbeCloseStatement
static SQLITE_NOINLINE int vdbeCloseStatement(Vdbe *p, int eOp){
  sqlite3 *const db = p->db;
  int rc = SQLITE_OK;
  int i;
  const int iSavepoint = p->iStatement-1;

  assert( eOp==SAVEPOINT_ROLLBACK || eOp==SAVEPOINT_RELEASE);
  assert( db->nStatement>0 );
  assert( p->iStatement==(db->nStatement+db->nSavepoint) );

  for(i=0; i<db->nDb; i++){
    int rc2 = SQLITE_OK;
    Btree *pBt = db->aDb[i].pBt;
    if( pBt ){
      if( eOp==SAVEPOINT_ROLLBACK ){
        rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint);
      }
      if( rc2==SQLITE_OK ){
        rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint);
      }
      if( rc==SQLITE_OK ){
        rc = rc2;
      }
    }
  }
  db->nStatement--;
  p->iStatement = 0;

  if( rc==SQLITE_OK ){
    if( eOp==SAVEPOINT_ROLLBACK ){
      rc = sqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint);
    }
    if( rc==SQLITE_OK ){
      rc = sqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint);
    }
  }

  /* If the statement transaction is being rolled back, also restore the
  ** database handles deferred constraint counter to the value it had when
  ** the statement transaction was opened.  */
  if( eOp==SAVEPOINT_ROLLBACK ){
    db->nDeferredCons = p->nStmtDefCons;
    db->nDeferredImmCons = p->nStmtDefImmCons;
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x3edbfc
movl $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x20(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3edbec
cmpl $0x2, -0xc(%rbp)
jne 0x3edbc4
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x2, %esi
callq 0x3edc90
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x3edbde
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x1, %esi
callq 0x3edc90
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x3edbea
movl -0x28(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x3edbec
jmp 0x3edbee
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3edb75
movq -0x18(%rbp), %rax
movl 0x2bc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x2bc(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x40(%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x3edc56
cmpl $0x2, -0xc(%rbp)
jne 0x3edc3a
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x2, %esi
callq 0x3edd60
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x3edc54
movq -0x18(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x1, %esi
callq 0x3edd60
movl %eax, -0x1c(%rbp)
jmp 0x3edc56
cmpl $0x2, -0xc(%rbp)
jne 0x3edc82
movq -0x8(%rbp), %rax
movq 0x58(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x2c0(%rax)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x2c8(%rax)
movl -0x1c(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)