LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfclose
int mfclose(mFILE *mf) {
    if (!mf)
	return -1;

    mfflush(mf);

#ifdef HAVE_MMAP
    if ((mf->mode & MF_MMAP) && mf->data) {
	/* Mmaped */
	munmap(mf->data, mf->size);
	mf->data = NULL;
    }
#endif

    if (mf->fp)
	fclose(mf->fp);

    mfdestroy(mf);

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x5562f
pushq %rbx
movq %rdi, %rbx
callq 0x55633
testb $0x40, 0x1c(%rbx)
je 0x55616
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x55616
movq 0x20(%rbx), %rsi
callq 0x63d0
andq $0x0, 0x8(%rbx)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x55623
callq 0x66e0
movq %rbx, %rdi
callq 0x55744
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfdestroy
int mfdestroy(mFILE *mf) {
    if (!mf)
	return -1;

    if (mf->data)
	free(mf->data);
    free(mf);

    return 0;
}

// Assembly:
testq %rdi, %rdi
je 0x55762
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfdetach
int mfdetach(mFILE *mf) {
    if (!mf)
	return -1;

    mfflush(mf);
    if (mf->mode & MF_MMAP)
	return -1;

    if (mf->fp) {
	fclose(mf->fp);
	mf->fp = NULL;
    }

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x55794
movq %rdi, %r14
callq 0x55633
testb $0x40, 0x1c(%r14)
jne 0x55794
movq (%r14), %rdi
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x55794
callq 0x66e0
andq $0x0, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfseek
int mfseek(mFILE *mf, long offset, int whence) {
    switch (whence) {
    case SEEK_SET:
	mf->offset = offset;
	break;
    case SEEK_CUR:
	mf->offset += offset;
	break;
    case SEEK_END:
	mf->offset = mf->size + offset;
	break;
    default:
	errno = EINVAL;
	return -1;
    }

    mf->eof = 0;
    return 0;
}

// Assembly:
cmpl $0x2, %edx
je 0x5580a
cmpl $0x1, %edx
je 0x55804
testl %edx, %edx
je 0x5580e
pushq %rax
callq 0x6060
movl $0x16, (%rax)
pushq $-0x1
popq %rax
addq $0x8, %rsp
retq
addq %rsi, 0x28(%rdi)
jmp 0x55812
addq 0x20(%rdi), %rsi
movq %rsi, 0x28(%rdi)
andl $0x0, 0x18(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/mFILE.c
// Function: mfprintf
int mfprintf(mFILE *mf, char *fmt, ...) {
    int ret;
    size_t est_length;
    va_list args;

    va_start(args, fmt);
    est_length = vflen(fmt, args);
    va_end(args);
    while (est_length + mf->offset > mf->alloced) {
	size_t new_alloced = mf->alloced ? mf->alloced * 2 : 1024;
	void * new_data    = realloc(mf->data, new_alloced);
	if (NULL == new_data) return -1;
	mf->alloced = new_alloced;
	mf->data    = new_data;
    }

    va_start(args, fmt);
    ret = vsprintf(&mf->data[mf->offset], fmt, args);
    va_end(args);

    if (ret > 0) {
	mf->offset += ret;
	if (mf->size < mf->offset)
	    mf->size = mf->offset;
    }

    if (mf->fp == stderr) {
	/* Auto-flush for stderr */
	if (0 != mfflush(mf)) return -1;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %r12
movq %rdx, 0x10(%r12)
movq %rcx, 0x18(%r12)
movq %r8, 0x20(%r12)
movq %r9, 0x28(%r12)
testb %al, %al
je 0x55aff
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rsi
movq %r12, 0x10(%rsi)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsi)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x5af70
movslq %eax, %r13
movq 0x10(%rbx), %r15
movl $0x400, %ebp            # imm = 0x400
movq 0x28(%rbx), %rax
addq %r13, %rax
cmpq %r15, %rax
jbe 0x55b65
testq %r15, %r15
leaq (%r15,%r15), %r15
cmoveq %rbp, %r15
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0x6c80
testq %rax, %rax
je 0x55bc8
movq %r15, 0x10(%rbx)
movq %rax, 0x8(%rbx)
jmp 0x55b33
movq %rsp, %rdx
movq %r12, 0x10(%rdx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x8(%rbx), %rdi
addq 0x28(%rbx), %rdi
movq %r14, %rsi
callq 0x6300
movl %eax, %r14d
testl %eax, %eax
pushq $-0x1
popq %rbp
jle 0x55bb4
movl %r14d, %eax
addq 0x28(%rbx), %rax
movq %rax, 0x28(%rbx)
cmpq %rax, 0x20(%rbx)
jae 0x55bb4
movq %rax, 0x20(%rbx)
movq (%rbx), %rax
movq 0x5d41a(%rip), %rcx     # 0xb2fd8
cmpq (%rcx), %rax
je 0x55bdf
movl %r14d, %ebp
jmp 0x55bcb
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x55633
testl %eax, %eax
jne 0x55bcb
jmp 0x55bc3
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/open_trace_file.c
// Function: find_file_url
mFILE *find_file_url(char *file, char *url) {
    char buf[8192], *cp;
    mFILE *mf = NULL;
    int maxlen = 8190 - strlen(file), len;
    hFILE *hf;

    /* Expand %s for the trace name */
    for (cp = buf; *url && cp - buf < maxlen; url++) {
	if (*url == '%' && *(url+1) == 's') {
	    url++;
	    cp += strlen(strcpy(cp, file));
	} else {
	    *cp++ = *url;
	}
    }
    *cp++ = 0;

    if (!(hf = hopen(buf, "r")))
	return NULL;

    if (NULL == (mf = mfcreate(NULL, 0)))
	return NULL;
    while ((len = hread(hf, buf, 8192)) > 0) {
	if (mfwrite(buf, len, 1, mf) <= 0) {
	    hclose_abruptly(hf);
	    mfdestroy(mf);
	    return NULL;
	}
    }
    if (hclose(hf) < 0) {
	mfdestroy(mf);
	return NULL;
    }

    mrewind(mf);
    return mf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2008, %rsp           # imm = 0x2008
movq %rsi, %rbx
movq %rdi, %r14
callq 0x62d0
movl $0x1ffe, %ecx           # imm = 0x1FFE
subl %eax, %ecx
movslq %ecx, %r12
movq %rsp, %r13
movq %r13, %r15
movb (%rbx), %al
testb %al, %al
je 0x55eea
movq %r15, %rcx
subq %r13, %rcx
cmpq %r12, %rcx
jge 0x55eea
cmpb $0x25, %al
jne 0x55edf
cmpb $0x73, 0x1(%rbx)
jne 0x55edf
incq %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x6680
movq %r15, %rdi
callq 0x62d0
addq %rax, %r15
jmp 0x55ee5
movb %al, (%r15)
incq %r15
incq %rbx
jmp 0x55ea9
movb $0x0, (%r15)
leaq 0x2ef14(%rip), %rsi     # 0x84e09
movq %rsp, %rdi
callq 0x5fdb8
testq %rax, %rax
je 0x55fa0
movq %rax, %r14
xorl %r15d, %r15d
xorl %edi, %edi
xorl %esi, %esi
callq 0x551d2
testq %rax, %rax
je 0x55fa3
movq %rax, %rbx
movq %rsp, %r15
movl $0x2000, %ebp           # imm = 0x2000
movq 0x8(%r14), %rsi
movq 0x10(%r14), %r12
subq %rsi, %r12
cmpq %rbp, %r12
movl $0x2000, %r13d          # imm = 0x2000
cmovbq %r12, %r13
movq %r15, %rdi
movq %r13, %rdx
callq 0x6570
addq %r13, 0x8(%r14)
movl $0x2000, %eax           # imm = 0x2000
cmpq $0x1fff, %r12           # imm = 0x1FFF
ja 0x55f75
movl $0x2000, %edx           # imm = 0x2000
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rcx
callq 0x5f777
testl %eax, %eax
jle 0x55fb8
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq %r15, %rdi
movq %rax, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x5590d
testq %rax, %rax
jne 0x55f29
movq %r14, %rdi
callq 0x5faaa
movq %rbx, %rdi
callq 0x55744
xorl %r15d, %r15d
movq %r15, %rax
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x5fa52
testl %eax, %eax
js 0x55f98
movq %rbx, %rdi
callq 0x5581e
movq %rbx, %r15
jmp 0x55fa3
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/open_trace_file.c
// Function: find_file_dir
static mFILE *find_file_dir(char *file, char *dirname) {
    char *path;
    mFILE *mf = NULL;

    path = expand_path(file, dirname);

    if (is_file(path))
	mf = mfopen(path, "rbm");

    free(path);
    return mf;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x56257
movq %rax, %rbx
movq %rax, %rdi
callq 0x550b0
testl %eax, %eax
je 0x5614d
leaq 0x32310(%rip), %rsi     # 0x88450
movq %rbx, %rdi
callq 0x555b8
movq %rax, %r14
jmp 0x56150
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x68a0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/open_trace_file.c
// Function: find_path
char *find_path(char *file, char *path) {
    char *newsearch;
    char *ele;
    char *outpath = NULL;

    /* Use path first */
    if (!path)
	path = getenv("RAWDATA");
    if (NULL == (newsearch = tokenise_search_path(path)))
	return NULL;
    
    for (ele = newsearch; *ele; ele += strlen(ele)+1) {
	char *ele2 = (*ele == '|') ? ele+1 : ele;

	if (!strncmp(ele2, "URL=", 4) ||
	    !strncmp(ele2, "http:", 5) ||
	    !strncmp(ele2, "ftp:", 4)) {
	    continue;
	} else {
	    outpath = expand_path(file, ele2);
	    if (is_file(outpath)) {
		free(newsearch);
		return outpath;
	    } else {
		free(outpath);
	    }
	} 
    }

    free(newsearch);

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
testq %rsi, %rsi
jne 0x5618a
leaq 0x322c1(%rip), %rdi     # 0x88443
callq 0x68f0
movq %rax, %rsi
movq %rsi, %rdi
callq 0x55c30
testq %rax, %rax
je 0x56243
leaq 0x322a9(%rip), %r15     # 0x8844b
pushq $0x4
popq %r12
leaq 0x32287(%rip), %r13     # 0x88434
pushq $0x5
popq %rbp
movq %rax, 0x8(%rsp)
movq %rax, %r14
movb (%r14), %al
xorl %ebx, %ebx
testb %al, %al
je 0x56237
cmpb $0x7c, %al
sete %bl
addq %r14, %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6330
testl %eax, %eax
je 0x56227
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x6330
testl %eax, %eax
je 0x56227
movq %rbx, %rdi
leaq 0x32247(%rip), %rsi     # 0x8843e
movq %r12, %rdx
callq 0x6330
testl %eax, %eax
je 0x56227
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x56257
movq %rax, %rbx
movq %rax, %rdi
callq 0x550b0
testl %eax, %eax
jne 0x56237
movq %rbx, %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x62d0
addq %rax, %r14
incq %r14
jmp 0x561b8
movq 0x8(%rsp), %rdi
callq 0x68a0
jmp 0x56245
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/./cram/rANS_byte.h
// Function: RansEncPutSymbol
static inline void RansEncPutSymbol(RansState* r, uint8_t** pptr, RansEncSymbol const* sym)
{
    RansAssert(sym->x_max != 0); // can't encode symbol with freq=0

    // renormalize
    uint32_t x = *r;
    uint32_t x_max = sym->x_max;

    if (x >= x_max) {
	uint8_t* ptr = *pptr;
	do {
	    *--ptr = (uint8_t) (x & 0xff);
	    x >>= 8;
	} while (x >= x_max);
	*pptr = ptr;
    }

    // x = C(s,x)
    // NOTE: written this way so we get a 32-bit "multiply high" when
    // available. If you're on a 64-bit platform with cheap multiplies
    // (e.g. x64), just bake the +32 into rcp_shift.
    //uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> 32) >> sym->rcp_shift;

    // The extra >>32 has already been added to RansEncSymbolInit
    uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> sym->rcp_shift);
    *r = x + sym->bias + q * sym->cmpl_freq;
}

// Assembly:
pushq %rax
movl (%rdx), %ecx
testl %ecx, %ecx
je 0x56955
movl (%rdi), %eax
cmpl %ecx, %eax
jb 0x56936
movq (%rsi), %r8
movb %al, -0x1(%r8)
decq %r8
shrl $0x8, %eax
cmpl %ecx, %eax
jae 0x56925
movq %r8, (%rsi)
movl %eax, %ecx
movl 0x4(%rdx), %esi
imulq %rcx, %rsi
movb 0xe(%rdx), %cl
shrq %cl, %rsi
addl 0x8(%rdx), %eax
movzwl 0xc(%rdx), %ecx
imull %esi, %ecx
addl %eax, %ecx
movl %ecx, (%rdi)
popq %rax
retq
leaq 0x31d54(%rip), %rdi     # 0x886b0
leaq 0x31cb5(%rip), %rsi     # 0x88618
leaq 0x31d56(%rip), %rcx     # 0x886c0
movl $0x10f, %edx            # imm = 0x10F
callq 0x6460
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/./cram/rANS_byte.h
// Function: RansDecSymbolInit
static inline void RansDecSymbolInit(RansDecSymbol* s, uint32_t start, uint32_t freq)
{
    RansAssert(start <= (1 << 16));
    RansAssert(freq <= (1 << 16) - start);
    s->start = (uint16_t) start;
    s->freq = (uint16_t) freq;
}

// Assembly:
pushq %rax
cmpl $0x10001, %esi          # imm = 0x10001
jae 0x56dbc
movl $0x10000, %eax          # imm = 0x10000
subl %esi, %eax
cmpl %edx, %eax
jb 0x56ddb
movw %si, (%rdi)
movw %dx, 0x2(%rdi)
popq %rax
retq
leaq 0x31943(%rip), %rdi     # 0x88706
leaq 0x3184e(%rip), %rsi     # 0x88618
leaq 0x31948(%rip), %rcx     # 0x88719
movl $0x103, %edx            # imm = 0x103
callq 0x6460
leaq 0x31973(%rip), %rdi     # 0x88755
leaq 0x3182f(%rip), %rsi     # 0x88618
leaq 0x31929(%rip), %rcx     # 0x88719
movl $0x104, %edx            # imm = 0x104
callq 0x6460
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/./cram/rANS_byte.h
// Function: RansDecRenorm
static inline void RansDecRenorm(RansState* r, uint8_t** pptr)
{
    // renormalize
    uint32_t x = *r;

    if (x < RANS_BYTE_L) {
        uint8_t* ptr = *pptr;
        do x = (x << 8) | *ptr++; while (x < RANS_BYTE_L);
        *pptr = ptr;
    }

    *r = x;
}

// Assembly:
movl (%rdi), %eax
cmpl $0x7fffff, %eax         # imm = 0x7FFFFF
ja 0x56e23
movq (%rsi), %rcx
movl %eax, %edx
movl %eax, %r8d
shll $0x8, %r8d
movzbl (%rcx), %eax
incq %rcx
orl %r8d, %eax
cmpl $0x8000, %edx           # imm = 0x8000
jb 0x56e06
movq %rcx, (%rsi)
movl %eax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_dump
void sam_hdr_dump(SAM_hdr *hdr) {
    khint_t k;
    int i;

    printf("===DUMP===\n");
    for (k = kh_begin(hdr->h); k != kh_end(hdr->h); k++) {
	SAM_hdr_type *t1, *t2;
	char c[2];

	if (!kh_exist(hdr->h, k))
	    continue;

	t1 = t2 = kh_val(hdr->h, k);
	c[0] = kh_key(hdr->h, k)>>8;
	c[1] = kh_key(hdr->h, k)&0xff;
	printf("Type %.2s, count %d\n", c, t1->prev->order+1);

	do {
	    SAM_hdr_tag *tag;
	    printf(">>>%d ", t1->order);
	    for (tag = t1->tag; tag; tag=tag->next) {
		printf("\"%.2s\":\"%.*s\"\t",
		       tag->str, tag->len-3, tag->str+3);
	    }
	    putchar('\n');
	    t1 = t1->next;
	} while (t1 != t2);
    }

    /* Dump out PG chains */
    printf("\n@PG chains:\n");
    for (i = 0; i < hdr->npg_end; i++) {
	int j;
	printf("  %d:", i);
	for (j = hdr->pg_end[i]; j != -1; j = hdr->pg[j].prev_id) {
	    printf("%s%d(%.*s)", 
		   j == hdr->pg_end[i] ? " " : "->",
		   j, hdr->pg[j].name_len, hdr->pg[j].name);
	}
	printf("\n");
    }

    puts("===END DUMP===");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x30d7f(%rip), %rdi     # 0x8893f
callq 0x6bb0
pushq $0xa
popq %rbp
leaq 0x30bbc(%rip), %r13     # 0x8878b
xorl %esi, %esi
movq 0x18(%rbx), %rax
cmpl (%rax), %esi
je 0x57c8f
movq 0x10(%rax), %rcx
movl %esi, %edx
shrl $0x4, %edx
movl (%rcx,%rdx,4), %edx
movq %rsi, 0x10(%rsp)
leal (%rsi,%rsi), %ecx
shrl %cl, %edx
testb $0x3, %dl
jne 0x57c83
movq 0x18(%rax), %rcx
movq 0x20(%rax), %rax
movl 0x10(%rsp), %edx
movq (%rax,%rdx,8), %r14
movzwl (%rcx,%rdx,4), %eax
rolw $0x8, %ax
movw %ax, 0xe(%rsp)
movq 0x8(%r14), %rax
movl 0x18(%rax), %edx
incl %edx
leaq 0x30b46(%rip), %rdi     # 0x8876f
leaq 0xe(%rsp), %rsi
xorl %eax, %eax
callq 0x6070
movq %r14, %r15
movl 0x18(%r15), %esi
leaq 0x30b41(%rip), %rdi     # 0x88784
xorl %eax, %eax
callq 0x6070
leaq 0x10(%r15), %r12
movq (%r12), %r12
testq %r12, %r12
je 0x57c74
movq 0x8(%r12), %rsi
movl 0x10(%r12), %edx
addl $-0x3, %edx
leaq 0x3(%rsi), %rcx
movq %r13, %rdi
xorl %eax, %eax
callq 0x6070
jmp 0x57c4e
movl %ebp, %edi
callq 0x6a40
movq (%r15), %r15
cmpq %r14, %r15
jne 0x57c38
movq 0x10(%rsp), %rsi
incl %esi
jmp 0x57bd1
leaq 0x30cb4(%rip), %rdi     # 0x8894a
callq 0x6bb0
leaq 0x25730(%rip), %r13     # 0x7d3d2
leaq 0x2eb39(%rip), %r14     # 0x867e2
leaq 0x30af0(%rip), %r15     # 0x887a0
xorl %r12d, %r12d
movslq 0x6c(%rbx), %rax
cmpq %rax, %r12
jge 0x57d2b
leaq 0x30ad7(%rip), %rdi     # 0x8879a
movl %r12d, %esi
xorl %eax, %eax
callq 0x6070
leaq (,%r12,4), %rax
addq 0x88(%rbx), %rax
movslq (%rax), %rdx
cmpq $-0x1, %rdx
je 0x57d1e
movq 0x88(%rbx), %rax
cmpl (%rax,%r12,4), %edx
movq %r14, %rsi
cmoveq %r13, %rsi
movq 0x78(%rbx), %rax
imulq $0x28, %rdx, %rbp
movl 0x18(%rax,%rbp), %ecx
movq (%rax,%rbp), %r8
movq %r15, %rdi
xorl %eax, %eax
callq 0x6070
movq 0x78(%rbx), %rax
addq %rbp, %rax
addq $0x20, %rax
jmp 0x57cdc
pushq $0xa
popq %rdi
callq 0x6a40
incq %r12
jmp 0x57cb3
leaq 0x30a79(%rip), %rdi     # 0x887ab
callq 0x6bb0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/./htslib/kstring.h
// Function: kputc_
static inline int kputc_(int c, kstring_t *s)
{
	if (s->l + 1 > s->m) {
		char *tmp;
		s->m = s->l + 1;
		kroundup32(s->m);
		if ((tmp = (char*)realloc(s->s, s->m)))
			s->s = tmp;
		else
			return EOF;
	}
	s->s[s->l++] = c;
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rcx
leaq 0x1(%rcx), %rdx
cmpq 0x8(%rsi), %rdx
jbe 0x58cd6
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
callq 0x6c80
testq %rax, %rax
je 0x58ceb
movq %rax, 0x10(%r14)
movq (%r14), %rcx
leaq 0x1(%rcx), %rdx
jmp 0x58cda
movq 0x10(%r14), %rax
movq %rdx, (%r14)
movb %bl, (%rax,%rcx)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $-0x1
jmp 0x58ce2
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_find_line
char *sam_hdr_find_line(SAM_hdr *hdr, char *type,
			char *ID_key, char *ID_value) {
    SAM_hdr_type *ty = sam_hdr_find(hdr, type, ID_key, ID_value);
    kstring_t ks = KS_INITIALIZER;
    SAM_hdr_tag *tag;
    int r = 0;

    if (!ty)
	return NULL;

    // Paste together the line from the hashed copy
    r |= (kputc_('@', &ks) == EOF);
    r |= (kputs(type, &ks) == EOF);
    for (tag = ty->tag; tag; tag = tag->next) {
	r |= (kputc_('\t', &ks) == EOF);
	r |= (kputsn(tag->str, tag->len, &ks) == EOF);
    }

    if (r) {
	KS_FREE(&ks);
	return NULL;
    }

    return ks_str(&ks);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r15
callq 0x58d95
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
testq %rax, %rax
je 0x590f5
movq %rax, %rbx
pushq $0x40
popq %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x58c6d
cmpl $-0x1, %eax
sete %bpl
movq %r15, %rdi
movq %r14, %rsi
callq 0x58cef
cmpl $-0x1, %eax
sete %al
orb %bpl, %al
movzbl %al, %r15d
addq $0x10, %rbx
pushq $0x9
popq %rbp
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x590e3
movl %ebp, %edi
movq %r14, %rsi
callq 0x58c6d
cmpl $-0x1, %eax
sete %r12b
movq 0x8(%rbx), %rdi
movl 0x10(%rbx), %esi
movq %r14, %rdx
callq 0x580e9
cmpl $-0x1, %eax
sete %al
orb %r12b, %al
movzbl %al, %eax
orl %eax, %r15d
jmp 0x590aa
movq 0x10(%rsp), %rax
testl %r15d, %r15d
je 0x590f7
movq %rax, %rdi
callq 0x68a0
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_find_key
SAM_hdr_tag *sam_hdr_find_key(SAM_hdr *sh,
			      SAM_hdr_type *type,
			      char *key,
			      SAM_hdr_tag **prev) {
    SAM_hdr_tag *tag, *p = NULL;

    for (tag = type->tag; tag; p = tag, tag = tag->next) {
	if (tag->str[0] == key[0] && tag->str[1] == key[1]) {
	    if (prev)
		*prev = p;
	    return tag;
	}
    }

    if (prev)
	*prev = p;

    return NULL;
}

// Assembly:
movq %rsi, %rax
addq $0x10, %rax
xorl %edi, %edi
movq %rdi, %rsi
movq (%rax), %rax
testq %rax, %rax
je 0x59134
movq 0x8(%rax), %r8
movb (%r8), %r9b
movq %rax, %rdi
cmpb (%rdx), %r9b
jne 0x5910d
movb 0x1(%r8), %r8b
movq %rax, %rdi
cmpb 0x1(%rdx), %r8b
jne 0x5910d
testq %rcx, %rcx
je 0x5913c
movq %rsi, (%rcx)
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_update
int sam_hdr_update(SAM_hdr *hdr, SAM_hdr_type *type, ...) {
    va_list ap;

    va_start(ap, type);
    
    for (;;) {
	char *k, *v;
	int idx;
	SAM_hdr_tag *tag, *prev;

	if (!(k = (char *)va_arg(ap, char *)))
	    break;
	v = va_arg(ap, char *);

	tag = sam_hdr_find_key(hdr, type, k, &prev);
	if (!tag) {
	    if (!(tag = pool_alloc(hdr->tag_pool)))
		return -1;
	    if (prev)
		prev->next = tag;
	    else
		type->tag = tag;

	    tag->next = NULL;
	}

	idx = ks_len(&hdr->text);
	if (ksprintf(&hdr->text, "%2.2s:%s", k, v) < 0)
	    return -1;
	tag->len = ks_len(&hdr->text) - idx;
	tag->str = string_ndup(hdr->str_pool,
			       ks_str(&hdr->text) + idx,
			       tag->len);
	if (!tag->str)
	    return -1;
    }

    va_end(ap);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x591a7
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
movq %rsi, 0x10(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
leaq 0x10(%rbx), %rax
movq %rax, 0x20(%rsp)
movl (%rsp), %eax
cmpq $0x28, %rax
ja 0x591e9
movq %rax, %rcx
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x591f7
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rsp)
movq (%rcx), %r13
testq %r13, %r13
je 0x592b3
cmpl $0x28, %eax
ja 0x59217
movl %eax, %ecx
addq 0x10(%rsp), %rcx
addl $0x8, %eax
movl %eax, (%rsp)
jmp 0x59225
movq 0x8(%rsp), %rcx
leaq 0x8(%rcx), %rax
movq %rax, 0x8(%rsp)
movq (%rcx), %r12
movq %rbx, %rsi
movq %r13, %rdx
leaq 0x28(%rsp), %rcx
callq 0x59104
movq %rax, %rbp
testq %rax, %rax
jne 0x59267
movq 0x30(%r14), %rdi
callq 0x75978
testq %rax, %rax
je 0x592ae
movq %rax, %rbp
movq 0x28(%rsp), %rax
testq %rax, %rax
cmoveq 0x20(%rsp), %rax
movq %rbp, (%rax)
andq $0x0, (%rbp)
movq (%r14), %r15
movq %r14, %rdi
leaq 0x2f657(%rip), %rsi     # 0x888cb
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x5b5f6
testl %eax, %eax
js 0x592ae
movq (%r14), %rax
movslq %r15d, %rsi
subq %r15, %rax
movl %eax, 0x10(%rbp)
movq 0x20(%r14), %rdi
addq 0x10(%r14), %rsi
movslq %eax, %rdx
callq 0x5a5da
movq %rax, 0x8(%rbp)
testq %rax, %rax
jne 0x591d0
pushq $-0x1
popq %rax
jmp 0x592b5
xorl %eax, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/./htslib/kstring.h
// Function: kputsn_
static inline int kputsn_(const void *p, int l, kstring_t *s)
{
	if (s->l + l > s->m) {
		char *tmp;
		s->m = s->l + l;
		kroundup32(s->m);
		if ((tmp = (char*)realloc(s->s, s->m)))
			s->s = tmp;
		else
			return EOF;
	}
	memcpy(s->s + s->l, p, l);
	s->l += l;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, %r12
movq (%rdx), %rdi
movslq %esi, %r15
leaq (%rdi,%r15), %rax
cmpq 0x8(%rdx), %rax
jbe 0x59535
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
callq 0x6c80
testq %rax, %rax
je 0x59558
movq %rax, 0x10(%r14)
movq (%r14), %rdi
jmp 0x59539
movq 0x10(%r14), %rax
addq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
pushq $-0x1
popq %rbx
jmp 0x5954a
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_new
SAM_hdr *sam_hdr_new() {
    SAM_hdr *sh = calloc(1, sizeof(*sh));

    if (!sh)
	return NULL;
    
    sh->h = kh_init(sam_hdr);
    if (!sh->h)
	goto err;

    sh->ID_cnt = 1;
    sh->ref_count = 1;

    sh->nref = 0;
    sh->ref  = NULL;
    if (!(sh->ref_hash = kh_init(m_s2i)))
	goto err;

    sh->nrg = 0;
    sh->rg  = NULL;
    if (!(sh->rg_hash = kh_init(m_s2i)))
	goto err;

    sh->npg = 0;
    sh->pg  = NULL;
    sh->npg_end = sh->npg_end_alloc = 0;
    sh->pg_end = NULL;
    if (!(sh->pg_hash = kh_init(m_s2i)))
	goto err;

    KS_INIT(&sh->text);

    if (!(sh->tag_pool = pool_create(sizeof(SAM_hdr_tag))))
	goto err;

    if (!(sh->type_pool = pool_create(sizeof(SAM_hdr_type))))
	goto err;

    if (!(sh->str_pool = string_pool_create(8192)))
	goto err;

    return sh;

 err:
    if (sh->h)
	kh_destroy(sam_hdr, sh->h);

    if (sh->tag_pool)
	pool_destroy(sh->tag_pool);

    if (sh->type_pool)
	pool_destroy(sh->type_pool);

    if (sh->str_pool)
	string_pool_destroy(sh->str_pool);

    free(sh);

    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
pushq $0x1
popq %rdi
movl $0x4a0, %esi            # imm = 0x4A0
callq 0x6470
testq %rax, %rax
je 0x59656
movq %rax, %rbx
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x6470
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x59640
movq %rax, %r14
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x494(%rbx)
callq 0x5966c
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x59614
callq 0x5966c
movq %rax, 0x60(%rbx)
testq %rax, %rax
je 0x59614
callq 0x5966c
movq %rax, 0x80(%rbx)
testq %rax, %rax
je 0x59614
pushq $0x18
popq %rdi
callq 0x758b4
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x59614
movq %rax, %r12
pushq $0x20
popq %rdi
callq 0x758b4
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x59667
movq %rax, %r15
movl $0x2000, %edi           # imm = 0x2000
callq 0x5a4a0
movq %rax, 0x20(%rbx)
testq %rax, %rax
jne 0x59658
jmp 0x5961a
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x59677
testq %r12, %r12
je 0x59633
movq %r12, %rdi
callq 0x7593c
movq 0x28(%rbx), %r15
testq %r15, %r15
je 0x59640
movq %r15, %rdi
callq 0x7593c
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x5964e
callq 0x5a4cd
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %r15d, %r15d
jmp 0x5961a
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_parse_
SAM_hdr *sam_hdr_parse_(const char *hdr, int len) {
    /* Make an empty SAM_hdr */
    SAM_hdr *sh;
    
    sh = sam_hdr_new();
    if (NULL == sh) return NULL;

    if (NULL == hdr) return sh; // empty header is permitted

    /* Parse the header, line by line */
    if (-1 == sam_hdr_add_lines(sh, hdr, len)) {
	sam_hdr_free(sh);
	return NULL;
    }

    /* Obtain sort order */
    sh->sort_order = sam_hdr_parse_sort_order(sh);

    //sam_hdr_dump(sh);
    //sam_hdr_add(sh, "RG", "ID", "foo", "SM", "bar", NULL);
    //sam_hdr_rebuild(sh);
    //printf(">>%s<<", ks_str(sh->text));

    //parse_references(sh);
    //parse_read_groups(sh);

    sam_hdr_link_pg(sh);
    //sam_hdr_dump(sh);

    return sh;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
callq 0x5955d
testq %rax, %rax
je 0x59706
movq %rax, %rbx
testq %r14, %r14
je 0x59708
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x57d46
cmpl $-0x1, %eax
je 0x596fe
movq 0x18(%rbx), %r14
movq %r14, %rdi
movl $0x4844, %esi           # imm = 0x4844
callq 0x58fd8
cmpl (%r14), %eax
jne 0x5971a
pushq $-0x1
popq %r13
movl %r13d, 0x90(%rbx)
movq %rbx, %rdi
callq 0x598f8
jmp 0x59708
movq %rbx, %rdi
callq 0x597b7
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%r14), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %r12
addq $0x10, %r12
pushq $-0x1
popq %r13
leaq 0x2f1d0(%rip), %r14     # 0x88903
leaq 0x2f1d2(%rip), %r15     # 0x8890c
movq (%r12), %r12
testq %r12, %r12
je 0x596ed
movq 0x8(%r12), %rbp
cmpb $0x53, (%rbp)
jne 0x5973a
cmpb $0x4f, 0x1(%rbp)
jne 0x5973a
addq $0x3, %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x6a50
testl %eax, %eax
je 0x597ac
movq %rbp, %rdi
movq %r15, %rsi
callq 0x6a50
testl %eax, %eax
je 0x597b1
movq %rbp, %rdi
leaq 0x2f196(%rip), %rsi     # 0x88916
callq 0x6a50
testl %eax, %eax
je 0x597a6
movq 0x59848(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
leaq 0x2f187(%rip), %rsi     # 0x88921
movq %rbp, %rdx
xorl %eax, %eax
callq 0x6a90
jmp 0x5973a
pushq $0x2
popq %r13
jmp 0x5973a
xorl %r13d, %r13d
jmp 0x5973a
pushq $0x1
popq %r13
jmp 0x5973a
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_free
void sam_hdr_free(SAM_hdr *hdr) {
    if (!hdr)
	return;

    if (--hdr->ref_count > 0)
	return;

    if (ks_str(&hdr->text))
	KS_FREE(&hdr->text);

    if (hdr->h)
	kh_destroy(sam_hdr, hdr->h);

    if (hdr->ref_hash)
	kh_destroy(m_s2i, hdr->ref_hash);

    if (hdr->ref) {
	int i;
	for (i = 0; i < hdr->nref; i++)
	    if (hdr->ref[i].name)
		free(hdr->ref[i].name);
	free(hdr->ref);
    }

    if (hdr->rg_hash)
	kh_destroy(m_s2i, hdr->rg_hash);

    if (hdr->rg) {
	int i;
	for (i = 0; i < hdr->nrg; i++)
	    if (hdr->rg[i].name)
		free(hdr->rg[i].name);
	free(hdr->rg);
    }

    if (hdr->pg_hash)
	kh_destroy(m_s2i, hdr->pg_hash);

    if (hdr->pg) {
	int i;
	for (i = 0; i < hdr->npg; i++)
	    if (hdr->pg[i].name)
		free(hdr->pg[i].name);
	free(hdr->pg);
    }

    if (hdr->pg_end)
	free(hdr->pg_end);

    if (hdr->type_pool)
	pool_destroy(hdr->type_pool);

    if (hdr->tag_pool)
	pool_destroy(hdr->tag_pool);

    if (hdr->str_pool)
	string_pool_destroy(hdr->str_pool);

    free(hdr);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x597d8
movq %rdi, %rbx
movl 0x498(%rdi), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x498(%rdi)
cmpl $0x1, %eax
jle 0x597de
popq %rbx
popq %r14
popq %r15
retq
movq 0x10(%rbx), %rdi
callq 0x68a0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x597f5
callq 0x59677
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x59803
callq 0x59a72
cmpq $0x0, 0x40(%rbx)
je 0x59834
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x38(%rbx), %rax
movq 0x40(%rbx), %rdi
cmpq %rax, %r15
jge 0x5982f
movq (%rdi,%r14), %rdi
callq 0x68a0
incq %r15
addq $0x20, %r14
jmp 0x59810
callq 0x68a0
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x59842
callq 0x59a72
cmpq $0x0, 0x58(%rbx)
je 0x59873
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x50(%rbx), %rax
movq 0x58(%rbx), %rdi
cmpq %rax, %r15
jge 0x5986e
movq (%rdi,%r14), %rdi
callq 0x68a0
incq %r15
addq $0x20, %r14
jmp 0x5984f
callq 0x68a0
movq 0x80(%rbx), %rdi
testq %rdi, %rdi
je 0x59884
callq 0x59a72
cmpq $0x0, 0x78(%rbx)
je 0x598b5
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x68(%rbx), %rax
movq 0x78(%rbx), %rdi
cmpq %rax, %r15
jge 0x598b0
movq (%rdi,%r14), %rdi
callq 0x68a0
incq %r15
addq $0x28, %r14
jmp 0x59891
callq 0x68a0
movq 0x88(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x598cf
callq 0x7593c
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x598dd
callq 0x7593c
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x598eb
callq 0x5a4cd
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x68a0
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_link_pg
int sam_hdr_link_pg(SAM_hdr *hdr) {
    int i, j, ret = 0;

    hdr->npg_end_alloc = hdr->npg;
    hdr->pg_end = realloc(hdr->pg_end, hdr->npg * sizeof(*hdr->pg_end));
    if (!hdr->pg_end)
	return -1;

    for (i = 0; i < hdr->npg; i++)
	hdr->pg_end[i] = i;

    for (i = 0; i < hdr->npg; i++) {
	khint_t k;
	SAM_hdr_tag *tag;
	char tmp;

	for (tag = hdr->pg[i].tag; tag; tag = tag->next) {
	    if (tag->str[0] == 'P' && tag->str[1] == 'P')
		break;
	}
	if (!tag) {
	    /* Chain start points */
	    continue;
	}

	tmp = tag->str[tag->len]; tag->str[tag->len] = 0;
	k = kh_get(m_s2i, hdr->pg_hash, tag->str+3);
	tag->str[tag->len] = tmp;

	if (k == kh_end(hdr->pg_hash)) {
	    ret = -1;
	    continue;
	}

	hdr->pg[i].prev_id = hdr->pg[kh_val(hdr->pg_hash, k)].id;
	hdr->pg_end[kh_val(hdr->pg_hash, k)] = -1;
    }

    for (i = j = 0; i < hdr->npg; i++) {
	if (hdr->pg_end[i] != -1)
	    hdr->pg_end[j++] = hdr->pg_end[i];
    }
    hdr->npg_end = j;

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x68(%rdi), %rsi
movl %esi, 0x70(%rdi)
movq 0x88(%rdi), %rdi
shlq $0x2, %rsi
callq 0x6c80
movq %rax, 0x88(%rbx)
testq %rax, %rax
je 0x59a2e
movl 0x68(%rbx), %ecx
xorl %edx, %edx
testl %ecx, %ecx
movl $0x0, %esi
cmovgl %ecx, %esi
cmpq %rdx, %rsi
je 0x59949
movl %edx, (%rax,%rdx,4)
incq %rdx
jmp 0x5993c
xorl %r14d, %r14d
xorl %eax, %eax
movslq %ecx, %rdx
cmpq %rdx, %r14
jge 0x599fc
movq 0x78(%rbx), %rcx
imulq $0x28, %r14, %r12
leaq (%rcx,%r12), %r13
addq $0x10, %r13
movq (%r13), %r13
testq %r13, %r13
je 0x599ed
movq 0x8(%r13), %rdx
cmpb $0x50, (%rdx)
jne 0x5996a
cmpb $0x50, 0x1(%rdx)
jne 0x5996a
movl %eax, 0x4(%rsp)
movslq 0x10(%r13), %rcx
movb (%rdx,%rcx), %r15b
movb $0x0, (%rdx,%rcx)
movq 0x80(%rbx), %rdi
movq 0x8(%r13), %rbp
leaq 0x3(%rbp), %rsi
callq 0x58f17
movslq 0x10(%r13), %rcx
movb %r15b, (%rbp,%rcx)
movq 0x80(%rbx), %rcx
pushq $-0x1
popq %rdx
cmpl (%rcx), %eax
je 0x599ef
movq 0x78(%rbx), %rdx
movq 0x20(%rcx), %rcx
movl %eax, %eax
movslq (%rcx,%rax,4), %rsi
imulq $0x28, %rsi, %rsi
movl 0x1c(%rdx,%rsi), %esi
movl %esi, 0x20(%rdx,%r12)
movq 0x88(%rbx), %rdx
movslq (%rcx,%rax,4), %rax
orl $-0x1, (%rdx,%rax,4)
movl 0x4(%rsp), %edx
jmp 0x599ef
movl %eax, %edx
incq %r14
movl 0x68(%rbx), %ecx
movl %edx, %eax
jmp 0x5994e
xorl %r8d, %r8d
xorl %edx, %edx
movslq %ecx, %rsi
cmpq %rsi, %r8
jge 0x59a29
movq 0x88(%rbx), %rsi
movl (%rsi,%r8,4), %edi
cmpl $-0x1, %edi
je 0x59a24
movslq %edx, %rcx
incl %edx
movl %edi, (%rsi,%rcx,4)
movl 0x68(%rbx), %ecx
incq %r8
jmp 0x59a01
movl %edx, 0x6c(%rbx)
jmp 0x59a31
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_find_rg
SAM_RG *sam_hdr_find_rg(SAM_hdr *hdr, const char *rg) {
    khint_t k = kh_get(m_s2i, hdr->rg_hash, rg);
    return k == kh_end(hdr->rg_hash)
	? NULL
	: &hdr->rg[kh_val(hdr->rg_hash, k)];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x60(%rdi), %r14
movq %r14, %rdi
callq 0x58f17
cmpl (%r14), %eax
jne 0x59ad7
xorl %eax, %eax
jmp 0x59ae9
movq 0x20(%r14), %rcx
movl %eax, %eax
movslq (%rcx,%rax,4), %rax
shlq $0x5, %rax
addq 0x58(%rbx), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_PG_ID
const char *sam_hdr_PG_ID(SAM_hdr *sh, const char *name) {
    khint_t k = kh_get(m_s2i, sh->pg_hash, name);
    if (k == kh_end(sh->pg_hash))
	return name;

    do {
	sprintf(sh->ID_buf, "%.1000s.%d", name, sh->ID_cnt++);
	k = kh_get(m_s2i, sh->pg_hash, sh->ID_buf);
    } while (k != kh_end(sh->pg_hash));

    return sh->ID_buf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x80(%rdi), %r15
movq %r15, %rdi
callq 0x58f17
cmpl (%r15), %eax
je 0x59b5e
leaq 0x94(%r14), %r15
leaq 0x2edb6(%rip), %r12     # 0x888d8
movl 0x494(%r14), %ecx
leal 0x1(%rcx), %eax
movl %eax, 0x494(%r14)
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6170
movq 0x80(%r14), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x58f17
cmpl (%r13), %eax
jne 0x59b22
movq %r15, %rbx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/sam_header.c
// Function: sam_hdr_add_PG
int sam_hdr_add_PG(SAM_hdr *sh, const char *name, ...) {
    va_list args;

    if (sh->npg_end) {
	/* Copy ends array to avoid us looping while modifying it */
	int *end = malloc(sh->npg_end * sizeof(int));
	int i, nends = sh->npg_end;

	if (!end)
	    return -1;

	memcpy(end, sh->pg_end, nends * sizeof(*end));

	for (i = 0; i < nends; i++) {
	    va_start(args, name);
	    if (-1 == sam_hdr_vadd(sh, "PG", args,
				   "ID", sam_hdr_PG_ID(sh, name),
				   "PN", name,
				   "PP", sh->pg[end[i]].name,
				   NULL)) {
		free(end);
		return  -1;
	    }
	    va_end(args);
	}

	free(end);
    } else {
	va_start(args, name);
	if (-1 == sam_hdr_vadd(sh, "PG", args,
			       "ID", sam_hdr_PG_ID(sh, name),
			       "PN", name,
			       NULL))
	    return -1;
	va_end(args);
    }

    //sam_hdr_dump(sh);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x59bd1
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movslq 0x6c(%rdi), %r13
testq %r13, %r13
je 0x59cad
leaq (,%r13,4), %r12
movq %r12, %rdi
callq 0x69d0
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x59d32
movq %rax, %r15
movq 0x88(%rbx), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x6570
xorl %eax, %eax
testl %r13d, %r13d
cmovlel %eax, %r13d
movq %rsp, %r12
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x59d1b
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x59af1
movq 0x78(%rbx), %r10
movslq (%r15,%rbp,4), %rcx
imulq $0x28, %rcx, %r11
movq %rbx, %rdi
leaq 0x2ec77(%rip), %rsi     # 0x888e3
movq %r12, %rdx
leaq 0x2e33e(%rip), %rcx     # 0x87fb4
movq %rax, %r8
leaq 0x2ec66(%rip), %r9      # 0x888e6
xorl %eax, %eax
pushq $0x0
pushq (%r10,%r11)
leaq 0x2ec5a(%rip), %r10     # 0x888e9
pushq %r10
pushq %r14
callq 0x58891
addq $0x20, %rsp
cmpl $-0x1, %eax
je 0x59d27
incq %rbp
jmp 0x59c1d
leaq 0x20(%rsp), %rax
movq %rsp, %r15
movq %rax, 0x10(%r15)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%r15)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%r15)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x59af1
subq $0x10, %rsp
andq $0x0, 0x8(%rsp)
movq %r14, (%rsp)
leaq 0x2ebf1(%rip), %rsi     # 0x888e3
leaq 0x2e2bb(%rip), %rcx     # 0x87fb4
leaq 0x2ebe6(%rip), %r9      # 0x888e6
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %r8
xorl %eax, %eax
callq 0x58891
popq %rcx
popq %rdx
cmpl $-0x1, %eax
jne 0x59d32
jmp 0x59d2f
movq %r15, %rdi
callq 0x68a0
xorl %ebp, %ebp
jmp 0x59d32
movq %r15, %rdi
callq 0x68a0
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/string_alloc.c
// Function: string_ndup
char *string_ndup(string_alloc_t *a_str, char *instr, size_t len) {
    char *str = string_alloc(a_str, len + 1);
    
    if (NULL == str) return NULL;
    
    strncpy(str, instr, len);
    str[len] = 0;
    
    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x1(%rdx), %rsi
callq 0x5a509
movq %rax, %r15
testq %rax, %rax
je 0x5a609
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x6380
movb $0x0, (%r15,%rbx)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_next_result
t_pool_result *t_pool_next_result(t_results_queue *q) {
    t_pool_result *r;

#ifdef DEBUG
    fprintf(stderr, "Requesting next result on queue %p\n", q);
#endif

    pthread_mutex_lock(&q->result_m);
    r = t_pool_next_result_locked(q);
    pthread_mutex_unlock(&q->result_m);

#ifdef DEBUG
    fprintf(stderr, "(q=%p) Found %p\n", q, r);
#endif

    return r;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
movq %r14, %rdi
callq 0x6ae0
movq %rbx, %rdi
callq 0x5a645
movq %rax, %rbx
movq %r14, %rdi
callq 0x64f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_next_result_locked
static t_pool_result *t_pool_next_result_locked(t_results_queue *q) {
    t_pool_result *r, *last;

    for (last = NULL, r = q->result_head; r; last = r, r = r->next) {
	if (r->serial == q->next_serial)
	    break;
    }

    if (r) {
	if (q->result_head == r)
	    q->result_head = r->next;
	else
	    last->next = r->next;

	if (q->result_tail == r)
	    q->result_tail = last;

	if (!q->result_head)
	    q->result_tail = NULL;

	q->next_serial++;
	q->queue_len--;
    }

    return r;
}

// Assembly:
xorl %esi, %esi
movq %rdi, %rax
movq (%rax), %rax
testq %rax, %rax
je 0x5a68d
movq %rsi, %rdx
movl 0x8(%rax), %ecx
movq %rax, %rsi
cmpl 0x10(%rdi), %ecx
jne 0x5a64a
cmpq %rax, (%rdi)
movq %rdx, %rsi
cmoveq %rdi, %rsi
movq (%rax), %r8
movq %r8, (%rsi)
cmpq %rax, 0x8(%rdi)
jne 0x5a67a
movq %rdx, 0x8(%rdi)
cmpq $0x0, (%rdi)
jne 0x5a685
andq $0x0, 0x8(%rdi)
incl %ecx
movl %ecx, 0x10(%rdi)
decl 0x18(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_next_result_wait
t_pool_result *t_pool_next_result_wait(t_results_queue *q) {
    t_pool_result *r;

#ifdef DEBUG
    fprintf(stderr, "Waiting for result %d...\n", q->next_serial);
#endif

    pthread_mutex_lock(&q->result_m);
    while (!(r = t_pool_next_result_locked(q))) {
	/* Possible race here now avoided via _locked() call, but incase... */
	struct timeval now;
	struct timespec timeout;

	gettimeofday(&now, NULL);
	timeout.tv_sec = now.tv_sec + 10;
	timeout.tv_nsec = now.tv_usec * 1000;

	pthread_cond_timedwait(&q->result_avail_c, &q->result_m, &timeout);
    }
    pthread_mutex_unlock(&q->result_m);

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x6ae0
leaq 0x48(%r14), %r15
leaq 0x18(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r14, %rdi
callq 0x5a645
testq %rax, %rax
jne 0x5a6fc
movq %r12, %rdi
xorl %esi, %esi
callq 0x6c40
movq 0x18(%rsp), %rax
addq $0xa, %rax
movq %rax, 0x8(%rsp)
imulq $0x3e8, 0x20(%rsp), %rax # imm = 0x3E8
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x6b50
jmp 0x5a6b9
movq %rax, %rbp
movq %rbx, %rdi
callq 0x64f0
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_results_queue_empty
int t_pool_results_queue_empty(t_results_queue *q) {
    int empty;

    pthread_mutex_lock(&q->result_m);
    empty = q->queue_len == 0 && q->pending == 0;
    pthread_mutex_unlock(&q->result_m);

    return empty;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x6ae0
xorl %ebp, %ebp
cmpl $0x0, 0x18(%r14)
jne 0x5a740
xorl %ebp, %ebp
cmpl $0x0, 0x1c(%r14)
sete %bpl
movq %rbx, %rdi
callq 0x64f0
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_delete_result
void t_pool_delete_result(t_pool_result *r, int free_data) {
    if (!r)
	return;

    if (free_data && r->data)
	free(r->data);

    free(r);
}

// Assembly:
testq %rdi, %rdi
je 0x5a7be
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0x5a7b5
movq 0x10(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
popq %rbx
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_results_queue_init
t_results_queue *t_results_queue_init(void) {
    t_results_queue *q = malloc(sizeof(*q));

    pthread_mutex_init(&q->result_m, NULL);
    pthread_cond_init(&q->result_avail_c, NULL);

    q->result_head = NULL;
    q->result_tail = NULL;
    q->next_serial = 0;
    q->curr_serial = 0;
    q->queue_len   = 0;
    q->pending     = 0;

    return q;
}

// Assembly:
pushq %rbx
pushq $0x78
popq %rdi
callq 0x69d0
movq %rax, %rbx
leaq 0x20(%rax), %rdi
xorl %esi, %esi
callq 0x6b10
leaq 0x48(%rbx), %rdi
xorl %esi, %esi
callq 0x68c0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/cram/thread_pool.c
// Function: t_pool_init
t_pool *t_pool_init(int qsize, int tsize) {
    int i;
    t_pool *p = malloc(sizeof(*p));
    p->qsize = qsize;
    p->tsize = tsize;
    p->njobs = 0;
    p->nwaiting = 0;
    p->shutdown = 0;
    p->head = p->tail = NULL;
    p->t_stack = NULL;
#ifdef DEBUG_TIME
    p->total_time = p->wait_time = 0;
#endif

    p->t = malloc(tsize * sizeof(p->t[0]));

    pthread_mutex_init(&p->pool_m, NULL);
    pthread_cond_init(&p->empty_c, NULL);
    pthread_cond_init(&p->full_c, NULL);

    pthread_mutex_lock(&p->pool_m);

#ifdef IN_ORDER
    if (!(p->t_stack = malloc(tsize * sizeof(*p->t_stack))))
	return NULL;
    p->t_stack_top = -1;

    for (i = 0; i < tsize; i++) {
	t_pool_worker_t *w = &p->t[i];
	p->t_stack[i] = 0;
	w->p = p;
	w->idx = i;
	w->wait_time = 0;
	pthread_cond_init(&w->pending_c, NULL);
	if (0 != pthread_create(&w->tid, NULL, t_pool_worker, w))
	    return NULL;
    }
#else
    pthread_cond_init(&p->pending_c, NULL);

    for (i = 0; i < tsize; i++) {
	t_pool_worker_t *w = &p->t[i];
	w->p = p;
	w->idx = i;
	pthread_cond_init(&w->pending_c, NULL);
	if (0 != pthread_create(&w->tid, NULL, t_pool_worker, w))
	    return NULL;
    }
#endif

    pthread_mutex_unlock(&p->pool_m);

    return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl $0x108, %edi            # imm = 0x108
callq 0x69d0
movq %rax, %r14
movl %ebp, (%rax)
movl %ebx, 0x20(%rax)
andq $0x0, 0xe8(%rax)
movslq %ebx, %r12
imulq $0x50, %r12, %rdi
callq 0x69d0
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%r14)
movups %xmm0, 0x10(%r14)
movq %rax, 0x28(%r14)
leaq 0x30(%r14), %r15
xorl %r13d, %r13d
movq %r15, %rdi
xorl %esi, %esi
callq 0x6b10
leaq 0x58(%r14), %rdi
xorl %esi, %esi
callq 0x68c0
leaq 0xb8(%r14), %rdi
xorl %esi, %esi
callq 0x68c0
movq %r15, (%rsp)
movq %r15, %rdi
callq 0x6ae0
shlq $0x2, %r12
movq %r12, %rdi
callq 0x69d0
movq %rax, 0xe8(%r14)
testq %rax, %rax
je 0x5a92d
orl $-0x1, 0xf0(%r14)
testl %ebx, %ebx
cmovlel %r13d, %ebx
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x5a921
movq 0x28(%r14), %r12
movq 0xe8(%r14), %rax
andl $0x0, (%rax,%r15,4)
leaq (%r12,%rbp), %r13
leaq (%r12,%rbp), %rdi
addq $0x18, %rdi
movq %r14, -0x18(%rdi)
movl %r15d, -0x10(%rdi)
andq $0x0, 0x30(%rdi)
xorl %esi, %esi
callq 0x68c0
leaq (%r12,%rbp), %rdi
addq $0x10, %rdi
xorl %esi, %esi
leaq 0x39(%rip), %rdx        # 0x5a93f
movq %r13, %rcx
callq 0x6dc0
incq %r15
addq $0x50, %rbp
movl $0x0, %r13d
testl %eax, %eax
je 0x5a8c0
jmp 0x5a92d
movq (%rsp), %rdi
callq 0x64f0
movq %r14, %r13
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq