// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: resolveP2Values
static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
  int i;
  int nMaxArgs = *pMaxFuncArgs;
  Op *pOp;
  int *aLabel = p->aLabel;
  p->readOnly = 1;
  p->bIsReader = 0;
  for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
    u8 opcode = pOp->opcode;

    /* NOTE: Be sure to update mkopcodeh.awk when adding or removing
    ** cases from this switch! */
    switch( opcode ){
      case OP_Function:
      case OP_AggStep: {
        if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;
        break;
      }
      case OP_Transaction: {
        if( pOp->p2!=0 ) p->readOnly = 0;
        /* fall thru */
      }
      case OP_AutoCommit:
      case OP_Savepoint: {
        p->bIsReader = 1;
        break;
      }
#ifndef SQLITE_OMIT_WAL
      case OP_Checkpoint:
#endif
      case OP_Vacuum:
      case OP_JournalMode: {
        p->readOnly = 0;
        p->bIsReader = 1;
        break;
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
      case OP_VUpdate: {
        if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
        break;
      }
      case OP_VFilter: {
        int n;
        assert( p->nOp - i >= 3 );
        assert( pOp[-1].opcode==OP_Integer );
        n = pOp[-1].p1;
        if( n>nMaxArgs ) nMaxArgs = n;
        break;
      }
#endif
      case OP_Next:
      case OP_SorterNext: {
        pOp->p4.xAdvance = sqlite3BtreeNext;
        pOp->p4type = P4_ADVANCE;
        break;
      }
      case OP_Prev: {
        pOp->p4.xAdvance = sqlite3BtreePrevious;
        pOp->p4type = P4_ADVANCE;
        break;
      }
    }

    pOp->opflags = sqlite3OpcodeProperty[opcode];
    if( (pOp->opflags & OPFLG_JUMP)!=0 && pOp->p2<0 ){
      assert( -1-pOp->p2<p->nLabel );
      pOp->p2 = aLabel[-1-pOp->p2];
    }
  }
  sqlite3DbFree(p->db, p->aLabel);
  p->aLabel = 0;
  *pMaxFuncArgs = nMaxArgs;
  assert( p->bIsReader!=0 || p->btreeMask==0 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %r15d
movq 0x40(%rdi), %rax
movzwl 0x9a(%rdi), %ecx
andl $0xfffffcff, %ecx       # imm = 0xFFFFFCFF
orl $0x100, %ecx            # imm = 0x100
movw %cx, 0x9a(%rdi)
movq 0x8(%rdi), %rcx
movl 0x34(%rdi), %edx
addq $0x10, %rcx
leaq 0x377d7(%rip), %rsi     # 0x68930
leaq 0x364a8(%rip), %rdi     # 0x67608
leaq -0x684a(%rip), %r8      # 0x2a91d
leaq -0x6732(%rip), %r9      # 0x2aa3c
testl %edx, %edx
jle 0x31221
movzbl -0x10(%rcx), %r10d
leal -0x1(%r10), %r11d
cmpl $0xc, %r11d
ja 0x311f4
movslq (%rdi,%r11,4), %r11
addq %rdi, %r11
jmpq *%r11
movzwl 0x9a(%r14), %r11d
andl $0xfffffcff, %r11d      # imm = 0xFFFFFCFF
orl $0x200, %r11d           # imm = 0x200
movw %r11w, 0x9a(%r14)
jmp 0x311f4
movq %r8, (%rcx)
jmp 0x311f0
movzbl -0xd(%rcx), %r11d
cmpl %r11d, %r15d
cmovlel %r11d, %r15d
jmp 0x311f4
movl -0x24(%rcx), %r11d
jmp 0x311cc
movl -0x8(%rcx), %r11d
cmpl %r15d, %r11d
cmovgl %r11d, %r15d
jmp 0x311f4
cmpl $0x0, -0x8(%rcx)
je 0x311e3
andb $-0x2, 0x9b(%r14)
orb $0x2, 0x9b(%r14)
jmp 0x311f4
movq %r9, (%rcx)
movb $-0x13, -0xf(%rcx)
movb (%r10,%rsi), %r10b
movb %r10b, -0xe(%rcx)
testb $0x1, %r10b
je 0x31216
movl -0x8(%rcx), %r10d
testl %r10d, %r10d
jns 0x31216
notl %r10d
movl (%rax,%r10,4), %r10d
movl %r10d, -0x8(%rcx)
addq $0x18, %rcx
decl %edx
jmp 0x3116e
movq (%r14), %rdi
movq 0x40(%r14), %rsi
callq 0x968b
andq $0x0, 0x40(%r14)
movl %r15d, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq