// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movslq 0x38(%rdi), %rax
movslq %esi, %rbx
subq %rbx, %rax
imulq $0x38, %rax, %r14
addq 0x10(%rdi), %r14
movslq %edx, %rax
movq %rax, -0x40(%rbp)
leaq 0x68(,%rax,8), %rax
leal 0x138(%rax), %r13d
movl %r8d, -0x30(%rbp)
testl %r8d, %r8d
movq %rax, -0x38(%rbp)
cmovnel %eax, %r13d
movl %ecx, -0x2c(%rbp)
movq 0x60(%rdi), %rax
movq (%rax,%rbx,8), %rsi
testq %rsi, %rsi
je 0x331ac
movq %r15, %rdi
callq 0x29bcf
movq 0x60(%r15), %rax
movq $0x0, (%rax,%rbx,8)
cmpl %r13d, 0x20(%r14)
jge 0x331cc
xorl %r12d, %r12d
movq %r14, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x2a792
testl %eax, %eax
jne 0x33271
jmp 0x331da
movq 0x18(%r14), %rax
movq %rax, 0x10(%r14)
andw $0xd, 0x8(%r14)
movq 0x10(%r14), %r12
movq 0x60(%r15), %rax
movq %r12, (%rax,%rbx,8)
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movups %xmm0, 0x50(%r12)
movups %xmm0, 0x40(%r12)
movups %xmm0, 0x30(%r12)
movups %xmm0, 0x20(%r12)
movups %xmm0, 0x10(%r12)
movq $0x0, 0x60(%r12)
movl -0x30(%rbp), %ecx
movb %cl, (%r12)
movl -0x2c(%rbp), %eax
movb %al, 0x1(%r12)
movq -0x40(%rbp), %rax
movw %ax, 0xc(%r12)
leaq (%r12,%rax,4), %rax
addq $0x60, %rax
movq %rax, 0x58(%r12)
testb %cl, %cl
jne 0x33271
movq 0x10(%r14), %rax
movq -0x38(%rbp), %rdx
leaq (%rax,%rdx), %rcx
movq %rcx, 0x10(%r12)
movups %xmm0, 0x40(%rax,%rdx)
movups %xmm0, 0x30(%rax,%rdx)
movups %xmm0, 0x20(%rax,%rdx)
movups %xmm0, 0x10(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
movq $0x0, 0x50(%rax,%rdx)
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq