// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xfeff, %cx            # imm = 0xFEFF
orw $0x100, %cx             # imm = 0x100
movw %cx, 0x9a(%rax)
movq -0x8(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xfdff, %cx            # imm = 0xFDFF
orw $0x0, %cx
movw %cx, 0x9a(%rax)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x34(%rax), %eax
subl $0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x4aa2b
movq -0x20(%rbp), %rax
movb (%rax), %al
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0xc, %eax
ja 0x4a9c1
movq -0x38(%rbp), %rax
leaq 0x5f120(%rip), %rcx     # 0xa99d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
cmpl -0x18(%rbp), %eax
jle 0x4a8d9
movq -0x20(%rbp), %rax
movzbl 0x3(%rax), %eax
movl %eax, -0x18(%rbp)
jmp 0x4a9c1
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x4a903
movq -0x8(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xfeff, %cx            # imm = 0xFEFF
orw $0x0, %cx
movw %cx, 0x9a(%rax)
jmp 0x4a905
movq -0x8(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xfdff, %cx            # imm = 0xFDFF
orw $0x200, %cx             # imm = 0x200
movw %cx, 0x9a(%rax)
jmp 0x4a9c1
movq -0x8(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xfeff, %cx            # imm = 0xFEFF
orw $0x0, %cx
movw %cx, 0x9a(%rax)
movq -0x8(%rbp), %rax
movw 0x9a(%rax), %cx
andw $0xfdff, %cx            # imm = 0xFDFF
orw $0x200, %cx             # imm = 0x200
movw %cx, 0x9a(%rax)
jmp 0x4a9c1
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
cmpl -0x18(%rbp), %eax
jle 0x4a975
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
jmp 0x4a9c1
movq -0x20(%rbp), %rax
movl -0x14(%rax), %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x4a98f
movl -0x30(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x4a9c1
movq -0x20(%rbp), %rax
leaq -0xddec(%rip), %rcx     # 0x3cbb0
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movb $-0x13, 0x1(%rax)
jmp 0x4a9c1
movq -0x20(%rbp), %rax
leaq -0xdb75(%rip), %rcx     # 0x3ce40
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movb $-0x13, 0x1(%rax)
movzbl -0x29(%rbp), %eax
movl %eax, %ecx
leaq 0x60ad2(%rip), %rax     # 0xab4a0
movb (%rax,%rcx), %cl
movq -0x20(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x20(%rbp), %rax
movzbl 0x2(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4aa0f
movq -0x20(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jge 0x4aa0f
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rdx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
subl 0x8(%rdx), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x4aa11
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x20(%rbp)
jmp 0x4a885
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rsi
callq 0x9cd0
movq -0x8(%rbp), %rax
movq $0x0, 0x40(%rax)
movl -0x18(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)