// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/sqlite3.c
// Function: vdbeIncrPopulate
static int vdbeIncrPopulate(IncrMerger *pIncr){
  int rc = SQLITE_OK;
  int rc2;
  i64 iStart = pIncr->iStartOff;
  SorterFile *pOut = &pIncr->aFile[1];
  SortSubtask *pTask = pIncr->pTask;
  MergeEngine *pMerger = pIncr->pMerger;
  PmaWriter writer;
  assert( pIncr->bEof==0 );

  vdbeSorterPopulateDebug(pTask, "enter");

  vdbePmaWriterInit(pOut->pFd, &writer, pTask->pSorter->pgsz, iStart);
  while( rc==SQLITE_OK ){
    int dummy;
    PmaReader *pReader = &pMerger->aReadr[ pMerger->aTree[1] ];
    int nKey = pReader->nKey;
    i64 iEof = writer.iWriteOff + writer.iBufEnd;

    /* Check if the output file is full or if the input has been exhausted.
    ** In either case exit the loop. */
    if( pReader->pFd==0 ) break;
    if( (iEof + nKey + sqlite3VarintLen(nKey))>(iStart + pIncr->mxSz) ) break;

    /* Write the next key to the output. */
    vdbePmaWriteVarint(&writer, nKey);
    vdbePmaWriteBlob(&writer, pReader->aKey, nKey);
    assert( pIncr->pMerger->pTask==pTask );
    rc = vdbeMergeEngineStep(pIncr->pMerger, &dummy);
  }

  rc2 = vdbePmaWriterFinish(&writer, &pOut->iEof);
  if( rc==SQLITE_OK ) rc = rc2;
  vdbeSorterPopulateDebug(pTask, "exit");
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq 0x10(%rdi), %r13
movq (%rdi), %rax
movq 0x8(%rdi), %rbx
movq %rdi, -0x30(%rbp)
movq 0x38(%rdi), %r14
movq 0x10(%rax), %rax
movl 0xc(%rax), %eax
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movslq %eax, %r12
movq %r12, %rdi
callq 0xbf9b
movq %rax, -0x58(%rbp)
testq %rax, %rax
je 0x3ca40
movq %r13, %rax
cqto
idivq %r12
movl %edx, -0x4c(%rbp)
movl %edx, -0x48(%rbp)
movq %r13, %rax
subq %rdx, %rax
movq %rax, -0x40(%rbp)
movl %r12d, -0x50(%rbp)
movq %r14, -0x38(%rbp)
jmp 0x3ca47
movl $0x7, -0x60(%rbp)
movq %r13, %rdi
xorl %r12d, %r12d
movq %r13, -0x68(%rbp)
testl %r12d, %r12d
jne 0x3cb2f
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %r14
movslq 0x4(%rax), %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
cmpq $0x0, 0x18(%r14,%rax)
je 0x3cb22
movslq 0x14(%r14,%rax), %r13
movl $0x1, %ecx
cmpl $0x80, %r13d
jb 0x3caa6
movq %r13, %rsi
movq %r13, %rdx
shrq $0x7, %rdx
incq %rcx
cmpq $0x3fff, %rsi           # imm = 0x3FFF
movq %rdx, %rsi
ja 0x3ca93
movslq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rsi
addq %r13, %rsi
addq %rdx, %rsi
addq %rcx, %rsi
movq -0x30(%rbp), %rcx
movslq 0x18(%rcx), %rdx
addq %rdi, %rdx
xorl %r12d, %r12d
movl $0x0, %ecx
cmpq %rdx, %rsi
jg 0x3cb27
addq %rax, %r14
movq %rbx, %r12
leaq -0x74(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x32f32
leaq -0x60(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x3bf27
movq 0x28(%r14), %rsi
movq %r15, %rdi
movl %r13d, %edx
callq 0x3bf27
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq %rbx, %rsi
movq %r12, %rbx
callq 0x3cb77
movq -0x68(%rbp), %rdi
movl %eax, %r12d
movb $0x1, %cl
jmp 0x3cb27
xorl %r12d, %r12d
xorl %ecx, %ecx
testb %cl, %cl
jne 0x3ca51
movq -0x30(%rbp), %rsi
addq $0x40, %rsi
leaq -0x60(%rbp), %rdi
callq 0x3bfd0
testl %r12d, %r12d
cmovnel %r12d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq