// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/gtlua/genome_stream_lua.c
// Function: lua_custom_stream_new_generic
static int lua_custom_stream_new_generic(lua_State *L, bool sorted)
{
  GtLuaCustomStream *lcs;
  GtNodeStream **ns;
  gt_assert(L);

  ns = lua_newuserdata(L, sizeof (GtNodeVisitor*));
  gt_assert(ns);
  *ns = gt_node_stream_create(gt_lua_custom_stream_class(), sorted);
  gt_assert(*ns);
  lcs = lua_custom_stream_cast(*ns);
  luaL_getmetatable(L, GENOME_STREAM_METATABLE);
  lua_setmetatable(L, -2);

  /* set clean env for this object */
  lua_newtable(L);
  lua_setfenv(L, -2);
  lcs->L = L;

  /* replace the default next_tree method to force an override in the custom
     stream */
  lua_pushstring(L, "next_tree");
  lua_pushcfunction(L, gt_node_stream_lua_next_tree_fail);
  lua_settable(L, -3);

  /* store reference to Lua object */
  lua_pushvalue(L, -1);
  lcs->ref = luaL_ref(L, LUA_REGISTRYINDEX);

  return 1;
}

// Assembly:
subq $0x28, %rsp
movb %sil, %al
movq %rdi, 0x20(%rsp)
andb $0x1, %al
movb %al, 0x1f(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0xfa692
movq 0xb9977(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x639fb(%rip), %rsi     # 0x15e066
leaq 0x7078c(%rip), %rdx     # 0x16adfe
leaq 0x8211d(%rip), %rcx     # 0x17c796
leaq 0x81fc7(%rip), %r8      # 0x17c647
movl $0xce, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xfa694
movq 0x20(%rsp), %rdi
movl $0x8, %esi
callq 0x53950
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x8(%rsp)
jne 0xfa6e8
movq 0xb9921(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x639a5(%rip), %rsi     # 0x15e066
leaq 0x820ed(%rip), %rdx     # 0x17c7b5
leaq 0x820c7(%rip), %rcx     # 0x17c796
leaq 0x81f71(%rip), %r8      # 0x17c647
movl $0xd1, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xfa6ea
callq 0xf9a90
movq %rax, %rdi
movb 0x1f(%rsp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0x34580
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
jne 0xfa74e
movq 0xb98bb(%rip), %rax     # 0x1b3fd8
movq (%rax), %rdi
leaq 0x6393f(%rip), %rsi     # 0x15e066
leaq 0x82086(%rip), %rdx     # 0x17c7b4
leaq 0x82061(%rip), %rcx     # 0x17c796
leaq 0x81f0b(%rip), %r8      # 0x17c647
movl $0xd3, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0xfa750
callq 0xf9a90
movq %rax, %rdi
movq 0x8(%rsp), %rax
movq (%rax), %rsi
callq 0x34af0
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
leaq 0x7972d(%rip), %rdx     # 0x173ea8
callq 0x51640
movq 0x20(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x523f0
movq 0x20(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x519c0
movq 0x20(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x52550
movq 0x20(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rdi
leaq 0x81eb6(%rip), %rsi     # 0x17c67c
callq 0x50970
movq 0x20(%rsp), %rdi
leaq 0x49(%rip), %rsi        # 0xfa820
xorl %edx, %edx
callq 0x51120
movq 0x20(%rsp), %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x51d10
movq 0x20(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x4f790
movq 0x20(%rsp), %rdi
movl $0xffffd8f0, %esi       # imm = 0xFFFFD8F0
callq 0x566a0
movl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x20(%rax)
movl $0x1, %eax
addq $0x28, %rsp
retq
nop