// File: /workspace/github_c_makefile_star2_O0/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: computeLimitRegisters
static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){
  Vdbe *v = 0;
  int iLimit = 0;
  int iOffset;
  int n;
  if( p->iLimit ) return;

  /* 
  ** "LIMIT -1" always shows all rows.  There is some
  ** controversy about what the correct behavior should be.
  ** The current implementation interprets "LIMIT 0" to mean
  ** no rows.
  */
  sqlite3ExprCacheClear(pParse);
  assert( p->pOffset==0 || p->pLimit!=0 );
  if( p->pLimit ){
    p->iLimit = iLimit = ++pParse->nMem;
    v = sqlite3GetVdbe(pParse);
    assert( v!=0 );
    if( sqlite3ExprIsInteger(p->pLimit, &n) ){
      sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit);
      VdbeComment((v, "LIMIT counter"));
      if( n==0 ){
        sqlite3VdbeGoto(v, iBreak);
      }else if( n>=0 && p->nSelectRow>(u64)n ){
        p->nSelectRow = n;
      }
    }else{
      sqlite3ExprCode(pParse, p->pLimit, iLimit);
      sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); VdbeCoverage(v);
      VdbeComment((v, "LIMIT counter"));
      sqlite3VdbeAddOp2(v, OP_IfNot, iLimit, iBreak); VdbeCoverage(v);
    }
    if( p->pOffset ){
      p->iOffset = iOffset = ++pParse->nMem;
      pParse->nMem++;   /* Allocate an extra register for limit+offset */
      sqlite3ExprCode(pParse, p->pOffset, iOffset);
      sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); VdbeCoverage(v);
      VdbeComment((v, "OFFSET counter"));
      sqlite3VdbeAddOp3(v, OP_SetIfNotPos, iOffset, iOffset, 0);
      sqlite3VdbeAddOp3(v, OP_Add, iLimit, iOffset, iOffset+1);
      VdbeComment((v, "LIMIT+OFFSET"));
      sqlite3VdbeAddOp3(v, OP_SetIfNotPos, iLimit, iOffset+1, -1);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x7de31
jmp 0x7dfb5
movq -0x8(%rbp), %rdi
callq 0x7ff50
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x7dfb5
movq -0x8(%rbp), %rax
movl 0x54(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x54(%rax)
movl %ecx, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rdi
callq 0x6bd00
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x72570
cmpl $0x0, %eax
je 0x7ded2
movq -0x20(%rbp), %rdi
movl -0x2c(%rbp), %edx
movl -0x24(%rbp), %ecx
movl $0x17, %esi
callq 0x6c310
cmpl $0x0, -0x2c(%rbp)
jne 0x7deab
movq -0x20(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x6c1b0
jmp 0x7ded0
cmpl $0x0, -0x2c(%rbp)
jl 0x7dece
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x2c(%rbp), %rcx
cmpq %rcx, %rax
jbe 0x7dece
movslq -0x2c(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x7ded0
jmp 0x7df0b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
movl -0x24(%rbp), %edx
callq 0x6c120
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %edx
movl $0x27, %esi
callq 0x6e570
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x14(%rbp), %ecx
movl $0x2f, %esi
callq 0x6c310
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x7dfb3
movq -0x8(%rbp), %rax
movl 0x54(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x54(%rax)
movl %ecx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movl 0x54(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x54(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rsi
movl -0x28(%rbp), %edx
callq 0x6c120
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %edx
movl $0x27, %esi
callq 0x6e570
movq -0x20(%rbp), %rdi
movl -0x28(%rbp), %edx
movl -0x28(%rbp), %ecx
movl $0x8c, %esi
xorl %r8d, %r8d
callq 0x56c10
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
movl -0x28(%rbp), %r8d
addl $0x1, %r8d
movl $0x59, %esi
callq 0x56c10
movq -0x20(%rbp), %rdi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movl $0x8c, %esi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x56c10
jmp 0x7dfb5
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)