// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
leaq 0x3be6e8(%rip), %rax    # 0x59d628
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
leaq 0x45eb6f(%rip), %rsi    # 0x63dac0
callq 0x336160
movq 0x28(%rsp), %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x336210
movq 0x28(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x335300
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
leaq 0x387970(%rip), %rdx    # 0x5668fa
callq 0x336410
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x58(%rax), %rsi
callq 0x335740
movq 0x28(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x336210
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x3341a0
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movl 0x40(%rax), %edx
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x336650
movq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x3341a0
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movl 0x40(%rax), %edx
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x33b590
movq 0x28(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x333ed0
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x3345d0
cmpl $0x6, %eax
je 0x1df086
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x33a490
movq 0x28(%rsp), %rdi
leaq 0x3878c8(%rip), %rsi    # 0x566903
callq 0x335740
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x58(%rax), %rsi
callq 0x335740
movq 0x28(%rsp), %rdi
leaq 0x3ce2a1(%rip), %rsi    # 0x5ad300
callq 0x335740
movq 0x28(%rsp), %rdi
movl $0x4, %esi
callq 0x338280
movq 0x28(%rsp), %rdi
callq 0x337ea0
movl %eax, 0x34(%rsp)
jmp 0x1df22e
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
callq 0x333eb0
movq 0x8(%rsp), %rdi
movl %eax, %esi
subl $0x1, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x3375c0
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x3345d0
cmpl $0x1, %eax
je 0x1df11b
movq 0x28(%rsp), %rdi
leaq 0x387833(%rip), %rsi    # 0x566903
callq 0x335740
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movq 0x58(%rax), %rsi
callq 0x335740
movq 0x28(%rsp), %rdi
leaq 0x385aab(%rip), %rsi    # 0x564b9f
callq 0x335740
movq 0x28(%rsp), %rdi
movl $0x3, %esi
callq 0x338280
movq 0x28(%rsp), %rdi
callq 0x337ea0
movl %eax, 0x34(%rsp)
jmp 0x1df22e
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x334ee0
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movb %al, 0x1f(%rsp)
testb $0x1, 0x1f(%rsp)
jne 0x1df1ee
jmp 0x1df143
movq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x3347b0
cmpl $0x0, %eax
jne 0x1df18f
movq 0x45ce42(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x336eab(%rip), %rsi    # 0x516013
leaq 0x38779e(%rip), %rdx    # 0x56690d
leaq 0x3877aa(%rip), %rcx    # 0x566920
leaq 0x387054(%rip), %r8     # 0x5661d1
movl $0x1fb, %r9d            # imm = 0x1FB
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1df191
movq 0x28(%rsp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x334f50
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movl $0x1, %esi
callq 0x33a490
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x335740
movq 0x28(%rsp), %rdi
movl $0x2, %esi
callq 0x338280
movq 0x28(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x334f50
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x68(%rax), %rdi
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rsi
movq 0x20(%rsp), %rax
movq 0x48(%rax), %rdx
movb 0x1f(%rsp), %r8b
movl $0x1, %ecx
xorl %eax, %eax
testb $0x1, %r8b
cmovnel %eax, %ecx
movq 0x10(%rsp), %r8
callq 0x1da810
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)