// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
movl %ecx, %r14d
movq %rdx, %rbx
movq (%rdi), %r12
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x1199d
cmpb $0x0, 0x50(%r12)
je 0x119cd
cmpl $-0xa, %r14d
je 0x11b0e
cmpl $-0x6, %r14d
je 0x11b0e
movq %r12, %rdi
movl %r14d, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x23197
movq %rdi, %r15
testl %esi, %esi
jns 0x119da
movl 0x34(%r15), %esi
decl %esi
movslq %esi, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %r13
movsbl 0x1(%r13), %esi
movq 0x10(%r13), %rdx
movq %r12, %rdi
callq 0x23197
movq $0x0, 0x10(%r13)
cmpl $-0xe, %r14d
jne 0x11a12
movl %ebx, 0x10(%r13)
movb $-0xe, 0x1(%r13)
jmp 0x11b0e
testq %rbx, %rbx
je 0x11a74
cmpl $-0x10, %r14d
je 0x11a94
cmpl $-0xa, %r14d
je 0x11a86
cmpl $-0x6, %r14d
jne 0x11a9f
movzwl 0xa(%rbx), %esi
movq %r12, %rdi
callq 0x35fcd
movq %rax, 0x10(%r13)
testq %rax, %rax
je 0x11af7
movq %rax, %r14
movq %rax, %rdi
addq $0x18, %rdi
leaq 0x18(%rbx), %rsi
movzwl 0xa(%rbx), %edx
shll $0x3, %edx
callq 0x82f0
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movzwl 0xa(%rbx), %edx
callq 0x82f0
movb $-0x6, %al
jmp 0x11b00
movq $0x0, 0x10(%r13)
movb $0x0, 0x1(%r13)
jmp 0x11b0e
movq %rbx, 0x10(%r13)
movb $-0xa, 0x1(%r13)
incl 0x18(%rbx)
jmp 0x11b0e
movq %rbx, 0x10(%r13)
movb $-0x6, 0x1(%r13)
jmp 0x11b0e
testl %r14d, %r14d
js 0x11b06
jne 0x11ac2
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %rbx, %rax
incl %r14d
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x11aaf
andl $0x3fffffff, %r14d      # imm = 0x3FFFFFFF
movq (%r15), %rdi
leal 0x1(%r14), %esi
callq 0x115e9
movq %rax, %r15
testq %rax, %rax
je 0x11aec
movl %r14d, %r14d
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x82f0
movb $0x0, (%r15,%r14)
movq %r15, 0x10(%r13)
movb $-0x1, 0x1(%r13)
jmp 0x11b0e
movq (%r15), %rax
movb $0x1, 0x50(%rax)
xorl %eax, %eax
movb %al, 0x1(%r13)
jmp 0x11b0e
movq %rbx, 0x10(%r13)
movb %r14b, 0x1(%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq