// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/annotationsketch/track.c
// Function: get_next_free_line
static int get_next_free_line(GtTrack *track, GtLine **result, GtBlock *block,
                              GtError *err)
{
  GtUword i;
  GtLine* line;
  int had_err = 0;
  bool is_occupied;
  gt_assert(track);

  /* find unoccupied line -- may need optimisation */
  for (i = 0; i < gt_array_size(track->lines); i++) {
    line = *(GtLine**) gt_array_get(track->lines, i);
    had_err = gt_line_breaker_line_is_occupied(track->lb, &is_occupied, line,
                                               block, err);
    if (had_err)
      break;
    if (!is_occupied) {
      *result = line;
      return 0;
    }
  }
  /* all lines are occupied, we need o create a new one */
  if (!had_err) {
    /* if line limit is hit, do not create any more lines! */
    if (track->max_num_lines != GT_UNDEF_UWORD
          && gt_array_size(track->lines) == track->max_num_lines)
    {
      track->discarded_blocks++;
      *result = NULL;
    }
    /* make sure there is only one line if 'split_lines' is set to false */
    if (!track->split)
    {
      if (gt_array_size(track->lines) < 1)
      {
        line = gt_line_new();
        gt_array_add(track->lines, line);
      }
      else
        line = *(GtLine**) gt_array_get(track->lines, 0);
      gt_assert(gt_array_size(track->lines) == 1);
    }
    else
    {
      line = gt_line_new();
      gt_array_add(track->lines, line);
    }
    gt_assert(line);
  }
  *result = line;
  return had_err;
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movl $0x0, 0xc(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x4cd00
movq 0x167309(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x11138d(%rip), %rsi    # 0x15e066
leaq 0x11c115(%rip), %rdx    # 0x168df5
leaq 0x11d60c(%rip), %rcx    # 0x16a2f3
leaq 0x11d24b(%rip), %r8     # 0x169f39
movl $0x3f, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x4cd02
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x76490
movq %rax, %rcx
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x4cdb2
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x18(%rsp), %rsi
callq 0x75c80
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x20(%rsp), %r8
leaq 0xb(%rsp), %rsi
callq 0xb8790
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0x4cd7c
jmp 0x4cdb2
testb $0x1, 0xb(%rsp)
jne 0x4cd9d
movq 0x10(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movl $0x0, 0x44(%rsp)
jmp 0x4cf2f
jmp 0x4cd9f
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x4cd0b
cmpl $0x0, 0xc(%rsp)
jne 0x4cf1a
movq 0x38(%rsp), %rax
cmpq $-0x1, 0x8(%rax)
je 0x4cdff
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x76490
movq 0x38(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x4cdff
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq 0x30(%rsp), %rax
movq $0x0, (%rax)
movq 0x38(%rsp), %rax
testb $0x1, 0x20(%rax)
jne 0x4ceb2
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x76490
cmpq $0x1, %rax
jae 0x4ce46
callq 0xb7510
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
leaq 0x10(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
jmp 0x4ce60
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x75c80
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x4ce62
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x76490
cmpq $0x1, %rax
je 0x4ceae
movq 0x16715b(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x1111df(%rip), %rsi    # 0x15e066
leaq 0x11d478(%rip), %rdx    # 0x16a306
leaq 0x11d45e(%rip), %rcx    # 0x16a2f3
leaq 0x11d09d(%rip), %r8     # 0x169f39
movl $0x60, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x4ceb0
jmp 0x4ced4
callq 0xb7510
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rdi
leaq 0x10(%rsp), %rsi
movl $0x8, %edx
callq 0x76220
jmp 0x4ced6
cmpq $0x0, 0x10(%rsp)
jne 0x4cf16
movq 0x1670f3(%rip), %rax    # 0x1b3fd8
movq (%rax), %rdi
leaq 0x111177(%rip), %rsi    # 0x15e066
leaq 0x11bfc8(%rip), %rdx    # 0x168ebe
leaq 0x11d3f6(%rip), %rcx    # 0x16a2f3
leaq 0x11d035(%rip), %r8     # 0x169f39
movl $0x67, %r9d
movb $0x0, %al
callq 0xb890
callq 0xb2e0
jmp 0x4cf18
jmp 0x4cf1a
movq 0x10(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rcx, (%rax)
movl 0xc(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopl (%rax,%rax)