// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/annotationsketch/style.c
// Function: gt_style_get_str_with_track
GtStyleQueryStatus gt_style_get_str_with_track(const GtStyle *sty,
                                               const char *section,
                                               const char *key, GtStr *text,
                                               GtFeatureNode *gn,
                                               const GtStr *track_id,
                                               GtError *err)
{
#ifndef NDEBUG
  int stack_size;
#endif
  int i = 0;
  gt_assert(sty && key && section);
  gt_error_check(err);
  gt_rwlock_wrlock(sty->lock);
#ifndef NDEBUG
  stack_size = lua_gettop(sty->L);
#endif
  /* get section */
  i = style_find_section_for_getting(sty, section);
  /* could not get section, return default */
  if (i < 0) {
    gt_assert(lua_gettop(sty->L) == stack_size);
    gt_rwlock_unlock(sty->lock);
    return GT_STYLE_QUERY_NOT_SET;
  }
  /* lookup entry for given key */
  lua_getfield(sty->L, -1, key);

  /* execute callback if function is given */
  if (lua_isfunction(sty->L, -1))
  {
    int num_of_args = 0;
    if (gn) {
      GtGenomeNode *gn_lua = gt_genome_node_ref((GtGenomeNode*) gn);
      gt_lua_genome_node_push(sty->L, gn_lua);
      num_of_args++;
      if (track_id) {
        lua_pushstring(sty->L, gt_str_get(track_id));
        num_of_args++;
      }
    }
    if (lua_pcall(sty->L, num_of_args, 1, 0) != 0)
    {
      gt_error_set(err, "%s", lua_tostring(sty->L, -1));
      lua_pop(sty->L, 3);
      gt_assert(lua_gettop(sty->L) == stack_size);
      gt_rwlock_unlock(sty->lock);
      return GT_STYLE_QUERY_ERROR;
    }
  }

  if (lua_isnil(sty->L, -1) || !lua_isstring(sty->L, -1)) {
    lua_pop(sty->L, i+1);
    gt_assert(lua_gettop(sty->L) == stack_size);
    gt_rwlock_unlock(sty->lock);
    return GT_STYLE_QUERY_NOT_SET;
  } else i++;
  /* retrieve string */
  gt_str_set(text, lua_tostring(sty->L, -1));
  /* reset stack to original state for subsequent calls */
  lua_pop(sty->L, i);
  gt_assert(lua_gettop(sty->L) == stack_size);
  gt_rwlock_unlock(sty->lock);
  return GT_STYLE_QUERY_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x5362c
movq %rdi, %rbx
testq %rdi, %rdi
je 0x5362c
movq %rdx, %rbp
testq %rdx, %rdx
je 0x5362c
movq %r9, %r13
movq %r8, %r14
movq %rsi, %r15
movq %rcx, (%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x53483
callq 0x34fea
testb %al, %al
jne 0x53631
movq 0x10(%rbx), %rdi
callq 0x3cfc0
movq (%rbx), %rdi
callq 0x56afc
movl %eax, %r12d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5310e
movq (%rbx), %rdi
testl %eax, %eax
js 0x53509
movl %eax, %r15d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %rbp, %rdx
callq 0x57f56
movq (%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x56f9b
cmpl $0x6, %eax
jne 0x5358c
testq %r14, %r14
je 0x53522
movq %r14, %rdi
callq 0x4130c
movq (%rbx), %rdi
movq %rax, %rsi
callq 0x875a5
testq %r13, %r13
je 0x53526
movq (%rbx), %r14
movq %r13, %rdi
callq 0x3bb5d
movq %r14, %rdi
movq %rax, %rsi
callq 0x5790a
movl $0x2, %esi
jmp 0x5352b
callq 0x56afc
movl $0x1, %r14d
cmpl %r12d, %eax
je 0x53611
callq 0x18089
xorl %esi, %esi
jmp 0x5352b
movl $0x1, %esi
movq (%rbx), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x588cb
testl %eax, %eax
je 0x5358c
movq (%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x573f8
leaq 0x9b5ad(%rip), %rsi     # 0xeeb01
movq 0x40(%rsp), %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x34f1f
movq (%rbx), %rdi
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x56b09
movq (%rbx), %rdi
callq 0x56afc
movl $0x2, %r14d
cmpl %r12d, %eax
je 0x53611
callq 0x17fde
movq (%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x56f9b
testl %eax, %eax
je 0x535ee
movq (%rbx), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5706f
testl %eax, %eax
je 0x535ee
movq (%rbx), %rdi
xorl %r14d, %r14d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x573f8
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x3b81e
movq (%rbx), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
subl %r15d, %esi
callq 0x56b09
movq (%rbx), %rdi
callq 0x56afc
cmpl %r12d, %eax
je 0x53611
callq 0x18017
movq (%rbx), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
subl %r15d, %esi
callq 0x56b09
movq (%rbx), %rdi
callq 0x56afc
movl $0x1, %r14d
cmpl %r12d, %eax
jne 0x53636
movq 0x10(%rbx), %rdi
callq 0x3cfdb
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x17f6c
callq 0x17fa5
callq 0x18050