// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lgc.c
// Function: GCTM
static void GCTM (lua_State *L, int propagateerrors) {
  global_State *g = G(L);
  const TValue *tm;
  TValue v;
  setgcovalue(L, &v, udata2finalize(g));
  tm = luaT_gettmbyobj(L, &v, TM_GC);
  if (tm != NULL && ttisfunction(tm)) {  /* is there a finalizer? */
    int status;
    lu_byte oldah = L->allowhook;
    int running  = g->gcrunning;
    L->allowhook = 0;  /* stop debug hooks during GC metamethod */
    g->gcrunning = 0;  /* avoid GC steps */
    setobj2s(L, L->top, tm);  /* push finalizer... */
    setobj2s(L, L->top + 1, &v);  /* ... and its argument */
    L->top += 2;  /* and (next line) call the finalizer */
    status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0);
    L->allowhook = oldah;  /* restore hooks */
    g->gcrunning = running;  /* restore state */
    if (status != LUA_OK && propagateerrors) {  /* error while running __gc? */
      if (status == LUA_ERRRUN) {  /* is there an error object? */
        const char *msg = (ttisstring(L->top - 1))
                            ? svalue(L->top - 1)
                            : "no message";
        luaO_pushfstring(L, "error in __gc metamethod (%s)", msg);
        status = LUA_ERRGCMM;  /* error in __gc metamethod */
      }
      luaD_throw(L, status);  /* re-throw error */
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0xe680
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movzbl 0x8(%rax), %ecx
orl $0x40, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movl $0x2, %edx
callq 0x18640
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xe677
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
andl $0xf, %eax
cmpl $0x6, %eax
jne 0xe677
movq -0x8(%rbp), %rax
movb 0xcc(%rax), %al
movb %al, -0x45(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x57(%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, 0xcc(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x57(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x10, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x20, %rcx
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x20, %rcx
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
subq %rax, %rcx
leaq 0x14d(%rip), %rsi       # 0xe720
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
callq 0xc200
movl %eax, -0x44(%rbp)
movb -0x45(%rbp), %cl
movq -0x8(%rbp), %rax
movb %cl, 0xcc(%rax)
movl -0x4c(%rbp), %eax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x57(%rax)
cmpl $0x0, -0x44(%rbp)
je 0xe675
cmpl $0x0, -0xc(%rbp)
je 0xe675
cmpl $0x2, -0x44(%rbp)
jne 0xe669
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x8(%rax), %eax
andl $0xf, %eax
cmpl $0x4, %eax
jne 0xe637
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x10(%rax), %rax
addq $0x18, %rax
movq %rax, -0x70(%rbp)
jmp 0xe644
leaq 0x26262(%rip), %rax     # 0x348a0
movq %rax, -0x70(%rbp)
jmp 0xe644
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0x26250(%rip), %rsi     # 0x348ab
movb $0x0, %al
callq 0x114b0
movl $0x5, -0x44(%rbp)
movq -0x8(%rbp), %rdi
movl -0x44(%rbp), %esi
callq 0xaa40
jmp 0xe677
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)