// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x13c59
movq -0x30(%rbp), %rax
movzbl 0x50(%rax), %eax
cmpl $0x0, %eax
je 0x13c7a
cmpl $-0x6, -0x1c(%rbp)
je 0x13c75
cmpl $-0xa, -0x1c(%rbp)
je 0x13c75
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rdx
callq 0x2e5d0
jmp 0x13e4c
cmpl $0x0, -0xc(%rbp)
jge 0x13c8d
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
subl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0xc(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %esi
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x2e5d0
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
cmpl $-0xe, -0x1c(%rbp)
jne 0x13ce9
movq -0x18(%rbp), %rax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $-0xe, 0x1(%rax)
jmp 0x13e4c
cmpq $0x0, -0x18(%rbp)
jne 0x13d09
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x1(%rax)
jmp 0x13e4a
cmpl $-0x6, -0x1c(%rbp)
jne 0x13da6
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rax
movzwl 0xa(%rax), %esi
callq 0x4a710
movq %rax, %rcx
movq %rcx, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
cmpq $0x0, -0x40(%rbp)
je 0x13d8e
movq -0x40(%rbp), %rdi
addq $0x18, %rdi
movq -0x38(%rbp), %rsi
addq $0x18, %rsi
movq -0x38(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x82f0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x38(%rbp), %rax
movzwl 0xa(%rax), %eax
movl %eax, %edx
callq 0x82f0
movq -0x28(%rbp), %rax
movb $-0x6, 0x1(%rax)
jmp 0x13da1
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb $0x1, 0x50(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x1(%rax)
jmp 0x13e48
cmpl $-0x10, -0x1c(%rbp)
jne 0x13dc5
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $-0x6, 0x1(%rax)
jmp 0x13e46
cmpl $-0xa, -0x1c(%rbp)
jne 0x13dea
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $-0xa, 0x1(%rax)
movq -0x18(%rbp), %rdi
callq 0x49370
jmp 0x13e44
cmpl $0x0, -0x1c(%rbp)
jge 0x13e0a
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x1c(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x1(%rax)
jmp 0x13e42
cmpl $0x0, -0x1c(%rbp)
jne 0x13e1c
movq -0x18(%rbp), %rdi
callq 0x92f0
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x4a7a0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movb $-0x1, 0x1(%rax)
jmp 0x13e44
jmp 0x13e46
jmp 0x13e48
jmp 0x13e4a
jmp 0x13e4c
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)