// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/extended/spec_visitor.c
// Function: spec_expect_matchdispatch
static int spec_expect_matchdispatch(lua_State *L)
{
  GtSpecVisitor *sv;
  bool success;
  const char *msg = "";

  /* get visitor */
  lua_pushlightuserdata(L, (void *) &spec_defuserdata);
  lua_gettable(L, LUA_REGISTRYINDEX);
  sv = lua_touserdata(L, -1);

  /* get correct matcher function from speclib */
  lua_getglobal(L, "matchers");
  lua_pushstring(L, sv->matcher_name);
  lua_gettable(L, -2);
  lua_insert(L, 1);

  /* get target */
  lua_rawgeti(L, LUA_REGISTRYINDEX, sv->target_ref);
  lua_insert(L, 2);
  luaL_unref(L, LUA_REGISTRYINDEX, sv->target_ref);

  /* call matcher */
  lua_pop(L, 2);
  if (!lua_isfunction(L, 1)) {
    luaL_where(L, 1);
    lua_pushstring(L, "matcher '");
    lua_pushstring(L, sv->matcher_name);
    lua_pushstring(L, "' is not a function");
    lua_concat(L, 4);
    return lua_error(L);
  }
  lua_pcall(L, lua_gettop(L)-1, 2, 0);

  /* handle results */
  if (!lua_isboolean(L, 1)) {
    lua_pushstring(L, "matcher '");
    lua_pushstring(L, sv->matcher_name);
    lua_pushstring(L, "' must return boolean");
    lua_concat(L, 3);
    return lua_error(L);
  }
  success = lua_toboolean(L, 1);
  if (!success) {
    gt_assert(lua_isstring(L, 2));
    msg = lua_tostring(L, 2);
    luaL_where(L, 1);
    lua_pushstring(L, msg);
    lua_concat(L, 2);
    msg = lua_tostring(L, -1);
  }
  gt_spec_results_add_result(sv->res, sv->current_aspect, sv->current_node,
                             success ? GT_SPEC_SUCCESS : GT_SPEC_FAILURE, msg);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x341934(%rip), %rsi    # 0x4ba1f8
callq 0x2248bd
movq %rbx, %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x2248f5
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x224118
movq %rax, %r14
leaq 0x21b6a1(%rip), %rdx    # 0x393f8e
movq %rbx, %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
callq 0x224a06
movq 0x58(%r14), %rsi
movq %rbx, %rdi
callq 0x2243ba
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x2248f5
movq %rbx, %rdi
movl $0x1, %esi
callq 0x2237fd
movl 0x40(%r14), %edx
movq %rbx, %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x224b36
movq %rbx, %rdi
movl $0x2, %esi
callq 0x2237fd
movl 0x40(%r14), %edx
movq %rbx, %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x227c38
movq %rbx, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x2235b9
movq %rbx, %rdi
movl $0x1, %esi
callq 0x223a4b
movq %rbx, %rdi
cmpl $0x6, %eax
jne 0x1789bd
callq 0x2235ac
leal -0x1(%rax), %esi
movq %rbx, %rdi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x22537b
movq %rbx, %rdi
movl $0x1, %esi
callq 0x223a4b
cmpl $0x1, %eax
jne 0x1789fb
movq %rbx, %rdi
movl $0x1, %esi
callq 0x223e82
movl %eax, %ebp
testl %eax, %eax
je 0x178a44
leaq 0x2517b8(%rip), %r8     # 0x3ca170
jmp 0x178a9e
movl $0x1, %esi
callq 0x226f4a
leaq 0x21b5c9(%rip), %rsi    # 0x393f97
movq %rbx, %rdi
callq 0x2243ba
movq 0x58(%r14), %rsi
movq %rbx, %rdi
callq 0x2243ba
leaq 0x25f47d(%rip), %rsi    # 0x3d7e66
movq %rbx, %rdi
callq 0x2243ba
movq %rbx, %rdi
movl $0x4, %esi
jmp 0x178a2d
leaq 0x21b595(%rip), %rsi    # 0x393f97
movq %rbx, %rdi
callq 0x2243ba
movq 0x58(%r14), %rsi
movq %rbx, %rdi
callq 0x2243ba
leaq 0x219925(%rip), %rsi    # 0x392342
movq %rbx, %rdi
callq 0x2243ba
movq %rbx, %rdi
movl $0x3, %esi
callq 0x225a4f
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x225800
movq %rbx, %rdi
movl $0x2, %esi
callq 0x223b1f
testl %eax, %eax
je 0x178ac3
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x223ea8
movq %rax, %r15
movq %rbx, %rdi
movl $0x1, %esi
callq 0x226f4a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2243ba
movq %rbx, %rdi
movl $0x2, %esi
callq 0x225a4f
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x223ea8
movq %rax, %r8
xorl %ecx, %ecx
testl %ebp, %ebp
sete %cl
movq 0x68(%r14), %rdi
movq 0x48(%r14), %rdx
movq 0x50(%r14), %rsi
callq 0x175ece
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x556c4