// File: /workspace/github_c_makefile_star2_O1/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)
movl 0x34(%rdi), %ecx
testl %ecx, %ecx
jle 0x36153
movq 0x8(%r14), %rdx
incl %ecx
addq $0x10, %rdx
leaq 0x40891(%rip), %rsi     # 0x76920
leaq 0x3f582(%rip), %rdi     # 0x75618
leaq -0x8dfd(%rip), %r8      # 0x2d2a0
leaq -0x8ce0(%rip), %r9      # 0x2d3c4
movzbl -0x10(%rdx), %r10d
leal -0x1(%r10), %r11d
cmpl $0xc, %r11d
ja 0x36122
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 0x36122
movq %r8, (%rdx)
jmp 0x3611e
movzbl -0xd(%rdx), %r11d
cmpl %r11d, %r15d
cmovlel %r11d, %r15d
jmp 0x36122
movl -0x24(%rdx), %r11d
jmp 0x360fa
movl -0x8(%rdx), %r11d
cmpl %r15d, %r11d
cmovgl %r11d, %r15d
jmp 0x36122
cmpl $0x0, -0x8(%rdx)
je 0x36111
andb $-0x2, 0x9b(%r14)
orb $0x2, 0x9b(%r14)
jmp 0x36122
movq %r9, (%rdx)
movb $-0x13, -0xf(%rdx)
movb (%r10,%rsi), %r10b
movb %r10b, -0xe(%rdx)
testb $0x1, %r10b
je 0x36144
movl -0x8(%rdx), %r10d
testl %r10d, %r10d
jns 0x36144
notl %r10d
movl (%rax,%r10,4), %r10d
movl %r10d, -0x8(%rdx)
decl %ecx
addq $0x18, %rdx
cmpl $0x1, %ecx
jg 0x360a4
movq (%r14), %rdi
movq 0x40(%r14), %rsi
callq 0x9c3a
movq $0x0, 0x40(%r14)
movl %r15d, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq