// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x4(%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0x3f, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
addl $-0x6, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x23, %eax
ja 0x1b2af
movq -0x58(%rbp), %rax
leaq 0x1a309(%rip), %rcx     # 0x353a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
shrl $0x6, %ecx
andl $0xff, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rdx
movq 0x10(%rdx), %rcx
movq %rcx, %rsi
addq $-0x10, %rsi
movq %rsi, 0x10(%rdx)
movq -0x10(%rcx), %rdx
movq %rdx, (%rax)
movq -0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x1b2b1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
movb $0x1, %al
cmpl $0x0, -0x8(%rcx)
movb %al, -0x59(%rbp)
je 0x1b12b
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
xorl %eax, %eax
cmpl $0x1, -0x8(%rcx)
movb %al, -0x5a(%rbp)
jne 0x1b125
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x0, -0x10(%rax)
sete %al
movb %al, -0x5a(%rbp)
movb -0x5a(%rbp), %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x10, %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movzbl 0x42(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x1b17c
movq -0x10(%rbp), %rax
movzbl 0x42(%rax), %ecx
xorl $0x80, %ecx
movb %cl, 0x42(%rax)
cmpl $0x0, -0x2c(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl -0x1c(%rbp), %ecx
shrl $0x6, %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
je 0x1b19f
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x4, %rcx
movq %rcx, 0x28(%rax)
jmp 0x1b2b1
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
addq $-0x10, %rax
movq %rax, -0x38(%rbp)
movl -0x1c(%rbp), %eax
shrl $0x17, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rax
addq $-0x10, %rax
movq -0x18(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
subq %rcx, %rax
sarq $0x4, %rax
movl %eax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x20, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
cmpl $0x1, -0x40(%rbp)
jle 0x1b227
movq -0x38(%rbp), %rcx
addq $-0x10, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %esi
callq 0x1a840
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x1c(%rbp), %ecx
shrl $0x6, %ecx
andl $0xff, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x10(%rcx), %rdx
movq %rdx, (%rax)
movq -0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x1b2b1
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x1b2b1
movl -0x1c(%rbp), %eax
shrl $0xe, %eax
andl $0x1ff, %eax            # imm = 0x1FF
subl $0x1, %eax
cmpl $0x0, %eax
jl 0x1b2ab
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x1b2b1
jmp 0x1b2b1
jmp 0x1b2b1
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)