// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3MemCompare
SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
  int f1, f2;
  int combined_flags;

  f1 = pMem1->flags;
  f2 = pMem2->flags;
  combined_flags = f1|f2;
  assert( !sqlite3VdbeMemIsRowSet(pMem1) && !sqlite3VdbeMemIsRowSet(pMem2) );

  /* If one value is NULL, it is less than the other. If both values
  ** are NULL, return 0.
  */
  if( combined_flags&MEM_Null ){
    return (f2&MEM_Null) - (f1&MEM_Null);
  }

  /* At least one of the two values is a number
  */
  if( combined_flags&(MEM_Int|MEM_Real|MEM_IntReal) ){
    testcase( combined_flags & MEM_Int );
    testcase( combined_flags & MEM_Real );
    testcase( combined_flags & MEM_IntReal );
    if( (f1 & f2 & (MEM_Int|MEM_IntReal))!=0 ){
      testcase( f1 & f2 & MEM_Int );
      testcase( f1 & f2 & MEM_IntReal );
      if( pMem1->u.i < pMem2->u.i ) return -1;
      if( pMem1->u.i > pMem2->u.i ) return +1;
      return 0;
    }
    if( (f1 & f2 & MEM_Real)!=0 ){
      if( pMem1->u.r < pMem2->u.r ) return -1;
      if( pMem1->u.r > pMem2->u.r ) return +1;
      return 0;
    }
    if( (f1&(MEM_Int|MEM_IntReal))!=0 ){
      testcase( f1 & MEM_Int );
      testcase( f1 & MEM_IntReal );
      if( (f2&MEM_Real)!=0 ){
        return sqlite3IntFloatCompare(pMem1->u.i, pMem2->u.r);
      }else if( (f2&(MEM_Int|MEM_IntReal))!=0 ){
        if( pMem1->u.i < pMem2->u.i ) return -1;
        if( pMem1->u.i > pMem2->u.i ) return +1;
        return 0;
      }else{
        return -1;
      }
    }
    if( (f1&MEM_Real)!=0 ){
      if( (f2&(MEM_Int|MEM_IntReal))!=0 ){
        testcase( f2 & MEM_Int );
        testcase( f2 & MEM_IntReal );
        return -sqlite3IntFloatCompare(pMem2->u.i, pMem1->u.r);
      }else{
        return -1;
      }
    }
    return +1;
  }

  /* If one value is a string and the other is a blob, the string is less.
  ** If both are strings, compare using the collating functions.
  */
  if( combined_flags&MEM_Str ){
    if( (f1 & MEM_Str)==0 ){
      return 1;
    }
    if( (f2 & MEM_Str)==0 ){
      return -1;
    }

    assert( pMem1->enc==pMem2->enc || pMem1->db->mallocFailed );
    assert( pMem1->enc==SQLITE_UTF8 ||
            pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );

    /* The collation sequence must be defined at this point, even if
    ** the user deletes the collation sequence after the vdbe program is
    ** compiled (this was not always the case).
    */
    assert( !pColl || pColl->xCmp );

    if( pColl ){
      return vdbeCompareMemString(pMem1, pMem2, pColl, 0);
    }
    /* If a NULL pointer was passed as the collate function, fall through
    ** to the blob case and use memcmp().  */
  }

  /* Both values must be blobs.  Compare using memcmp().  */
  return sqlite3BlobCompare(pMem1, pMem2);
}

// Assembly:
movzwl 0x8(%rdi), %r8d
movzwl 0x8(%rsi), %ecx
movl %ecx, %eax
orl %r8d, %eax
testb $0x1, %al
jne 0x29b4ef
testb $0x2c, %al
je 0x29b4fc
movl %ecx, %eax
andl %r8d, %eax
testb $0x24, %al
je 0x29b531
movq (%rsi), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rcx, (%rdi)
jl 0x29b5c7
setg %al
movzbl %al, %eax
retq
andl $0x1, %ecx
andl $0x1, %r8d
subl %r8d, %ecx
movl %ecx, %eax
retq
testb $0x2, %al
je 0x29eeb0
movl $0x1, %eax
testb $0x2, %r8b
je 0x29b5c7
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0x2, %cl
je 0x29b5c7
testq %rdx, %rdx
je 0x29b5c8
xorl %ecx, %ecx
jmp 0x29ed84
testb $0x8, %al
jne 0x29b54f
testb $0x24, %r8b
je 0x29b56c
testb $0x8, %cl
jne 0x29b5a2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0x24, %cl
je 0x29b5c7
movq (%rsi), %rcx
jmp 0x29b4df
movsd (%rdi), %xmm0
movsd (%rsi), %xmm1
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
ucomisd %xmm0, %xmm1
ja 0x29b5c7
xorl %eax, %eax
ucomisd %xmm1, %xmm0
seta %al
retq
movl $0x1, %eax
testb $0x8, %r8b
je 0x29b5c7
testb $0x24, %cl
je 0x29b5cd
movq (%rsi), %rax
movq %rax, -0x10(%rsp)
fildll -0x10(%rsp)
fldl (%rdi)
xorl %ecx, %ecx
fxch %st(1)
fucomi %st(1), %st
seta %cl
negl %ecx
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
movl $0x1, %eax
jmp 0x29b5c4
movq (%rdi), %rax
movq %rax, -0x8(%rsp)
fildll -0x8(%rsp)
fldl (%rsi)
xorl %ecx, %ecx
fxch %st(1)
fucomi %st(1), %st
seta %cl
fxch %st(1)
fucompi %st(1), %st
fstp %st(0)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovbel %ecx, %eax
retq
jmp 0x29eeb0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq