// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeChangeP4
SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
  Op *pOp;
  sqlite3 *db;
  assert( p!=0 );
  db = p->db;
  assert( p->magic==VDBE_MAGIC_INIT );
  if( p->aOp==0 || db->mallocFailed ){
    if ( n!=P4_KEYINFO && n!=P4_VTAB ) {
      freeP4(db, n, (void*)*(char**)&zP4);
    }
    return;
  }
  assert( p->nOp>0 );
  assert( addr<p->nOp );
  if( addr<0 ){
    addr = p->nOp - 1;
  }
  pOp = &p->aOp[addr];
  assert( pOp->p4type==P4_NOTUSED || pOp->p4type==P4_INT32 );
  freeP4(db, pOp->p4type, pOp->p4.p);
  pOp->p4.p = 0;
  if( n==P4_INT32 ){
    /* Note: this cast is safe, because the origin data point was an int
    ** that was cast to a (const char *). */
    pOp->p4.i = SQLITE_PTR_TO_INT(zP4);
    pOp->p4type = P4_INT32;
  }else if( zP4==0 ){
    pOp->p4.p = 0;
    pOp->p4type = P4_NOTUSED;
  }else if( n==P4_KEYINFO ){
    KeyInfo *pOrig, *pNew;

    pOrig = (KeyInfo*)zP4;
    pOp->p4.pKeyInfo = pNew = sqlite3KeyInfoAlloc(db, pOrig->nField);
    if( pNew ){
      memcpy(pNew->aColl, pOrig->aColl, pOrig->nField*sizeof(pNew->aColl[0]));
      memcpy(pNew->aSortOrder, pOrig->aSortOrder, pOrig->nField);
      pOp->p4type = P4_KEYINFO;
    }else{
      p->db->mallocFailed = 1;
      pOp->p4type = P4_NOTUSED;
    }
  }else if( n==P4_KEYINFO_HANDOFF ){
    pOp->p4.p = (void*)zP4;
    pOp->p4type = P4_KEYINFO;
  }else if( n==P4_VTAB ){
    pOp->p4.p = (void*)zP4;
    pOp->p4type = P4_VTAB;
    sqlite3VtabLock((VTable *)zP4);
    assert( ((VTable *)zP4)->db==p->db );
  }else if( n<0 ){
    pOp->p4.p = (void*)zP4;
    pOp->p4type = (signed char)n;
  }else{
    if( n==0 ) n = sqlite3Strlen30(zP4);
    pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);
    pOp->p4type = P4_DYNAMIC;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movq (%rdi), %r12
movq 0x8(%rdi), %r13
testq %r13, %r13
je 0x10773
cmpb $0x0, 0x50(%r12)
je 0x107a0
cmpl $-0xa, %r14d
je 0x108bc
cmpl $-0x6, %r14d
je 0x108bc
movq %r12, %rdi
movl %r14d, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fc08
movq %rdi, %r15
movq %rdx, -0x38(%rbp)
testl %esi, %esi
jns 0x107b1
movl 0x34(%r15), %esi
decl %esi
movslq %esi, %rax
imulq $0x18, %rax, %rbx
leaq (%rbx,%r13), %rax
movq %rax, -0x30(%rbp)
movsbl 0x1(%r13,%rbx), %esi
movq 0x10(%r13,%rbx), %rdx
movq %r12, %rdi
callq 0x1fc08
andq $0x0, 0x10(%r13,%rbx)
cmpl $-0xe, %r14d
jne 0x107f3
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
movl %eax, 0x10(%rcx)
movb $-0xe, 0x1(%rcx)
jmp 0x108bc
movq -0x30(%rbp), %r13
movq -0x38(%rbp), %rbx
testq %rbx, %rbx
je 0x10859
cmpl $-0x10, %r14d
je 0x1086e
cmpl $-0xa, %r14d
je 0x10860
cmpl $-0x6, %r14d
jne 0x10879
movzwl 0xa(%rbx), %esi
movq %r12, %rdi
callq 0x3107c
movq %r13, %r12
movq %rax, 0x10(%r13)
testq %rax, %rax
je 0x108a4
movq %rax, %r14
movq %rax, %rdi
addq $0x18, %rdi
leaq 0x18(%rbx), %rsi
movzwl 0xa(%rbx), %edx
shll $0x3, %edx
callq 0x82c0
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movzwl 0xa(%rbx), %edx
callq 0x82c0
movb $-0x6, %al
jmp 0x108ad
movb $0x0, 0x1(%r13)
jmp 0x108bc
movq %rbx, 0x10(%r13)
movb $-0xa, 0x1(%r13)
incl 0x18(%rbx)
jmp 0x108bc
movq %rbx, 0x10(%r13)
movb $-0x6, 0x1(%r13)
jmp 0x108bc
testl %r14d, %r14d
js 0x108b4
jne 0x1088b
movq %rbx, %rdi
callq 0x8f8e
movl %eax, %r14d
movq (%r15), %rdi
movq %rbx, %rsi
movl %r14d, %edx
callq 0x310c8
movq %rax, 0x10(%r13)
movb $-0x1, 0x1(%r13)
jmp 0x108bc
movq (%r15), %rax
movb $0x1, 0x50(%rax)
xorl %eax, %eax
movb %al, 0x1(%r12)
jmp 0x108bc
movq %rbx, 0x10(%r13)
movb %r14b, 0x1(%r13)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq