// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/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 */
){
  int eRet = 0;
  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.  */
      eRet = (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. */
      FKey *p;

      /* Check if any child key columns are being modified. */
      for(p=pTab->pFKey; p; p=p->pNextFrom){
        if( 0==sqlite3_stricmp(pTab->zName, p->zTo) ) return 2;
        if( fkChildIsModified(pTab, p, aChange, chngRowid) ){
          eRet = 1;
        }
      }

      /* Check if any parent key columns are being modified. */
      for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){
        if( fkParentIsModified(pTab, p, aChange, chngRowid) ){
          if( p->aAction[1]!=OE_None ) return 2;
          eRet = 1;
        }
      }
    }
  }
  return eRet;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq (%rdi), %rax
xorl %r15d, %r15d
testb $0x40, 0x31(%rax)
je 0x2e9cd8
movq %rdx, %r14
movq %rsi, %rbx
testq %rdx, %rdx
je 0x2e9c5e
movl %ecx, %ebp
movq 0x20(%rbx), %rax
testq %rax, %rax
je 0x2e9c8b
movq (%rbx), %rcx
xorl %esi, %esi
leaq 0xf0e92(%rip), %rdx     # 0x3daa60
movq 0x10(%rax), %rdi
testq %rcx, %rcx
je 0x2e9c07
testq %rdi, %rdi
je 0x2e9c10
xorl %r8d, %r8d
movzbl (%rcx,%r8), %r9d
movzbl (%rdi,%r8), %r10d
cmpb %r10b, %r9b
jne 0x2e9bf8
testq %r9, %r9
jne 0x2e9c02
jmp 0x2e9cd2
movb (%r9,%rdx), %r9b
cmpb (%r10,%rdx), %r9b
jne 0x2e9c10
incq %r8
jmp 0x2e9bdf
testq %rdi, %rdi
je 0x2e9cd2
movslq 0x28(%rax), %rdi
testq %rdi, %rdi
jle 0x2e9c49
shlq $0x4, %rdi
xorl %r8d, %r8d
movslq 0x40(%rax,%r8), %r9
movl $0x1, %r15d
cmpl $0x0, (%r14,%r9,4)
jns 0x2e9c4c
testl %ebp, %ebp
je 0x2e9c40
movswl 0x44(%rbx), %r10d
cmpl %r10d, %r9d
je 0x2e9c4c
addq $0x10, %r8
cmpq %r8, %rdi
jne 0x2e9c20
movl %esi, %r15d
movq 0x8(%rax), %rax
movl %r15d, %esi
testq %rax, %rax
jne 0x2e9bce
jmp 0x2e9c8e
movq (%rbx), %rsi
movq 0x70(%rbx), %rdi
addq $0x50, %rdi
xorl %edx, %edx
callq 0x2aefdf
movl $0x1, %r15d
cmpq $0x0, 0x10(%rax)
jne 0x2e9cd8
xorl %r15d, %r15d
cmpq $0x0, 0x20(%rbx)
setne %r15b
jmp 0x2e9cd8
xorl %r15d, %r15d
movq (%rbx), %rsi
movq 0x70(%rbx), %rdi
addq $0x50, %rdi
xorl %edx, %edx
callq 0x2aefdf
movq 0x10(%rax), %r12
testq %r12, %r12
je 0x2e9cd8
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %ebp, %ecx
callq 0x2ea55f
testl %eax, %eax
je 0x2e9ccb
movl $0x1, %r15d
cmpb $0x0, 0x2e(%r12)
jne 0x2e9cd2
movq 0x18(%r12), %r12
jmp 0x2e9ca4
movl $0x2, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq