LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/match/substriter.c
// Function: gt_substriter_next
int gt_substriter_next(Substriter *substriter)
{
  unsigned int firstspecial;

  while (true)
  {
    if (substriter->remaining >= (GtUword) substriter->qvalue)
    {
      firstspecial = qgram2code(&substriter->currentcode,
                                (const GtCodetype **) substriter->multimappower,
                                substriter->qvalue,
                                substriter->currentptr);
      if (firstspecial == substriter->qvalue)
      {
        substriter->remaining--;
        substriter->currentptr++;
        break;
      }
      substriter->remaining -= firstspecial + 1;
      substriter->currentptr += firstspecial + 1;
    } else
    {
      return 0;
    }
  }
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x20(%rdi), %edx
movq 0x10(%rdi), %rcx
movl $0x1, %esi
xorl %eax, %eax
cmpq %rdx, %rcx
jb 0x244d6c
movq (%rdi), %r8
movq 0x28(%rdi), %r9
movl %esi, %r10d
movq %rdx, %rbx
xorl %r11d, %r11d
leaq -0x1(%rbx), %r14
testl %r14d, %r14d
js 0x244d56
movl %r14d, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
movzbl (%r8,%r15), %r12d
cmpq $0xfd, %r12
ja 0x244d3f
movq (%r9,%r15,8), %rbx
addq (%rbx,%r12,8), %r11
incl %r10d
movq %r14, %rbx
jmp 0x244d0e
testl %r10d, %r10d
je 0x244d5a
movl %ebx, %r9d
subq %r9, %rcx
movq %rcx, 0x10(%rdi)
addq %r9, %r8
movq %r8, (%rdi)
jmp 0x244cf9
movq %r11, 0x18(%rdi)
decq %rcx
movq %rcx, 0x10(%rdi)
incq %r8
movq %r8, (%rdi)
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/ltr/ltr_orf_annotator_stream.c
// Function: gt_ltr_orf_annotator_stream_class
const GtNodeStreamClass* gt_ltr_orf_annotator_stream_class(void)
{
  static const GtNodeStreamClass *nsc = NULL;
  gt_class_alloc_lock_enter();
  if (!nsc) {
    nsc = gt_node_stream_class_new(sizeof (GtLTRORFAnnotatorStream),
                                   ltr_orf_annotator_stream_free,
                                   ltr_orf_annotator_stream_next);
  }
  gt_class_alloc_lock_leave();
  return nsc;
}

// Assembly:
pushq %rax
callq 0xbafdf
cmpq $0x0, 0x1c2976(%rip)    # 0x412c98
jne 0x250341
leaq 0x24(%rip), %rsi        # 0x25034f
leaq 0x47(%rip), %rdx        # 0x250379
pushq $0x28
popq %rdi
callq 0x2f6f0
movq %rax, 0x1c2957(%rip)    # 0x412c98
callq 0xbb026
movq 0x1c294b(%rip), %rax    # 0x412c98
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/ltr/ltr_orf_annotator_stream.c
// Function: ltr_orf_annotator_stream_next
static int ltr_orf_annotator_stream_next(GtNodeStream *ns, GtGenomeNode **gn,
                                         GtError *err)
{
  GtLTRORFAnnotatorStream *bs;
  gt_error_check(err);
  bs = ltr_orf_annotator_stream_cast(ns);
  if (bs->progress_loc != NULL)
    (*bs->progress_loc)++;
  return gt_node_stream_next(bs->orf_stream, gn, err);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdx, %rdx
je 0x250398
movq %rbx, %rdi
callq 0x32150
testb %al, %al
jne 0x2503c8
callq 0x250314
movq %rax, %rdi
movq %r15, %rsi
callq 0x2ff80
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x2503b4
incq (%rcx)
movq 0x10(%rax), %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x304c0
movq 0x1babe1(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0x8e417(%rip), %rsi     # 0x2de7f0
leaq 0x8e5e3(%rip), %rdx     # 0x2de9c3
leaq 0xfe437(%rip), %rcx     # 0x34e81e
leaq 0xfe3db(%rip), %r8      # 0x34e7c9
pushq $0x29
popq %r9
xorl %eax, %eax
callq 0x32960
callq 0x2e820
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/ltr/ltr_orf_annotator_stream.c
// Function: gt_ltr_orf_annotator_stream_new
GtNodeStream* gt_ltr_orf_annotator_stream_new(GtNodeStream *in_stream,
                                              GtEncseq *encseq,
                                              unsigned int min,
                                              unsigned int max,
                                              bool all,
                                              GtError *err)
{
  GtLTRORFAnnotatorStream *bs;
  GtNodeStream *ns;
  GtRegionMapping *rmap;
  gt_assert(in_stream);
  ns = gt_node_stream_create(gt_ltr_orf_annotator_stream_class(), false);
  bs = ltr_orf_annotator_stream_cast(ns);
  bs->types = gt_hashmap_new(GT_HASH_STRING, NULL, NULL);
  bs->progress_loc = NULL;
  gt_hashmap_add(bs->types, gt_ft_LTR_retrotransposon, (void*) 1);
  rmap = gt_region_mapping_new_encseq_seqno(encseq);
  gt_assert(rmap);
  bs->orf_stream = gt_orf_finder_stream_new(in_stream, rmap, bs->types, min,
                                            max, all, err);
  return ns;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, 0x14(%rsp)
movl %edx, 0x10(%rsp)
testq %rdi, %rdi
je 0x2504b8
movq %r9, %r15
movl %r8d, %r14d
movq %rsi, %rbx
movq %rdi, %r12
callq 0x250314
movq %rax, %rdi
xorl %esi, %esi
callq 0x312a0
movq %rax, %r13
callq 0x250314
movq %rax, %rdi
movq %r13, %rsi
callq 0x2ff80
movq %rax, %rbp
pushq $0x1
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x31560
movq %rax, 0x20(%rbp)
andq $0x0, 0x18(%rbp)
leaq 0xcaf90(%rip), %rsi     # 0x31b3fa
pushq $0x1
popq %rdx
movq %rax, %rdi
callq 0x31790
movq %rbx, %rdi
callq 0x170a8c
testq %rax, %rax
je 0x2504e2
movq 0x20(%rbp), %rdx
movq %r15, (%rsp)
movzbl %r14b, %r9d
movq %r12, %rdi
movq %rax, %rsi
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %r8d
callq 0x164441
movq %rax, 0x10(%rbp)
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1baaf1(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0x8e327(%rip), %rsi     # 0x2de7f0
leaq 0xa71bc(%rip), %rdx     # 0x2f768c
leaq 0xfe2d2(%rip), %rcx     # 0x34e7a9
leaq 0xfe2eb(%rip), %r8      # 0x34e7c9
pushq $0x4e
jmp 0x25050a
movq 0x1baac7(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0x8e2fd(%rip), %rsi     # 0x2de7f0
leaq 0xfeed7(%rip), %rdx     # 0x34f3d1
leaq 0xfe2a8(%rip), %rcx     # 0x34e7a9
leaq 0xfe2c1(%rip), %r8      # 0x34e7c9
pushq $0x55
popq %r9
xorl %eax, %eax
callq 0x32960
callq 0x2e820
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/custom_track_example.c
// Function: gt_custom_track_example_class
const GtCustomTrackClass* gt_custom_track_example_class(void)
{
  static const GtCustomTrackClass *ctc = NULL;
  gt_class_alloc_lock_enter();
  if (!ctc)
  {
    ctc = gt_custom_track_class_new(sizeof (GtCustomTrackExample),
                                    gt_custom_track_example_sketch,
                                    gt_custom_track_example_get_height,
                                    gt_custom_track_example_get_title,
                                    gt_custom_track_example_delete);
  }
  gt_class_alloc_lock_leave();
  return ctc;
}

// Assembly:
pushq %rax
callq 0xbafdf
cmpq $0x0, 0x1ab353(%rip)    # 0x412d08
jne 0x2679e2
leaq -0x236(%rip), %rsi      # 0x267788
leaq 0x2b(%rip), %rdx        # 0x2679f0
leaq 0x3e(%rip), %rcx        # 0x267a0a
leaq 0x55(%rip), %r8         # 0x267a28
pushq $0x20
popq %rdi
callq 0x26745c
movq %rax, 0x1ab326(%rip)    # 0x412d08
callq 0xbb026
movq 0x1ab31a(%rip), %rax    # 0x412d08
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/custom_track_example.c
// Function: gt_custom_track_example_new
GtCustomTrack* gt_custom_track_example_new()
{
  GtCustomTrackExample *cte;
  GtCustomTrack *ct;
  ct = gt_custom_track_create(gt_custom_track_example_class());
  cte = gt_custom_track_example_cast(ct);
  cte->title = gt_str_new_cstr("Example custom track for AnnotationSketch");
  cte->height = 40;
  return ct;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x2679a7
movq %rax, %rdi
callq 0x267499
movq %rax, %rbx
callq 0x2679a7
movq %rax, %rdi
movq %rbx, %rsi
callq 0x26773b
movq %rax, %r14
leaq 0xec393(%rip), %rdi     # 0x353e0d
callq 0x300e0
movq %rax, 0x18(%r14)
movq $0x28, 0x10(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/custom_track_script_wrapper.c
// Function: gt_custom_track_script_wrapper_class
const GtCustomTrackClass* gt_custom_track_script_wrapper_class(void)
{
  static const GtCustomTrackClass *ctc = NULL;
  gt_class_alloc_lock_enter();
  if (!ctc)
  {
    ctc = gt_custom_track_class_new(sizeof (GtCustomTrackScriptWrapper),
                                    gt_custom_track_script_wrapper_sketch,
                                    gt_custom_track_script_wrapper_get_height,
                                    gt_custom_track_script_wrapper_get_title,
                                    gt_custom_track_script_wrapper_delete);
  }
  gt_class_alloc_lock_leave();
  return ctc;
}

// Assembly:
pushq %rax
callq 0xbafdf
cmpq $0x0, 0x1aa957(%rip)    # 0x412d18
jne 0x2683ee
leaq -0x72(%rip), %rsi       # 0x268358
leaq 0x2b(%rip), %rdx        # 0x2683fc
leaq 0x3e(%rip), %rcx        # 0x268416
leaq 0x6a(%rip), %r8         # 0x268449
pushq $0x38
popq %rdi
callq 0x26745c
movq %rax, 0x1aa92a(%rip)    # 0x412d18
callq 0xbb026
movq 0x1aa91e(%rip), %rax    # 0x412d18
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/custom_track_script_wrapper.c
// Function: gt_custom_track_script_wrapper_get_title
const char* gt_custom_track_script_wrapper_get_title(GtCustomTrack *ct)
{
  GtCustomTrackScriptWrapper *cte;
  cte = gt_custom_track_script_wrapper_cast(ct);
  gt_str_reset(cte->title_buffer);
  cte->get_title_func(NULL, cte->title_buffer);
  return gt_str_get(cte->title_buffer);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2683b3
movq %rax, %rdi
movq %rbx, %rsi
callq 0x26773b
movq %rax, %rbx
movq 0x30(%rax), %rdi
callq 0x32720
movq 0x30(%rbx), %rsi
xorl %edi, %edi
callq *0x20(%rbx)
movq 0x30(%rbx), %rdi
popq %rbx
jmp 0x32b70
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/custom_track_script_wrapper.c
// Function: gt_custom_track_script_wrapper_delete
void gt_custom_track_script_wrapper_delete(GtCustomTrack *ct)
{
  GtCustomTrackScriptWrapper *cte;
  if (!ct) return;
  cte = gt_custom_track_script_wrapper_cast(ct);
  cte->free_func(NULL);
  gt_str_delete(cte->title_buffer);
}

// Assembly:
testq %rdi, %rdi
je 0x268474
pushq %rbx
movq %rdi, %rbx
callq 0x2683b3
movq %rax, %rdi
movq %rbx, %rsi
callq 0x26773b
movq %rax, %rbx
xorl %edi, %edi
callq *0x28(%rax)
movq 0x30(%rbx), %rdi
popq %rbx
jmp 0x33020
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/annotationsketch/custom_track_script_wrapper.c
// Function: gt_custom_track_script_wrapper_new
GtCustomTrack* gt_custom_track_script_wrapper_new(GtCtScriptRenderFunc
                                                             render_func,
                                                  GtCtScriptGetHeightFunc
                                                             get_height_func,
                                                  GtCtScriptGetTitleFunc
                                                             get_title_func,
                                                  GtCtScriptFreeFunc
                                                             free_func)
{
  GtCustomTrackScriptWrapper *cte;
  GtCustomTrack *ct;
  ct = gt_custom_track_create(gt_custom_track_script_wrapper_class());
  cte = gt_custom_track_script_wrapper_cast(ct);
  cte->render_func = render_func;
  cte->get_height_func = get_height_func;
  cte->get_title_func = get_title_func;
  cte->free_func = free_func;
  cte->title_buffer = gt_str_new();
  return ct;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x2683b3
movq %rax, %rdi
callq 0x267499
movq %rax, %r13
callq 0x2683b3
movq %rax, %rdi
movq %r13, %rsi
callq 0x26773b
movq %rax, %rbp
movq %r12, 0x10(%rax)
movq %r15, 0x18(%rax)
movq %r14, 0x20(%rax)
movq %rbx, 0x28(%rax)
callq 0x31660
movq %rax, 0x30(%rbp)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: insert_offset
static inline void insert_offset(khash_t(i) *h, int bin, uint64_t beg, uint64_t end)
{
	khint_t k;
	bam_binlist_t *l;
	int ret;
	k = kh_put(i, h, bin, &ret);
	l = &kh_value(h, k);
	if (ret) { // not present
		l->m = 1; l->n = 0;
		l->list = (pair64_t*)calloc(l->m, 16);
	}
	if (l->n == l->m) {
		l->m <<= 1;
		l->list = (pair64_t*)realloc(l->list, l->m * 16);
	}
	l->list[l->n].u = beg; l->list[l->n++].v = end;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
leaq 0xc(%rsp), %r12
movq %r12, %rdx
callq 0x29a6a7
movl %eax, %r13d
shlq $0x4, %r13
addq 0x20(%r15), %r13
cmpl $0x0, (%r12)
je 0x2993b0
movq $0x1, (%r13)
leaq 0x4(%r13), %r15
pushq $0x1
popq %rdi
pushq $0x10
popq %rsi
callq 0x31f40
movq %rax, 0x8(%r13)
xorl %ecx, %ecx
jmp 0x2993dd
leaq 0x4(%r13), %r15
movl (%r13), %esi
movl 0x4(%r13), %ecx
cmpl %esi, %ecx
jne 0x2993dd
leal (%rsi,%rsi), %eax
movl %eax, (%r13)
movq 0x8(%r13), %rdi
shll $0x5, %esi
callq 0x330a8
movq %rax, 0x8(%r13)
movl 0x4(%r13), %ecx
jmp 0x2993e1
movq 0x8(%r13), %rax
movl %ecx, %edx
shlq $0x4, %rdx
movq %r14, (%rax,%rdx)
incl %ecx
movl %ecx, (%r15)
movq %rbx, 0x8(%rax,%rdx)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: bam_index_destroy
void bam_index_destroy(bam_index_t *idx)
{
	khint_t k;
	int i;
	if (idx == 0) return;
	for (i = 0; i < idx->n; ++i) {
		khash_t(i) *index = idx->index[i];
		bam_lidx_t *index2 = idx->index2 + i;
		for (k = kh_begin(index); k != kh_end(index); ++k) {
			if (kh_exist(index, k))
				free(kh_value(index, k).list);
		}
		kh_destroy(i, index);
		free(index2->offset);
	}
	free(idx->index); free(idx->index2);
	free(idx);
}

// Assembly:
testq %rdi, %rdi
je 0x2994d4
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r15d, %r15d
movslq (%rbx), %rax
movq 0x10(%rbx), %rdi
cmpq %rax, %r15
jge 0x2994b0
movq (%rdi,%r15,8), %r14
movq 0x18(%rbx), %r12
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpl (%r14), %r13d
je 0x299474
movq 0x10(%r14), %rax
movl %r13d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x29946c
movq 0x20(%r14), %rax
movl %r13d, %ecx
shlq $0x4, %rcx
movq 0x8(%rax,%rcx), %rdi
callq 0x33058
incl %r13d
addl $0x2, %ebp
jmp 0x29943a
movq 0x18(%r14), %rdi
callq 0x33058
movq 0x10(%r14), %rdi
callq 0x33058
movq 0x20(%r14), %rdi
callq 0x33058
movq %r14, %rdi
callq 0x33058
movq %r15, %rax
shlq $0x4, %rax
movq 0x8(%r12,%rax), %rdi
callq 0x33058
incq %r15
jmp 0x29941d
callq 0x33058
movq 0x18(%rbx), %rdi
callq 0x33058
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x33058
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: bam_index_load
bam_index_t *bam_index_load(const char *fn)
{
	bam_index_t *idx;
	idx = bam_index_load_local(fn);
	if (idx == 0 && (strstr(fn, "ftp://") == fn || strstr(fn, "http://") == fn)) {
		char *fnidx = calloc(strlen(fn) + 5, 1);
		strcat(strcpy(fnidx, fn), ".bai");
		fprintf(stderr, "[bam_index_load] attempting to download the remote index file.\n");
		download_from_remote(fnidx);
		idx = bam_index_load_local(fn);
	}
	if (idx == 0) fprintf(stderr, "[bam_index_load] fail to load BAM index.\n");
	return idx;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x2997fa
testq %rax, %rax
je 0x299c44
popq %rbx
popq %r14
popq %r15
retq
leaq 0xc154f(%rip), %rsi     # 0x35b19a
pushq $0x6
popq %rdx
movq %rbx, %rdi
callq 0x2f1b0
testl %eax, %eax
je 0x299c70
leaq 0xc1540(%rip), %rsi     # 0x35b1a1
pushq $0x7
popq %rdx
movq %rbx, %rdi
callq 0x2f1b0
testl %eax, %eax
jne 0x299cd9
movq %rbx, %rdi
callq 0x2fe60
leaq 0x5(%rax), %rdi
pushq $0x1
popq %r14
movq %r14, %rsi
callq 0x31f40
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x31b50
movq %r15, %rdi
callq 0x2fe60
movl $0x6961622e, (%r15,%rax) # imm = 0x6961622E
movb $0x0, 0x4(%r15,%rax)
movq 0x1712fd(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc14f1(%rip), %rdi     # 0x35b1ae
pushq $0x3f
popq %rsi
movq %r14, %rdx
callq 0x32760
movq %rbx, %rdi
callq 0x2997fa
testq %rax, %rax
jne 0x299c3e
movq 0x1712d0(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc1504(%rip), %rdi     # 0x35b1ee
pushq $0x29
popq %rsi
pushq $0x1
popq %rdx
callq 0x32760
xorl %eax, %eax
jmp 0x299c3e
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: bam_index_build2
int bam_index_build2(const char *fn, const char *_fnidx)
{
	char *fnidx;
	FILE *fpidx;
	bamFile fp;
	bam_index_t *idx;
	if ((fp = bam_open(fn, "r")) == 0) {
		fprintf(stderr, "[bam_index_build2] fail to open the BAM file.\n");
		return -1;
	}
	idx = bam_index_core(fp);
	bam_close(fp);
	if(idx == 0) {
		fprintf(stderr, "[bam_index_build2] fail to index the BAM file.\n");
		return -1;
	}
	if (_fnidx == 0) {
		fnidx = (char*)calloc(strlen(fn) + 5, 1);
		strcpy(fnidx, fn); strcat(fnidx, ".bai");
	} else fnidx = strdup(_fnidx);
	fpidx = fopen(fnidx, "wb");
	if (fpidx == 0) {
		fprintf(stderr, "[bam_index_build2] fail to create the index file.\n");
		free(fnidx);
		return -1;
	}
	bam_index_save(idx, fpidx);
	bam_index_destroy(idx);
	fclose(fpidx);
	free(fnidx);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0x4883a(%rip), %rsi     # 0x2e254b
callq 0x292937
testq %rax, %rax
je 0x299dd0
movq %rax, %r12
movq %rax, %rdi
callq 0x298d1f
movq %rax, %rbx
movq %r12, %rdi
callq 0x292a35
testq %rbx, %rbx
je 0x299de5
testq %r14, %r14
je 0x299d50
movq %r14, %rdi
callq 0x316c0
movq %rax, %r14
jmp 0x299d88
movq %r15, %rdi
callq 0x2fe60
leaq 0x5(%rax), %rdi
pushq $0x1
popq %rsi
callq 0x31f40
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x31b50
movq %r14, %rdi
callq 0x2fe60
movl $0x6961622e, (%r14,%rax) # imm = 0x6961622E
movb $0x0, 0x4(%r14,%rax)
leaq 0x44fc1(%rip), %rsi     # 0x2ded50
movq %r14, %rdi
callq 0x32660
testq %rax, %rax
je 0x299e03
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2994d5
movq %rbx, %rdi
callq 0x299403
movq %r15, %rdi
callq 0x320a0
movq %r14, %rdi
callq 0x33058
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x1711d9(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc1437(%rip), %rdi     # 0x35b218
pushq $0x2e
jmp 0x299df8
movq 0x1711c4(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc1451(%rip), %rdi     # 0x35b247
pushq $0x2f
popq %rsi
pushq $0x1
popq %rdx
callq 0x32760
jmp 0x299e27
movq 0x1711a6(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc1463(%rip), %rdi     # 0x35b277
pushq $0x32
popq %rsi
pushq $0x1
popq %rdx
callq 0x32760
movq %r14, %rdi
callq 0x33058
pushq $-0x1
popq %rax
jmp 0x299dc4
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: bam_index
int bam_index(int argc, char *argv[])
{
	if (argc < 2) {
		fprintf(stderr, "Usage: samtools index <in.bam> [out.index]\n");
		return 1;
	}
	if (argc >= 3) bam_index_build2(argv[1], argv[2]);
	else bam_index_build(argv[1]);
	return 0;
}

// Assembly:
pushq %rax
cmpl $0x1, %edi
jle 0x299e58
movl %edi, %eax
movq 0x8(%rsi), %rdi
cmpl $0x2, %eax
jne 0x299e4b
callq 0x299e2c
jmp 0x299e54
movq 0x10(%rsi), %rsi
callq 0x299cfc
xorl %eax, %eax
popq %rcx
retq
movq 0x171151(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc1441(%rip), %rdi     # 0x35b2aa
pushq $0x2b
popq %rsi
pushq $0x1
popq %rdx
callq 0x32760
pushq $0x1
popq %rax
jmp 0x299e56
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: bam_idxstats
int bam_idxstats(int argc, char *argv[])
{
	bam_index_t *idx;
	bam_header_t *header;
	bamFile fp;
	int i;
	if (argc < 2) {
		fprintf(stderr, "Usage: samtools idxstats <in.bam>\n");
		return 1;
	}
	fp = bam_open(argv[1], "r");
	if (fp == 0) { fprintf(stderr, "[%s] fail to open BAM.\n", __func__); return 1; }
	header = bam_header_read(fp);
	bam_close(fp);
	idx = bam_index_load(argv[1]);
	if (idx == 0) { fprintf(stderr, "[%s] fail to load the index.\n", __func__); return 1; }
	for (i = 0; i < idx->n; ++i) {
		khint_t k;
		khash_t(i) *h = idx->index[i];
		printf("%s\t%d", header->target_name[i], header->target_len[i]);
		k = kh_get(i, h, BAM_MAX_BIN);
		if (k != kh_end(h))
			printf("\t%llu\t%llu", (long long)kh_val(h, k).list[1].u, (long long)kh_val(h, k).list[1].v);
		else printf("\t0\t0");
		putchar('\n');
	}
	printf("*\t0\t0\t%llu\n", (long long)idx->n_no_coor);
	bam_header_destroy(header);
	bam_index_destroy(idx);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, %edi
jle 0x299f92
movq %rsi, %r14
movq 0x8(%rsi), %rdi
leaq 0x486b0(%rip), %rsi     # 0x2e254b
callq 0x292937
testq %rax, %rax
je 0x299fb0
movq %rax, %r15
movq %rax, %rdi
callq 0x294cb4
movq %rax, %rbx
movq %r15, %rdi
callq 0x292a35
movq 0x8(%r14), %rdi
callq 0x299c2c
testq %rax, %rax
je 0x299fc3
movq %rax, %r14
movslq (%rax), %r13
pushq $0xa
popq %rbp
xorl %r15d, %r15d
cmpq %r13, %r15
jge 0x299f5d
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %r12
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq (%rax,%r15,8), %rsi
movl (%rcx,%r15,4), %edx
leaq 0xc143b(%rip), %rdi     # 0x35b33c
xorl %eax, %eax
callq 0x2e300
movq %r12, %rdi
movl $0x924a, %esi           # imm = 0x924A
callq 0x299fe7
cmpl (%r12), %eax
jne 0x299f2b
leaq 0xc142b(%rip), %rdi     # 0x35b34d
xorl %eax, %eax
callq 0x2e300
jmp 0x299f51
movq 0x20(%r12), %rcx
movl %eax, %eax
shlq $0x4, %rax
movq 0x8(%rcx,%rax), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
leaq 0xc13f8(%rip), %rdi     # 0x35b342
xorl %eax, %eax
callq 0x2e300
movl %ebp, %edi
callq 0x2ef90
incq %r15
jmp 0x299edd
movq 0x8(%r14), %rsi
leaq 0xc13ea(%rip), %rdi     # 0x35b352
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2e300
movq %rbx, %rdi
callq 0x294c39
movq %r14, %rdi
callq 0x299403
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x171017(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xc1333(%rip), %rdi     # 0x35b2d6
pushq $0x22
popq %rsi
pushq $0x1
popq %rdx
callq 0x32760
jmp 0x299fe2
movq 0x170ff9(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0xc1338(%rip), %rsi     # 0x35b2f9
jmp 0x299fd4
movq 0x170fe6(%rip), %rax    # 0x40afb0
movq (%rax), %rdi
leaq 0xc134a(%rip), %rsi     # 0x35b31e
leaq 0xc1336(%rip), %rdx     # 0x35b311
xorl %eax, %eax
callq 0x32960
pushq $0x1
popq %rbp
jmp 0x299f81
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: get_chunk_coordinates
pair64_t *get_chunk_coordinates(const bam_index_t *idx, int tid, int beg, int end, int *cnt_off)
{ // for pysam compatibility
	bam_iter_t iter;
	pair64_t *off;
	iter = bam_iter_query(idx, tid, beg, end);
	off = iter->off; *cnt_off = iter->n_off;
	free(iter);
	return off;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
callq 0x29a06a
movq 0x28(%rax), %r14
movl 0x10(%rax), %ecx
movl %ecx, (%rbx)
movq %rax, %rdi
callq 0x33058
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_index.c
// Function: bam_fetch
int bam_fetch(bamFile fp, const bam_index_t *idx, int tid, int beg, int end, void *data, bam_fetch_f func)
{
	int ret;
	bam_iter_t iter;
	bam1_t *b;
	b = bam_init1();
	iter = bam_iter_query(idx, tid, beg, end);
	while ((ret = bam_iter_read(fp, iter, b)) >= 0) func(b, data);
	bam_iter_destroy(iter);
	bam_destroy1(b);
	return (ret == -1)? 0 : ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movl %r8d, 0x4(%rsp)
movl %ecx, (%rsp)
movl %edx, %r12d
movq %rsi, %rbp
movq %rdi, %r15
movq 0x40(%rsp), %r13
pushq $0x1
popq %rdi
pushq $0x38
popq %rsi
callq 0x31f40
movq %rax, %rbx
movq %rbp, %rdi
movl %r12d, %esi
movl (%rsp), %edx
movl 0x4(%rsp), %ecx
callq 0x29a06a
movq %rax, %r12
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x29a431
testl %eax, %eax
js 0x29a665
movq %rbx, %rdi
movq %r14, %rsi
callq *%r13
jmp 0x29a648
movl %eax, %ebp
movq %r12, %rdi
callq 0x29a415
testq %rbx, %rbx
je 0x29a685
movq 0x30(%rbx), %rdi
callq 0x33058
movq %rbx, %rdi
callq 0x33058
xorl %eax, %eax
cmpl $-0x1, %ebp
cmovnel %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_lpileup.c
// Function: bam_lplbuf_reset
void bam_lplbuf_reset(bam_lplbuf_t *buf)
{
	freenode_t *p, *q;
	bam_plbuf_reset(buf->plbuf);
	for (p = buf->head; p->next;) {
		q = p->next;
		mp_free(buf->mp, p);
		p = q;
	}
	buf->head = buf->tail;
	buf->max_level = 0;
	buf->n_cur = buf->n_pre = 0;
	buf->n_nodes = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
callq 0x29b554
movq 0x30(%rbx), %rsi
movq 0x8(%rsi), %r14
testq %r14, %r14
je 0x29c192
movq 0x20(%rbx), %rdi
callq 0x29c1af
movq %r14, %rsi
jmp 0x29c17b
movq 0x38(%rbx), %rax
movq %rax, 0x30(%rbx)
andl $0x0, 0xc(%rbx)
andq $0x0, 0x4(%rbx)
andl $0x0, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_lpileup.c
// Function: mp_free
static inline void mp_free(mempool_t *mp, freenode_t *p)
{
	--mp->cnt; p->next = 0; p->cnt = TV_GAP;
	if (mp->n == mp->max) {
		mp->max = mp->max? mp->max<<1 : 256;
		mp->buf = (freenode_t**)realloc(mp->buf, sizeof(freenode_t*) * mp->max);
	}
	mp->buf[mp->n++] = p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
decl (%rdi)
movq %rsi, %r14
andq $0x0, 0x8(%rsi)
movl $0xfffffff, %eax        # imm = 0xFFFFFFF
andl (%rsi), %eax
orl $0x20000000, %eax       # imm = 0x20000000
movl %eax, (%rsi)
movl 0x4(%rdi), %ecx
cmpl 0x8(%rdi), %ecx
jne 0x29c1ff
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x100, %ecx            # imm = 0x100
cmovnel %eax, %ecx
movl %ecx, 0x8(%rbx)
movq 0x10(%rbx), %rdi
movslq %ecx, %rsi
shlq $0x3, %rsi
callq 0x330a8
movq %rax, 0x10(%rbx)
movl 0x4(%rbx), %ecx
jmp 0x29c203
movq 0x10(%rbx), %rax
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rbx)
movslq %ecx, %rcx
movq %r14, (%rax,%rcx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_lpileup.c
// Function: bam_lplbuf_init
bam_lplbuf_t *bam_lplbuf_init(bam_pileup_f func, void *data)
{
	bam_lplbuf_t *tv;
	tv = (bam_lplbuf_t*)calloc(1, sizeof(bam_lplbuf_t));
	tv->mp = mp_init();
	tv->head = tv->tail = mp_alloc(tv->mp);
	tv->func = func;
	tv->user_data = data;
	tv->plbuf = bam_plbuf_init(tview_func, tv);
	return (bam_lplbuf_t*)tv;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x1
popq %r15
pushq $0x60
popq %rsi
movq %r15, %rdi
callq 0x31f40
movq %rax, %r12
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x31f40
movq %rax, 0x20(%r12)
movq %rax, %rdi
callq 0x29c287
movq %rax, 0x38(%r12)
movq %rax, 0x30(%r12)
movq %r14, 0x48(%r12)
movq %rbx, 0x50(%r12)
leaq 0x43(%rip), %rdi        # 0x29c2ae
movq %r12, %rsi
callq 0x29b486
movq %rax, 0x58(%r12)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/bam_lpileup.c
// Function: bam_lplbuf_destroy
void bam_lplbuf_destroy(bam_lplbuf_t *tv)
{
	freenode_t *p, *q;
	free(tv->cur_level); free(tv->pre_level);
	bam_plbuf_destroy(tv->plbuf);
	free(tv->aux);
	for (p = tv->head; p->next;) {
		q = p->next;
		mp_free(tv->mp, p); p = q;
	}
	mp_free(tv->mp, p);
	assert(tv->mp->cnt == 0);
	mp_destroy(tv->mp);
	free(tv);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x33058
movq 0x18(%rbx), %rdi
callq 0x33058
movq 0x58(%rbx), %rdi
callq 0x29b53f
movq 0x28(%rbx), %rdi
callq 0x33058
movq 0x30(%rbx), %rsi
movq 0x8(%rsi), %r14
movq 0x20(%rbx), %rdi
callq 0x29c1af
movq %r14, %rsi
testq %r14, %r14
jne 0x29c5fa
movq 0x20(%rbx), %r14
cmpl $0x0, (%r14)
jne 0x29c651
xorl %r15d, %r15d
movslq 0x4(%r14), %rax
movq 0x10(%r14), %rdi
cmpq %rax, %r15
jge 0x29c637
movq (%rdi,%r15,8), %rdi
callq 0x33058
incq %r15
jmp 0x29c61c
callq 0x33058
movq %r14, %rdi
callq 0x33058
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x33058
leaq 0xbefde(%rip), %rdi     # 0x35b636
leaq 0xbefe8(%rip), %rsi     # 0x35b647
leaq 0xbf00c(%rip), %rcx     # 0x35b672
movl $0xbe, %edx
callq 0x2edc0
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: kftp_connect
int kftp_connect(knetFile *ftp)
{
	ftp->ctrl_fd = socket_connect(ftp->host, ftp->port);
	if (ftp->ctrl_fd == -1) return -1;
	kftp_get_response(ftp);
	kftp_send_cmd(ftp, "USER anonymous\r\n", 1);
	kftp_send_cmd(ftp, "PASS kftp@\r\n", 1);
	kftp_send_cmd(ftp, "TYPE I\r\n", 1);
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movq 0x18(%rbx), %rsi
callq 0x2a1423
movl %eax, 0x20(%rbx)
cmpl $-0x1, %eax
je 0x2a1419
movq %rbx, %rdi
callq 0x2a1505
leaq 0xbaa0a(%rip), %rsi     # 0x35bdf0
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x2a162a
leaq 0xbaa07(%rip), %rsi     # 0x35be01
movq %rbx, %rdi
movl %ebp, %edx
callq 0x2a162a
leaq 0xbaa03(%rip), %rsi     # 0x35be0e
movq %rbx, %rdi
movl %ebp, %edx
callq 0x2a162a
xorl %eax, %eax
jmp 0x2a141c
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: socket_connect
static int socket_connect(const char *host, const char *port)
{
#define __err_connect(func) do { perror(func); freeaddrinfo(res); return -1; } while (0)

	int on = 1, fd;
	struct linger lng = { 0, 0 };
	struct addrinfo hints, *res = 0;
	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	/* In Unix/Mac, getaddrinfo() is the most convenient way to get
	 * server information. */
	if (getaddrinfo(host, port, &hints, &res) != 0) __err_connect("getaddrinfo");
	if ((fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) == -1) __err_connect("socket");
	/* The following two setsockopt() are used by ftplib
	 * (http://nbpfaus.net/~pfau/ftplib/). I am not sure if they
	 * necessary. */
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) == -1) __err_connect("setsockopt");
	if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &lng, sizeof(lng)) == -1) __err_connect("setsockopt");
	if (connect(fd, res->ai_addr, res->ai_addrlen) != 0) __err_connect("connect");
	freeaddrinfo(res);
	return fd;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x58, %rsp
andq $0x0, 0x18(%rsp)
leaq 0x8(%rsp), %rcx
andq $0x0, (%rcx)
pushq $0x1
popq %rax
movl %eax, 0x14(%rsp)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl %eax, 0x8(%rdx)
callq 0x2ee60
testl %eax, %eax
jne 0x2a14d6
movq 0x8(%rsp), %rax
movl 0x4(%rax), %edi
movl 0x8(%rax), %esi
movl 0xc(%rax), %edx
callq 0x31360
cmpl $-0x1, %eax
je 0x2a14df
movl %eax, %ebx
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq 0x14(%rsp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0x2f6e0
leaq 0xbaaca(%rip), %r14     # 0x35bf60
cmpl $-0x1, %eax
je 0x2a14e6
pushq $0x1
popq %rsi
pushq $0xd
popq %rdx
leaq 0x18(%rsp), %rcx
pushq $0x8
popq %r8
movl %ebx, %edi
callq 0x2f6e0
cmpl $-0x1, %eax
je 0x2a14e6
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rsi
movl 0x10(%rax), %edx
movl %ebx, %edi
callq 0x30d40
testl %eax, %eax
je 0x2a14f1
leaq 0xbaa97(%rip), %r14     # 0x35bf6b
jmp 0x2a14e6
leaq 0xbaa77(%rip), %r14     # 0x35bf54
jmp 0x2a14e6
leaq 0xb833f(%rip), %r14     # 0x359825
movq %r14, %rdi
callq 0x32870
pushq $-0x1
popq %rbx
movq 0x8(%rsp), %rdi
callq 0x2fd40
movl %ebx, %eax
addq $0x58, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: kftp_get_response
static int kftp_get_response(knetFile *ftp)
{
#ifndef _WIN32
	unsigned char c;
#else
	char c;
#endif
	int n = 0;
	char *p;
	if (socket_wait(ftp->ctrl_fd, 1) <= 0) return 0;
	while (netread(ftp->ctrl_fd, &c, 1)) { // FIXME: this is *VERY BAD* for unbuffered I/O
		//fputc(c, stderr);
		if (n >= ftp->max_response) {
			ftp->max_response = ftp->max_response? ftp->max_response<<1 : 256;
			ftp->response = realloc(ftp->response, ftp->max_response);
		}
		ftp->response[n++] = c;
		if (c == '\n') {
			if (n >= 4 && isdigit(ftp->response[0]) && isdigit(ftp->response[1]) && isdigit(ftp->response[2])
				&& ftp->response[3] != '-') break;
			n = 0;
			continue;
		}
	}
	if (n < 2) return -1;
	ftp->response[n-2] = 0;
	return strtol(ftp->response, &p, 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x20(%rdi), %edi
pushq $0x1
popq %rsi
callq 0x2a2049
testl %eax, %eax
jle 0x2a15f8
xorl %ecx, %ecx
leaq 0xf(%rsp), %r14
pushq $0x1
popq %r15
movl $0x100, %ebp            # imm = 0x100
movl %ecx, %r12d
movl 0x20(%rbx), %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2f180
testq %rax, %rax
je 0x2a15ed
movl 0x38(%rbx), %ecx
movq 0x48(%rbx), %rax
cmpl %ecx, %r12d
jl 0x2a1579
leal (%rcx,%rcx), %edx
testl %ecx, %ecx
cmovel %ebp, %edx
movl %edx, 0x38(%rbx)
movslq %edx, %rsi
movq %rax, %rdi
callq 0x330a8
movq %rax, 0x48(%rbx)
movb 0xf(%rsp), %dl
leal 0x1(%r12), %r13d
movslq %r12d, %rcx
movb %dl, (%rax,%rcx)
movl %r13d, %ecx
cmpb $0xa, %dl
jne 0x2a1539
movl $0x0, %ecx
cmpl $0x3, %r12d
jl 0x2a1539
callq 0x301c0
movq (%rax), %rdx
movq 0x48(%rbx), %rax
movsbq (%rax), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
movl $0x0, %ecx
je 0x2a1539
movsbq 0x1(%rax), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
movl $0x0, %ecx
je 0x2a1539
movsbq 0x2(%rax), %rcx
testb $0x8, 0x1(%rdx,%rcx,2)
movl $0x0, %ecx
je 0x2a1539
cmpb $0x2d, 0x3(%rax)
je 0x2a1539
jmp 0x2a1603
cmpl $0x2, %r12d
jge 0x2a15fc
pushq $-0x1
popq %rax
jmp 0x2a161b
xorl %eax, %eax
jmp 0x2a161b
movq 0x48(%rbx), %rax
movl %r12d, %r13d
movl %r13d, %ecx
movb $0x0, -0x2(%rax,%rcx)
movq 0x48(%rbx), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x30c20
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: kftp_reconnect
int kftp_reconnect(knetFile *ftp)
{
	if (ftp->ctrl_fd != -1) {
		netclose(ftp->ctrl_fd);
		ftp->ctrl_fd = -1;
	}
	netclose(ftp->fd);
	ftp->fd = -1;
	return kftp_connect(ftp);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rdi), %edi
cmpl $-0x1, %edi
je 0x2a1697
callq 0x2e740
orl $-0x1, 0x20(%rbx)
movl 0x4(%rbx), %edi
callq 0x2e740
orl $-0x1, 0x4(%rbx)
movq %rbx, %rdi
popq %rbx
jmp 0x2a13bc
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: kftp_parse_url
knetFile *kftp_parse_url(const char *fn, const char *mode)
{
	knetFile *fp;
	char *p;
	int l;
	if (strstr(fn, "ftp://") != fn) return 0;
	for (p = (char*)fn + 6; *p && *p != '/'; ++p);
	if (*p != '/') return 0;
	l = p - fn - 6;
	fp = calloc(1, sizeof(knetFile));
	fp->type = KNF_TYPE_FTP;
	fp->fd = -1;
	/* the Linux/Mac version of socket_connect() also recognizes a port
	 * like "ftp", but the Windows version does not. */
	fp->port = strdup("21");
	fp->host = calloc(l + 1, 1);
	if (strchr(mode, 'c')) fp->no_reconnect = 1;
	strncpy(fp->host, fn + 6, l);
	fp->retr = calloc(strlen(p) + 8, 1);
	sprintf(fp->retr, "RETR %s\r\n", p);
    fp->size_cmd = calloc(strlen(p) + 8, 1);
    sprintf(fp->size_cmd, "SIZE %s\r\n", p);
	fp->seek_offset = 0;
	return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r12
movq %rdi, %r15
leaq 0xb9ad6(%rip), %rsi     # 0x35b19a
pushq $0x6
popq %rdx
callq 0x2f1b0
testl %eax, %eax
je 0x2a16e5
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x100000000, %rbp      # imm = 0x100000000
addq $0x6, %r15
xorl %r13d, %r13d
movq %r15, %rbx
movzbl (%rbx), %eax
testl %eax, %eax
je 0x2a16d0
cmpl $0x2f, %eax
je 0x2a170d
incq %rbx
addq %rbp, %r13
jmp 0x2a16f9
pushq $0x1
popq %rdi
movl $0x80, %esi
callq 0x31f40
movq %rax, %r14
movabsq $-0xfffffffe, %rax      # imm = 0xFFFFFFFF00000002
movq %rax, (%r14)
leaq 0xba6e6(%rip), %rdi     # 0x35be17
callq 0x316c0
movq %rax, 0x18(%r14)
addq %r13, %rbp
sarq $0x20, %rbp
movq %rbp, %rdi
pushq $0x1
popq %rsi
callq 0x31f40
movq %rax, %rbp
movq %rax, 0x10(%r14)
pushq $0x63
popq %rsi
movq %r12, %rdi
callq 0x312c0
testq %rax, %rax
je 0x2a176b
movl $0x1, 0x3c(%r14)
sarq $0x20, %r13
movq %rbp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x32180
movq %rbx, %rdi
callq 0x2fe60
leaq 0x8(%rax), %rdi
pushq $0x1
popq %r15
movq %r15, %rsi
callq 0x31f40
movq %rax, 0x50(%r14)
leaq 0xba67a(%rip), %rsi     # 0x35be1a
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x303f0
movq %rbx, %rdi
callq 0x2fe60
leaq 0x8(%rax), %rdi
movq %r15, %rsi
callq 0x31f40
movq %rax, 0x58(%r14)
leaq 0xba658(%rip), %rsi     # 0x35be24
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x303f0
jmp 0x2a16d3
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: khttp_parse_url
knetFile *khttp_parse_url(const char *fn, const char *mode)
{
	knetFile *fp;
	char *p, *proxy, *q;
	int l;
	if (strstr(fn, "http://") != fn) return 0;
	// set ->http_host
	for (p = (char*)fn + 7; *p && *p != '/'; ++p);
	l = p - fn - 7;
	fp = calloc(1, sizeof(knetFile));
	fp->http_host = calloc(l + 1, 1);
	strncpy(fp->http_host, fn + 7, l);
	fp->http_host[l] = 0;
	for (q = fp->http_host; *q && *q != ':'; ++q);
	if (*q == ':') *q++ = 0;
	// get http_proxy
	proxy = getenv("http_proxy");
	// set ->host, ->port and ->path
	if (proxy == 0) {
		fp->host = strdup(fp->http_host); // when there is no proxy, server name is identical to http_host name.
		fp->port = strdup(*q? q : "80");
		fp->path = strdup(*p? p : "/");
	} else {
		fp->host = (strstr(proxy, "http://") == proxy)? strdup(proxy + 7) : strdup(proxy);
		for (q = fp->host; *q && *q != ':'; ++q);
		if (*q == ':') *q++ = 0; 
		fp->port = strdup(*q? q : "80");
		fp->path = strdup(fn);
	}
	fp->type = KNF_TYPE_HTTP;
	fp->ctrl_fd = fp->fd = -1;
	fp->seek_offset = 0;
	return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xb97c0(%rip), %rsi     # 0x35b1a1
pushq $0x7
popq %rdx
callq 0x2f1b0
testl %eax, %eax
je 0x2a19f4
xorl %ebx, %ebx
jmp 0x2a1b46
movabsq $0x100000000, %rbp      # imm = 0x100000000
leaq 0x7(%rbx), %r13
xorl %r12d, %r12d
movq %r13, %r15
movzbl (%r15), %r14d
testl %r14d, %r14d
je 0x2a1a1f
cmpl $0x2f, %r14d
je 0x2a1a1f
incq %r15
addq %rbp, %r12
jmp 0x2a1a08
movq %rbx, (%rsp)
pushq $0x1
popq %rdi
movl $0x80, %esi
callq 0x31f40
movq %rax, %rbx
addq %r12, %rbp
sarq $0x20, %rbp
movq %rbp, %rdi
pushq $0x1
popq %rsi
callq 0x31f40
movq %rax, %rbp
movq %rax, 0x78(%rbx)
sarq $0x20, %r12
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x32180
movb $0x0, (%rbp,%r12)
movq %rbp, %r13
movzbl (%r13), %eax
testl %eax, %eax
je 0x2a1a82
cmpl $0x3a, %eax
je 0x2a1a7a
incq %r13
jmp 0x2a1a67
movb $0x0, (%r13)
incq %r13
leaq 0xba3d2(%rip), %rdi     # 0x35be5b
callq 0x31460
testq %rax, %rax
je 0x2a1ae0
movq %rax, %r12
leaq 0xb9704(%rip), %rsi     # 0x35b1a1
pushq $0x7
popq %rdx
movq %rax, %rdi
callq 0x2f1b0
leaq 0x7(%r12), %rdi
testl %eax, %eax
cmovneq %r12, %rdi
callq 0x316c0
movq %rax, 0x10(%rbx)
incq %rax
movzbl -0x1(%rax), %ecx
testl %ecx, %ecx
je 0x2a1b18
cmpl $0x3a, %ecx
jne 0x2a1abc
movb $0x0, -0x1(%rax)
cmpb $0x0, (%rax)
leaq 0x383bc(%rip), %rdi     # 0x2d9e96
cmovneq %rax, %rdi
jmp 0x2a1b1f
movq %rbp, %rdi
callq 0x316c0
cmpb $0x0, (%r13)
movq %rax, 0x10(%rbx)
leaq 0x3839e(%rip), %rdi     # 0x2d9e96
cmovneq %r13, %rdi
callq 0x316c0
movq %rax, 0x18(%rbx)
testb %r14b, %r14b
leaq 0x3df6f(%rip), %rax     # 0x2dfa7e
cmoveq %rax, %r15
movq %r15, %rdi
jmp 0x2a1b2c
leaq 0x38377(%rip), %rdi     # 0x2d9e96
callq 0x316c0
movq %rax, 0x18(%rbx)
movq (%rsp), %rdi
callq 0x316c0
movq %rax, 0x70(%rbx)
movabsq $-0xfffffffd, %rax      # imm = 0xFFFFFFFF00000003
movq %rax, (%rbx)
orl $-0x1, 0x20(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: my_netread
static off_t my_netread(int fd, void *buf, off_t len)
{
	off_t rest = len, curr, l = 0;
	/* recv() and read() may not read the required length of data with
	 * one call. They have to be called repeatedly. */
	while (rest) {
		if (socket_wait(fd, 1) <= 0) break; // socket is not ready for reading
		curr = netread(fd, buf + l, rest);
		/* According to the glibc manual, section 13.2, a zero returned
		 * value indicates end-of-file (EOF), which should mean that
		 * read() will not return zero if EOF has not been met but data
		 * are not immediately available. */
		if (curr == 0) break;
		l += curr; rest -= curr;
	}
	return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
xorl %r15d, %r15d
pushq $0x1
popq %r12
testq %rbx, %rbx
je 0x2a1d3b
movl %ebp, %edi
movl %r12d, %esi
callq 0x2a2049
testl %eax, %eax
jle 0x2a1d3b
leaq (%r14,%r15), %rsi
movl %ebp, %edi
movq %rbx, %rdx
callq 0x2f180
testq %rax, %rax
je 0x2a1d3b
addq %rax, %r15
subq %rax, %rbx
jmp 0x2a1d0d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: knet_open
knetFile *knet_open(const char *fn, const char *mode)
{
	knetFile *fp = 0;
	if (mode[0] != 'r') {
		fprintf(stderr, "[kftp_open] only mode \"r\" is supported.\n");
		return 0;
	}
	if (strstr(fn, "ftp://") == fn) {
		fp = kftp_parse_url(fn, mode);
		if (fp == 0) return 0;
		if (kftp_connect(fp) == -1) {
			knet_close(fp);
			return 0;
		}
		kftp_connect_file(fp);
	} else if (strstr(fn, "http://") == fn) {
		fp = khttp_parse_url(fn, mode);
		if (fp == 0) return 0;
		khttp_connect_file(fp);
	} else { // local file
#ifdef _WIN32
		/* In windows, O_BINARY is necessary. In Linux/Mac, O_BINARY may
		 * be undefined on some systems, although it is defined on my
		 * Mac and the Linux I have tested on. */
		int fd = open(fn, O_RDONLY | O_BINARY);
#else		
		int fd = open(fn, O_RDONLY);
#endif
		if (fd == -1) {
			perror("open");
			return 0;
		}
		fp = (knetFile*)calloc(1, sizeof(knetFile));
		fp->type = KNF_TYPE_LOCAL;
		fp->fd = fd;
		fp->ctrl_fd = -1;
	}
	if (fp && fp->fd == -1) {
		knet_close(fp);
		return 0;
	}
	return fp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpb $0x72, (%rsi)
jne 0x2a1e10
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xb9439(%rip), %rsi     # 0x35b19a
pushq $0x6
popq %rdx
callq 0x2f1b0
testl %eax, %eax
je 0x2a1db9
leaq 0xb942d(%rip), %rsi     # 0x35b1a1
pushq $0x7
popq %rdx
movq %rbx, %rdi
callq 0x2f1b0
movq %rbx, %rdi
testl %eax, %eax
je 0x2a1de3
xorl %esi, %esi
xorl %eax, %eax
callq 0x309e0
cmpl $-0x1, %eax
je 0x2a1e2e
movl %eax, %ebp
pushq $0x1
popq %rdi
movl $0x80, %esi
callq 0x31f40
movq %rax, %rbx
movl $0x1, (%rax)
movl %ebp, 0x4(%rax)
orl $-0x1, 0x20(%rax)
jmp 0x2a1df8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2a16ac
testq %rax, %rax
je 0x2a1e06
movq %rax, %rbx
movq %rax, %rdi
callq 0x2a13bc
cmpl $-0x1, %eax
je 0x2a1dfe
movq %rbx, %rdi
callq 0x2a17de
jmp 0x2a1df8
callq 0x2a19cc
testq %rax, %rax
je 0x2a1e06
movq %rax, %rbx
movq %rax, %rdi
callq 0x2a1b58
cmpl $-0x1, 0x4(%rbx)
jne 0x2a1e08
movq %rbx, %rdi
callq 0x2a1e3c
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq 0x169199(%rip), %rax    # 0x40afb0
movq (%rax), %rcx
leaq 0xba0b4(%rip), %rdi     # 0x35bed5
pushq $0x28
popq %rsi
pushq $0x1
popq %rdx
callq 0x32760
jmp 0x2a1e06
leaq 0x4b2d3(%rip), %rdi     # 0x2ed108
callq 0x32870
jmp 0x2a1e06
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: knet_close
int knet_close(knetFile *fp)
{
	if (fp == 0) return 0;
	if (fp->ctrl_fd != -1) netclose(fp->ctrl_fd); // FTP specific
	if (fp->fd != -1) {
		/* On Linux/Mac, netclose() is an alias of close(), but on
		 * Windows, it is an alias of closesocket(). */
		if (fp->type == KNF_TYPE_LOCAL) close(fp->fd);
		else netclose(fp->fd);
	}
	free(fp->host); free(fp->port);
	free(fp->response); free(fp->retr); // FTP specific
	free(fp->path); free(fp->http_host); // HTTP specific
	free(fp);
	return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x2a1e9e
pushq %rbx
movq %rdi, %rbx
movl 0x20(%rdi), %edi
cmpl $-0x1, %edi
je 0x2a1e52
callq 0x2e740
movl 0x4(%rbx), %edi
cmpl $-0x1, %edi
je 0x2a1e5f
callq 0x2e740
movq 0x10(%rbx), %rdi
callq 0x33058
movq 0x18(%rbx), %rdi
callq 0x33058
movq 0x48(%rbx), %rdi
callq 0x33058
movq 0x50(%rbx), %rdi
callq 0x33058
movq 0x70(%rbx), %rdi
callq 0x33058
movq 0x78(%rbx), %rdi
callq 0x33058
movq %rbx, %rdi
callq 0x33058
popq %rbx
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: knet_dopen
knetFile *knet_dopen(int fd, const char *mode)
{
	knetFile *fp = (knetFile*)calloc(1, sizeof(knetFile));
	fp->type = KNF_TYPE_LOCAL;
	fp->fd = fd;
	return fp;
}

// Assembly:
pushq %rbx
movl %edi, %ebx
pushq $0x1
popq %rdi
movl $0x80, %esi
callq 0x31f40
movl $0x1, (%rax)
movl %ebx, 0x4(%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/samtools-0.1.18/knetfile.c
// Function: knet_read
off_t knet_read(knetFile *fp, void *buf, off_t len)
{
	off_t l = 0;
	if (fp->fd == -1) return 0;
	if (fp->type == KNF_TYPE_FTP) {
		if (fp->is_ready == 0) {
			if (!fp->no_reconnect) kftp_reconnect(fp);
			kftp_connect_file(fp);
		}
	} else if (fp->type == KNF_TYPE_HTTP) {
		if (fp->is_ready == 0)
			khttp_connect_file(fp);
	}
	if (fp->type == KNF_TYPE_LOCAL) { // on Windows, the following block is necessary; not on UNIX
		off_t rest = len, curr;
		while (rest) {
			do {
				curr = read(fp->fd, buf + l, rest);
			} while (curr < 0 && EINTR == errno);
			if (curr < 0) return -1;
			if (curr == 0) break;
			l += curr; rest -= curr;
		}
	} else l = my_netread(fp->fd, buf, len);
	fp->offset += l;
	return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x4(%rdi), %edi
cmpl $-0x1, %edi
je 0x2a1f02
movq %rdx, %r14
movq %rsi, %r15
movl (%rbx), %eax
cmpl $0x3, %eax
je 0x2a1f07
cmpl $0x2, %eax
jne 0x2a1f17
cmpl $0x0, 0x40(%rbx)
jne 0x2a1f58
cmpl $0x0, 0x3c(%rbx)
jne 0x2a1ef8
movq %rbx, %rdi
callq 0x2a1682
movq %rbx, %rdi
callq 0x2a17de
jmp 0x2a1f15
xorl %r13d, %r13d
jmp 0x2a1f6d
cmpl $0x0, 0x40(%rbx)
jne 0x2a1f58
movq %rbx, %rdi
callq 0x2a1b58
movl (%rbx), %eax
cmpl $0x1, %eax
jne 0x2a1f55
xorl %r12d, %r12d
pushq $-0x1
popq %r13
testq %r14, %r14
je 0x2a1f66
leaq (%r15,%r12), %rbp
movl 0x4(%rbx), %edi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x2f180
testq %rax, %rax
jns 0x2a1f4b
callq 0x31620
cmpl $0x4, (%rax)
je 0x2a1f2c
jmp 0x2a1f6d
je 0x2a1f66
addq %rax, %r12
subq %rax, %r14
jmp 0x2a1f23
movl 0x4(%rbx), %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2a1cf6
movq %rax, %r12
addq %r12, 0x8(%rbx)
movq %r12, %r13
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq