// File: /workspace/github_c_makefile_star2_O3/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), %rsi
movzwl 0x9a(%rdi), %eax
andl $0xfffffcff, %eax       # imm = 0xFFFFFCFF
orl $0x100, %eax            # imm = 0x100
movw %ax, 0x9a(%rdi)
movl 0x34(%rdi), %eax
testl %eax, %eax
jle 0x36866
movq 0x8(%r14), %rcx
incl %eax
addq $0x10, %rcx
leaq 0x401d2(%rip), %rdx     # 0x76970
leaq 0x3eea7(%rip), %rdi     # 0x7564c
leaq -0x8cc4(%rip), %r8      # 0x2dae8
leaq -0x8ba8(%rip), %r9      # 0x2dc0b
movzbl -0x10(%rcx), %r10d
leal -0x1(%r10), %r11d
cmpl $0xc, %r11d
ja 0x36831
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 0x36831
movq %r8, (%rcx)
jmp 0x3682d
movzbl -0xd(%rcx), %r11d
cmpl %r11d, %r15d
cmovlel %r11d, %r15d
jmp 0x36831
movl -0x24(%rcx), %r11d
jmp 0x36809
movl -0x8(%rcx), %r11d
cmpl %r15d, %r11d
cmovgl %r11d, %r15d
jmp 0x36831
cmpl $0x0, -0x8(%rcx)
je 0x36820
andb $-0x2, 0x9b(%r14)
orb $0x2, 0x9b(%r14)
jmp 0x36831
movq %r9, (%rcx)
movb $-0x13, -0xf(%rcx)
movb (%r10,%rdx), %r10b
movb %r10b, -0xe(%rcx)
testb $0x1, %r10b
je 0x36853
movl -0x8(%rcx), %r10d
testl %r10d, %r10d
jns 0x36853
notl %r10d
movl (%rsi,%r10,4), %r10d
movl %r10d, -0x8(%rcx)
decl %eax
addq $0x18, %rcx
cmpl $0x1, %eax
ja 0x367b3
movq 0x40(%r14), %rsi
movq (%r14), %rdi
callq 0x9ca4
movq $0x0, 0x40(%r14)
movl %r15d, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq