// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: vdbeRecordCompareString
static int vdbeRecordCompareString(
  int nKey1, const void *pKey1, /* Left key */
  UnpackedRecord *pPKey2        /* Right key */
){
  const u8 *aKey1 = (const u8*)pKey1;
  int serial_type;
  int res;

  assert( pPKey2->aMem[0].flags & MEM_Str );
  vdbeAssertFieldCountWithinLimits(nKey1, pKey1, pPKey2->pKeyInfo);
  serial_type = (u8)(aKey1[1]);
  if( serial_type >= 0x80 ){
    sqlite3GetVarint32(&aKey1[1], (u32*)&serial_type);
  }
  if( serial_type<12 ){
    res = pPKey2->r1;      /* (pKey1/nKey1) is a number or a null */
  }else if( !(serial_type & 0x01) ){
    res = pPKey2->r2;      /* (pKey1/nKey1) is a blob */
  }else{
    int nCmp;
    int nStr;
    int szHdr = aKey1[0];

    nStr = (serial_type-12) / 2;
    if( (szHdr + nStr) > nKey1 ){
      pPKey2->errCode = (u8)SQLITE_CORRUPT_BKPT;
      return 0;    /* Corruption */
    }
    nCmp = MIN( pPKey2->aMem[0].n, nStr );
    res = memcmp(&aKey1[szHdr], pPKey2->aMem[0].z, nCmp);

    if( res>0 ){
      res = pPKey2->r2;
    }else if( res<0 ){
      res = pPKey2->r1;
    }else{
      res = nStr - pPKey2->aMem[0].n;
      if( res==0 ){
        if( pPKey2->nField>1 ){
          res = sqlite3VdbeRecordCompareWithSkip(nKey1, pKey1, pPKey2, 1);
        }else{
          res = pPKey2->default_rc;
          pPKey2->eqSeen = 1;
        }
      }else if( res>0 ){
        res = pPKey2->r2;
      }else{
        res = pPKey2->r1;
      }
    }
  }

  assert( vdbeRecordCompareDebug(nKey1, pKey1, pPKey2, res)
       || CORRUPT_DB
       || pPKey2->pKeyInfo->db->mallocFailed
  );
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x80, -0x24(%rbp)
jl 0x402680
movq -0x20(%rbp), %rdi
addq $0x1, %rdi
leaq -0x24(%rbp), %rsi
callq 0x3fa520
cmpl $0xc, -0x24(%rbp)
jge 0x402696
movq -0x18(%rbp), %rax
movsbl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x4027e9
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x4026b1
movq -0x18(%rbp), %rax
movsbl 0x15(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x4027e7
movq -0x20(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x24(%rbp), %eax
subl $0xc, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x30(%rbp)
movl -0x34(%rbp), %eax
addl -0x30(%rbp), %eax
cmpl -0x8(%rbp), %eax
jle 0x4026f6
movl $0x14275, %edi          # imm = 0x14275
callq 0x3dff80
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x13(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x4027ef
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0xc(%rax), %eax
cmpl -0x30(%rbp), %eax
jge 0x402716
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0xc(%rax), %eax
movl %eax, -0x38(%rbp)
jmp 0x40271c
movl -0x30(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rdi
movslq -0x34(%rbp), %rax
addq %rax, %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rsi
movslq -0x2c(%rbp), %rdx
callq 0x192c0
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jle 0x40275b
movq -0x18(%rbp), %rax
movsbl 0x15(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x4027e5
cmpl $0x0, -0x28(%rbp)
jge 0x40276e
movq -0x18(%rbp), %rax
movsbl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x4027e3
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
movq 0x8(%rcx), %rcx
subl 0xc(%rcx), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x4027c1
movq -0x18(%rbp), %rax
movzwl 0x10(%rax), %eax
cmpl $0x1, %eax
jle 0x4027ac
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl $0x1, %ecx
callq 0x402800
movl %eax, -0x28(%rbp)
jmp 0x4027bf
movq -0x18(%rbp), %rax
movsbl 0x12(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movb $0x1, 0x16(%rax)
jmp 0x4027e1
cmpl $0x0, -0x28(%rbp)
jle 0x4027d4
movq -0x18(%rbp), %rax
movsbl 0x15(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x4027df
movq -0x18(%rbp), %rax
movsbl 0x14(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x4027e1
jmp 0x4027e3
jmp 0x4027e5
jmp 0x4027e7
jmp 0x4027e9
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)