LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/utils.c
// Function: copy_file
long copy_file(const char *src_name, const char *dst_name)
{
   unsigned char *buf;
   long bytes_written;
   long bytes_read;

   bytes_read = read_file(src_name, &buf);

   if (bytes_read > 0) {
      bytes_written = write_file(dst_name, buf, bytes_read);
      if (bytes_written != bytes_read) {
         bytes_read = -1;
      }
      free(buf);
   }

   return bytes_read;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
leaq -0x20(%rbp), %rsi
callq 0x2e55
movq %rax, %rbx
testq %rax, %rax
jle 0x30c7
movq -0x20(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2f03
cmpq %rbx, %rax
movq $-0x1, %rax
cmovneq %rax, %rbx
movq %r15, %rdi
callq 0x1040
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/utils.c
// Function: dir_list_ext
void dir_list_ext(const char *dir, const char *extension, dir_list *list)
{
   char *pool;
   char *pool_ptr;
   struct dirent *entry;
   DIR *dfd;
   int idx;

   dfd = opendir(dir);
   if (dfd == NULL) {
      ERROR("Can't open '%s'\n", dir);
      exit(1);
   }

   pool = malloc(FILENAME_MAX * MAX_DIR_FILES);
   pool_ptr = pool;

   idx = 0;
   while ((entry = readdir(dfd)) != NULL && idx < MAX_DIR_FILES) {
      if (!extension || str_ends_with(entry->d_name, extension)) {
         sprintf(pool_ptr, "%s/%s", dir, entry->d_name);
         list->files[idx] = pool_ptr;
         pool_ptr += strlen(pool_ptr) + 1;
         idx++;
      }
   }
   list->count = idx;

   closedir(dfd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
callq 0x10c0
testq %rax, %rax
je 0x31ae
movq %rax, %r14
movl $0x80000, %edi          # imm = 0x80000
callq 0x11c0
movq %rax, %r13
movq %r14, %rdi
callq 0x11b0
testq %rax, %rax
je 0x318a
movq %rax, %rbx
xorl %r15d, %r15d
testq %r12, %r12
je 0x3137
leaq 0x13(%rbx), %rdi
movq %r12, %rsi
callq 0x31b7
testl %eax, %eax
je 0x316f
addq $0x13, %rbx
movq %r13, %rdi
leaq 0xff9e(%rip), %rsi      # 0x130e3
movq -0x30(%rbp), %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1250
movslq %r15d, %r15
movq -0x38(%rbp), %rax
movq %r13, (%rax,%r15,8)
movq %r13, %rdi
callq 0x10d0
addq %rax, %r13
incq %r13
incl %r15d
movq %r14, %rdi
callq 0x11b0
testq %rax, %rax
je 0x318d
movq %rax, %rbx
cmpl $0x80, %r15d
jl 0x3122
jmp 0x318d
xorl %r15d, %r15d
movq -0x38(%rbp), %rax
movl %r15d, 0x400(%rax)
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1130
movq -0x30(%rbp), %rdi
callq 0x12b0
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/utils.c
// Function: str_ends_with
int str_ends_with(const char *str, const char *suffix)
{
   if (!str || !suffix) {
      return 0;
   }
   size_t len_str = strlen(str);
   size_t len_suffix = strlen(suffix);
   if (len_suffix > len_str) {
      return 0;
   }
   return (0 == strncmp(str + len_str - len_suffix, suffix, len_suffix));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
xorl %r15d, %r15d
orb %al, %cl
jne 0x320d
movq %rsi, %rbx
movq %rdi, %r14
callq 0x10d0
movq %rax, %r12
movq %rbx, %rdi
callq 0x10d0
cmpq %r12, %rax
ja 0x320d
addq %r12, %r14
subq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1060
xorl %r15d, %r15d
testl %eax, %eax
sete %r15b
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/./stb/stb_image_write.h
// Function: stbi_write_hdr_core
static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data)
{
   if (y <= 0 || x <= 0 || data == NULL)
      return 0;
   else {
      // Each component is stored separately. Allocate scratch space for full output scanline.
      unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4);
      int i, len;
      char buffer[128];
      char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
      s->func(s->context, header, sizeof(header)-1);

#ifdef STBI_MSC_SECURE_CRT
      len = sprintf_s(buffer, "EXPOSURE=          1.0000000000000\n\n-Y %d +X %d\n", y, x);
#else
      len = sprintf(buffer, "EXPOSURE=          1.0000000000000\n\n-Y %d +X %d\n", y, x);
#endif
      s->func(s->context, buffer, len);

      for(i=0; i < y; i++)
         stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i)*x);
      STBIW_FREE(scratch);
      return 1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %ecx, -0x2c(%rbp)
movl %edx, %r15d
movq %rdi, -0x40(%rbp)
testl %edx, %edx
setle %al
movq %rsi, -0x38(%rbp)
testl %esi, %esi
setle %cl
orb %al, %cl
testq %r8, %r8
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x561d
movq -0x38(%rbp), %rax
leal (,%rax,4), %edi
movq %r8, %r12
callq 0x11c0
movq %rax, %r14
leaq 0x10f50(%rip), %rsi     # 0x164c0
leaq -0x110(%rbp), %rax
movl $0x8, %ecx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movw $0xa, 0x40(%rax)
movq -0x40(%rbp), %r13
movq 0x8(%r13), %rdi
movq %rax, %rsi
movl $0x41, %edx
callq *(%r13)
leaq 0x10bea(%rip), %rsi     # 0x1618d
xorl %ebx, %ebx
leaq -0xc0(%rbp), %rdi
movl %r15d, %edx
movq -0x38(%rbp), %rcx
xorl %eax, %eax
callq 0x1250
movq 0x8(%r13), %rdi
leaq -0xc0(%rbp), %rsi
movl %eax, %edx
callq *(%r13)
movq -0x38(%rbp), %rax
movl %eax, %r13d
imull -0x2c(%rbp), %r13d
imull %eax, %r13d
decl %r15d
cmpl $0x0, 0x14c0f(%rip)     # 0x1a1f4
movl %r15d, %eax
cmovel %ebx, %eax
imull %r13d, %eax
cltq
leaq (%r12,%rax,4), %r8
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x2c(%rbp), %edx
movq %r14, %rcx
callq 0x51eb
incl %ebx
addl $-0x1, %r15d
jb 0x55de
movq %r14, %rdi
callq 0x1040
movl $0x1, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/./stb/stb_image_write.h
// Function: stbi_write_png
STBIWDEF int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes)
{
   FILE *f;
   int len;
   unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len);
   if (png == NULL) return 0;
#ifdef STBI_MSC_SECURE_CRT
   if (fopen_s(&f, filename, "wb"))
      f = NULL;
#else
   f = fopen(filename, "wb");
#endif
   if (!f) { STBIW_FREE(png); return 0; }
   fwrite(png, 1, len, f);
   fclose(f);
   STBIW_FREE(png);
   return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %r9d, %r10d
movl %ecx, %eax
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %r14
leaq -0x14(%rbp), %r9
movq %r8, %rdi
movl %r10d, %esi
movl %eax, %r8d
callq 0x5fd3
testq %rax, %rax
je 0x65f5
movq %rax, %rbx
leaq 0xcb08(%rip), %rsi      # 0x130c9
movq %r14, %rdi
callq 0x1220
testq %rax, %rax
je 0x65fa
movq %rax, %r14
movslq -0x14(%rbp), %rdx
movl $0x1, %esi
movq %rbx, %rdi
movq %rax, %rcx
callq 0x1270
movq %r14, %rdi
callq 0x10b0
movl $0x1, %r14d
jmp 0x65fd
xorl %r14d, %r14d
jmp 0x6605
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x1040
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/n64graphics_ci.c
// Function: raw2rgba
rgba *raw2rgba(const uint8_t *raw, int width, int height, int depth)
{
    rgba *img;
    int img_size;

    img_size = width * height * sizeof(*img);
    img = malloc(img_size);
    if (!img) {
        ERROR("Error allocating %d bytes\n", img_size);
        return NULL;
    }

    if (depth == 16) {
        for (int i = 0; i < width * height; i++) {
            img[i].red = SCALE_5_8((raw[i * 2] & 0xF8) >> 3);
            img[i].green = SCALE_5_8(((raw[i * 2] & 0x07) << 2) | ((raw[i * 2 + 1] & 0xC0) >> 6));
            img[i].blue = SCALE_5_8((raw[i * 2 + 1] & 0x3E) >> 1);
            img[i].alpha = (raw[i * 2 + 1] & 0x01) ? 0xFF : 0x00;
        }
    }
    else if (depth == 32) {
        for (int i = 0; i < width * height; i++) {
            img[i].red = raw[i * 4];
            img[i].green = raw[i * 4 + 1];
            img[i].blue = raw[i * 4 + 2];
            img[i].alpha = raw[i * 4 + 3];
        }
    }

    return img;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r12d
movl %esi, %r15d
movq %rdi, %r14
imull %edx, %r15d
leal (,%r15,4), %r13d
movslq %r13d, %rdi
callq 0x11c0
testq %rax, %rax
je 0x6f62
movq %rax, %rbx
cmpl $0x10, %r12d
je 0x6ebd
cmpl $0x20, %r12d
jne 0x6f7f
testl %r15d, %r15d
jle 0x6f7f
movl %r15d, %eax
xorl %ecx, %ecx
movb (%r14,%rcx,4), %dl
movb %dl, (%rbx,%rcx,4)
movb 0x1(%r14,%rcx,4), %dl
movb %dl, 0x1(%rbx,%rcx,4)
movb 0x2(%r14,%rcx,4), %dl
movb %dl, 0x2(%rbx,%rcx,4)
movb 0x3(%r14,%rcx,4), %dl
movb %dl, 0x3(%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x6e8e
jmp 0x6f7f
testl %r15d, %r15d
jle 0x6f7f
movl %r15d, %eax
xorl %ecx, %ecx
movl $0xffff, %edx           # imm = 0xFFFF
movzbl (%r14,%rcx,2), %edi
movl %edi, %esi
shrl $0x3, %esi
movl %esi, %r8d
shll $0x8, %r8d
subl %esi, %r8d
andl %edx, %r8d
imull $0x2109, %r8d, %esi     # imm = 0x2109
shrl $0x12, %esi
movb %sil, (%rbx,%rcx,4)
andl $0x7, %edi
movzbl 0x1(%r14,%rcx,2), %esi
movl %esi, %r8d
shrl $0x6, %r8d
leal (%r8,%rdi,4), %edi
movl %edi, %r8d
shll $0x8, %r8d
subl %edi, %r8d
andl %edx, %r8d
imull $0x2109, %r8d, %edi     # imm = 0x2109
shrl $0x12, %edi
movb %dil, 0x1(%rbx,%rcx,4)
movl %esi, %edi
shrl %edi
andl $0x1f, %edi
movl %edi, %r8d
shll $0x8, %r8d
subl %edi, %r8d
andl %edx, %r8d
imull $0x2109, %r8d, %edi     # imm = 0x2109
shrl $0x12, %edi
movb %dil, 0x2(%rbx,%rcx,4)
andb $0x1, %sil
negb %sil
movb %sil, 0x3(%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x6ed0
jmp 0x6f7f
movq 0x13087(%rip), %rax     # 0x19ff0
movq (%rax), %rdi
leaq 0xe513(%rip), %rsi      # 0x15486
xorl %ebx, %ebx
movl %r13d, %edx
xorl %eax, %eax
callq 0x1160
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_O1/DavidSM64[P]n64graphics_ci/n64graphics_ci.c
// Function: rawci2rgba
rgba *rawci2rgba(const uint8_t *rawci, const uint8_t *palette, int width, int height, int depth)
{
    uint8_t *raw_rgba;
    rgba *img = NULL;
    int raw_size;
    int pal_index_1;
    int pal_index_2;

    // first convert to raw RGBA
    raw_size = 2 * width * height;
    raw_rgba = malloc(raw_size);
    if (!raw_rgba) {
        ERROR("Error allocating %u bytes\n", raw_size);
        return NULL;
    }

    if (depth == 4) { // CI4
        for (int i = 0; i < (width * height) / 2; i++) {
            pal_index_1 = rawci[i] >> 4;
            pal_index_2 = rawci[i] & 0xF;
            raw_rgba[i * 4 + 0] = palette[pal_index_1 * 2 + 0];
            raw_rgba[i * 4 + 1] = palette[pal_index_1 * 2 + 1];
            raw_rgba[i * 4 + 2] = palette[pal_index_2 * 2 + 0];
            raw_rgba[i * 4 + 3] = palette[pal_index_2 * 2 + 1];
        }
    } else { // CI8
        for (int i = 0; i < width * height; i++) {
            pal_index_1 = rawci[i];
            raw_rgba[i * 2 + 0] = palette[pal_index_1 * 2 + 0];
            raw_rgba[i * 2 + 1] = palette[pal_index_1 * 2 + 1];
        }
    }

    // then convert to RGBA image data
    img = raw2rgba(raw_rgba, width, height, 16);

    free(raw_rgba);

    return img;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, -0x2c(%rbp)
movq %rsi, %r15
movq %rdi, %r13
movl %edx, -0x30(%rbp)
movl %edx, %ebx
movl %ecx, -0x34(%rbp)
imull %ecx, %ebx
leal (%rbx,%rbx), %r14d
movslq %r14d, %rdi
callq 0x11c0
testq %rax, %rax
je 0x707b
movq %rax, %r12
cmpl $0x4, -0x2c(%rbp)
jne 0x7023
cmpl $0x2, %ebx
jl 0x704b
shrl %ebx
xorl %eax, %eax
movzbl (%r13,%rax), %ecx
movl %ecx, %edx
shrl $0x3, %edx
movl %edx, %esi
andl $-0x2, %esi
movb (%r15,%rsi), %sil
movb %sil, (%r12,%rax,4)
orq $0x1, %rdx
movb (%r15,%rdx), %dl
movb %dl, 0x1(%r12,%rax,4)
andl $0xf, %ecx
movb (%r15,%rcx,2), %dl
movb %dl, 0x2(%r12,%rax,4)
movb 0x1(%r15,%rcx,2), %cl
movb %cl, 0x3(%r12,%rax,4)
incq %rax
cmpq %rax, %rbx
jne 0x6fde
jmp 0x704b
testl %ebx, %ebx
jle 0x704b
movl %ebx, %eax
xorl %ecx, %ecx
movzbl (%r13,%rcx), %edx
movb (%r15,%rdx,2), %sil
movb %sil, (%r12,%rcx,2)
movb 0x1(%r15,%rdx,2), %dl
movb %dl, 0x1(%r12,%rcx,2)
incq %rcx
cmpq %rcx, %rax
jne 0x702b
movq %r12, %rdi
movl -0x30(%rbp), %esi
movl -0x34(%rbp), %edx
movl $0x10, %ecx
callq 0x6e39
movq %rax, %rbx
movq %r12, %rdi
callq 0x1040
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12f6e(%rip), %rax     # 0x19ff0
movq (%rax), %rdi
leaq 0xe415(%rip), %rsi      # 0x154a1
movl %r14d, %edx
xorl %eax, %eax
callq 0x1160
xorl %eax, %eax
jmp 0x706c
// File: /workspace/github_c_makefile_star2_O1/DavidSM64[P]n64graphics_ci/n64graphics_ci.c
// Function: rgba2png
int rgba2png(const char *png_filename, const rgba *img, int width, int height)
{
    int ret = 0;
    INFO("Saving RGBA %dx%d to \"%s\"\n", width, height, png_filename);

    // convert to format stb_image_write expects
    uint8_t *data = malloc(4 * width*height);
    if (data) {
        for (int j = 0; j < height; j++) {
            for (int i = 0; i < width; i++) {
                int idx = j*width + i;
                data[4 * idx] = img[idx].red;
                data[4 * idx + 1] = img[idx].green;
                data[4 * idx + 2] = img[idx].blue;
                data[4 * idx + 3] = img[idx].alpha;
            }
        }

        ret = stbi_write_png(png_filename, width, height, 4, data, 0);

        free(data);
    }

    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r12
movq %rdi, %r15
leaq 0x12d4a(%rip), %rax     # 0x1a1d8
cmpl $0x0, (%rax)
je 0x74a9
leaq 0xe0a5(%rip), %rdi      # 0x1553f
movl %r14d, %esi
movl %ebx, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x10e0
movl %r14d, %eax
imull %ebx, %eax
shll $0x2, %eax
movslq %eax, %rdi
callq 0x11c0
testq %rax, %rax
je 0x756d
movq %rax, %r13
movq %r15, -0x30(%rbp)
testl %ebx, %ebx
jle 0x7546
movl %r14d, %eax
movl %ebx, %ecx
addq $0x3, %r12
leaq (,%rax,4), %rdx
leal (,%r14,4), %esi
xorl %edi, %edi
xorl %r8d, %r8d
testl %r14d, %r14d
jle 0x7539
movl %edi, %r9d
xorl %r10d, %r10d
movb -0x3(%r12,%r10,4), %r11b
movl %r9d, %r15d
movb %r11b, (%r13,%r15)
movb -0x2(%r12,%r10,4), %r11b
leal 0x1(%r9), %r15d
movb %r11b, (%r13,%r15)
movb -0x1(%r12,%r10,4), %r11b
leal 0x2(%r9), %r15d
movb %r11b, (%r13,%r15)
movb (%r12,%r10,4), %r11b
leal 0x3(%r9), %r15d
movb %r11b, (%r13,%r15)
incq %r10
addl $0x4, %r9d
cmpq %r10, %rax
jne 0x74f7
incq %r8
addq %rdx, %r12
addl %esi, %edi
cmpq %rcx, %r8
jne 0x74ec
movq -0x30(%rbp), %rdi
movl %r14d, %esi
movl %ebx, %edx
movl $0x4, %ecx
movq %r13, %r8
xorl %r9d, %r9d
callq 0x6589
movl %eax, %ebx
movq %r13, %rdi
callq 0x1040
movl %ebx, %eax
jmp 0x756f
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_O1/DavidSM64[P]n64graphics_ci/n64graphics_ci.c
// Function: getPaletteFilename
char* getPaletteFilename(char* ci_filename)
{
    int bin_filename_len;
    int extension_len;
    char* pal_bin_filename;
    char* extension_loc;
    char* extension;

    // Write Palette file
    bin_filename_len = strlen(ci_filename);
    extension_loc = strrchr(ci_filename, '.');
    extension_len = (int)(extension_loc - ci_filename);
    extension = malloc(extension_len);
    memcpy(extension, extension_loc, extension_len);
    pal_bin_filename = malloc(bin_filename_len + 4); // +4 to include ".pal"
    if (!pal_bin_filename) {
        ERROR("Error allocating bytes for palette filename\n");
    }
    memcpy(pal_bin_filename, ci_filename, bin_filename_len);
    strcpy(pal_bin_filename + bin_filename_len, ".pal");
    //strcpy(pal_bin_filename + bin_filename_len, extension);

    free(extension);

    return pal_bin_filename;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x10d0
movq %rax, %r14
shlq $0x20, %r14
movabsq $0x400000000, %rdi      # imm = 0x400000000
addq %r14, %rdi
sarq $0x20, %rdi
callq 0x11c0
movq %rax, %r15
testq %rax, %rax
je 0x75fd
sarq $0x20, %r14
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11a0
movl $0x6c61702e, (%r15,%r14) # imm = 0x6C61702E
movb $0x0, 0x4(%r15,%r14)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x1355
jmp 0x75cf
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]libcperciva/tests/sysendian/main.c
// Function: fill_testcases
static void
fill_testcases(struct tests * tests)
{
	uint16_t val16;
	uint32_t val32;
	uint64_t val64;
	size_t i;

	/* Load 16-bit tests. */
	for (i = 0; i < 2; i++) {
		tests->val16[i] = tests16[i].val;
		memcpy(&val16, tests16[i].be_arr, 2);
		tests->val16_be[i] = val16;
		memcpy(&val16, tests16[i].le_arr, 2);
		tests->val16_le[i] = val16;
	}

	/* Load 32-bit tests. */
	for (i = 0; i < 4; i++) {
		tests->val32[i] = tests32[i].val;
		memcpy(&val32, tests32[i].be_arr, 4);
		tests->val32_be[i] = val32;
		memcpy(&val32, tests32[i].le_arr, 4);
		tests->val32_le[i] = val32;
	}

	/* Load 64-bit tests. */
	for (i = 0; i < 8; i++) {
		tests->val64[i] = tests64[i].val;
		memcpy(&val64, tests64[i].be_arr, 8);
		tests->val64_be[i] = val64;
		memcpy(&val64, tests64[i].le_arr, 8);
		tests->val64_le[i] = val64;
	}
}

// Assembly:
leaq 0x431c(%rip), %rax      # 0x6104
xorl %ecx, %ecx
movzwl -0x4(%rax), %edx
movw %dx, (%rdi,%rcx,2)
movzwl -0x2(%rax), %edx
movw %dx, 0x4(%rdi,%rcx,2)
movzwl (%rax), %edx
movw %dx, 0x8(%rdi,%rcx,2)
incq %rcx
addq $0x6, %rax
cmpq $0x1, %rcx
je 0x1dea
movq $-0x10, %rax
leaq 0x42fa(%rip), %rcx      # 0x6118
movl -0x8(%rcx), %edx
movl %edx, 0x1c(%rdi,%rax)
movl -0x4(%rcx), %edx
movl %edx, 0x2c(%rdi,%rax)
movl (%rcx), %edx
movl %edx, 0x3c(%rdi,%rax)
addq $0xc, %rcx
addq $0x4, %rax
jne 0x1e1e
movq $-0x40, %rax
leaq 0x4306(%rip), %rcx      # 0x6150
movq -0x10(%rcx), %rdx
movq %rdx, 0x80(%rdi,%rax)
movq -0x8(%rcx), %rdx
movq %rdx, 0xc0(%rdi,%rax)
movq (%rcx), %rdx
movq %rdx, 0x100(%rdi,%rax)
addq $0x18, %rcx
addq $0x8, %rax
jne 0x1e4a
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]libcperciva/tests/sysendian/main.c
// Function: perftest_func
static int
perftest_func(void * cookie, uint8_t * buf, size_t buflen, size_t nreps)
{
	struct tests * tests = cookie;
	size_t nreps_i;

	(void)buf; /* UNUSED */

	if (buflen == 32) {
		for (nreps_i = 0; nreps_i < nreps; nreps_i++)
			PERFTEST_FULL(tests, 32);
	} else if (buflen == 64) {
		for (nreps_i = 0; nreps_i < nreps; nreps_i++)
			PERFTEST_FULL(tests, 64);
	}

	/* Success! */
	return (0);
}

// Assembly:
cmpq $0x20, %rdx
je 0x1ed0
cmpq $0x40, %rdx
jne 0x1f0a
testq %rcx, %rcx
je 0x1f0a
xorl %eax, %eax
xorl %edx, %edx
movq 0x40(%rdi,%rdx,8), %rsi
movq 0x40(%rdi,%rdx,8), %rsi
movq 0x80(%rdi,%rdx,8), %rsi
bswapq %rsi
movq %rsi, -0x8(%rsp)
movq 0xc0(%rdi,%rdx,8), %rsi
movq %rsi, -0x8(%rsp)
movq -0x8(%rsp), %rsi
incq %rdx
cmpq $0x8, %rdx
jne 0x1e91
incq %rax
cmpq %rcx, %rax
jne 0x1e8f
jmp 0x1f0a
testq %rcx, %rcx
je 0x1f0a
xorl %eax, %eax
movq $-0x10, %rdx
movl 0x1c(%rdi,%rdx), %esi
movl 0x1c(%rdi,%rdx), %esi
movl 0x2c(%rdi,%rdx), %esi
bswapl %esi
movl %esi, -0xc(%rsp)
movl 0x3c(%rdi,%rdx), %esi
movl %esi, -0xc(%rsp)
movl -0xc(%rsp), %esi
addq $0x4, %rdx
jne 0x1ede
incq %rax
cmpq %rcx, %rax
jne 0x1ed7
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]libcperciva/tests/sysendian/main.c
// Function: print_arr
static void
print_arr(const char * str, const uint8_t * arr, size_t n)
{
	size_t i;

	printf("%s", str);
	for (i = 0; i < n; i++)
		printf("%02x ", arr[i]);
	printf("\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
leaq 0x14bd(%rip), %rdi      # 0x33e2
xorl %eax, %eax
callq 0x10d0
testq %rbx, %rbx
je 0x1f52
leaq 0x1250(%rip), %r15      # 0x3188
xorl %r12d, %r12d
movzbl (%r14,%r12), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x10d0
incq %r12
cmpq %r12, %rbx
jne 0x1f3b
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1040
nop
// File: /workspace/github_c_makefile_star2_O1/smilingthax[P]libfontembed/main.c
// Function: main
int main(int argc,char **argv)
{
  const char *fn=TESTFONT;
  if (argc==2) {
    fn=argv[1];
  }
  OTF_FILE *otf=otf_load(fn);
  assert(otf);
  printf("width(4): %d\n",otf_get_width(otf,4));


  if (strcmp(fn,"test.ttf")!=0) {
    example_write_fontdescr(otf,"test.ttf");
  } else {
    example_write_fontdescr(otf,NULL);
  }

  // show_post(otf);

  // show_name(otf);

  // show_cmap(otf);
  // printf("%d %d\n",otf_from_unicode(otf,'A'),0);

  // ... name 6 -> FontName  /20(cid)
  // ? StemV Flags(?) from FontName

  otf_close(otf);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jne 0x3415
movq 0x8(%rsi), %r14
jmp 0x341c
leaq 0x6c82(%rip), %r14      # 0xa09e
movq %r14, %rdi
callq 0x3d3f
testq %rax, %rax
je 0x3484
movq %rax, %rbx
movq %rax, %rdi
movl $0x4, %esi
callq 0x4548
leaq 0x6cad(%rip), %rdi      # 0xa0ed
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
leaq 0x6cab(%rip), %rsi      # 0xa0fb
movq %r14, %rdi
callq 0x21e0
testl %eax, %eax
je 0x3468
leaq 0x6c98(%rip), %rsi      # 0xa0fb
movq %rbx, %rdi
jmp 0x346d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x309c
movq %rbx, %rdi
callq 0x3c70
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x6c47(%rip), %rdi      # 0xa0d2
leaq 0x6b77(%rip), %rsi      # 0xa009
leaq 0x6c3d(%rip), %rcx      # 0xa0d6
movl $0x94, %edx
callq 0x20e0
nop
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/run_hmmannot.c
// Function: annot_worker_for
static void annot_worker_for(void *_data, long i, int tid) // kt_for() callback
{
    annot_step_t *annot_s = (annot_step_t *) _data;
    int exit_code, wexit_st;

    char cmd[4096];
    sprintf(cmd, "%s --noali --cpu 1 -o /dev/null --tblout %s %s %s", annot_s->shared->nhmmscan, annot_s->temp_out[i], annot_s->shared->nhmmdb, annot_s->temp_in[i]);

    exit_code = run_system_cmd(cmd, 3);
    if (exit_code == -1) {
        fprintf(stderr, "[E::%s] failed to execute command: %s\n", __func__, cmd);
        exit(EXIT_FAILURE);
    }
    
    wexit_st = WEXITSTATUS(exit_code);
    if (wexit_st) {
        fprintf(stderr, "[E::%s] command with non-zero exit code: %d\n", __func__, wexit_st);
        exit(EXIT_FAILURE);
    }

    return;
}

// Assembly:
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq 0x18(%rdi), %rax
movq (%rax,%rsi,8), %rcx
movq (%rdi), %rax
movq 0x10(%rdi), %rdi
movq 0x8(%rax), %rdx
movq 0x10(%rax), %r8
movq (%rdi,%rsi,8), %r9
leaq 0x3901(%rip), %rsi      # 0x74cc
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2360
movq %rbx, %rdi
movl $0x3, %esi
callq 0x5443
cmpl $-0x1, %eax
je 0x3bfd
shrl $0x8, %eax
andl $0xff, %eax
jne 0x3c05
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
retq
movq %rsp, %rdi
callq 0x2637
movl %eax, %edi
callq 0x260d
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_db_destroy
void hmm_annot_db_destroy(hmm_annot_db_t *annot_db)
{
    if (!annot_db) return;
    size_t i;
    kh_str_t *h_gnames = (kh_str_t *) annot_db->h_gnames;
    kh_str_destroy(h_gnames);
    for (i = 0; i < annot_db->n_gene; ++i)
        free(annot_db->gnames[i]);
    free(annot_db->gnames);
    kh_str_t *h_snames = (kh_str_t *) annot_db->h_snames;
    kh_str_destroy(h_snames);
    for (i = 0; i < annot_db->n_seg; ++i)
        free(annot_db->snames[i]);
    free(annot_db->snames);
    free(annot_db->a);
    free(annot_db->index);
    free(annot_db);
}

// Assembly:
testq %rdi, %rdi
je 0x3cf0
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %r14
testq %r14, %r14
je 0x3c4d
movq 0x10(%r14), %rsi
movq 0x18(%r14), %r15
movq %r15, %rdi
callq 0x5842
movq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0x5842
movq %r15, %rdi
movq %r14, %rsi
callq 0x5842
cmpl $0x0, 0x18(%rbx)
je 0x3c6e
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2050
incq %r14
movl 0x18(%rbx), %eax
cmpq %rax, %r14
jb 0x3c56
movq 0x20(%rbx), %rdi
callq 0x2050
movq 0x38(%rbx), %r14
testq %r14, %r14
je 0x3ca7
movq 0x10(%r14), %rsi
movq 0x18(%r14), %r15
movq %r15, %rdi
callq 0x5842
movq 0x8(%r14), %rsi
movq %r15, %rdi
callq 0x5842
movq %r15, %rdi
movq %r14, %rsi
callq 0x5842
cmpl $0x0, 0x1c(%rbx)
je 0x3cc8
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2050
incq %r14
movl 0x1c(%rbx), %eax
cmpq %rax, %r14
jb 0x3cb0
movq 0x28(%rbx), %rdi
callq 0x2050
movq 0x10(%rbx), %rdi
callq 0x2050
movq 0x48(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2050
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_bed6_db_destroy
void hmm_annot_bed6_db_destroy(hmm_annot_bed6_db_t *annot_db)
{
    size_t i;
    for (i = 0; i < annot_db->n_seg; ++i)
        free(annot_db->snames[i]);
    free(annot_db->snames);
    free(annot_db->a);
    free(annot_db);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x18(%rdi)
je 0x3d27
xorl %r14d, %r14d
movq 0x28(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2050
incq %r14
cmpq 0x18(%rbx), %r14
jb 0x3d11
movq 0x28(%rbx), %rdi
callq 0x2050
movq 0x10(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_gname2id
uint32_t hmm_annot_gname2id(hmm_annot_db_t *annot_db, char *gname)
{
    kh_str_t *h_gnames;
    khint32_t k;
    h_gnames = (kh_str_t *) annot_db->h_gnames;
    k = kh_str_get(h_gnames, gname);
    return k < kh_end(h_gnames)? kh_val(h_gnames, k) : UINT32_MAX;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq 0x30(%rdi), %r9
movq 0x10(%r9), %r14
xorl %esi, %esi
movl $0x0, %edx
testq %r14, %r14
je 0x475b
movl (%r9), %ecx
movl $0x1, %r8d
shll %cl, %r8d
movsbl (%rbx), %eax
testl %eax, %eax
je 0x46f5
movb 0x1(%rbx), %dl
testb %dl, %dl
je 0x46f7
leaq 0x2(%rbx), %rsi
movl %eax, %edi
shll $0x5, %edi
subl %eax, %edi
movsbl %dl, %eax
addl %edi, %eax
movb (%rsi), %dl
incq %rsi
testb %dl, %dl
jne 0x46de
jmp 0x46f7
xorl %eax, %eax
imull $0x9e3779b9, %eax, %r12d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r12d
movq %r8, 0x10(%rsp)
leal -0x1(%r8), %ebp
movq %r9, 0x8(%rsp)
movq 0x8(%r9), %r15
movl %r12d, %r13d
movl %r13d, %eax
shrl $0x5, %eax
movl (%r15,%rax,4), %eax
btl %r13d, %eax
jae 0x474a
movl %r13d, %eax
leaq (%rax,%rax,2), %rax
movq (%r14,%rax,4), %rdi
movq %rbx, %rsi
callq 0x2200
testl %eax, %eax
je 0x4751
incl %r13d
andl %ebp, %r13d
cmpl %r12d, %r13d
jne 0x4718
movq 0x10(%rsp), %rdx
jmp 0x4754
movl %r13d, %edx
xorl %esi, %esi
movq 0x8(%rsp), %r9
testq %r14, %r14
je 0x476a
movb (%r9), %cl
movl $0x1, %esi
shll %cl, %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %esi, %edx
jae 0x477e
movl %edx, %eax
leaq (%rax,%rax,2), %rax
movl 0x8(%r14,%rax,4), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_sname2id
uint32_t hmm_annot_sname2id(hmm_annot_db_t *annot_db, char *sname)
{
    kh_str_t *h_snames;
    khint32_t k;
    h_snames = (kh_str_t *) annot_db->h_snames;
    k = kh_str_get(h_snames, sname);
    return k < kh_end(h_snames)? kh_val(h_snames, k) : UINT32_MAX;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq 0x38(%rdi), %r9
movq 0x10(%r9), %r14
xorl %esi, %esi
movl $0x0, %edx
testq %r14, %r14
je 0x4851
movl (%r9), %ecx
movl $0x1, %r8d
shll %cl, %r8d
movsbl (%rbx), %eax
testl %eax, %eax
je 0x47eb
movb 0x1(%rbx), %dl
testb %dl, %dl
je 0x47ed
leaq 0x2(%rbx), %rsi
movl %eax, %edi
shll $0x5, %edi
subl %eax, %edi
movsbl %dl, %eax
addl %edi, %eax
movb (%rsi), %dl
incq %rsi
testb %dl, %dl
jne 0x47d4
jmp 0x47ed
xorl %eax, %eax
imull $0x9e3779b9, %eax, %r12d # imm = 0x9E3779B9
negb %cl
shrl %cl, %r12d
movq %r8, 0x10(%rsp)
leal -0x1(%r8), %ebp
movq %r9, 0x8(%rsp)
movq 0x8(%r9), %r15
movl %r12d, %r13d
movl %r13d, %eax
shrl $0x5, %eax
movl (%r15,%rax,4), %eax
btl %r13d, %eax
jae 0x4840
movl %r13d, %eax
leaq (%rax,%rax,2), %rax
movq (%r14,%rax,4), %rdi
movq %rbx, %rsi
callq 0x2200
testl %eax, %eax
je 0x4847
incl %r13d
andl %ebp, %r13d
cmpl %r12d, %r13d
jne 0x480e
movq 0x10(%rsp), %rdx
jmp 0x484a
movl %r13d, %edx
xorl %esi, %esi
movq 0x8(%rsp), %r9
testq %r14, %r14
je 0x4860
movb (%r9), %cl
movl $0x1, %esi
shll %cl, %esi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %esi, %edx
jae 0x4874
movl %edx, %eax
leaq (%rax,%rax,2), %rax
movl 0x8(%r14,%rax,4), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_db_sort
void hmm_annot_db_sort(hmm_annot_db_t *annot_db, hmm_annot_so_t so)
{
    if (so == annot_db->so) return;
    switch(so) {
        case ORDER_GNAME:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc1);
            break;
        case ORDER_GID:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc2);
            break;
        case ORDER_SNAME:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc3);
            break;
        case ORDER_SID:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc4);
            break;
        case ORDER_SID_OG:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc5);
            break;
        case ORDER_SID_CO:
            qsort(annot_db->a, annot_db->n, sizeof(hmm_annot_t), hmm_annot_cmpfunc6);
            break;
        default:
            fprintf(stderr, "[E::%s] undefined sorting: %d\n", __func__, so);
            exit(EXIT_FAILURE);
    }
    annot_db->so = so;
    hmm_annot_db_sort_index(annot_db);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl %esi, 0x40(%rdi)
je 0x4ade
movl %esi, %r14d
leal -0x1(%r14), %eax
cmpl $0x6, %eax
jae 0x4ae4
movq %rdi, %rbx
movl %eax, %eax
leaq 0x5411(%rip), %rcx      # 0x9d90
movq (%rcx,%rax,8), %rcx
movq (%rdi), %rsi
movq 0x10(%rdi), %rdi
movl $0x50, %edx
callq 0x20d0
movl %r14d, 0x40(%rbx)
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x49a6
callq 0x2050
movq $0x0, 0x48(%rbx)
movl 0x40(%rbx), %edi
leal 0x1(%rdi), %eax
cmpl $0x7, %eax
ja 0x4aec
movl $0x17, %ecx
btl %eax, %ecx
jb 0x4ade
movl $0xe0, %ecx
btl %eax, %ecx
jae 0x4a47
movq 0x10(%rbx), %r15
movl 0x1c(%rbx), %r14d
movl $0x8, %esi
movq %r14, %rdi
callq 0x21f0
movl 0x4c(%r15), %edx
movq (%rbx), %rdi
cmpq $0x2, %rdi
jb 0x4abe
xorl %esi, %esi
movl $0x1, %ecx
movl $0x1, %r9d
movl %edx, %r8d
leaq (%r9,%r9,4), %rdx
shlq $0x4, %rdx
movl 0x4c(%r15,%rdx), %edx
cmpl %edx, %r8d
jne 0x4a22
movl %r8d, %edx
jmp 0x4a3b
movl %ecx, %r9d
subl %esi, %r9d
shlq $0x20, %rsi
orq %rsi, %r9
movl %r8d, %esi
movq %r9, (%rax,%rsi,8)
movl %ecx, %esi
movl %edx, %r8d
incl %ecx
movq %rcx, %r9
cmpq %rcx, %rdi
ja 0x4a0b
jmp 0x4ac5
movq 0x10(%rbx), %r15
movl 0x18(%rbx), %r14d
movl $0x8, %esi
movq %r14, %rdi
callq 0x21f0
movl $0x1fffffff, %edi       # imm = 0x1FFFFFFF
movl 0x48(%r15), %edx
andl %edi, %edx
movq (%rbx), %r8
cmpq $0x2, %r8
jb 0x4abe
xorl %esi, %esi
movl $0x1, %ecx
movl $0x1, %r10d
movl %edx, %r9d
leaq (%r10,%r10,4), %rdx
shlq $0x4, %rdx
movl 0x48(%r15,%rdx), %edx
andl %edi, %edx
cmpl %edx, %r9d
jne 0x4a99
movl %r9d, %edx
jmp 0x4ab2
movl %ecx, %r10d
subl %esi, %r10d
shlq $0x20, %rsi
orq %rsi, %r10
movl %r9d, %esi
movq %r10, (%rax,%rsi,8)
movl %ecx, %esi
movl %edx, %r9d
incl %ecx
movq %rcx, %r10
cmpq %rcx, %r8
ja 0x4a80
jmp 0x4ac5
movl $0x1, %ecx
xorl %esi, %esi
subl %esi, %ecx
shlq $0x20, %rsi
movl %ecx, %ecx
orq %rsi, %rcx
movl %edx, %edx
movq %rcx, (%rax,%rdx,8)
movq %rax, 0x48(%rbx)
movl %r14d, 0x44(%rbx)
popq %rbx
popq %r14
popq %r15
retq
movl %r14d, %edi
callq 0x268d
callq 0x26b7
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_cmpfunc5
static int hmm_annot_cmpfunc5(const void *a, const void *b)
{
    hmm_annot_t *x, *y;
    x = (hmm_annot_t *) a;
    y = (hmm_annot_t *) b;

    if (x->sid != y->sid)
        return (x->sid > y->sid) - (x->sid < y->sid);
    if (x->og_type != y->og_type)
        return (x->og_type > y->og_type) - (x->og_type < y->og_type);
    if (x->gid != y->gid)
        return (x->gid > y->gid) - (x->gid < y->gid);
    return (x->score < y->score) - (x->score > y->score);
}

// Assembly:
movl 0x4c(%rsi), %eax
cmpl %eax, 0x4c(%rdi)
jne 0x4b7d
movl 0x48(%rdi), %eax
movl %eax, %edx
shrl $0x1d, %edx
andl $0x3, %edx
movl 0x48(%rsi), %ecx
movl %ecx, %r8d
shrl $0x1d, %r8d
andl $0x3, %r8d
cmpl %r8d, %edx
jne 0x4b7d
movl $0x1fffffff, %edx       # imm = 0x1FFFFFFF
andl %edx, %eax
andl %edx, %ecx
cmpl %ecx, %eax
jne 0x4b7d
movsd 0x38(%rdi), %xmm0
movsd 0x38(%rsi), %xmm1
ucomisd %xmm0, %xmm1
seta %al
ucomisd %xmm1, %xmm0
seta %cl
jmp 0x4b83
seta %al
setb %cl
movzbl %al, %eax
movzbl %cl, %ecx
subl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_db_index_query
hmm_annot_t *hmm_annot_db_index_query(hmm_annot_db_t *annot_db, uint32_t id, uint32_t *n)
{
    hmm_annot_t *q = 0;
    *n = 0;
    if (id < annot_db->n_idx) {
        q = &annot_db->a[annot_db->index[id] >> 32];
        *n = (uint32_t) annot_db->index[id];
    }
    return q;
}

// Assembly:
movl $0x0, (%rdx)
cmpl %esi, 0x44(%rdi)
jbe 0x4bdc
movq 0x48(%rdi), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rcx
movq %rcx, %rax
shrq $0x20, %rax
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
addq 0x10(%rdi), %rax
movl %ecx, (%rdx)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_formatted_print_index_list
void hmm_annot_formatted_print_index_list(hmm_annot_db_t *annot_db, uint64_t *index_list, size_t n, FILE *fo,
        OG_TYPE_t og_type, double max_evalue, int header)
{
    uint32_t i, j, n_annot;
    int score;
    hmm_annot_t *annot;
    hmm_annot_db_sort(annot_db, ORDER_SID_CO);
    if (header)
        print_hmm_annot_bed6_header(fo);
    for (i = 0; i < n; ++i) {
        annot = hmm_annot_db_index_query(annot_db, index_list[i], &n_annot);
        for (j = 0; j < n_annot; ++j) {
            if (annot[j].og_type != (uint32_t) og_type || 
                    annot[j].evalue > max_evalue) continue;
            score = lround(annot[j].score);
            score = MIN(score, MAX_BED_SCORE);
            fprintf(fo, "%s\t%u\t%u\t%s\t%d\t%c\n", annot[j].sname, annot[j].alifrom, 
                    annot[j].alito, annot[j].gname, score, annot[j].strand? '-' : '+');
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movsd %xmm0, 0x20(%rsp)
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, (%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl $0x6, %esi
callq 0x4955
testl %ebp, %ebp
je 0x4cba
leaq 0x29e5(%rip), %rsi      # 0x7690
movq %r14, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x2220
movq %r14, 0x18(%rsp)
cmpq $0x0, (%rsp)
je 0x4dad
movl $0x3e8, %r12d           # imm = 0x3E8
xorl %eax, %eax
xorl %r15d, %r15d
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rax
movq 0x8(%rsp), %rdx
cmpl %eax, 0x44(%rdx)
jbe 0x4d07
movl %eax, %eax
movq 0x48(%rdx), %rcx
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,4), %r13
shlq $0x4, %r13
addq 0x10(%rdx), %r13
jmp 0x4d0c
xorl %eax, %eax
xorl %r13d, %r13d
testl %eax, %eax
je 0x4d9d
movl %eax, %eax
shlq $0x4, %rax
leaq (%rax,%rax,4), %rbp
xorl %r14d, %r14d
movl 0x48(%r13,%r14), %eax
shrl $0x1d, %eax
andl $0x3, %eax
cmpl %ebx, %eax
jne 0x4d94
movsd 0x30(%r13,%r14), %xmm0
ucomisd 0x20(%rsp), %xmm0
ja 0x4d94
movsd 0x38(%r13,%r14), %xmm0
callq 0x20e0
movq %rax, %r10
cmpl %r12d, %r10d
cmovgel %r12d, %r10d
movq (%r13,%r14), %r9
movq 0x8(%r13,%r14), %rdx
movl 0x18(%r13,%r14), %ecx
movl 0x1c(%r13,%r14), %r8d
movl 0x48(%r13,%r14), %eax
shrl $0x1f, %eax
leal 0x2b(,%rax,2), %r11d
movq 0x18(%rsp), %rdi
leaq 0x28a2(%rip), %rsi      # 0x7627
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x2220
addq $0x10, %rsp
addq $0x50, %r14
cmpq %r14, %rbp
jne 0x4d21
incl %r15d
movq %r15, %rax
cmpq (%rsp), %r15
jb 0x4cd5
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_formatted_print_sname_list
void hmm_annot_formatted_print_sname_list(hmm_annot_db_t *annot_db, char **sname_list, size_t n, FILE *fo,
        OG_TYPE_t og_type, double max_evalue, int header)
{
    uint32_t i, j, n_annot;
    int score;
    hmm_annot_t *annot;
    hmm_annot_db_sort(annot_db, ORDER_SID_CO);
    if (header)
        print_hmm_annot_bed6_header(fo);
    for (i = 0; i < n; ++i) {
        annot = hmm_annot_db_sname_query(annot_db, sname_list[i], &n_annot);
        for (j = 0; j < n_annot; ++j) {
            if (annot[j].og_type != (uint32_t) og_type ||
                    annot[j].evalue > max_evalue) continue;
            score = lround(annot[j].score);
            score = MIN(score, MAX_BED_SCORE);
            fprintf(fo, "%s\t%u\t%u\t%s\t%d\t%c\n", annot[j].sname, annot[j].alifrom,
                    annot[j].alito, annot[j].gname, score, annot[j].strand? '-' : '+');
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movsd %xmm0, 0x20(%rsp)
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, (%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r13
movl $0x6, %esi
callq 0x4955
testl %ebp, %ebp
je 0x4e09
leaq 0x2896(%rip), %rsi      # 0x7690
movq %r14, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x2220
movq %r14, 0x18(%rsp)
cmpq $0x0, (%rsp)
je 0x4f09
movl $0x3e8, %r12d           # imm = 0x3E8
xorl %eax, %eax
xorl %r15d, %r15d
movq %r13, 0x8(%rsp)
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r13, %rdi
callq 0x478d
cmpl %eax, 0x44(%r13)
jbe 0x4e5f
movq 0x48(%r13), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rax
movq %rax, %rcx
shrq $0x20, %rcx
leaq (%rcx,%rcx,4), %rbp
shlq $0x4, %rbp
addq 0x10(%r13), %rbp
jmp 0x4e63
xorl %eax, %eax
xorl %ebp, %ebp
testl %eax, %eax
je 0x4ef4
movl %eax, %eax
shlq $0x4, %rax
leaq (%rax,%rax,4), %r13
xorl %r14d, %r14d
movl 0x48(%rbp,%r14), %eax
shrl $0x1d, %eax
andl $0x3, %eax
cmpl %ebx, %eax
jne 0x4eeb
movsd 0x30(%rbp,%r14), %xmm0
ucomisd 0x20(%rsp), %xmm0
ja 0x4eeb
movsd 0x38(%rbp,%r14), %xmm0
callq 0x20e0
movq %rax, %r10
cmpl %r12d, %r10d
cmovgel %r12d, %r10d
movq (%rbp,%r14), %r9
movq 0x8(%rbp,%r14), %rdx
movl 0x18(%rbp,%r14), %ecx
movl 0x1c(%rbp,%r14), %r8d
movl 0x48(%rbp,%r14), %eax
shrl $0x1f, %eax
leal 0x2b(,%rax,2), %r11d
movq 0x18(%rsp), %rdi
leaq 0x274b(%rip), %rsi      # 0x7627
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x2220
addq $0x10, %rsp
addq $0x50, %r14
cmpq %r14, %r13
jne 0x4e78
incl %r15d
movq %r15, %rax
cmpq (%rsp), %r15
movq 0x8(%rsp), %r13
jb 0x4e29
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: hmm_annot_print_bed6
void hmm_annot_print_bed6(hmm_annot_bed6_db_t *annots, FILE *fo, int header)
{
    if (!annots->n) return;

    if (header)
        print_hmm_annot_bed6_header(fo);
    size_t i;
    hmm_annot_bed6_t *bed6;
    
    qsort(annots->a, annots->n, sizeof(hmm_annot_bed6_t), annot_bed6_cmpfunc);
    
    for (i = 0; i < annots->n; ++i) {
        bed6 = &annots->a[i];
        fprintf(fo, "%s\t%u\t%u\t%s\t%d\t%c\n", bed6->sname, bed6->alifrom,
                bed6->alito, bed6->gname, bed6->score, bed6->strand);
    }
}

// Assembly:
cmpq $0x0, (%rdi)
je 0x5200
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0x5186
leaq 0x2519(%rip), %rsi      # 0x7690
movq %rbx, %rdi
movl $0x3e8, %edx            # imm = 0x3E8
xorl %eax, %eax
callq 0x2220
movq (%r14), %rsi
movq 0x10(%r14), %rdi
leaq 0x6d(%rip), %rcx        # 0x5201
movl $0x20, %edx
callq 0x20d0
cmpq $0x0, (%r14)
je 0x51f7
movl $0x1c, %r12d
leaq 0x2476(%rip), %r15      # 0x7627
xorl %r13d, %r13d
movq 0x10(%r14), %rax
movl -0x8(%rax,%r12), %ecx
movl -0x4(%rax,%r12), %r8d
movq -0x1c(%rax,%r12), %rdx
movq -0x14(%rax,%r12), %r9
movl (%rax,%r12), %r10d
movsbl -0xc(%rax,%r12), %r11d
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x2220
addq $0x10, %rsp
incq %r13
addq $0x20, %r12
cmpq (%r14), %r13
jb 0x51b4
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/hmmannot.c
// Function: annot_bed6_cmpfunc
static int annot_bed6_cmpfunc(const void *a, const void *b)
{
    hmm_annot_bed6_t *x, *y;
    x = (hmm_annot_bed6_t *) a;
    y = (hmm_annot_bed6_t *) b;
    int c;
    c = strcmp(x->sname, y->sname);
    if (c) return c;
    c = (x->alifrom > y->alifrom) - (x->alifrom < y->alifrom);
    if (c) return c;
    return (x->alito > y->alito) - (x->alito < y->alito);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
movq (%rsi), %rsi
callq 0x2200
testl %eax, %eax
jne 0x523a
movl 0x14(%r14), %ecx
xorl %eax, %eax
cmpl 0x14(%rbx), %ecx
seta %al
sbbl $0x0, %eax
jne 0x523a
movl 0x18(%r14), %ecx
xorl %eax, %eax
cmpl 0x18(%rbx), %ecx
seta %al
sbbl $0x0, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/misc.c
// Function: make_tempfile
char *make_tempfile(char *temp_dir, char *file_template, const char *suffix)
{
    sprintf(file_template, "%s/tmpXXXXXXXXXX%s", temp_dir, suffix);
    int ret = mkstemps(file_template, strlen(suffix));
    if (ret >= 0) {
        // need to close the file descriptor
        close(ret);
        return strdup(file_template);
    }
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rdx
leaq 0x22e0(%rip), %rsi      # 0x76e0
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x2360
movq %r14, %rdi
callq 0x2130
movq %rbx, %rdi
movl %eax, %esi
callq 0x2030
testl %eax, %eax
js 0x5439
movl %eax, %edi
callq 0x21b0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x23b0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/misc.c
// Function: check_executable
void check_executable(char *exe)
{
    char cmd[4096];
    sprintf(cmd, "command -v %s 1>/dev/null 2>/dev/null", exe);

    int exit_code = run_system_cmd(cmd, 1);
    if (exit_code == -1 || WEXITSTATUS(exit_code)) {
        fprintf(stderr, "[E::%s] executable %s is not available\n", __func__, exe);
        exit(EXIT_FAILURE);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
leaq 0x2271(%rip), %rsi      # 0x76f3
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2360
movq %r14, %rdi
callq 0x2140
testl $0xff00, %eax           # imm = 0xFF00
jne 0x54ac
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
movq %rbx, %rdi
callq 0x26e1
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/misc.c
// Function: open_outstream
FILE *open_outstream(char *prefix, char *suffix)
{
    FILE *fo;
    char *out;

    MYMALLOC(out, strlen(prefix) + strlen(suffix) + 1);
    sprintf(out, "%s%s", prefix, suffix);
    fo = fopen(out, "w");
    if (!fo) {
        fprintf(stderr, "[E::%s] failed to open file '%s' to write: %s\n", __func__, out, strerror(errno));
        exit(EXIT_FAILURE);
    }
    free(out);

    return fo;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x2130
movq %rax, %rbx
movq %r14, %rdi
callq 0x2130
leaq (%rbx,%rax), %rdi
incq %rdi
callq 0x2280
movq %rax, %rbx
leaq 0x21b8(%rip), %rsi      # 0x7752
movq %rax, %rdi
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x2360
leaq 0x1d9a(%rip), %rsi      # 0x734b
movq %rbx, %rdi
callq 0x2310
testq %rax, %rax
je 0x55d2
movq %rax, %r14
movq %rbx, %rdi
callq 0x2050
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x270c
// File: /workspace/github_c_makefile_star2_O1/c-zhou[P]oatk/kthread.c
// Function: kt_forpool_init
void *kt_forpool_init(int n_threads)
{
	kt_forpool_t *fp;
	int i;
	fp = (kt_forpool_t*)calloc(1, sizeof(kt_forpool_t));
	fp->n_threads = fp->n_pending = n_threads;
	fp->tid = (pthread_t*)calloc(fp->n_threads, sizeof(pthread_t));
	fp->w = (kto_worker_t*)calloc(fp->n_threads, sizeof(kto_worker_t));
	for (i = 0; i < fp->n_threads; ++i) fp->w[i].t = fp;
	pthread_mutex_init(&fp->mutex, 0);
	pthread_cond_init(&fp->cv_m, 0);
	pthread_cond_init(&fp->cv_s, 0);
	for (i = 0; i < fp->n_threads; ++i) pthread_create(&fp->tid[i], 0, kt_fp_worker, &fp->w[i]);
	pthread_mutex_lock(&fp->mutex);
	while (fp->n_pending) pthread_cond_wait(&fp->cv_m, &fp->mutex);
	pthread_mutex_unlock(&fp->mutex);
	return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebp
movl $0x1, %edi
movl $0xb8, %esi
callq 0x21f0
movq %rax, %rbx
movl %ebp, 0x4(%rax)
movl %ebp, (%rax)
movslq %ebp, %r14
movl $0x8, %esi
movq %r14, %rdi
callq 0x21f0
movq %rax, 0x10(%rbx)
movl $0x18, %esi
movq %r14, %rdi
callq 0x21f0
movq %rax, 0x18(%rbx)
testl %r14d, %r14d
jle 0x5def
movl %ebp, %ecx
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rcx
xorl %edx, %edx
movq %rbx, (%rax,%rdx)
addq $0x18, %rdx
cmpq %rdx, %rcx
jne 0x5de2
leaq 0x30(%rbx), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x23d0
leaq 0x58(%rbx), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x2250
movq %rbx, %rdi
addq $0x88, %rdi
xorl %esi, %esi
callq 0x2250
cmpl $0x0, (%rbx)
jle 0x5e58
xorl %r13d, %r13d
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x10(%rbx), %rdi
addq %r13, %rdi
movq 0x18(%rbx), %rcx
addq %rbp, %rcx
xorl %esi, %esi
leaq 0x4d(%rip), %rdx        # 0x5e8d
callq 0x22e0
incq %r12
movslq (%rbx), %rax
addq $0x18, %rbp
addq $0x8, %r13
cmpq %rax, %r12
jl 0x5e29
movq %r14, %rdi
callq 0x23e0
cmpl $0x0, 0x4(%rbx)
je 0x5e73
movq %r15, %rdi
movq %r14, %rsi
callq 0x2100
jmp 0x5e60
movq %r14, %rdi
callq 0x2260
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq