// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/script_filter.c
// Function: gt_script_filter_run
int gt_script_filter_run(GtScriptFilter *sf, GtFeatureNode *gf,
                         bool *select_node, GtError *err)
{
  int had_err = 0;
#ifndef NDEBUG
  int stack_size;
#endif
  GtGenomeNode *gn_lua;

#ifndef NDEBUG
  stack_size = lua_gettop(sf->L);
#endif

  if (!had_err) {
    lua_getglobal(sf->L, "filter");
    if (lua_isnil(sf->L, -1)) {
      gt_error_set(err, "function 'filter' is not defined");
      had_err = -1;
      lua_pop(sf->L, 1);
    }
  }

  if (!had_err) {
    gn_lua = gt_genome_node_ref((GtGenomeNode*) gf);
    gt_lua_genome_node_push(sf->L, gn_lua);

    if (lua_pcall(sf->L, 1, 1, 0) != 0) {
      gt_error_set(err, "error running function 'filter': %s",
                   lua_tostring(sf->L, -1));
      lua_pop(sf->L, 1);
      had_err = -1;
    }
  }

  if (!had_err && !lua_isboolean(sf->L, -1)) {
    gt_error_set(err, "function 'filter' must return boolean");
    lua_pop(sf->L, 1);
    had_err = -1;
  }

  if (!had_err) {
    *select_node = lua_toboolean(sf->L, -1);
    lua_pop(sf->L, 1);
  }
  gt_assert(lua_gettop(sf->L) == stack_size);

  return had_err;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x333eb0
movl %eax, 0x10(%rsp)
cmpl $0x0, 0x14(%rsp)
jne 0x1d25d7
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xffffd8ee, %esi       # imm = 0xFFFFD8EE
leaq 0x3572c4(%rip), %rdx    # 0x529850
callq 0x336410
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3345d0
cmpl $0x0, %eax
jne 0x1d25d5
movq 0x18(%rsp), %rdi
leaq 0x392596(%rip), %rsi    # 0x564b4a
movb $0x0, %al
callq 0xd88c0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x333ed0
jmp 0x1d25d7
cmpl $0x0, 0x14(%rsp)
jne 0x1d266e
movq 0x28(%rsp), %rdi
callq 0x171410
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movq 0x8(%rsp), %rsi
callq 0x1fbf90
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
movl %edx, %esi
callq 0x3375c0
cmpl $0x0, %eax
je 0x1d266c
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x334f50
movq (%rsp), %rdi
movq %rax, %rdx
leaq 0x392520(%rip), %rsi    # 0x564b6b
movb $0x0, %al
callq 0xd88c0
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x333ed0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
jmp 0x1d266e
cmpl $0x0, 0x14(%rsp)
jne 0x1d26b9
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3345d0
cmpl $0x1, %eax
je 0x1d26b9
movq 0x18(%rsp), %rdi
leaq 0x3924f7(%rip), %rsi    # 0x564b8f
movb $0x0, %al
callq 0xd88c0
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x333ed0
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
cmpl $0x0, 0x14(%rsp)
jne 0x1d26f4
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x334ee0
cmpl $0x0, %eax
setne %cl
movq 0x20(%rsp), %rax
andb $0x1, %cl
movb %cl, (%rax)
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x333ed0
jmp 0x1d26f6
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x333eb0
cmpl 0x10(%rsp), %eax
je 0x1d2741
movq 0x469890(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x3438f9(%rip), %rsi    # 0x516013
leaq 0x392494(%rip), %rdx    # 0x564bb5
leaq 0x3924ad(%rip), %rcx    # 0x564bd5
leaq 0x39230d(%rip), %r8     # 0x564a3c
movl $0x13a, %r9d            # imm = 0x13A
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1d2743
movl 0x14(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)