// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: allocateCursor
static VdbeCursor *allocateCursor(
  Vdbe *p,              /* The virtual machine */
  int iCur,             /* Index of the new VdbeCursor */
  int nField,           /* Number of fields in the table or index */
  int iDb,              /* Database the cursor belongs to, or -1 */
  u8 eCurType           /* Type of the new cursor */
){
  /* Find the memory cell that will be used to store the blob of memory
  ** required for this VdbeCursor structure. It is convenient to use a 
  ** vdbe memory cell to manage the memory allocation required for a
  ** VdbeCursor structure for the following reasons:
  **
  **   * Sometimes cursor numbers are used for a couple of different
  **     purposes in a vdbe program. The different uses might require
  **     different sized allocations. Memory cells provide growable
  **     allocations.
  **
  **   * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can
  **     be freed lazily via the sqlite3_release_memory() API. This
  **     minimizes the number of malloc calls made by the system.
  **
  ** Memory cells for cursors are allocated at the top of the address
  ** space. Memory cell (p->nMem) corresponds to cursor 0. Space for
  ** cursor 1 is managed by memory cell (p->nMem-1), etc.
  */
  Mem *pMem = &p->aMem[p->nMem-iCur];

  int nByte;
  VdbeCursor *pCx = 0;
  nByte = 
      ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + 
      (eCurType==CURTYPE_BTREE?sqlite3BtreeCursorSize():0);

  assert( iCur<p->nCursor );
  if( p->apCsr[iCur] ){
    sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
    p->apCsr[iCur] = 0;
  }
  if( SQLITE_OK==sqlite3VdbeMemClearAndResize(pMem, nByte) ){
    p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
    memset(pCx, 0, sizeof(VdbeCursor));
    pCx->eCurType = eCurType;
    pCx->iDb = iDb;
    pCx->nField = nField;
    pCx->aOffset = &pCx->aType[nField];
    if( eCurType==CURTYPE_BTREE ){
      pCx->uc.pCursor = (BtCursor*)
          &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField];
      sqlite3BtreeCursorZero(pCx->uc.pCursor);
    }
  }
  return pCx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movb %al, -0x15(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %ecx
subl -0xc(%rbp), %ecx
movslq %ecx, %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x30(%rbp)
movslq -0x10(%rbp), %rax
shlq $0x3, %rax
addq $0x68, %rax
movq %rax, -0x38(%rbp)
movzbl -0x15(%rbp), %eax
cmpl $0x0, %eax
jne 0x43ef6
callq 0x49430
movl %eax, -0x3c(%rbp)
jmp 0x43efd
xorl %eax, %eax
movl %eax, -0x3c(%rbp)
jmp 0x43efd
movq -0x38(%rbp), %rax
movl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x43f4d
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x36e80
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0x39160
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x44006
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq %rdx, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movslq -0xc(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0xb2b0
movb -0x15(%rbp), %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x10(%rbp), %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, 0xc(%rax)
movq -0x30(%rbp), %rcx
addq $0x60, %rcx
movslq -0x10(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x58(%rax)
movzbl -0x15(%rbp), %eax
cmpl $0x0, %eax
jne 0x44004
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x10(%rbp), %rax
shlq $0x3, %rax
addq $0x68, %rax
addq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x49440
jmp 0x44006
movq -0x30(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq