// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3ComputeGeneratedColumns
SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns(
  Parse *pParse,    /* Parsing context */
  int iRegStore,    /* Register holding the first column */
  Table *pTab       /* The table */
){
  int i;
  Walker w;
  Column *pRedo;
  int eProgress;
  VdbeOp *pOp;

  assert( pTab->tabFlags & TF_HasGenerated );
  testcase( pTab->tabFlags & TF_HasVirtual );
  testcase( pTab->tabFlags & TF_HasStored );

  /* Before computing generated columns, first go through and make sure
  ** that appropriate affinity has been applied to the regular columns
  */
  sqlite3TableAffinity(pParse->pVdbe, pTab, iRegStore);
  if( (pTab->tabFlags & TF_HasStored)!=0
   && (pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1))->opcode==OP_Affinity
  ){
    /* Change the OP_Affinity argument to '@' (NONE) for all stored
    ** columns.  '@' is the no-op affinity and those columns have not
    ** yet been computed. */
    int ii, jj;
    char *zP4 = pOp->p4.z;
    assert( zP4!=0 );
    assert( pOp->p4type==P4_DYNAMIC );
    for(ii=jj=0; zP4[jj]; ii++){
      if( pTab->aCol[ii].colFlags & COLFLAG_VIRTUAL ){
        continue;
      }
      if( pTab->aCol[ii].colFlags & COLFLAG_STORED ){
        zP4[jj] = SQLITE_AFF_NONE;
      }
      jj++;
    }
  }

  /* Because there can be multiple generated columns that refer to one another,
  ** this is a two-pass algorithm.  On the first pass, mark all generated
  ** columns as "not available".
  */
  for(i=0; i<pTab->nCol; i++){
    if( pTab->aCol[i].colFlags & COLFLAG_GENERATED ){
      testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL );
      testcase( pTab->aCol[i].colFlags & COLFLAG_STORED );
      pTab->aCol[i].colFlags |= COLFLAG_NOTAVAIL;
    }
  }

  w.u.pTab = pTab;
  w.xExprCallback = exprColumnFlagUnion;
  w.xSelectCallback = 0;
  w.xSelectCallback2 = 0;

  /* On the second pass, compute the value of each NOT-AVAILABLE column.
  ** Companion code in the TK_COLUMN case of sqlite3ExprCodeTarget() will
  ** compute dependencies and mark remove the COLSPAN_NOTAVAIL mark, as
  ** they are needed.
  */
  pParse->iSelfTab = -iRegStore;
  do{
    eProgress = 0;
    pRedo = 0;
    for(i=0; i<pTab->nCol; i++){
      Column *pCol = pTab->aCol + i;
      if( (pCol->colFlags & COLFLAG_NOTAVAIL)!=0 ){
        int x;
        pCol->colFlags |= COLFLAG_BUSY;
        w.eCode = 0;
        sqlite3WalkExpr(&w, pCol->pDflt);
        pCol->colFlags &= ~COLFLAG_BUSY;
        if( w.eCode & COLFLAG_NOTAVAIL ){
          pRedo = pCol;
          continue;
        }
        eProgress = 1;
        assert( pCol->colFlags & COLFLAG_GENERATED );
        x = sqlite3TableColumnToStorage(pTab, i) + iRegStore;
        sqlite3ExprCodeGeneratedColumn(pParse, pCol, x);
        pCol->colFlags &= ~COLFLAG_NOTAVAIL;
      }
    }
  }while( pRedo && eProgress );
  if( pRedo ){
    sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pRedo->zName);
  }
  pParse->iSelfTab = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movl %esi, %edx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq %r14, %rsi
movl %edx, 0xc(%rsp)
callq 0x2cda4a
testb $0x40, 0x40(%r14)
je 0x2ed76b
movq 0x10(%rbx), %rax
movq (%rax), %rcx
cmpb $0x0, 0x61(%rcx)
je 0x2ed70f
leaq 0x1dc77b(%rip), %rax    # 0x4c9e88
jmp 0x2ed729
movslq 0x90(%rax), %rcx
movq 0x88(%rax), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
addq $-0x18, %rax
cmpb $0x5a, (%rax)
jne 0x2ed76b
movq 0x10(%rax), %rax
cmpb $0x0, (%rax)
je 0x2ed76b
xorl %ecx, %ecx
movl $0x1c, %edx
movq %rax, %rsi
movq 0x8(%r14), %rdi
movzwl (%rdi,%rdx), %edi
testb $0x20, %dil
jne 0x2ed75a
testb $0x40, %dil
je 0x2ed758
movb $0x40, (%rsi)
incl %ecx
movslq %ecx, %rdi
leaq (%rax,%rdi), %rsi
addq $0x20, %rdx
cmpb $0x0, (%rax,%rdi)
jne 0x2ed741
movswq 0x46(%r14), %rax
testq %rax, %rax
jle 0x2ed79e
movq 0x8(%r14), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movzwl 0x1c(%rcx,%rdx), %esi
testb $0x60, %sil
je 0x2ed795
orl $0x80, %esi
movw %si, 0x1c(%rcx,%rdx)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x2ed77f
leaq 0x18(%rsp), %rcx
movq %r14, 0x28(%rcx)
leaq 0x1a45(%rip), %rax      # 0x2ef1f3
movq %rax, 0x8(%rcx)
movl 0xc(%rsp), %eax
negl %eax
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rcx)
movq %rbx, 0x10(%rsp)
movl %eax, 0x40(%rbx)
xorl %ebx, %ebx
cmpw $0x0, 0x46(%r14)
jle 0x2ed86d
xorl %ebp, %ebp
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x8(%r14), %r12
movzwl 0x1c(%r12,%rbp), %eax
testb %al, %al
jns 0x2ed851
orl $0x100, %eax            # imm = 0x100
movw %ax, 0x1c(%r12,%rbp)
movw $0x0, 0x3c(%rsp)
movq 0x8(%r12,%rbp), %rsi
testq %rsi, %rsi
je 0x2ed811
leaq 0x18(%rsp), %rdi
callq 0x2ca211
addq %rbp, %r12
andb $-0x2, 0x1d(%r12)
testb $-0x80, 0x3c(%rsp)
jne 0x2ed84e
movswl %r15w, %esi
movq %r14, %rdi
callq 0x2c77b7
movswl %ax, %edx
addl 0xc(%rsp), %edx
movq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x2c7815
andb $0x7f, 0x1c(%r12)
movl $0x1, %ebx
jmp 0x2ed851
movq %r12, %r13
incq %r15
movswq 0x46(%r14), %rax
addq $0x20, %rbp
cmpq %rax, %r15
jl 0x2ed7dd
testl %ebx, %ebx
setne %bl
jmp 0x2ed870
xorl %r13d, %r13d
testq %r13, %r13
je 0x2ed87d
testb %bl, %bl
jne 0x2ed7c7
testq %r13, %r13
movq 0x10(%rsp), %rbx
je 0x2ed89c
movq (%r13), %rdx
leaq 0xf341f(%rip), %rsi     # 0x3e0cb1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x284eb8
movl $0x0, 0x40(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq