// File: /workspace/github_c_makefile_star2_O1/tylerneylon[P]APIsWithLua/lua/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_IDIV:
    case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR:
    case OP_MOD: case OP_POW:
    case OP_UNM: case OP_BNOT: 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--;
      if (ci->callstatus & CIST_LEQ) {  /* "<=" using "<" instead? */
        lua_assert(op == OP_LE);
        ci->callstatus ^= CIST_LEQ;  /* clear mark */
        res = !res;  /* negate 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 'luaT_trybinTM' 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 %r15
pushq %r14
pushq %rbx
movq 0x20(%rdi), %r14
movq 0x28(%r14), %rax
movl -0x4(%rax), %r15d
movl %r15d, %ecx
andl $0x3f, %ecx
addl $-0x6, %ecx
cmpl $0x23, %ecx
ja 0x11c26
movq %rdi, %rbx
movq 0x20(%r14), %rax
leaq 0x1035f(%rip), %rdx     # 0x21f5c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
shrl $0x2, %r15d
andl $0xff0, %r15d           # imm = 0xFF0
movq 0x10(%rbx), %rcx
leaq -0x10(%rcx), %rdx
movq %rdx, 0x10(%rbx)
movups -0x10(%rcx), %xmm0
movups %xmm0, (%rax,%r15)
popq %rbx
popq %r14
popq %r15
retq
movq 0x10(%rbx), %rcx
movl -0x8(%rcx), %eax
addq $-0x10, %rcx
testl %eax, %eax
je 0x11c53
cmpl $0x1, %eax
jne 0x11cbd
cmpl $0x0, (%rcx)
sete %al
jmp 0x11cbf
testl $0x7fc000, %r15d        # imm = 0x7FC000
jne 0x11cb0
jmp 0x11c26
movb $0x1, %al
jmp 0x11cbf
movq 0x10(%rbx), %rcx
movl %r15d, %edx
shrl $0x17, %edx
shlq $0x4, %rdx
addq %rdx, %rax
negq %rax
leaq (%rcx,%rax), %rsi
addq $-0x20, %rsi
shrq $0x4, %rsi
movups -0x10(%rcx), %xmm0
movups %xmm0, -0x30(%rcx)
cmpl $0x2, %esi
jl 0x11c94
addq $-0x20, %rcx
movq %rcx, 0x10(%rbx)
movq %rbx, %rdi
callq 0x117a4
movq 0x20(%r14), %rax
shrl $0x2, %r15d
andl $0xff0, %r15d           # imm = 0xFF0
movq 0x10(%rbx), %rcx
movups -0x10(%rcx), %xmm0
movups %xmm0, (%rax,%r15)
movq 0x8(%r14), %rax
movq %rax, 0x10(%rbx)
jmp 0x11c26
xorl %eax, %eax
movq %rcx, 0x10(%rbx)
movb 0x42(%r14), %cl
testb %cl, %cl
js 0x11ccf
xorb $0x1, %al
jmp 0x11cd6
andb $0x7f, %cl
movb %cl, 0x42(%r14)
movzbl %al, %eax
shrl $0x6, %r15d
movzbl %r15b, %ecx
cmpl %eax, %ecx
je 0x11c26
addq $0x4, 0x28(%r14)
jmp 0x11c26