LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/kopytjuk[P]wasm-image-converter/src/converter.cpp
// Function: convert_image(char**, int&, ImageType, char**, int&, ImageType)
void convert_image(char** inp, int& insize, ImageType intype, char** outp, 
  int& outsize, ImageType outtype){

  cout << "Decoding image..." << endl;

  cout << "First 10 bytes: ";
  utils::print_first_bytes(*inp, 10);

  rgb8_image_t imageData;

  char_array_to_image(inp, insize, imageData, intype);

  cout << "Image decoded! Encoding..." << endl;
  
  image_to_char_array(imageData, outtype, outp, outsize);

  cout << "Image encoded to desired format!" << endl;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r9d, -0x2c(%rbp)
movq %r8, -0x38(%rbp)
movq %rcx, %r15
movl %edx, %r12d
movq %rsi, %rbx
movq %rdi, %r13
movq 0xff4f(%rip), %r14      # 0x14fd8
leaq 0x80ec(%rip), %rsi      # 0xd17c
movq %r14, %rdi
callq 0x4510
movq %rax, %rdi
callq 0x42c0
leaq 0x80e7(%rip), %rsi      # 0xd18e
movq %r14, %rdi
callq 0x4510
movq (%r13), %rdi
pushq $0xa
popq %rsi
callq 0xc2cf
xorps %xmm0, %xmm0
leaq -0x80(%rbp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
movq $0x3, 0x18(%rdx)
andq $0x0, 0x38(%rdx)
movaps %xmm0, 0x20(%rdx)
movl (%rbx), %esi
movq %r13, %rdi
movl %r12d, %ecx
callq 0x515d
movq 0xfee9(%rip), %rdi      # 0x14fd8
leaq 0x80a9(%rip), %rsi      # 0xd19f
callq 0x4510
movq %rax, %rdi
callq 0x42c0
leaq -0x80(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq %r15, %rdx
movq -0x38(%rbp), %rcx
callq 0x5238
movq 0xfebb(%rip), %rdi      # 0x14fd8
leaq 0x8096(%rip), %rsi      # 0xd1ba
callq 0x4510
movq %rax, %rdi
callq 0x42c0
leaq -0x80(%rbp), %rdi
callq 0x53b6
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
callq 0x53b6
movq %rbx, %rdi
callq 0x48d0
// File: /workspace/github_c_makefile_star2_O2/kopytjuk[P]wasm-image-converter/src/converter.cpp
// Function: char_array_to_image(char**, int, boost::gil::image<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mp11::mp_list<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t>, boost::mp11::mp_list<std::integral_constant<int, 0>, std::integral_constant<int, 1>, std::integral_constant<int, 2>>>>, false, std::allocator<unsigned char>>&, ImageType)
void char_array_to_image(char **arr, int arr_size, rgb8_image_t &img, ImageType type) {
  
  stringstream arr_stream(ios_base::in | ios_base::out | ios_base::binary);
  arr_stream.write(*arr, arr_size);
  arr_stream.seekg(0);

  switch (type) {
    case JpegImage:
      read_image( arr_stream, img, jpeg_tag() );
      break;
    case PngImage:
      read_image( arr_stream, img, png_tag() );
      break;
    default:
      cout << "Cannot convert input image type! Exiting." << endl;
      break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
leaq -0x1b0(%rbp), %rdi
pushq $0x1c
popq %rsi
callq 0x4400
leaq -0x1a0(%rbp), %rdi
movq (%r12), %rsi
movslq %r15d, %rdx
callq 0x4610
leaq -0x1b0(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x45f0
testl %r14d, %r14d
je 0x51cf
cmpl $0x1, %r14d
jne 0x51e6
leaq -0x1b0(%rbp), %rdi
leaq -0x21(%rbp), %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x5419
jmp 0x5201
leaq -0x1b0(%rbp), %rdi
leaq -0x21(%rbp), %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x54b9
jmp 0x5201
movq 0xfdeb(%rip), %rdi      # 0x14fd8
leaq 0x7fe7(%rip), %rsi      # 0xd1db
callq 0x4510
movq %rax, %rdi
callq 0x42c0
leaq -0x1b0(%rbp), %rdi
callq 0x43f0
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5221
jmp 0x5221
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
callq 0x43f0
movq %rbx, %rdi
callq 0x48d0
// File: /workspace/github_c_makefile_star2_O2/kopytjuk[P]wasm-image-converter/src/converter.cpp
// Function: image_to_char_array(boost::gil::image<boost::gil::pixel<unsigned char, boost::gil::layout<boost::mp11::mp_list<boost::gil::red_t, boost::gil::green_t, boost::gil::blue_t>, boost::mp11::mp_list<std::integral_constant<int, 0>, std::integral_constant<int, 1>, std::integral_constant<int, 2>>>>, false, std::allocator<unsigned char>>&, ImageType, char**, int&)
void image_to_char_array(rgb8_image_t &img, ImageType type, char **arr, int &size){

  stringstream arr_stream(ios_base::in | ios_base::out | ios_base::binary);

  switch (type) {
    case JpegImage:
      write_view(arr_stream, view(img), jpeg_tag() );
      break;
    case PngImage:
      write_view(arr_stream, view(img), png_tag() );
      break;
    default:
      cout << "Cannot write to output image type! Exiting." << endl;
      break;
  }

  arr_stream.seekg(0, ios::end);

  size = arr_stream.tellg();

  cout << "Allocating " << to_string(size/1024) << "KB for the output image."<< endl;

  // allocate memory for file
  *arr = new char [size];

  arr_stream.seekg (0, ios::beg);
  arr_stream.read (*arr, size);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, %r15
leaq -0x1c8(%rbp), %rdi
pushq $0x1c
popq %rsi
callq 0x4400
testl %r12d, %r12d
je 0x5287
cmpl $0x1, %r12d
jne 0x529e
leaq -0x1c8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x554f
jmp 0x52b9
leaq -0x1c8(%rbp), %rdi
leaq -0x40(%rbp), %rdx
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x55ae
jmp 0x52b9
movq 0xfd33(%rip), %rdi      # 0x14fd8
leaq 0x7f59(%rip), %rsi      # 0xd205
callq 0x4510
movq %rax, %rdi
callq 0x42c0
leaq -0x1c8(%rbp), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x4630
leaq -0x1c8(%rbp), %rdi
callq 0x4890
movl %eax, (%rbx)
movq 0xfcf9(%rip), %rdi      # 0x14fd8
leaq 0x7f4b(%rip), %rsi      # 0xd231
callq 0x4510
movq %rax, %r15
movl (%rbx), %eax
movl $0x400, %ecx            # imm = 0x400
cltd
idivl %ecx
leaq -0x40(%rbp), %rdi
movl %eax, %esi
callq 0x4e65
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x44b0
leaq 0x7f27(%rip), %rsi      # 0xd23d
movq %rax, %rdi
callq 0x4510
movq %rax, %rdi
callq 0x42c0
leaq -0x40(%rbp), %rdi
callq 0x42a0
movslq (%rbx), %rdi
callq 0x4040
movq %rax, (%r14)
leaq -0x1c8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4630
movq (%r14), %rsi
movslq (%rbx), %rdx
leaq -0x1c8(%rbp), %rdi
callq 0x45e0
leaq -0x1c8(%rbp), %rdi
callq 0x43f0
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x538e
jmp 0x538e
jmp 0x538e
jmp 0x538e
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x42a0
jmp 0x5391
movq %rax, %rbx
leaq -0x1c8(%rbp), %rdi
callq 0x43f0
movq %rbx, %rdi
callq 0x48d0
// File: /workspace/github_c_makefile_star2_O2/kopytjuk[P]wasm-image-converter/src/utils.cpp
// Function: utils::read_file_to_char_array(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char*, int)
void utils::read_file_to_char_array(std::string fn, char *arr, int size){

  std::ifstream file (fn, std::ios::in | std::ios::binary);

  if (file.is_open())
  {
      file.seekg (0, std::ios::beg);
      file.read(arr, size);
      file.close();

  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %rsi
leaq -0x218(%rbp), %rdi
pushq $0xc
popq %rdx
callq 0x47c0
leaq -0x1a0(%rbp), %rdi
callq 0x4140
testb %al, %al
je 0xc2a0
leaq -0x218(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4630
movslq %r14d, %rdx
leaq -0x218(%rbp), %rdi
movq %rbx, %rsi
callq 0x45e0
leaq -0x218(%rbp), %rdi
callq 0x4110
leaq -0x218(%rbp), %rdi
callq 0x4160
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x48d0
// File: /workspace/github_c_makefile_star2_O2/kopytjuk[P]wasm-image-converter/src/utils.cpp
// Function: utils::write_char_array_to_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char*, int)
void utils::write_char_array_to_file(const std::string fn, char *arr, int size){
    
    std::ofstream file (fn, std::ios::out | std::ios::binary);

    if (file.is_open())
    {
        file.write(arr, size);
        file.close();

    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %rsi
leaq -0x210(%rbp), %rdi
pushq $0x14
popq %rdx
callq 0x4940
leaq -0x1a0(%rbp), %rdi
callq 0x4140
testb %al, %al
je 0xc3b6
movslq %r14d, %rdx
leaq -0x210(%rbp), %rdi
movq %rbx, %rsi
callq 0x4610
leaq -0x210(%rbp), %rdi
callq 0x4690
leaq -0x210(%rbp), %rdi
callq 0x46f0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x46f0
movq %rbx, %rdi
callq 0x48d0
// File: /workspace/github_c_makefile_star2_O2/kopytjuk[P]wasm-image-converter/src/utils.cpp
// Function: utils::filesize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int utils::filesize(std::string fn){
    
    int size;

    std::ifstream file (fn, std::ios::in | std::ios::binary | std::ios::ate);

    if (file.is_open())
    {
        file.seekg(0, std::ios::end);
        size = file.tellg();
        file.close();
        return size;

    } else{
        return -1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdi, %rsi
leaq -0x210(%rbp), %rdi
pushq $0xe
popq %rdx
callq 0x47c0
leaq -0x198(%rbp), %rdi
callq 0x4140
testb %al, %al
je 0xc441
leaq -0x210(%rbp), %rdi
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x4630
leaq -0x210(%rbp), %rdi
callq 0x4890
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x4110
jmp 0xc444
pushq $-0x1
popq %rbx
leaq -0x210(%rbp), %rdi
callq 0x4160
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %rbp
retq
jmp 0xc45e
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
callq 0x4160
movq %rbx, %rdi
callq 0x48d0
// File: /workspace/github_c_makefile_star2_O2/giometti[P]mastering_UNIX_programming/chapter_01/group.c
// Function: main
int main(void) {
	struct group *grp;

	setgrent();
	while((grp = getgrent()) != NULL)
		printf("gid=%d name=%s\n",
			grp->gr_gid, grp->gr_name);
	endgrent();

	return 0;
}

// Assembly:
pushq %rbx
callq 0x1060
leaq 0xe8b(%rip), %rbx       # 0x2004
callq 0x1040
testq %rax, %rax
je 0x1195
movl 0x10(%rax), %esi
movq (%rax), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1050
jmp 0x1179
callq 0x1030
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/craigbarnes[P]lua-gumbo/gumbo/util.c
// Function: trim
static int trim(lua_State *L)
{
    size_t len;
    const char *str = luaL_checklstring(L, 1, &len);
    const char *trimmed = do_trim(str, &len);
    lua_pushlstring(L, trimmed, len);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r14
movl %ebp, %esi
movq %r14, %rdx
callq 0x1070
movq %rax, %rdi
movq %r14, %rsi
callq 0x131c
movq (%r14), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x10a0
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/craigbarnes[P]lua-gumbo/gumbo/util.c
// Function: trim_and_collapse
static int trim_and_collapse(lua_State *L)
{
    luaL_Buffer b;
    size_t len;
    const char *str = luaL_checklstring(L, 1, &len);
    str = do_trim(str, &len);

    #if LUA_VERSION_NUM >= 502
        char *out = luaL_buffinitsize(L, &b, len);
        size_t pos = 0;
    #else
        luaL_buffinit(L, &b);
    #endif

    for (size_t i = 0; i < len; ) {
        char ch = str[i++];
        if (ascii_isspace(ch)) {
            while (i < len && ascii_isspace(str[i])) {
                i++;
            }
            ch = ' ';
        }
        #if LUA_VERSION_NUM >= 502
            out[pos++] = ch;
        #else
            luaL_addchar(&b, ch);
        #endif
    }

    #if LUA_VERSION_NUM >= 502
        luaL_addsize(&b, pos);
    #endif

    luaL_pushresult(&b);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x2030, %rsp           # imm = 0x2030
movq %rdi, %r14
pushq $0x1
popq %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x1070
movq %rax, %rdi
movq %r15, %rsi
callq 0x131c
movq %rax, %rbx
movq (%r15), %rdx
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x1090
xorl %ecx, %ecx
leaq 0xe04(%rip), %rdx       # 0x2050
xorl %esi, %esi
movq 0x8(%rsp), %rdi
cmpq %rdi, %rsi
jae 0x128c
movzbl (%rbx,%rsi), %r8d
incq %rsi
testb $0x1, (%rdx,%r8)
je 0x1283
movb $0x20, %r8b
cmpq %rdi, %rsi
jae 0x1280
movzbl (%rbx,%rsi), %r9d
testb $0x1, (%rdx,%r9)
je 0x1283
incq %rsi
jmp 0x1267
movq %rdi, %rsi
movb %r8b, (%rax,%rcx)
incq %rcx
jmp 0x124e
leaq 0x10(%rsp), %rdi
addq %rcx, 0x10(%rdi)
callq 0x1060
pushq $0x1
popq %rax
addq $0x2030, %rsp           # imm = 0x2030
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/craigbarnes[P]lua-gumbo/gumbo/util.c
// Function: createtable
static int createtable(lua_State *L)
{
    lua_Integer narr = luaL_checkinteger(L, 1);
    lua_Integer nrec = luaL_checkinteger(L, 2);
    if (unlikely(narr < 0 || narr > INT_MAX)) {
        luaL_argerror(L, 1, "value outside valid range");
    }
    if (unlikely(nrec < 0 || nrec > INT_MAX)) {
        luaL_argerror(L, 2, "value outside valid range");
    }
    lua_createtable(L, (int)narr, (int)nrec);
    return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
pushq $0x1
popq %rsi
callq 0x1080
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1080
movq %rax, %r15
testq $-0x80000000, %r14      # imm = 0x80000000
jne 0x12f4
movq %r15, %rax
shrq $0x1f, %rax
jne 0x1308
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x1050
pushq $0x1
popq %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0xd38(%rip), %rdx       # 0x2033
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x1040
jmp 0x12d4
leaq 0xd24(%rip), %rdx       # 0x2033
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1040
jmp 0x12dd
// File: /workspace/github_c_makefile_star2_O2/craigbarnes[P]lua-gumbo/gumbo/util.c
// Function: do_trim
static const char *do_trim(const char *str, size_t *n)
{
    size_t len = *n;
    while (len && ascii_isspace(*str)) {
        len--;
        str++;
    }

    const char *end = str + len - 1;
    while (len && ascii_isspace(*end)) {
        len--;
        end--;
    }

    *n = len;
    return str;
}

// Assembly:
movq (%rsi), %rdx
leaq (%rdi,%rdx), %rax
leaq 0xd26(%rip), %rcx       # 0x2050
movq %rdx, %r8
subq $0x1, %r8
jb 0x1349
movzbl (%rdi), %r9d
testb $0x1, (%rcx,%r9)
je 0x1346
incq %rdi
movq %r8, %rdx
jmp 0x132d
movq %rdi, %rax
movq %rdx, %rdi
subq $0x1, %rdx
jb 0x135f
movzbl -0x1(%rax,%rdi), %r8d
testb $0x1, (%rcx,%r8)
jne 0x1349
movq %rdi, (%rsi)
retq
nop
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_header_dup
bam_header_t *bam_header_dup(const bam_header_t *h0)
{
	bam_header_t *h;
	int i;
	h = bam_header_init();
	*h = *h0;
	h->hash = h->dict = h->rg2lib = 0;
	h->text = (char*)calloc(h->l_text + 1, 1);
	memcpy(h->text, h0->text, h->l_text);
	h->target_len = (uint32_t*)calloc(h->n_targets, 4);
	h->target_name = (char**)calloc(h->n_targets, sizeof(void*));
	for (i = 0; i < h->n_targets; ++i) {
		h->target_len[i] = h0->target_len[i];
		h->target_name[i] = strdup(h0->target_name[i]);
	}
	return h;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x58dd
movq %rax, %r14
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups 0x30(%rbx), %xmm3
movups %xmm1, 0x10(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm3, 0x30(%rax)
movups %xmm0, (%rax)
andq $0x0, 0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movl 0x30(%rax), %r15d
leal 0x1(%r15), %edi
pushq $0x1
popq %rsi
callq 0x31c0
movq %rax, 0x38(%r14)
movq 0x38(%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x3260
movslq (%r14), %r12
movq %r12, -0x30(%rbp)
pushq $0x4
popq %rsi
movq %r12, %rdi
callq 0x31c0
movq %rax, %r15
movq %rax, 0x10(%r14)
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0x31c0
movq %rax, %r12
movq %r14, -0x38(%rbp)
movq %rax, 0x8(%r14)
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
testl %eax, %eax
movl $0x0, %r14d
cmovgl %eax, %r14d
cmpq %r13, %r14
je 0x387e
movq 0x10(%rbx), %rax
movl (%rax,%r13,4), %eax
movl %eax, (%r15,%r13,4)
movq 0x8(%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0x3600
movq %rax, (%r12,%r13,8)
incq %r13
jmp 0x3857
movq -0x38(%rbp), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bgzf_open
BGZF *bgzf_open(const char *path, const char *mode)
{
	BGZF *fp = 0;
	assert(compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE);
	if (strchr(mode, 'r') || strchr(mode, 'R')) {
		_bgzf_file_t fpr;
		if ((fpr = _bgzf_open(path, "r")) == 0) return 0;
		fp = bgzf_read_init();
		fp->fp = fpr;
	} else if (strchr(mode, 'w') || strchr(mode, 'W')) {
		FILE *fpw;
		if ((fpw = fopen(path, "w")) == 0) return 0;
		fp = bgzf_write_init(mode2level(mode));
		fp->fp = fpw;
	}
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl $0xff00, %edi           # imm = 0xFF00
callq 0x3550
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x3b99
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
jne 0x3b28
pushq $0x52
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
je 0x3b4a
leaq 0x7873(%rip), %rsi      # 0xb3a2
movq %r14, %rdi
callq 0x33c0
testq %rax, %rax
je 0x3b92
movq %rax, %r14
callq 0x912d
movq %r14, 0x30(%rax)
jmp 0x3b94
pushq $0x77
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
jne 0x3b6a
pushq $0x57
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
je 0x3b92
leaq 0x7a5d(%rip), %rsi      # 0xb5ce
movq %r14, %rdi
callq 0x33c0
testq %rax, %rax
je 0x3b92
movq %rax, %r14
movq %rbx, %rdi
callq 0x78a8
movl %eax, %edi
callq 0x784c
jmp 0x3b44
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x79cd(%rip), %rdi      # 0xb56d
leaq 0x76b5(%rip), %rsi      # 0xb25c
leaq 0x79f4(%rip), %rcx      # 0xb5a2
movl $0x4db, %edx            # imm = 0x4DB
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bgzf_dopen
BGZF *bgzf_dopen(int fd, const char *mode)
{
	BGZF *fp = 0;
	assert(compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE);
	if (strchr(mode, 'r') || strchr(mode, 'R')) {
		_bgzf_file_t fpr;
		if ((fpr = _bgzf_dopen(fd, "r")) == 0) return 0;
		fp = bgzf_read_init();
		fp->fp = fpr;
	} else if (strchr(mode, 'w') || strchr(mode, 'W')) {
		FILE *fpw;
		if ((fpw = fdopen(fd, "w")) == 0) return 0;
		fp = bgzf_write_init(mode2level(mode));
		fp->fp = fpw;
	}
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %r14d
movl $0xff00, %edi           # imm = 0xFF00
callq 0x3550
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x3c6c
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
jne 0x3bfb
pushq $0x52
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
je 0x3c1d
leaq 0x77a0(%rip), %rsi      # 0xb3a2
movl %r14d, %edi
callq 0x3370
testq %rax, %rax
je 0x3c65
movq %rax, %r14
callq 0x912d
movq %r14, 0x30(%rax)
jmp 0x3c67
pushq $0x77
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
jne 0x3c3d
pushq $0x57
popq %rsi
movq %rbx, %rdi
callq 0x3100
testq %rax, %rax
je 0x3c65
leaq 0x798a(%rip), %rsi      # 0xb5ce
movl %r14d, %edi
callq 0x3370
testq %rax, %rax
je 0x3c65
movq %rax, %r14
movq %rbx, %rdi
callq 0x78a8
movl %eax, %edi
callq 0x784c
jmp 0x3c17
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x78fa(%rip), %rdi      # 0xb56d
leaq 0x75e2(%rip), %rsi      # 0xb25c
leaq 0x794f(%rip), %rcx      # 0xb5d0
movl $0x4ed, %edx            # imm = 0x4ED
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_open
tamFile sam_open(const char *fn)
{
	tamFile fp;
	gzFile gzfp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "rb") : gzopen(fn, "rb");
	if (gzfp == 0) return 0;
	fp = (tamFile)calloc(1, sizeof(struct __tamFile_t));
	fp->str = (kstring_t*)calloc(1, sizeof(kstring_t));
	fp->fp = gzfp;
	fp->ks = ks_init(fp->fp);
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x2d, (%rdi)
jne 0x3e5e
cmpb $0x0, 0x1(%rdi)
je 0x3eb5
leaq 0x7705(%rip), %rsi      # 0xb56a
callq 0x34f0
movq %rax, %rbx
testq %rax, %rax
je 0x3ea4
pushq $0x1
popq %r15
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x31c0
movq %rax, %r14
pushq $0x18
popq %rsi
movq %r15, %rdi
callq 0x31c0
movq %rax, 0x10(%r14)
movq %rbx, (%r14)
movq %rbx, %rdi
callq 0x6e39
movq %rax, 0x8(%r14)
jmp 0x3ea7
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xb104(%rip), %rax      # 0xefc0
movq (%rax), %rdi
callq 0x3360
leaq 0x769f(%rip), %rsi      # 0xb56a
movl %eax, %edi
callq 0x35e0
jmp 0x3e6a
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_header_read
bam_header_t *sam_header_read(tamFile fp)
{
	int ret, dret;
	bam_header_t *header = bam_header_init();
	kstring_t *str = fp->str;
	while ((ret = ks_getuntil(fp->ks, KS_SEP_TAB, str, &dret)) >= 0 && str->s[0] == '@') { // skip header
		str->s[str->l] = dret; // note that str->s is NOT null terminated!!
		append_text(header, str);
		if (dret != '\n') {
			ret = ks_getuntil(fp->ks, '\n', str, &dret);
			str->s[str->l] = '\n'; // NOT null terminated!!
			append_text(header, str);
		}
		++fp->n_lines;
	}
	sam_header_parse(header);
	bam_init_header_hash(header);
	fp->is_first = 1;
	return header;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x58dd
movq %rax, %r14
movq 0x10(%rbx), %r15
pushq $0x1
popq %r12
leaq -0x2c(%rbp), %r13
movq 0x8(%rbx), %rdi
movl %r12d, %esi
movq %r15, %rdx
movq %r13, %rcx
callq 0x6e6a
testl %eax, %eax
js 0x3f60
movq 0x10(%r15), %rax
cmpb $0x40, (%rax)
jne 0x3f60
movb -0x2c(%rbp), %cl
movq (%r15), %rdx
movb %cl, (%rax,%rdx)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7638
cmpl $0xa, -0x2c(%rbp)
je 0x3f5a
movq 0x8(%rbx), %rdi
pushq $0xa
popq %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x6e6a
movq (%r15), %rax
movq 0x10(%r15), %rcx
movb $0xa, (%rcx,%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7638
incq 0x18(%rbx)
jmp 0x3ef9
movq %r14, %rdi
callq 0x713a
movq %r14, %rdi
callq 0x6403
movl $0x1, 0x20(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_header_destroy
void bam_header_destroy(bam_header_t *header)
{
	int32_t i;
	//extern void bam_destroy_header_hash(bam_header_t *header);
	if (header == 0) return;
	if (header->target_name) {
		for (i = 0; i < header->n_targets; ++i)
			free(header->target_name[i]);
		free(header->target_name);
		free(header->target_len);
	}
	free(header->text);
	if (header->dict) sam_header_free(header->dict);
	if (header->rg2lib) sam_tbl_destroy(header->rg2lib);
	//bam_destroy_header_hash(header);
	free(header);
}

// Assembly:
testq %rdi, %rdi
je 0x472f
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x46fe
xorl %r14d, %r14d
movslq (%rbx), %rax
movq 0x8(%rbx), %rdi
cmpq %rax, %r14
jge 0x46f0
movq (%rdi,%r14,8), %rdi
callq 0x33d0
incq %r14
jmp 0x46d6
callq 0x33d0
movq 0x10(%rbx), %rdi
callq 0x33d0
movq 0x38(%rbx), %rdi
callq 0x33d0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x4715
callq 0x5902
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x4723
callq 0x5976
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x33d0
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: samclose
void samclose(samfile_t *fp)
{
	if (fp == 0) return;
	if (fp->header) bam_header_destroy(fp->header);
	if (fp->type & TYPE_BAM) bam_close(fp->x.bam);
	else if (fp->type & TYPE_READ) sam_close(fp->x.tamr);
	else fclose(fp->x.tamw);
	free(fp);
}

// Assembly:
testq %rdi, %rdi
je 0x4761
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x474c
callq 0x46bd
movl (%rbx), %eax
testb $0x1, %al
jne 0x4762
movq 0x8(%rbx), %rdi
testb $0x2, %al
jne 0x476d
callq 0x32e0
jmp 0x4772
retq
movq 0x8(%rbx), %rdi
callq 0x4780
jmp 0x4772
callq 0x4912
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x33d0
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bgzf_close
int bgzf_close(BGZF* fp)
{
	int ret, count, block_length;
	if (fp == 0) return -1;
	if (fp->is_write) {
		if (bgzf_flush(fp) != 0) return -1;
		fp->compress_level = -1;
		block_length = deflate_block(fp, 0); // write an empty block
		count = fwrite(fp->compressed_block, 1, block_length, fp->fp);
		if (fflush(fp->fp) != 0) {
			fp->errcode |= BGZF_ERR_IO;
			return -1;
		}
		if (fp->mt) mt_destroy(fp->mt);
	}
	ret = fp->is_write? fclose(fp->fp) : _bgzf_close(fp->fp);
	if (ret != 0) return -1;
	free(fp->uncompressed_block);
	free(fp->compressed_block);
	free_cache(fp);
	free(fp);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
pushq $-0x1
popq %r14
testq %rdi, %rdi
je 0x4900
movq %rdi, %rbx
testb $0x3, 0x2(%rdi)
je 0x48d6
movq %rbx, %rdi
callq 0x7c12
testl %eax, %eax
jne 0x4900
orl $0xfffc0000, (%rbx)     # imm = 0xFFFC0000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7d81
movslq %eax, %rdx
movq 0x20(%rbx), %rdi
movq 0x30(%rbx), %rcx
pushq $0x1
popq %r13
movq %r13, %rsi
callq 0x3660
movq 0x30(%rbx), %rdi
callq 0x33b0
testl %eax, %eax
je 0x47f7
orb $0x4, (%rbx)
jmp 0x4900
movq 0x38(%rbx), %r15
testq %r15, %r15
je 0x48d6
leaq 0x38(%r15), %r12
movq %r12, %rdi
callq 0x34e0
movl $0x1, 0xc(%r15)
movl $0x0, 0x10(%r15)
leaq 0x60(%r15), %rdi
movq %rdi, -0x30(%rbp)
callq 0x30e0
movq %r12, -0x38(%rbp)
movq %r12, %rdi
callq 0x3210
movslq (%r15), %rax
cmpq %rax, %r13
jge 0x4855
movq 0x30(%r15), %rax
movq (%rax,%r13,8), %rdi
xorl %esi, %esi
callq 0x32a0
incq %r13
jmp 0x4839
xorl %r12d, %r12d
movslq 0x4(%r15), %rax
cmpq %rax, %r12
jge 0x4873
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rdi
callq 0x33d0
incq %r12
jmp 0x4858
pushq $0x10
popq %r13
xorl %r12d, %r12d
movslq (%r15), %rax
cmpq %rax, %r12
jge 0x4898
movq 0x28(%r15), %rax
movq (%rax,%r13), %rdi
callq 0x33d0
incq %r12
addq $0x28, %r13
jmp 0x487a
movq 0x18(%r15), %rdi
callq 0x33d0
movq 0x20(%r15), %rdi
callq 0x33d0
movq 0x28(%r15), %rdi
callq 0x33d0
movq 0x30(%r15), %rdi
callq 0x33d0
movq -0x30(%rbp), %rdi
callq 0x3650
movq -0x38(%rbp), %rdi
callq 0x33a0
movq %r15, %rdi
callq 0x33d0
movq 0x30(%rbx), %rdi
callq 0x32e0
testl %eax, %eax
jne 0x4900
movq 0x18(%rbx), %rdi
callq 0x33d0
movq 0x20(%rbx), %rdi
callq 0x33d0
movq %rbx, %rdi
callq 0x33d0
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_close
void sam_close(tamFile fp)
{
	if (fp) {
		ks_destroy(fp->ks);
		gzclose(fp->fp);
		free(fp->str->s); free(fp->str);
		free(fp);
	}
}

// Assembly:
testq %rdi, %rdi
je 0x4955
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x7115
movq (%rbx), %rdi
callq 0x35a0
movq 0x10(%rbx), %rax
movq 0x10(%rax), %rdi
callq 0x33d0
movq 0x10(%rbx), %rdi
callq 0x33d0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x33d0
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_calend
uint32_t bam_calend(const bam1_core_t *c, const uint32_t *cigar)
{
	int k, end = c->pos;
	for (k = 0; k < c->n_cigar; ++k) {
		int op  = bam_cigar_op(cigar[k]);
		int len = bam_cigar_oplen(cigar[k]);
		if (op == BAM_CBACK) { // move backward
			int l, u, v;
			if (k == c->n_cigar - 1) break; // skip trailing 'B'
			for (l = k - 1, u = v = 0; l >= 0; --l) {
				int op1  = bam_cigar_op(cigar[l]);
				int len1 = bam_cigar_oplen(cigar[l]);
				if (bam_cigar_type(op1)&1) { // consume query
					if (u + len1 >= len) { // stop
						if (bam_cigar_type(op1)&2) v += len - u;
						break;
					} else u += len1;
				}
				if (bam_cigar_type(op1)&2) v += len1;
			}
			end = l < 0? c->pos : end - v;
		} else if (bam_cigar_type(op)&2) end += bam_cigar_oplen(cigar[k]);
	}
	return end;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x4(%rdi), %edx
movl 0x10(%rdi), %edi
leal -0x1(%rdi), %r8d
xorl %r9d, %r9d
movl $0x3c1a7, %r10d         # imm = 0x3C1A7
movl %edx, %eax
cmpq %rdi, %r9
je 0x5894
movl (%rsi,%r9,4), %r11d
movl %r11d, %ecx
andl $0xf, %ecx
shrl $0x4, %r11d
cmpl $0x9, %ecx
jne 0x585f
cmpq %r8, %r9
je 0x5894
xorl %r15d, %r15d
movq %r9, %r14
xorl %ebx, %ebx
testq %r14, %r14
jle 0x5875
movl -0x4(%rsi,%r14,4), %ecx
movl %ecx, %r13d
shrl $0x4, %r13d
addl %ecx, %ecx
movl $0x3c1a7, %r12d         # imm = 0x3C1A7
shrl %cl, %r12d
btl %ecx, %r10d
jb 0x5840
movl %r15d, %ecx
jmp 0x5849
leal (%r15,%r13), %ecx
cmpl %r11d, %ecx
jge 0x5879
shll $0x1e, %r12d
sarl $0x1f, %r12d
andl %r13d, %r12d
addl %r12d, %ebx
decq %r14
movl %ecx, %r15d
jmp 0x5819
addl %ecx, %ecx
movl $0x3c1a7, %ebx          # imm = 0x3C1A7
shrl %cl, %ebx
shll $0x1e, %ebx
sarl $0x1f, %ebx
andl %r11d, %ebx
addl %ebx, %eax
jmp 0x588c
movl %edx, %eax
jmp 0x588c
shll $0x1e, %r12d
sarl $0x1f, %r12d
subl %r11d, %r15d
andl %r12d, %r15d
subl %ebx, %eax
addl %r15d, %eax
incq %r9
jmp 0x57ec
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_cigar2qlen
int32_t bam_cigar2qlen(const bam1_core_t *c, const uint32_t *cigar)
{
	uint32_t k;
	int32_t l = 0;
	for (k = 0; k < c->n_cigar; ++k)
		if (bam_cigar_type(bam_cigar_op(cigar[k]))&1)
			l += bam_cigar_oplen(cigar[k]);
	return l;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x10(%rdi), %ecx
xorl %edx, %edx
movl $0x3c1a7, %edi          # imm = 0x3C1A7
xorl %eax, %eax
cmpq %rdx, %rcx
je 0x58db
movl (%rsi,%rdx,4), %r8d
leal (%r8,%r8), %r9d
btl %r9d, %edi
movl $0x0, %r9d
sbbl %r9d, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %eax, %r8d
incq %rdx
movl %r8d, %eax
jmp 0x58af
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_header_free
void sam_header_free(void *_header)
{
	HeaderDict *header = (HeaderDict*)_header;
    list_t *hlines = header;
    while (hlines)
    {
        sam_header_line_free(hlines->data);
        hlines = hlines->next;
    }
    list_free(header);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rdi, %r12
testq %r12, %r12
je 0x5960
movq 0x10(%r12), %r14
leaq 0x8(%r14), %r13
movq (%r13), %r13
testq %r13, %r13
je 0x5948
movq 0x10(%r13), %r15
movq 0x8(%r15), %rdi
callq 0x33d0
movq %r15, %rdi
callq 0x33d0
addq $0x8, %r13
jmp 0x5924
movq 0x8(%r14), %rdi
callq 0x81ec
movq %r14, %rdi
callq 0x33d0
movq 0x8(%r12), %r12
jmp 0x5916
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x81ec
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bgzf_check_EOF
int bgzf_check_EOF(BGZF *fp)
{
	static uint8_t magic[28] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0";
	uint8_t buf[28];
	off_t offset;
	offset = _bgzf_tell((_bgzf_file_t)fp->fp);
	if (_bgzf_seek(fp->fp, -28, SEEK_END) < 0) return 0;
	_bgzf_read(fp->fp, buf, 28);
	_bgzf_seek(fp->fp, offset, SEEK_SET);
	return (memcmp(magic, buf, 28) == 0)? 1 : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x3410
movq %rax, %r14
movq 0x30(%rbx), %rdi
pushq $-0x1c
popq %rsi
pushq $0x2
popq %rdx
callq 0x3190
testl %eax, %eax
js 0x5a24
movq 0x30(%rbx), %rcx
leaq -0x40(%rbp), %r15
pushq $0x1
popq %rsi
pushq $0x1c
popq %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x3510
movq 0x30(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3190
leaq 0x9c62(%rip), %rdi      # 0xf670
movq %r15, %rsi
movq %r12, %rdx
callq 0x3310
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %al
jmp 0x5a26
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bgzf_read
ssize_t bgzf_read(BGZF *fp, void *data, ssize_t length)
{
	ssize_t bytes_read = 0;
	uint8_t *output = data;
	if (length <= 0) return 0;
	assert(fp->is_write == 0);
	while (bytes_read < length) {
		int copy_length, available = fp->block_length - fp->block_offset;
		uint8_t *buffer;
		if (available <= 0) {
			if (bgzf_read_block(fp) != 0) return -1;
			available = fp->block_length - fp->block_offset;
			if (available <= 0) break;
		}
		copy_length = length - bytes_read < available? length - bytes_read : available;
		buffer = fp->uncompressed_block;
		memcpy(output, buffer + fp->block_offset, copy_length);
		fp->block_offset += copy_length;
		output += copy_length;
		bytes_read += copy_length;
	}
	if (fp->block_offset == fp->block_length) {
		fp->block_address = _bgzf_tell((_bgzf_file_t)fp->fp);
		fp->block_offset = fp->block_length = 0;
	}
	return bytes_read;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
jle 0x5aba
movq %rdi, %r14
testb $0x3, 0x2(%rdi)
jne 0x5aed
movq %rdx, %r15
movq %rsi, %r12
movl 0xc(%r14), %eax
xorl %ebx, %ebx
movq %r15, %r13
movl 0x8(%r14), %ecx
subq %rbx, %r13
jle 0x5abe
subl %eax, %ecx
jg 0x5a89
movq %r14, %rdi
callq 0x78ec
testl %eax, %eax
jne 0x5ad8
movl 0x8(%r14), %edx
movl 0xc(%r14), %eax
movl %edx, %ecx
subl %eax, %ecx
jle 0x5ac0
movl %ecx, %ecx
cmpq %rcx, %r13
cmovlq %r13, %rcx
movslq %eax, %rsi
addq 0x18(%r14), %rsi
movslq %ecx, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x3260
movl 0xc(%r14), %eax
addl %r13d, %eax
movl %eax, 0xc(%r14)
addq %r13, %r12
addq %r13, %rbx
jmp 0x5a5f
xorl %ebx, %ebx
jmp 0x5adb
movl %ecx, %edx
cmpl %edx, %eax
jne 0x5adb
movq 0x30(%r14), %rdi
callq 0x3410
movq %rax, 0x10(%r14)
andq $0x0, 0x8(%r14)
jmp 0x5adb
pushq $-0x1
popq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5b00(%rip), %rdi      # 0xb5f4
leaq 0x5761(%rip), %rsi      # 0xb25c
leaq 0x5b04(%rip), %rcx      # 0xb606
movl $0x5a8, %edx            # imm = 0x5A8
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_aux_append
void bam_aux_append(bam1_t *b, const char tag[2], char type, int len, uint8_t *data)
{
	int ori_len = b->data_len;
	b->data_len += 3 + len;
	b->l_aux += 3 + len;
	if (b->m_data < b->data_len) {
		b->m_data = b->data_len;
		kroundup32(b->m_data);
		b->data = (uint8_t*)realloc(b->data, b->m_data);
	}
	b->data[ori_len] = tag[0]; b->data[ori_len + 1] = tag[1];
	b->data[ori_len + 2] = type;
	memcpy(b->data + ori_len + 3, data, len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdi, %r15
movslq 0x28(%rdi), %rbx
leal 0x3(%r14), %ecx
leal (%rbx,%r14), %eax
addl $0x3, %eax
movl %eax, 0x28(%rdi)
addl %ecx, 0x24(%rdi)
movl %edx, %r12d
movq %rsi, %r13
cmpl %eax, 0x2c(%rdi)
jge 0x60ac
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x10, %ecx
orl %eax, %ecx
incl %ecx
movl %ecx, 0x2c(%r15)
movq 0x30(%r15), %rdi
movslq %ecx, %rsi
movq %r8, -0x30(%rbp)
callq 0x3590
movq -0x30(%rbp), %r8
movq %rax, 0x30(%r15)
jmp 0x60b0
movq 0x30(%r15), %rax
movb (%r13), %cl
movb %cl, (%rax,%rbx)
movb 0x1(%r13), %al
movq 0x30(%r15), %rcx
movb %al, 0x1(%rcx,%rbx)
movq 0x30(%r15), %rax
movb %r12b, 0x2(%rax,%rbx)
movq 0x30(%r15), %rax
leaq (%rax,%rbx), %rdi
addq $0x3, %rdi
movslq %r14d, %rdx
movq %r8, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3260
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_aux_get
uint8_t *bam_aux_get(const bam1_t *b, const char tag[2])
{
	uint8_t *s;
	int y = tag[0]<<8 | tag[1];
	s = bam1_aux(b);
	while (s < b->data + b->data_len) {
		int x = (int)s[0]<<8 | s[1];
		s += 2;
		if (x == y) return s;
		__skip_tag(s);
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movsbl (%rsi), %eax
shll $0x8, %eax
movsbl 0x1(%rsi), %r14d
orl %eax, %r14d
movq 0x30(%rdi), %rcx
movl 0x10(%rdi), %eax
shll $0x2, %eax
movzbl 0xb(%rdi), %esi
addq %rcx, %rsi
addq %rax, %rsi
movslq 0x14(%rdi), %rax
addq %rax, %rsi
incl %eax
pushq $0x2
popq %r8
cltd
idivl %r8d
movslq %eax, %r12
addq %rsi, %r12
movslq 0x28(%rdi), %r15
addq %rcx, %r15
xorl %ebx, %ebx
cmpq %r15, %r12
jae 0x61cc
movzwl (%r12), %eax
rolw $0x8, %ax
movzwl %ax, %eax
cmpl %r14d, %eax
je 0x61c5
callq 0x3080
movq (%rax), %rax
movzbl 0x2(%r12), %ecx
movl (%rax,%rcx,4), %edi
leaq 0x3(%r12), %r13
cmpl $0x42, %edi
je 0x6196
cmpl $0x5a, %edi
je 0x6186
cmpl $0x48, %edi
jne 0x61b6
leaq 0x1(%r13), %r12
cmpb $0x0, (%r13)
movq %r12, %r13
jne 0x6186
jmp 0x614b
movzbl 0x3(%r12), %edi
callq 0x61de
movslq 0x4(%r12), %rcx
cltq
imulq %rcx, %rax
leaq (%rax,%r13), %r12
addq $0x5, %r12
jmp 0x614b
callq 0x61de
movl %eax, %eax
addq %rax, %r13
movq %r13, %r12
jmp 0x614b
addq $0x2, %r12
movq %r12, %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/skoren[P]bacValidation/./bamcat.h
// Function: bam_aux_type2size
static inline int bam_aux_type2size(int x)
{
	if (x == 'C' || x == 'c' || x == 'A') return 1;
	else if (x == 'S' || x == 's') return 2;
	else if (x == 'I' || x == 'i' || x == 'f' || x == 'F') return 4;
	else return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leal -0x41(%rdi), %eax
cmpl $0x22, %eax
ja 0x6201
movabsq $0x400000005, %rcx      # imm = 0x400000005
btq %rax, %rcx
jae 0x6201
movl $0x1, %eax
popq %rbp
retq
movl %edi, %eax
andl $-0x21, %eax
cmpl $0x53, %eax
jne 0x6212
movl $0x2, %eax
jmp 0x61ff
addl $-0x46, %edi
cmpl $0x23, %edi
ja 0x6231
movabsq $0x900000009, %rax      # imm = 0x900000009
btq %rdi, %rax
jae 0x6231
movl $0x4, %eax
jmp 0x61ff
xorl %eax, %eax
jmp 0x61ff
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_aux_del
int bam_aux_del(bam1_t *b, uint8_t *s)
{
	uint8_t *p, *aux;
	aux = bam1_aux(b);
	p = s - 2;
	__skip_tag(s);
	memmove(p, s, b->l_aux - (s - aux));
	b->data_len -= s - p;
	b->l_aux -= s - p;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x30(%rdi), %rax
movq %rax, -0x38(%rbp)
movl 0x10(%rdi), %eax
movq %rax, -0x30(%rbp)
movq 0x8(%rdi), %r12
movslq 0x14(%rdi), %rax
movq %rax, -0x40(%rbp)
callq 0x3080
movq (%rax), %rax
movzbl (%r14), %ecx
movl (%rax,%rcx,4), %edi
leaq 0x1(%r14), %r15
cmpl $0x42, %edi
je 0x6298
cmpl $0x5a, %edi
je 0x6289
cmpl $0x48, %edi
jne 0x62b6
leaq 0x1(%r15), %r13
cmpb $0x0, (%r15)
movq %r13, %r15
jne 0x6289
jmp 0x62c3
movzbl 0x1(%r14), %edi
callq 0x61de
movslq 0x2(%r14), %rcx
cltq
imulq %rcx, %rax
leaq (%r15,%rax), %r13
addq $0x5, %r13
jmp 0x62c3
callq 0x61de
movl %eax, %eax
addq %rax, %r15
movq %r15, %r13
addq $-0x2, %r14
movq -0x30(%rbp), %rcx
shll $0x2, %ecx
movq -0x38(%rbp), %rax
addq %rcx, %rax
shrl $0x18, %r12d
addq %rax, %r12
movq -0x40(%rbp), %rax
addq %rax, %r12
incl %eax
pushq $0x2
popq %rcx
cltd
idivl %ecx
movslq %eax, %rdx
addq %r12, %rdx
movslq 0x24(%rbx), %rax
subq %r13, %rdx
addq %rax, %rdx
movq %r14, %rdi
movq %r13, %rsi
callq 0x3570
subl %r14d, %r13d
subl %r13d, 0x28(%rbx)
subl %r13d, 0x24(%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_aux_drop_other
int bam_aux_drop_other(bam1_t *b, uint8_t *s)
{
	if (s) {
		uint8_t *p, *aux;
		aux = bam1_aux(b);
		p = s - 2;
		__skip_tag(s);
		memmove(aux, p, s - p);
		b->data_len -= b->l_aux - (s - p);
		b->l_aux = s - p;
	} else {
		b->data_len -= b->l_aux;
		b->l_aux = 0;
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x639b
movq %rsi, %r12
movl 0x10(%rbx), %eax
shll $0x2, %eax
addq 0x30(%rbx), %rax
movzbl 0xb(%rbx), %ecx
movslq 0x14(%rbx), %rdx
addq %rdx, %rcx
addq %rax, %rcx
leal 0x1(%rdx), %eax
pushq $0x2
popq %rsi
cltd
idivl %esi
movslq %eax, %r14
addq %rcx, %r14
leaq -0x2(%r12), %r15
callq 0x3080
movq (%rax), %rax
movzbl (%r12), %ecx
movl (%rax,%rcx,4), %edi
leaq 0x1(%r12), %r13
cmpl $0x42, %edi
je 0x63a7
cmpl $0x5a, %edi
je 0x638b
cmpl $0x48, %edi
jne 0x63c7
leaq 0x1(%r13), %r12
cmpb $0x0, (%r13)
movq %r12, %r13
jne 0x638b
jmp 0x63d4
movl 0x24(%rbx), %eax
subl %eax, 0x28(%rbx)
andl $0x0, 0x24(%rbx)
jmp 0x63f2
movzbl 0x1(%r12), %edi
callq 0x61de
movslq 0x2(%r12), %rcx
cltq
imulq %rcx, %rax
leaq (%rax,%r13), %r12
addq $0x5, %r12
jmp 0x63d4
callq 0x61de
movl %eax, %eax
addq %rax, %r13
movq %r13, %r12
subq %r15, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3570
movl %r12d, %eax
subl 0x24(%rbx), %eax
addl %eax, 0x28(%rbx)
movl %r12d, 0x24(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_get_tid
int32_t bam_get_tid(const bam_header_t *header, const char *seq_name)
{
	khint_t k;
	khash_t(s) *h = (khash_t(s)*)header->hash;
	k = kh_get(s, h, seq_name);
	return k == kh_end(h)? -1 : kh_value(h, k);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x6890
cmpl (%rbx), %eax
jne 0x6880
pushq $-0x1
popq %rax
jmp 0x6889
movq 0x20(%rbx), %rcx
movl %eax, %eax
movl (%rcx,%rax,4), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: bam_aux2i
int32_t bam_aux2i(const uint8_t *s)
{
	int type;
	if (s == 0) return 0;
	type = *s++;
	if (type == 'c') return (int32_t)*(int8_t*)s;
	else if (type == 'C') return (int32_t)*(uint8_t*)s;
	else if (type == 's') return (int32_t)*(int16_t*)s;
	else if (type == 'S') return (int32_t)*(uint16_t*)s;
	else if (type == 'i' || type == 'I') return *(int32_t*)s;
	else return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
testq %rdi, %rdi
je 0x6c93
movb (%rdi), %cl
leal -0x43(%rcx), %edx
rolb $0x4, %dl
cmpb $0x3, %dl
ja 0x6c88
movzbl %dl, %eax
leaq 0x4401(%rip), %rcx      # 0xb068
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x1(%rdi), %eax
jmp 0x6c93
movsbl 0x1(%rdi), %eax
jmp 0x6c93
movswl 0x1(%rdi), %eax
jmp 0x6c93
movzwl 0x1(%rdi), %eax
jmp 0x6c93
andb $-0x21, %cl
cmpb $0x49, %cl
jne 0x6c93
movl 0x1(%rdi), %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: _bam_get_lines
char **__bam_get_lines(const char *fn, int *_n) // for bam_plcmd.c only
{
	char **list = 0, *s;
	int n = 0, dret, m = 0;
	gzFile fp = (strcmp(fn, "-") == 0)? gzdopen(fileno(stdin), "r") : gzopen(fn, "r");
	kstream_t *ks;
	kstring_t *str;
	str = (kstring_t*)calloc(1, sizeof(kstring_t));
	ks = ks_init(fp);
	while (ks_getuntil(ks, '\n', str, &dret) > 0) {
		if (n == m) {
			m = m? m << 1 : 16;
			list = (char**)realloc(list, m * sizeof(char*));
		}
		if (str->s[str->l-1] == '\r')
			str->s[--str->l] = '\0';
		s = list[n++] = (char*)calloc(str->l + 1, 1);
		strcpy(s, str->s);
	}
	ks_destroy(ks);
	gzclose(fp);
	free(str->s); free(str);
	*_n = n;
	return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, -0x40(%rbp)
cmpb $0x2d, (%rdi)
jne 0x6d0d
cmpb $0x0, 0x1(%rdi)
je 0x6e17
leaq 0x468e(%rip), %rsi      # 0xb3a2
callq 0x34f0
movq %rax, %rbx
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x31c0
movq %rax, %r15
movq %rbx, -0x38(%rbp)
movq %rbx, %rdi
callq 0x6e39
movq %rax, %rbx
xorl %r14d, %r14d
pushq $0xa
popq %r13
xorl %r12d, %r12d
movq $0x0, -0x30(%rbp)
movq %rbx, %rdi
movl %r13d, %esi
movq %r15, %rdx
leaq -0x44(%rbp), %rcx
callq 0x6e6a
testl %eax, %eax
jle 0x6ddb
movl %r12d, %eax
cmpq %rax, %r14
jne 0x6d97
movq %rbx, %r13
leal (%r12,%r12), %ebx
testl %r12d, %r12d
pushq $0x10
popq %rax
cmovel %eax, %ebx
movslq %ebx, %rsi
shlq $0x3, %rsi
movq -0x30(%rbp), %rdi
callq 0x3590
movq %rax, -0x30(%rbp)
movl %ebx, %r12d
movq %r13, %rbx
pushq $0xa
popq %r13
movq (%r15), %rdi
movq 0x10(%r15), %rax
cmpb $0xd, -0x1(%rax,%rdi)
jne 0x6db4
leaq -0x1(%rdi), %rcx
movq %rcx, (%r15)
movb $0x0, -0x1(%rax,%rdi)
movq %rcx, %rdi
incq %rdi
pushq $0x1
popq %rsi
callq 0x31c0
movq -0x30(%rbp), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
movq 0x10(%r15), %rsi
movq %rax, %rdi
callq 0x32c0
jmp 0x6d4b
movq %rbx, %rdi
callq 0x7115
movq -0x38(%rbp), %rdi
callq 0x35a0
movq 0x10(%r15), %rdi
callq 0x33d0
movq %r15, %rdi
callq 0x33d0
movq -0x40(%rbp), %rax
movl %r14d, (%rax)
movq -0x30(%rbp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x81a2(%rip), %rax      # 0xefc0
movq (%rax), %rdi
callq 0x3360
leaq 0x4575(%rip), %rsi      # 0xb3a2
movl %eax, %edi
callq 0x35e0
jmp 0x6d19
// File: /workspace/github_c_makefile_star2_O2/skoren[P]bacValidation/bamcat.c
// Function: sam_header_parse
int sam_header_parse(bam_header_t *h)
{
	char **tmp;
	int i;
	free(h->target_len); free(h->target_name);
	h->n_targets = 0; h->target_len = 0; h->target_name = 0;
	if (h->l_text < 3) return 0;
	if (h->dict == 0) h->dict = sam_header_parse2(h->text);
	tmp = sam_header2list(h->dict, "SQ", "SN", &h->n_targets);
	if (h->n_targets == 0) return 0;
	h->target_name = calloc(h->n_targets, sizeof(void*));
	for (i = 0; i < h->n_targets; ++i)
		h->target_name[i] = strdup(tmp[i]);
	free(tmp);
	tmp = sam_header2list(h->dict, "SQ", "LN", &h->n_targets);
	h->target_len = calloc(h->n_targets, 4);
	for (i = 0; i < h->n_targets; ++i)
		h->target_len[i] = atoi(tmp[i]);
	free(tmp);
	return h->n_targets;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x33d0
movq 0x8(%rbx), %rdi
callq 0x33d0
andl $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
xorl %r14d, %r14d
cmpl $0x3, 0x30(%rbx)
jb 0x7257
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
jne 0x718d
movq 0x38(%rbx), %rdi
callq 0x7269
movq %rax, %rdi
movq %rax, 0x18(%rbx)
leaq 0x4199(%rip), %rsi      # 0xb32d
leaq 0x4195(%rip), %rdx      # 0xb330
movq %rbx, %rcx
callq 0x7587
movslq (%rbx), %r12
testq %r12, %r12
je 0x7257
movq %rax, %r15
leaq 0x8(%rbx), %r14
pushq $0x8
popq %rsi
movq %r12, %rdi
callq 0x31c0
movq %rax, (%r14)
xorl %r13d, %r13d
testl %r12d, %r12d
movq %r12, %rax
movl $0x0, %r12d
cmovgl %eax, %r12d
cmpq %r13, %r12
je 0x71f1
movq (%r15,%r13,8), %rdi
callq 0x3600
movq (%r14), %rcx
movq %rax, (%rcx,%r13,8)
incq %r13
jmp 0x71d7
movq %r15, %rdi
callq 0x33d0
movq 0x18(%rbx), %rdi
leaq 0x4129(%rip), %rsi      # 0xb32d
leaq 0x4128(%rip), %rdx      # 0xb333
movq %rbx, %rcx
callq 0x7587
movq %rax, %r15
movl (%rbx), %r14d
movslq %r14d, %r12
pushq $0x4
popq %rsi
movq %r12, %rdi
callq 0x31c0
movq %rax, %r13
movq %rax, 0x10(%rbx)
xorl %ebx, %ebx
testl %r12d, %r12d
cmovlel %ebx, %r12d
cmpq %rbx, %r12
je 0x724f
movq (%r15,%rbx,8), %rdi
callq 0x3540
movl %eax, (%r13,%rbx,4)
incq %rbx
jmp 0x7237
movq %r15, %rdi
callq 0x33d0
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq