// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/tools/gt_sam_interface.c
// Function: gt_sam_interface_runner
static int gt_sam_interface_runner(GT_UNUSED int argc,
                                   GT_UNUSED const char **argv,
                                   GT_UNUSED int parsed_args,
                                   void *tool_arguments, GtError *err)
{
  GtSamInterfaceArguments *arguments = tool_arguments;
  int had_err = 0, count_out = 0;
  GtSamfileIterator *sa_iter;
  GtSamAlignment *sa_align;
  GtAlphabet *alpha = gt_alphabet_new_dna();

  gt_error_check(err);
  gt_assert(arguments);

  if (arguments->bool_is_sam) {
    if (gt_option_is_set(arguments->ref_idxfile))
      sa_iter = gt_samfile_iterator_new_sam(argv[parsed_args], alpha,
                                        gt_str_get(arguments->indexfilename),
                                        err);
    else
      sa_iter  = gt_samfile_iterator_new_sam(argv[parsed_args], alpha,
                                        NULL,
                                        err);

  }
  else {
    sa_iter = gt_samfile_iterator_new_bam(argv[parsed_args], alpha, err);
  }
  while (gt_samfile_iterator_next(sa_iter, &sa_align) > 0 &&
         arguments->lines - count_out) {
    uint16_t cig_len, idx;

    cig_len = gt_sam_alignment_cigar_length(sa_align);

    printf("%s\t%d\t%s\t",
           gt_sam_alignment_identifier(sa_align),
           (int) gt_sam_alignment_flag(sa_align),
           gt_samfile_iterator_reference_name(sa_iter,
                                         gt_sam_alignment_ref_num(sa_align)));
    if (gt_sam_alignment_is_unmapped(sa_align))
      printf("*");
    else {
      for (idx = 0; idx < cig_len; idx++) {
        printf("%d%c",
               (int) gt_sam_alignment_cigar_i_length(sa_align, idx),
               gt_sam_alignment_cigar_i_operation(sa_align, idx));
      }
    }
    printf("\t");
    gt_alphabet_decode_seq_to_fp(alpha, stdout,
        gt_sam_alignment_sequence(sa_align),
        gt_sam_alignment_read_length(sa_align));
    printf("\t%s\n",
           (char *) gt_sam_alignment_qualitystring(sa_align));
    count_out++;
  }
  gt_samfile_iterator_delete(sa_iter);
  gt_alphabet_delete(alpha);
  return had_err;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r15
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r12
callq 0xd340f
movq %rax, 0x10(%rsp)
testq %r15, %r15
je 0xc05d4
movq %r15, %rdi
callq 0x101a9a
testb %al, %al
jne 0xc07b6
testq %rbx, %rbx
je 0xc07b1
cmpb $0x1, (%rbx)
jne 0xc060c
movq 0x8(%rbx), %rdi
callq 0x10fe52
movslq %ebp, %rcx
movq (%r12,%rcx,8), %r12
testb %al, %al
je 0xc0622
movq 0x10(%rbx), %rdi
callq 0x120d23
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
jmp 0xc062c
movslq %ebp, %rax
movq (%r12,%rax,8), %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x178e98
jmp 0xc0634
movq %r12, %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x178eac
movq %rax, %r15
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x178ebe
testl %eax, %eax
jle 0xc078e
leaq 0x29e681(%rip), %r12    # 0x35ecd4
xorl %r14d, %r14d
movq %rbx, 0x20(%rsp)
movq %r15, 0x18(%rsp)
cmpl %r14d, 0x4(%rbx)
je 0xc078e
movq 0x8(%rsp), %rdi
callq 0x1787e8
movl %eax, %r13d
movq 0x8(%rsp), %rdi
callq 0x1785da
movq %rax, %rbp
movq 0x8(%rsp), %rdi
callq 0x178855
movl %eax, %ebx
movq 0x8(%rsp), %rdi
callq 0x1785ed
movq %r15, %rdi
movl %eax, %esi
callq 0x178f68
leaq 0x29e61f(%rip), %rdi    # 0x35ecca
movq %rbp, %rsi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %rdi
callq 0x178892
testb %al, %al
je 0xc06d4
movl $0x2a, %edi
callq 0x17a20
jmp 0xc0713
testw %r13w, %r13w
je 0xc0713
xorl %r15d, %r15d
movq 0x8(%rsp), %rdi
movzwl %r15w, %ebx
movl %ebx, %esi
callq 0x1787fb
movl %eax, %ebp
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x17881b
movzbl %al, %edx
movq %r12, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x17070
incl %r15d
cmpw %r15w, %r13w
jne 0xc06dd
movl $0x9, %edi
callq 0x17a20
movq 0x4037c4(%rip), %rax    # 0x4c3ee8
movq (%rax), %rbx
movq 0x8(%rsp), %rdi
callq 0x178700
movq %rax, %r13
movq 0x8(%rsp), %rdi
callq 0x178583
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0xd394b
movq 0x8(%rsp), %rdi
callq 0x1787d1
leaq 0x29e6f9(%rip), %rdi    # 0x35ee5b
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
incl %r14d
movq 0x18(%rsp), %r15
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x178ebe
testl %eax, %eax
movq 0x20(%rsp), %rbx
jg 0xc0660
movq %r15, %rdi
callq 0x178e1a
movq 0x10(%rsp), %rdi
callq 0xd335d
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1e932
callq 0x1e8fb
nop