// File: /workspace/github_c_makefile_star2_O2/bhk[P]tooltree/lua/../opensource/lua-5.2.3/src/lvm.c
// Function: luaV_finishOp
void luaV_finishOp (lua_State *L) {
  CallInfo *ci = L->ci;
  StkId base = ci->u.l.base;
  Instruction inst = *(ci->u.l.savedpc - 1);  /* interrupted instruction */
  OpCode op = GET_OPCODE(inst);
  switch (op) {  /* finish its execution */
    case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
    case OP_MOD: case OP_POW: case OP_UNM: case OP_LEN:
    case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: {
      setobjs2s(L, base + GETARG_A(inst), --L->top);
      break;
    }
    case OP_LE: case OP_LT: case OP_EQ: {
      int res = !l_isfalse(L->top - 1);
      L->top--;
      /* metamethod should not be called when operand is K */
      lua_assert(!ISK(GETARG_B(inst)));
      if (op == OP_LE &&  /* "<=" using "<" instead? */
          ttisnil(luaT_gettmbyobj(L, base + GETARG_B(inst), TM_LE)))
        res = !res;  /* invert result */
      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);
      if (res != GETARG_A(inst))  /* condition failed? */
        ci->u.l.savedpc++;  /* skip jump instruction */
      break;
    }
    case OP_CONCAT: {
      StkId top = L->top - 1;  /* top when 'call_binTM' was called */
      int b = GETARG_B(inst);      /* first element to concatenate */
      int total = cast_int(top - 1 - (base + b));  /* yet to concatenate */
      setobj2s(L, top - 2, top);  /* put TM result in proper position */
      if (total > 1) {  /* are there elements to concat? */
        L->top = top - 1;  /* top is one after last element (at top-2) */
        luaV_concat(L, total);  /* concat them (may yield again) */
      }
      /* move final result to final position */
      setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1);
      L->top = ci->top;  /* restore top */
      break;
    }
    case OP_TFORCALL: {
      lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP);
      L->top = ci->top;  /* correct top */
      break;
    }
    case OP_CALL: {
      if (GETARG_C(inst) - 1 >= 0)  /* nresults >= 0? */
        L->top = ci->top;  /* adjust results */
      break;
    }
    case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE:
      break;
    default: lua_assert(0);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x20(%rdi), %r14
movq 0x38(%r14), %rax
movl -0x4(%rax), %r15d
movl %r15d, %eax
andl $0x3f, %eax
leal -0x6(%rax), %ecx
cmpl $0x1c, %ecx
ja 0x17a9c
movq %rdi, %rbx
movq 0x30(%r14), %rsi
leaq 0x8310(%rip), %rdx      # 0x1fd7c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x10(%rbx), %rax
leaq -0x10(%rax), %rcx
movq %rcx, 0x10(%rbx)
shrl $0x2, %r15d
andl $0xff0, %r15d           # imm = 0xFF0
movq -0x10(%rax), %rcx
movq %rcx, (%rsi,%r15)
movl -0x8(%rax), %eax
movl %eax, 0x8(%rsi,%r15)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %rcx
movl -0x8(%rcx), %edx
addq $-0x10, %rcx
testl %edx, %edx
je 0x17ac2
cmpl $0x1, %edx
jne 0x17ac7
cmpl $0x0, (%rcx)
sete %r12b
jmp 0x17aca
movb $0x1, %r12b
jmp 0x17aca
xorl %r12d, %r12d
movl %r12d, %ebp
xorb $0x1, %bpl
movq %rcx, 0x10(%rbx)
cmpl $0x1a, %eax
jne 0x17b00
movl %r15d, %eax
shrl $0x13, %eax
andl $-0x10, %eax
addq %rax, %rsi
pushq $0xe
popq %rdx
movq %rbx, %rdi
callq 0x16978
cmpl $0x0, 0x8(%rax)
movzbl %r12b, %eax
movzbl %bpl, %ebp
cmovel %eax, %ebp
movzbl %bpl, %eax
shrl $0x6, %r15d
movzbl %r15b, %ecx
cmpl %eax, %ecx
je 0x17a9c
addq $0x4, 0x38(%r14)
jmp 0x17a9c
testl $0x7fc000, %r15d        # imm = 0x7FC000
jne 0x17b8a
jmp 0x17a9c
movq 0x10(%rbx), %rax
movl %r15d, %ecx
shrl $0x17, %ecx
shlq $0x4, %rcx
addq %rcx, %rsi
negq %rsi
addq %rax, %rsi
addq $-0x20, %rsi
shrq $0x4, %rsi
movq -0x10(%rax), %rcx
movq %rcx, -0x30(%rax)
movl -0x8(%rax), %ecx
movl %ecx, -0x28(%rax)
cmpl $0x2, %esi
jl 0x17b67
addq $-0x20, %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x1763b
movq 0x10(%rbx), %rax
movq 0x30(%r14), %rcx
shrl $0x2, %r15d
andl $0xff0, %r15d           # imm = 0xFF0
movq -0x10(%rax), %rdx
movq %rdx, (%rcx,%r15)
movl -0x8(%rax), %eax
movl %eax, 0x8(%rcx,%r15)
movq 0x8(%r14), %rax
movq %rax, 0x10(%rbx)
jmp 0x17a9c