// File: /workspace/github_c_makefile_star2_O2/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 0x56967
movq %rax, 0x10(%rsp)
testq %r15, %r15
je 0x42189
movq %r15, %rdi
callq 0x89eb7
testb %al, %al
jne 0x42378
testq %rbx, %rbx
je 0x4234e
cmpb $0x1, (%rbx)
jne 0x421c1
movq 0x8(%rbx), %rdi
callq 0x9b4cb
movslq %ebp, %rcx
movq (%r12,%rcx,8), %r12
testb %al, %al
je 0x421d7
movq 0x10(%rbx), %rdi
callq 0xad1fa
movq %r12, %rdi
movq 0x10(%rsp), %rsi
movq %rax, %rdx
jmp 0x421e1
movslq %ebp, %rax
movq (%r12,%rax,8), %rdi
movq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x113c3c
jmp 0x421e9
movq %r12, %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x113c50
movq %rax, %r15
leaq 0x2b3ac5(%rip), %rbp    # 0x2f5cb8
xorl %r14d, %r14d
movq %rbx, 0x20(%rsp)
movq %rax, 0x18(%rsp)
movq %r15, %rdi
leaq 0x8(%rsp), %rsi
callq 0x113c62
testl %eax, %eax
jle 0x4232b
cmpl %r14d, 0x4(%rbx)
je 0x4232b
movq 0x8(%rsp), %rdi
callq 0x1131f6
movl %eax, %r13d
movq 0x8(%rsp), %rdi
callq 0x112ed0
movq %rax, %r12
movq 0x8(%rsp), %rdi
callq 0x1132fa
movl %eax, %ebx
movq 0x8(%rsp), %rdi
callq 0x112f14
movq %r15, %rdi
movl %eax, %esi
callq 0x113d36
leaq 0x2b3a4e(%rip), %rdi    # 0x2f5cae
movq %r12, %rsi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x17070
movq 0x8(%rsp), %rdi
callq 0x1133d0
testb %al, %al
je 0x422ee
pushq $0x2a
popq %rdi
callq 0x179c0
pushq $0x9
popq %rdi
callq 0x179c0
movq 0x3f5c1c(%rip), %rax    # 0x437eb0
movq (%rax), %rbx
movq 0x8(%rsp), %rdi
callq 0x113086
movq %rax, %r12
movq 0x8(%rsp), %rdi
callq 0x112de7
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x5703f
movq 0x8(%rsp), %rdi
callq 0x1131df
leaq 0x2b3b6d(%rip), %rdi    # 0x2f5e3f
movq %rax, %rsi
xorl %eax, %eax
callq 0x17070
incl %r14d
movq 0x20(%rsp), %rbx
movq 0x18(%rsp), %r15
jmp 0x42200
xorl %r15d, %r15d
cmpw %r15w, %r13w
je 0x42285
movq 0x8(%rsp), %rdi
movzwl %r15w, %ebx
movl %ebx, %esi
callq 0x11323c
movl %eax, %r12d
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x11328f
movzbl %al, %edx
movq %rbp, %rdi
movl %r12d, %esi
xorl %eax, %eax
callq 0x17070
incl %r15d
jmp 0x422f1
movq %r15, %rdi
callq 0x113bc4
movq 0x10(%rsp), %rdi
callq 0x568b5
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3f5c13(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2a2cb4(%rip), %rsi    # 0x2e5013
leaq 0x3062ed(%rip), %rdx    # 0x348653
leaq 0x2b3929(%rip), %rcx    # 0x2f5c96
leaq 0x2b3800(%rip), %r8     # 0x2f5b74
pushq $0x6c
jmp 0x423a0
movq 0x3f5be9(%rip), %rax    # 0x437f68
movq (%rax), %rdi
leaq 0x2a2c8a(%rip), %rsi    # 0x2e5013
leaq 0x2a2e2f(%rip), %rdx    # 0x2e51bf
leaq 0x2b38ff(%rip), %rcx    # 0x2f5c96
leaq 0x2b37d6(%rip), %r8     # 0x2f5b74
pushq $0x6b
popq %r9
xorl %eax, %eax
callq 0x17a50
callq 0x17390
nop