// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3TableLock
SQLITE_PRIVATE void sqlite3TableLock(
  Parse *pParse,     /* Parsing context */
  int iDb,           /* Index of the database containing the table to lock */
  int iTab,          /* Root page number of the table to be locked */
  u8 isWriteLock,    /* True for a write lock */
  const char *zName  /* Name of the table to be locked */
){
  Parse *pToplevel = sqlite3ParseToplevel(pParse);
  int i;
  int nBytes;
  TableLock *p;
  assert( iDb>=0 );

  for(i=0; i<pToplevel->nTableLock; i++){
    p = &pToplevel->aTableLock[i];
    if( p->iDb==iDb && p->iTab==iTab ){
      p->isWriteLock = (p->isWriteLock || isWriteLock);
      return;
    }
  }

  nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1);
  pToplevel->aTableLock =
      sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes);
  if( pToplevel->aTableLock ){
    p = &pToplevel->aTableLock[pToplevel->nTableLock++];
    p->iDb = iDb;
    p->iTab = iTab;
    p->isWriteLock = isWriteLock;
    p->zName = zName;
  }else{
    pToplevel->nTableLock = 0;
    pToplevel->db->mallocFailed = 1;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %cl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq %r8, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1d8(%rax)
je 0x5e5ba
movq -0x8(%rbp), %rax
movq 0x1d8(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x5e5c2
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x1c0(%rcx), %eax
jge 0x5e656
movq -0x28(%rbp), %rax
movq 0x1c8(%rax), %rax
movslq -0x2c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl (%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x5e646
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0x10(%rbp), %eax
jne 0x5e646
movq -0x38(%rbp), %rax
movzbl 0x8(%rax), %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
jne 0x5e630
movzbl -0x11(%rbp), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x8(%rax)
jmp 0x5e714
jmp 0x5e648
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x5e5d1
movq -0x28(%rbp), %rax
movl 0x1c0(%rax), %eax
addl $0x1, %eax
cltq
imulq $0x18, %rax, %rax
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x1c8(%rax), %rsi
movl -0x30(%rbp), %edx
callq 0x46020
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x1c8(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x1c8(%rax)
je 0x5e6fb
movq -0x28(%rbp), %rax
movq 0x1c8(%rax), %rax
movq -0x28(%rbp), %rdx
movl 0x1c0(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x1c0(%rdx)
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movl -0xc(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movb -0x11(%rbp), %cl
movq -0x38(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x5e714
movq -0x28(%rbp), %rax
movl $0x0, 0x1c0(%rax)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movb $0x1, 0x50(%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)