// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3_unlock_notify
SQLITE_API int sqlite3_unlock_notify(
  sqlite3 *db,
  void (*xNotify)(void **, int),
  void *pArg
){
  int rc = SQLITE_OK;

  sqlite3_mutex_enter(db->mutex);
  enterMutex();

  if( xNotify==0 ){
    removeFromBlockedList(db);
    db->pBlockingConnection = 0;
    db->pUnlockConnection = 0;
    db->xUnlockNotify = 0;
    db->pUnlockArg = 0;
  }else if( 0==db->pBlockingConnection ){
    /* The blocking transaction has been concluded. Or there never was a
    ** blocking transaction. In either case, invoke the notify callback
    ** immediately.
    */
    xNotify(&pArg, 1);
  }else{
    sqlite3 *p;

    for(p=db->pBlockingConnection; p && p!=db; p=p->pUnlockConnection){}
    if( p ){
      rc = SQLITE_LOCKED;              /* Deadlock detected. */
    }else{
      db->pUnlockConnection = db->pBlockingConnection;
      db->xUnlockNotify = xNotify;
      db->pUnlockArg = pArg;
      removeFromBlockedList(db);
      addToBlockedList(db);
    }
  }

  leaveMutex();
  assert( !db->mallocFailed );
  sqlite3ErrorWithMsg(db, rc, (rc?"database is deadlocked":0));
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rdx, (%rsp)
testq %rsi, %rsi
je 0x282810
movq %rsi, %rax
movq 0x2d8(%rbx), %rsi
testq %rsi, %rsi
je 0x28283e
movq %rdx, %rcx
leaq 0x15327d(%rip), %rdx    # 0x3d5a06
movl $0x6, %r14d
cmpq %rbx, %rsi
je 0x282871
movq %rsi, %rdi
movq 0x2e0(%rdi), %rdi
testq %rdi, %rdi
je 0x2827ac
cmpq %rbx, %rdi
jne 0x28279b
testq %rdi, %rdi
jne 0x282871
movq %rsi, 0x2e0(%rbx)
movq %rax, 0x2f0(%rbx)
movq %rcx, 0x2e8(%rbx)
movq 0x23c687(%rip), %rax    # 0x4bee58
xorl %r14d, %r14d
testq %rax, %rax
je 0x282889
cmpq %rbx, %rax
je 0x282892
movq %rax, %rdx
movq %rdx, %rcx
movq 0x2f8(%rdx), %rdx
testq %rdx, %rdx
je 0x2828aa
cmpq %rbx, %rdx
jne 0x2827e9
addq $0x2f8, %rcx            # imm = 0x2F8
movq %rdx, %rax
jmp 0x282899
movq 0x23c641(%rip), %rax    # 0x4bee58
testq %rax, %rax
je 0x28285b
cmpq %rbx, %rax
je 0x28284a
movq %rax, %rcx
movq 0x2f8(%rax), %rax
testq %rax, %rax
je 0x28285b
cmpq %rbx, %rax
jne 0x282821
addq $0x2f8, %rcx            # imm = 0x2F8
jmp 0x282851
movq %rsp, %rdi
movl $0x1, %esi
callq *%rax
jmp 0x28286c
leaq 0x23c607(%rip), %rcx    # 0x4bee58
movq 0x2f8(%rax), %rax
movq %rax, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x2e8(%rbx)
movups %xmm0, 0x2d8(%rbx)
xorl %r14d, %r14d
xorl %edx, %edx
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x2762da
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x23c5c8(%rip), %rcx    # 0x4bee58
jmp 0x2828e0
leaq 0x23c5bf(%rip), %rcx    # 0x4bee58
movq 0x2f8(%rax), %rax
movq %rax, (%rcx)
movq 0x23c5ae(%rip), %rax    # 0x4bee58
leaq 0x23c5a7(%rip), %rcx    # 0x4bee58
testq %rax, %rax
je 0x2828e0
movq 0x2f0(%rbx), %rdx
cmpq %rdx, 0x2f0(%rax)
je 0x2828ed
movq %rax, %rcx
movq 0x2f8(%rax), %rax
testq %rax, %rax
je 0x2828e4
cmpq %rdx, 0x2f0(%rax)
jne 0x2828c6
jmp 0x2828e6
xorl %eax, %eax
jmp 0x2828ed
xorl %eax, %eax
addq $0x2f8, %rcx            # imm = 0x2F8
movq %rax, 0x2f8(%rbx)
movq %rbx, (%rcx)
jmp 0x28286f