// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: exprDup
static Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){
  Expr *pNew = 0;                      /* Value to return */
  if( p ){
    const int isReduced = (flags&EXPRDUP_REDUCE);
    u8 *zAlloc;
    u32 staticFlag = 0;

    assert( pzBuffer==0 || isReduced );

    /* Figure out where to write the new Expr structure. */
    if( pzBuffer ){
      zAlloc = *pzBuffer;
      staticFlag = EP_Static;
    }else{
      zAlloc = sqlite3DbMallocRaw(db, dupedExprSize(p, flags));
    }
    pNew = (Expr *)zAlloc;

    if( pNew ){
      /* Set nNewSize to the size allocated for the structure pointed to
      ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or
      ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed
      ** by the copy of the p->u.zToken string (if any).
      */
      const unsigned nStructSize = dupedExprStructSize(p, flags);
      const int nNewSize = nStructSize & 0xfff;
      int nToken;
      if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){
        nToken = sqlite3Strlen30(p->u.zToken) + 1;
      }else{
        nToken = 0;
      }
      if( isReduced ){
        assert( ExprHasProperty(p, EP_Reduced)==0 );
        memcpy(zAlloc, p, nNewSize);
      }else{
        int nSize = exprStructSize(p);
        memcpy(zAlloc, p, nSize);
        memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize);
      }

      /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */
      pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static);
      pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly);
      pNew->flags |= staticFlag;

      /* Copy the p->u.zToken string, if any. */
      if( nToken ){
        char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize];
        memcpy(zToken, p->u.zToken, nToken);
      }

      if( 0==((p->flags|pNew->flags) & EP_TokenOnly) ){
        /* Fill in the pNew->x.pSelect or pNew->x.pList member. */
        if( ExprHasProperty(p, EP_xIsSelect) ){
          pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, isReduced);
        }else{
          pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, isReduced);
        }
      }

      /* Fill in pNew->pLeft and pNew->pRight. */
      if( ExprHasAnyProperty(pNew, EP_Reduced|EP_TokenOnly) ){
        zAlloc += dupedExprNodeSize(p, flags);
        if( ExprHasProperty(pNew, EP_Reduced) ){
          pNew->pLeft = exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc);
          pNew->pRight = exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc);
        }
        if( pzBuffer ){
          *pzBuffer = zAlloc;
        }
      }else{
        pNew->flags2 = 0;
        if( !ExprHasAnyProperty(p, EP_TokenOnly) ){
          pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0);
          pNew->pRight = sqlite3ExprDup(db, p->pRight, 0);
        }
      }

    }
  }
  return pNew;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x61a64
movl -0x14(%rbp), %eax
andl $0x1, %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x3c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x617a5
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movl $0x8000, -0x3c(%rbp)    # imm = 0x8000
jmp 0x617c8
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x61a70
movq -0x60(%rbp), %rdi
movl %eax, %esi
callq 0x134e0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x61a62
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x61af0
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
andl $0xfff, %eax            # imm = 0xFFF
movl %eax, -0x44(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x400, %eax            # imm = 0x400
je 0x61829
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x61829
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x92f0
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x61830
movl $0x0, -0x48(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x61849
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x44(%rbp), %rdx
callq 0x82f0
jmp 0x61884
movq -0x10(%rbp), %rdi
callq 0x61b50
movl %eax, -0x4c(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x4c(%rbp), %rdx
callq 0x82f0
movq -0x38(%rbp), %rdi
movslq -0x4c(%rbp), %rax
addq %rax, %rdi
movslq -0x4c(%rbp), %rax
movl $0x48, %edx
subq %rax, %rdx
xorl %esi, %esi
callq 0x8200
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %ecx
andl $0xffff1fff, %ecx       # imm = 0xFFFF1FFF
movw %cx, 0x2(%rax)
movl -0x40(%rbp), %edx
andl $0x6000, %edx           # imm = 0x6000
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %ecx
orl %edx, %ecx
movw %cx, 0x2(%rax)
movl -0x3c(%rbp), %edx
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %ecx
orl %edx, %ecx
movw %cx, 0x2(%rax)
cmpl $0x0, -0x48(%rbp)
je 0x618f0
movq -0x38(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq -0x28(%rbp), %rcx
movq %rax, 0x8(%rcx)
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movslq -0x48(%rbp), %rdx
callq 0x82f0
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %ecx
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
orl %eax, %ecx
andl $0x4000, %ecx           # imm = 0x4000
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x61964
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x800, %eax            # imm = 0x800
jne 0x61943
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movl -0x2c(%rbp), %edx
callq 0x61ba0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x61962
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
movl -0x2c(%rbp), %edx
callq 0x61da0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x61964
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x6000, %eax           # imm = 0x6000
cmpl $0x0, %eax
je 0x61a08
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x61f90
movl %eax, %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x2000, %eax           # imm = 0x2000
jne 0x619f4
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %edx
leaq -0x38(%rbp), %rcx
callq 0x61750
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movl $0x1, %edx
leaq -0x38(%rbp), %rcx
callq 0x61750
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x61a06
movq -0x38(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x61a60
movq -0x28(%rbp), %rax
movb $0x0, 0x36(%rax)
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0x61a5e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x61690
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
xorl %edx, %edx
callq 0x61690
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x61a60
jmp 0x61a62
jmp 0x61a64
movq -0x28(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop