// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3FkRequired
SQLITE_PRIVATE int sqlite3FkRequired(
  Parse *pParse,                  /* Parse context */
  Table *pTab,                    /* Table being modified */
  int *aChange,                   /* Non-NULL for UPDATE operations */
  int chngRowid                   /* True for UPDATE that affects rowid */
){
  if( pParse->db->flags&SQLITE_ForeignKeys ){
    if( !aChange ){
      /* A DELETE operation. Foreign key processing is required if the 
      ** table in question is either the child or parent table for any 
      ** foreign key constraint.  */
      return (sqlite3FkReferences(pTab) || pTab->pFKey);
    }else{
      /* This is an UPDATE. Foreign key processing is only required if the
      ** operation modifies one or more child or parent key columns. */
      int i;
      FKey *p;

      /* Check if any child key columns are being modified. */
      for(p=pTab->pFKey; p; p=p->pNextFrom){
        for(i=0; i<p->nCol; i++){
          int iChildKey = p->aCol[i].iFrom;
          if( aChange[iChildKey]>=0 ) return 1;
          if( iChildKey==pTab->iPKey && chngRowid ) return 1;
        }
      }

      /* Check if any parent key columns are being modified. */
      for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
        for(i=0; i<p->nCol; i++){
          char *zKey = p->aCol[i].zCol;
          int iKey;
          for(iKey=0; iKey<pTab->nCol; iKey++){
            Column *pCol = &pTab->aCol[iKey];
            if( (zKey ? !sqlite3StrICmp(pCol->zName, zKey)
                      : (pCol->colFlags & COLFLAG_PRIMKEY)!=0) ){
              if( aChange[iKey]>=0 ) return 1;
              if( iKey==pTab->iPKey && chngRowid ) return 1;
            }
          }
        }
      }
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x2c(%rax), %eax
andl $0x80000, %eax          # imm = 0x80000
cmpl $0x0, %eax
je 0x7ca70
cmpq $0x0, -0x20(%rbp)
jne 0x7c8bc
movq -0x18(%rbp), %rdi
callq 0x6bb10
movq %rax, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x51(%rbp)
jne 0x7c8ac
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0x7ca77
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x7c959
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x7c946
movq -0x30(%rbp), %rax
addq $0x40, %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0x7c918
movl $0x1, -0x4(%rbp)
jmp 0x7ca77
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x7c939
cmpl $0x0, -0x24(%rbp)
je 0x7c939
movl $0x1, -0x4(%rbp)
jmp 0x7ca77
jmp 0x7c93b
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x7c8da
jmp 0x7c948
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x7c8c8
movq -0x18(%rbp), %rdi
callq 0x6bb10
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x7ca6c
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x7ca59
movq -0x30(%rbp), %rax
addq $0x40, %rax
movslq -0x28(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x42(%rcx), %ecx
cmpl %ecx, %eax
jge 0x7ca49
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x7c9f2
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq -0x40(%rbp), %rsi
callq 0xc970
cmpl $0x0, %eax
jne 0x7ca39
jmp 0x7ca02
movq -0x50(%rbp), %rax
movzwl 0x2a(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7ca39
movq -0x20(%rbp), %rax
movslq -0x44(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jl 0x7ca19
movl $0x1, -0x4(%rbp)
jmp 0x7ca77
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
movswl 0x40(%rcx), %ecx
cmpl %ecx, %eax
jne 0x7ca37
cmpl $0x0, -0x24(%rbp)
je 0x7ca37
movl $0x1, -0x4(%rbp)
jmp 0x7ca77
jmp 0x7ca39
jmp 0x7ca3b
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x7c9aa
jmp 0x7ca4b
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x7c978
jmp 0x7ca5b
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x7c966
jmp 0x7ca6e
jmp 0x7ca70
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq