LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/screen.c
// Function: hed_scr_flush
void hed_scr_flush(void)
{
  if (screen->out_buf_len > 0) {
    size_t pos = 0;
    while (pos < screen->out_buf_len) {
      ssize_t n = write(screen->term_fd, screen->out_buf + pos, screen->out_buf_len - pos);
      if (n < 0) {
        if (errno != EINTR)
          break;
      } else if (n == 0)
        break;
      pos += n;
    }
    screen->out_buf_len = 0;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x7372(%rip), %rax      # 0xa1c0
cmpq $0x0, 0x518(%rax)
je 0x2eb3
xorl %r14d, %r14d
movq 0x735e(%rip), %rax      # 0xa1c0
movq 0x518(%rax), %rdx
subq %r14, %rdx
jbe 0x2ea1
movl (%rax), %edi
leaq (%rax,%r14), %rsi
addq $0x111, %rsi            # imm = 0x111
callq 0x20b0
movq %rax, %rbx
testq %rax, %rax
js 0x2e91
je 0x2e9b
addq %rbx, %r14
movb $0x1, %al
jmp 0x2e9d
callq 0x2040
cmpl $0x4, (%rax)
je 0x2e8a
xorl %eax, %eax
testb %al, %al
jne 0x2e5b
movq 0x7318(%rip), %rax      # 0xa1c0
movq $0x0, 0x518(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/screen.c
// Function: hed_scr_out
void hed_scr_out(const char *fmt, ...)
{
  static char buf[1024];

  va_list ap;
  va_start(ap, fmt);
  vsnprintf(buf, sizeof(buf), fmt, ap);
  va_end(ap);

  size_t len = strlen(buf);
  if (screen->out_buf_len + len > sizeof(screen->out_buf))
    hed_scr_flush();
  memcpy(screen->out_buf + screen->out_buf_len, buf, len);
  screen->out_buf_len += len;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x2f1c
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rdi, 0x10(%rcx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x728d(%rip), %rbx      # 0xa1d0
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r10, %rdx
callq 0x20a0
movq %rbx, %rdi
callq 0x20e0
movq %rax, %rbx
movq 0x725b(%rip), %rax      # 0xa1c0
movq %rbx, %rcx
addq 0x518(%rax), %rcx
cmpq $0x401, %rcx            # imm = 0x401
jb 0x2f7d
callq 0x2e43
movq 0x723c(%rip), %r14      # 0xa1c0
movq 0x518(%r14), %rax
leaq (%r14,%rax), %rdi
addq $0x111, %rdi            # imm = 0x111
leaq 0x7233(%rip), %rsi      # 0xa1d0
movq %rbx, %rdx
callq 0x21b0
addq %rbx, 0x518(%r14)
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/screen.c
// Function: hed_scr_set_color
void hed_scr_set_color(int c1, int c2)
{
  if (c1 >= 0)
    hed_scr_out("\x1b[%dm", c1);
  if (c2 >= 0)
    hed_scr_out("\x1b[%dm", c2);
}

// Assembly:
pushq %rbx
movl %esi, %ebx
testl %edi, %edi
js 0x319b
movl %edi, %esi
leaq 0x41cf(%rip), %rdi      # 0x7363
xorl %eax, %eax
callq 0x2ebb
testl %ebx, %ebx
js 0x31b0
leaq 0x41bd(%rip), %rdi      # 0x7363
movl %ebx, %esi
xorl %eax, %eax
popq %rbx
jmp 0x2ebb
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/screen.c
// Function: hed_scr_move_cursor
void hed_scr_move_cursor(int x, int y)
{
  if (x < 1) x = 1;
  if (y < 1) y = 1;
  if (x > screen->w) x = screen->w;
  if (y > screen->h) y = screen->h;
  hed_scr_out("\x1b[%d;%dH", y, x);
}

// Assembly:
cmpl $0x2, %edi
movl $0x1, %eax
cmovll %eax, %edi
cmpl $0x2, %esi
cmovll %eax, %esi
movq 0x6f9e(%rip), %rax      # 0xa1c0
movl 0x4(%rax), %edx
movl 0x8(%rax), %eax
cmpl %edx, %edi
cmovll %edi, %edx
cmpl %eax, %esi
cmovgel %eax, %esi
leaq 0x414f(%rip), %rdi      # 0x7388
xorl %eax, %eax
jmp 0x2ebb
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: hed_new_file_from_data
struct hed_file *hed_new_file_from_data(uint8_t *data, size_t data_len)
{
  struct hed_file *file = new_file();
  if (! file)
    return NULL;
  
  file->data = data;
  file->data_len = data_len;
  file->modified = (data != NULL);
  return file;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x48, %edi
callq 0x21d0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x1a(%rax)
movups %xmm0, 0x34(%rax)
movl $0x0, 0x44(%rax)
testq %rax, %rax
je 0x32bf
movq %rbx, 0x10(%rax)
movq %r14, 0x18(%rax)
testq %rbx, %rbx
setne 0x28(%rax)
jmp 0x32c1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: hed_free_file
void hed_free_file(struct hed_file *file)
{
  if (file->filename)
    free(file->filename);
  if (file->data)
    free(file->data);
  free(file);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x32db
callq 0x2030
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x32e9
callq 0x2030
movq %rbx, %rdi
popq %rbx
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: hed_read_file
struct hed_file *hed_read_file(const char *filename)
{
  FILE *f = fopen(filename, "r");
  if (! f) {
    show_msg("ERROR: can't open file '%s'", filename);
    return NULL;
  }

  uint8_t *data = NULL;
  char *new_filename = malloc(strlen(filename) + 1);
  if (! new_filename) {
    show_msg("ERROR: out of memory");
    goto err;
  }
  strcpy(new_filename, filename);
  
  if (fseek(f, 0, SEEK_END) < 0) {
    show_msg("ERROR: can't determine file size");
    goto err;
  }
  long size = ftell(f);
  if (size < 0 || (unsigned long) size > SIZE_MAX) {
    show_msg("ERROR: file is too large");
    goto err;
  }
  if (fseek(f, 0, SEEK_SET) == -1) {
    show_msg("ERROR: can't seek to start of file");
    goto err;
  }
  data = malloc((size_t) size);
  if (! data) {
    show_msg("ERROR: not enough memory for %ld bytes", size);
    goto err;
  }
  
  if (fread(data, 1, size, f) != (size_t) size) {
    show_msg("ERROR: error reading file");
    goto err;
  }
  
  struct hed_file *file = new_file();
  if (! file) {
    show_msg("ERROR: error reading file");
    goto err;
  }
  file->data = data;
  file->data_len = size;
  file->filename = new_filename;
  fclose(f);
  return file;

 err:
  if (new_filename)
    free(new_filename);
  if (data)
    free(data);
  fclose(f);
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r15
leaq 0x43d7(%rip), %rsi      # 0x76dc
callq 0x2240
testq %rax, %rax
je 0x33f3
movq %rax, %rbx
movq %r15, %rdi
callq 0x20e0
leaq 0x1(%rax), %rdi
callq 0x21d0
movq %rax, %r14
testq %rax, %rax
je 0x3409
movq %r14, %rdi
movq %r15, %rsi
callq 0x2050
movq %rbx, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x21f0
testl %eax, %eax
js 0x3412
movq %rbx, %rdi
callq 0x2180
testq %rax, %rax
js 0x341b
movq %rax, %r12
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21f0
cmpl $-0x1, %eax
je 0x3424
movq %r12, %rdi
callq 0x21d0
testq %rax, %rax
je 0x3470
movq %rax, %r15
movl $0x1, %esi
movq %rax, %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2090
cmpq %r12, %rax
jne 0x3467
movl $0x48, %edi
callq 0x21d0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x1a(%rax)
movups %xmm0, 0x34(%rax)
movl $0x0, 0x44(%rax)
testq %rax, %rax
je 0x3467
movq %rax, %r13
movq %r15, 0x10(%rax)
movq %r12, 0x18(%rax)
movq %r14, 0x20(%rax)
movq %rbx, %rdi
callq 0x20c0
jmp 0x345a
leaq 0x3fae(%rip), %rdi      # 0x73a8
xorl %r13d, %r13d
movq %r15, %rsi
xorl %eax, %eax
callq 0x2d46
jmp 0x345a
leaq 0x3fb4(%rip), %rdi      # 0x73c4
jmp 0x342b
leaq 0x3fc0(%rip), %rdi      # 0x73d9
jmp 0x342b
leaq 0x3fd8(%rip), %rdi      # 0x73fa
jmp 0x342b
leaq 0x3fe8(%rip), %rdi      # 0x7413
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2d46
testq %r14, %r14
je 0x3442
movq %r14, %rdi
callq 0x2030
testq %r15, %r15
je 0x344f
movq %r15, %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x20c0
xorl %r13d, %r13d
movq %r13, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x3fef(%rip), %rdi      # 0x745d
jmp 0x342e
leaq 0x3fbf(%rip), %rdi      # 0x7436
xorl %r15d, %r15d
movq %r12, %rsi
xorl %eax, %eax
callq 0x2d46
jmp 0x3435
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: hed_write_file
int hed_write_file(struct hed_file *file, const char *filename)
{
  if (! file->data)
    return 0;

  char *new_filename = NULL;
  if (! file->filename || strcmp(filename, file->filename) != 0) {
    new_filename = malloc(strlen(filename) + 1);
    if (! new_filename)
      return show_msg("ERROR: out of memory");
    strcpy(new_filename, filename);
  }
  
  FILE *f = fopen(filename, "w");
  if (! f) {
    free(new_filename);
    return show_msg("ERROR: can't open file '%s'", filename);
  }
  if (fwrite(file->data, 1, file->data_len, f) != file->data_len) {
    free(new_filename);
    fclose(f);
    return show_msg("ERROR: can't write file '%s'", filename);
  }
  fclose(f);
  show_msg("File saved: '%s'", filename);
  file->modified = false;

  if (new_filename) {
    if (file->filename)
      free(file->filename);
    file->filename = new_filename;
  }
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x10(%rdi)
je 0x355d
movq %rsi, %rbx
movq %rdi, %r14
movq 0x20(%rdi), %rsi
testq %rsi, %rsi
je 0x34b4
movq %rbx, %rdi
callq 0x2150
testl %eax, %eax
je 0x34f3
movq %rbx, %rdi
callq 0x20e0
leaq 0x1(%rax), %rdi
callq 0x21d0
testq %rax, %rax
je 0x34da
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
jmp 0x34f6
leaq 0x3ee3(%rip), %rdi      # 0x73c4
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2d46
xorl %r15d, %r15d
leaq 0x3f7a(%rip), %rsi      # 0x7477
movq %rbx, %rdi
callq 0x2240
testq %rax, %rax
je 0x356b
movq %rax, %r12
movq 0x10(%r14), %rdi
movq 0x18(%r14), %rdx
movl $0x1, %esi
movq %rax, %rcx
callq 0x22a0
cmpq 0x18(%r14), %rax
jne 0x357c
movq %r12, %rdi
callq 0x20c0
leaq 0x3f5f(%rip), %rdi      # 0x7496
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2d46
movb $0x0, 0x28(%r14)
testq %r15, %r15
je 0x355d
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x3559
callq 0x2030
movq %r15, 0x20(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r15, %rdi
callq 0x2030
leaq 0x3e2e(%rip), %rdi      # 0x73a8
jmp 0x3593
movq %r15, %rdi
callq 0x2030
movq %r12, %rdi
callq 0x20c0
leaq 0x3ee6(%rip), %rdi      # 0x7479
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2d46
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: get_file_u32
bool get_file_u32(struct hed_file *file, size_t pos, uint32_t *data)
{
  if (! file->data || pos + 4 > file->data_len) return false;

  if (file->endianess == HED_DATA_LITTLE_ENDIAN) {
    *data = (((uint32_t) file->data[pos+3] << 24) |
             ((uint32_t) file->data[pos+2] << 16) |
             ((uint32_t) file->data[pos+1] <<  8) |
             ((uint32_t) file->data[pos+0] <<  0));
  } else {
    *data = (((uint32_t) file->data[pos+0] << 24) |
             ((uint32_t) file->data[pos+1] << 16) |
             ((uint32_t) file->data[pos+2] <<  8) |
             ((uint32_t) file->data[pos+3] <<  0));
  }
  return true;
}

// Assembly:
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3618
leaq 0x4(%rsi), %rcx
cmpq 0x18(%rdi), %rcx
jbe 0x361b
xorl %eax, %eax
retq
addq %rsi, %rax
cmpl $0x0, 0x2c(%rdi)
je 0x3642
movzbl (%rax), %ecx
shll $0x18, %ecx
movzbl 0x1(%rax), %esi
shll $0x10, %esi
orl %ecx, %esi
movzbl 0x2(%rax), %ecx
shll $0x8, %ecx
orl %esi, %ecx
addq $0x3, %rax
jmp 0x365b
movzbl 0x3(%rax), %ecx
shll $0x18, %ecx
movzbl 0x2(%rax), %esi
shll $0x10, %esi
orl %ecx, %esi
movzbl 0x1(%rax), %ecx
shll $0x8, %ecx
orl %esi, %ecx
movzbl (%rax), %eax
orl %ecx, %eax
movl %eax, (%rdx)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: get_file_u64
bool get_file_u64(struct hed_file *file, size_t pos, uint64_t *data)
{
  if (! file->data || pos + 8 > file->data_len) return false;

  if (file->endianess == HED_DATA_LITTLE_ENDIAN) {
    *data = (((uint64_t) file->data[pos+7] << 56) |
             ((uint64_t) file->data[pos+6] << 48) |
             ((uint64_t) file->data[pos+5] << 40) |
             ((uint64_t) file->data[pos+4] << 32) |
             ((uint64_t) file->data[pos+3] << 24) |
             ((uint64_t) file->data[pos+2] << 16) |
             ((uint64_t) file->data[pos+1] <<  8) |
             ((uint64_t) file->data[pos+0] <<  0));
  } else {
    *data = (((uint64_t) file->data[pos+0] << 56) |
             ((uint64_t) file->data[pos+1] << 48) |
             ((uint64_t) file->data[pos+2] << 40) |
             ((uint64_t) file->data[pos+3] << 32) |
             ((uint64_t) file->data[pos+4] << 24) |
             ((uint64_t) file->data[pos+5] << 16) |
             ((uint64_t) file->data[pos+6] <<  8) |
             ((uint64_t) file->data[pos+7] <<  0));
  }
  return true;
}

// Assembly:
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3678
leaq 0x8(%rsi), %rcx
cmpq 0x18(%rdi), %rcx
jbe 0x367b
xorl %eax, %eax
retq
addq %rsi, %rax
cmpl $0x0, 0x2c(%rdi)
je 0x36d0
movzbl (%rax), %ecx
shlq $0x38, %rcx
movzbl 0x1(%rax), %esi
shlq $0x30, %rsi
orq %rcx, %rsi
movzbl 0x2(%rax), %ecx
shlq $0x28, %rcx
orq %rsi, %rcx
movzbl 0x3(%rax), %esi
shlq $0x20, %rsi
orq %rcx, %rsi
movzbl 0x4(%rax), %ecx
shll $0x18, %ecx
orq %rsi, %rcx
movzbl 0x5(%rax), %esi
shll $0x10, %esi
orq %rcx, %rsi
movzbl 0x6(%rax), %ecx
shll $0x8, %ecx
orq %rsi, %rcx
addq $0x7, %rax
jmp 0x3717
movzbl 0x7(%rax), %ecx
shlq $0x38, %rcx
movzbl 0x6(%rax), %esi
shlq $0x30, %rsi
orq %rcx, %rsi
movzbl 0x5(%rax), %ecx
shlq $0x28, %rcx
orq %rsi, %rcx
movzbl 0x4(%rax), %esi
shlq $0x20, %rsi
orq %rcx, %rsi
movzbl 0x3(%rax), %ecx
shll $0x18, %ecx
orq %rsi, %rcx
movzbl 0x2(%rax), %esi
shll $0x10, %esi
orq %rcx, %rsi
movzbl 0x1(%rax), %ecx
shll $0x8, %ecx
orq %rsi, %rcx
movzbl (%rax), %eax
orq %rcx, %rax
movq %rax, (%rdx)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: get_file_f32
bool get_file_f32(struct hed_file *file, size_t pos, float *data)
{
  if (! file->data || pos + 4 > file->data_len) return false;
  if (is_cpu_float_little_endian() == (file->endianess == HED_DATA_LITTLE_ENDIAN)) {
    memcpy(data, &file->data[pos], 4);
    return true;
  }
  uint8_t buf[4] = { file->data[pos+3], file->data[pos+2], file->data[pos+1], file->data[pos+0] };
  memcpy(data, buf, 4);
  return true;
}

// Assembly:
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3736
leaq 0x4(%rsi), %rcx
cmpq 0x18(%rdi), %rcx
jbe 0x3739
xorl %eax, %eax
retq
cmpb $0x0, 0x6e90(%rip)      # 0xa5d0
jne 0x3749
movb $0x1, 0x6e87(%rip)      # 0xa5d0
cmpb $0x1, 0x6e80(%rip)      # 0xa5d0
jne 0x375f
cmpl $0x0, 0x2c(%rdi)
jne 0x375f
movl (%rax,%rsi), %eax
movl %eax, (%rdx)
jmp 0x377d
movb 0x3(%rax,%rsi), %cl
movb 0x2(%rax,%rsi), %dil
movb (%rax,%rsi), %r8b
movb 0x1(%rax,%rsi), %al
movb %cl, (%rdx)
movb %dil, 0x1(%rdx)
movb %al, 0x2(%rdx)
movb %r8b, 0x3(%rdx)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file.c
// Function: get_file_f64
bool get_file_f64(struct hed_file *file, size_t pos, double *data)
{
  if (! file->data || pos + 8 > file->data_len) return false;

  if (is_cpu_float_little_endian() == (file->endianess == HED_DATA_LITTLE_ENDIAN)) {
    memcpy(data, &file->data[pos], 8);
    return true;
  }
  uint8_t buf[8] = {
    file->data[pos+7], file->data[pos+6], file->data[pos+5], file->data[pos+4],
    file->data[pos+3], file->data[pos+2], file->data[pos+1], file->data[pos+0],
  };
  memcpy(data, buf, 8);
  return true;
}

// Assembly:
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3793
leaq 0x8(%rsi), %rcx
cmpq 0x18(%rdi), %rcx
jbe 0x3796
xorl %eax, %eax
retq
cmpb $0x0, 0x6e33(%rip)      # 0xa5d0
jne 0x37a6
movb $0x1, 0x6e2a(%rip)      # 0xa5d0
cmpb $0x1, 0x6e23(%rip)      # 0xa5d0
jne 0x37bf
cmpl $0x0, 0x2c(%rdi)
jne 0x37bf
movq (%rax,%rsi), %rax
movq %rax, (%rdx)
movb $0x1, %al
retq
pushq %rbx
movb 0x7(%rax,%rsi), %cl
movb 0x6(%rax,%rsi), %dil
movb 0x5(%rax,%rsi), %r8b
movb 0x4(%rax,%rsi), %r9b
movb 0x3(%rax,%rsi), %r10b
movb 0x2(%rax,%rsi), %r11b
movb (%rax,%rsi), %bl
movb 0x1(%rax,%rsi), %al
movb %cl, (%rdx)
movb %dil, 0x1(%rdx)
movb %r8b, 0x2(%rdx)
movb %r9b, 0x3(%rdx)
movb %r10b, 0x4(%rdx)
movb %r11b, 0x5(%rdx)
movb %al, 0x6(%rdx)
movb %bl, 0x7(%rdx)
movb $0x1, %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/utf8.c
// Function: utf8_prev
const void *utf8_prev(const void *start, const void *str)
{
  const uint8_t *s = str;

  s--;
  while ((const void *)s > start && (*s & 0xc0) == 0x80) {
    s--;
  }
  const void *last = s;
  const void *next;
  while ((next = utf8_next(last)) != NULL && next < str) {
    last = next;
  }
  return last;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq -0x1(%rsi), %rcx
movq %rcx, %rax
cmpq %rdi, %rcx
jbe 0x382b
movb (%rax), %dl
andb $-0x40, %dl
leaq -0x1(%rax), %rcx
negb %dl
jo 0x380f
jmp 0x382b
cmpq %rbx, %rax
jae 0x383b
movq %rax, %r14
movq %rax, %rdi
callq 0x3846
testq %rax, %rax
jne 0x3826
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/utf8.c
// Function: utf8_next
const void *utf8_next(const void *str)
{
  const uint8_t *s = str;

  if (*s == 0)
    return NULL;
  
  if ((s[0] & 0x80) == 0) {
    return s + 1;
  }
  
  if ((s[0] & 0xe0) == 0xc0) {
    if ((s[1] & 0xc0) != 0x80)
      return s + 1;
    uint32_t val = ((s[0] & 0x1f) << 6) | (s[1] & 0x3f);
    if (val <= 0x7f)
      return s + 1;
    return s + 2;
  }

  if ((s[0] & 0xf0) == 0xe0) {
    if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80)
      return s + 1;
    uint32_t val = ((s[0] & 0x0f) << 12) | ((s[1] & 0x3f) << 6) | (s[2] & 0x3f);
    if (val <= 0x7ff)
      return s + 1;
    return s + 3;
  }

  if ((s[0] & 0xf8) == 0xf0) {
    if ((s[1] & 0xc0) != 0x80 || (s[2] & 0xc0) != 0x80 || (s[3] & 0xc0) != 0x80)
      return s + 1;
    uint32_t val = ((s[0] & 0x07) << 18) | ((s[1] & 0x3f) << 12) | ((s[2] & 0x3f) << 6) | (s[3] & 0x3f);
    if (val <= 0xffff || val > 0x10ffff)
      return s + 1;
    return s + 4;
  }

  return s + 1;
}

// Assembly:
movzbl (%rdi), %ecx
testl %ecx, %ecx
je 0x3858
testb %cl, %cl
js 0x385b
incq %rdi
movq %rdi, %rax
retq
xorl %eax, %eax
retq
movl %ecx, %eax
andl $-0x20, %eax
cmpl $0xc0, %eax
jne 0x3885
leaq 0x1(%rdi), %rax
movb 0x1(%rdi), %dl
andb $-0x40, %dl
negb %dl
jno 0x3924
addq $0x2, %rdi
testb $0x1e, %cl
cmovneq %rdi, %rax
retq
movl %ecx, %eax
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0x38c7
leaq 0x1(%rdi), %rax
movzbl 0x1(%rdi), %edx
movl %edx, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x3924
movb 0x2(%rdi), %sil
andb $-0x40, %sil
negb %sil
jno 0x3924
shll $0xc, %ecx
movzwl %cx, %ecx
andl $0x20, %edx
shll $0x6, %edx
addq $0x3, %rdi
orl %ecx, %edx
jmp 0x3880
movl %ecx, %edx
andl $-0x8, %edx
leaq 0x1(%rdi), %rax
cmpl $0xf0, %edx
jne 0x3924
movzbl (%rax), %edx
movl %edx, %esi
andl $-0x40, %esi
cmpl $0x80, %esi
jne 0x3924
movb 0x2(%rdi), %sil
andb $-0x40, %sil
negb %sil
jno 0x3924
movb 0x3(%rdi), %sil
andb $-0x40, %sil
negb %sil
jno 0x3924
andl $0x7, %ecx
shll $0x12, %ecx
andl $0x30, %edx
shll $0xc, %edx
addl %edx, %ecx
addl $0xffef0000, %ecx       # imm = 0xFFEF0000
addq $0x4, %rdi
cmpl $0xfff00000, %ecx       # imm = 0xFFF00000
cmovaeq %rdi, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file_sel.c
// Function: compare_files
static int compare_files(const void *p1, const void *p2)
{
  const struct file_item *f1 = *(struct file_item **)p1;
  const struct file_item *f2 = *(struct file_item **)p2;
  if (f1->is_file == f2->is_file)
    return strcmp(f1->filename, f2->filename);
  return (! f1->is_file) ? -1 : 1;
}

// Assembly:
movq (%rdi), %rdi
movq (%rsi), %rsi
movb 0x18(%rdi), %al
cmpb 0x18(%rsi), %al
jne 0x424f
addq $0x28, %rdi
addq $0x28, %rsi
jmp 0x2150
movzbl %al, %eax
decl %eax
orl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file_sel.c
// Function: move_sel_page_up
static void move_sel_page_up(struct file_sel *fs)
{
  struct hed_screen *scr = &fs->editor->screen;
  size_t n_page_lines = scr->h - 1 - EDITOR_BORDER_LINES;

  for (size_t i = 0; i < n_page_lines; i++) {
    if (fs->sel->prev)
      fs->sel = fs->sel->prev;
    else
      break;
  }
  if (fs->sel->index < fs->top_line) {
    if (fs->sel->index > n_page_lines/2)
      fs->top_line = fs->sel->index - n_page_lines/2;
    else
      fs->top_line = 0;
  }
  scr->redraw_needed = true;
}

// Assembly:
movq (%rdi), %rax
movslq 0x110(%rax), %rcx
addq $-0x6, %rcx
testl %ecx, %ecx
je 0x4283
movq 0x28(%rdi), %rdx
movq %rcx, %rsi
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
je 0x4283
movq %rdx, 0x28(%rdi)
decq %rsi
jne 0x4271
movq 0x28(%rdi), %rdx
movq 0x10(%rdx), %rdx
cmpq 0x30(%rdi), %rdx
jae 0x42a1
shrq %rcx
xorl %esi, %esi
subq %rcx, %rdx
cmovaeq %rdx, %rsi
movq %rsi, 0x30(%rdi)
movb $0x1, 0x115(%rax)
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/file_sel.c
// Function: move_sel_page_down
static void move_sel_page_down(struct file_sel *fs)
{
  struct hed_screen *scr = &fs->editor->screen;
  size_t n_page_lines = scr->h - 1 - EDITOR_BORDER_LINES;

  for (size_t i = 0; i < n_page_lines; i++) {
    if (fs->sel->next)
      fs->sel = fs->sel->next;
    else
      break;
  }
  if (fs->top_line + n_page_lines - 1 < fs->sel->index) {
    if (fs->sel->index > n_page_lines/2)
      fs->top_line = fs->sel->index - n_page_lines/2;
    else
      fs->top_line = 0;
  }
  scr->redraw_needed = true;
}

// Assembly:
movq (%rdi), %rax
movslq 0x110(%rax), %rcx
addq $-0x6, %rcx
testl %ecx, %ecx
je 0x42d3
movq 0x28(%rdi), %rdx
movq %rcx, %rsi
movq (%rdx), %rdx
testq %rdx, %rdx
je 0x42d3
movq %rdx, 0x28(%rdi)
decq %rsi
jne 0x42c2
movq 0x28(%rdi), %rdx
movq 0x30(%rdi), %rsi
addq %rcx, %rsi
decq %rsi
movq 0x10(%rdx), %rdx
cmpq %rdx, %rsi
jae 0x42fa
shrq %rcx
xorl %esi, %esi
subq %rcx, %rdx
cmovaeq %rdx, %rsi
movq %rsi, 0x30(%rdi)
movb $0x1, 0x115(%rax)
retq
nop
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: hed_add_file
void hed_add_file(struct hed_editor *editor, struct hed_file *file)
{
  // close current file if it's the only one and it's empty
  if (editor->file && editor->file == editor->file->next && ! editor->file->data)
    close_current_file(editor);
  
  if (! editor->file) {
    file->next = file;
    file->prev = file;
    editor->file = file;
    return;
  }
  
  file->next = editor->file;
  file->prev = editor->file->prev;
  file->prev->next = file;
  file->next->prev = file;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x628(%rdi), %r14
movq 0x628(%rdi), %rax
testq %rax, %rax
je 0x434f
cmpq (%rax), %rax
jne 0x434f
cmpq $0x0, 0x10(%rax)
jne 0x434f
callq 0x4380
movq (%r14), %rax
testq %rax, %rax
je 0x436e
movq %rax, (%rbx)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rbx)
movq %rbx, (%rax)
movq (%rbx), %r14
addq $0x8, %r14
jmp 0x4375
movq %rbx, (%rbx)
movq %rbx, 0x8(%rbx)
movq %rbx, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: close_current_file
static void close_current_file(struct hed_editor *editor)
{
  struct hed_file *file = editor->file;
  if (! file)
    return;
  if (file->next == file) {
    hed_free_file(file);
    editor->file = NULL;
    return;
  }
  
  file->next->prev = file->prev;
  file->prev->next = file->next;
  editor->file = file->next;
  hed_free_file(file);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x628(%rdi), %rdi
testq %rdi, %rdi
je 0x43c7
movq (%rdi), %rax
cmpq %rdi, %rax
je 0x43b7
movq 0x8(%rdi), %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rdi), %rcx
movq %rax, (%rcx)
movq (%rdi), %rax
movq %rax, 0x628(%rbx)
popq %rbx
jmp 0x32c9
callq 0x32c9
movq $0x0, 0x628(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: hed_draw_key_help
void hed_draw_key_help(int x, int y, const char *key, const char *help)
{
  move_cursor(x, y);
  set_color(FG_BLACK, BG_GRAY);
  out("%s", key);
  reset_color();
  out(" %s", help);

  size_t txt_len = strlen(key) + strlen(help) + 1;
  for (size_t i = txt_len; i < EDITOR_KEY_HELP_SPACING-1; i++)
    out(" ");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
callq 0x320a
movl $0x1e, %edi
movl $0x2f, %esi
callq 0x3184
leaq 0x353f(%rip), %rdi      # 0x792d
movq %r14, %rsi
xorl %eax, %eax
callq 0x2ebb
callq 0x31ee
leaq 0x3528(%rip), %rdi      # 0x792c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2ebb
movq %r14, %rdi
callq 0x20e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x20e0
movq %rax, %rbx
addq %r14, %rax
incq %rax
cmpq $0xe, %rax
ja 0x444d
addq %r14, %rbx
leaq 0x33a5(%rip), %r14      # 0x77df
movq %r14, %rdi
xorl %eax, %eax
callq 0x2ebb
incq %rbx
cmpq $0xe, %rbx
jb 0x443a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: hed_set_cursor_pos
void hed_set_cursor_pos(struct hed_editor *editor, size_t pos, size_t visible_len_after)
{
  struct hed_screen *scr = &editor->screen;
  struct hed_file *file = editor->file;
  size_t n_page_lines = get_num_displayed_file_lines(editor);
  size_t last_line = file->data_len / 16 + (file->data_len % 16 != 0);

  if (pos >= file->data_len)
    pos = (file->data_len == 0) ? 0 : file->data_len-1;
  if (pos + visible_len_after >= file->data_len)
    visible_len_after = file->data_len - pos;
  
  file->cursor_pos = pos;

  // If the cursor or 'visible_len_after' bytes after it are not visible,
  // center the screen vertically around the cursor
  if (! (file->cursor_pos / 16 >= file->top_line
         && (file->cursor_pos+visible_len_after) / 16 >= file->top_line
         && file->cursor_pos / 16 <= file->top_line + n_page_lines
         && (file->cursor_pos+visible_len_after) / 16 <= file->top_line + n_page_lines)) {
    if (file->cursor_pos / 16 < n_page_lines/2)
      file->top_line = 0;
    else {
      file->top_line = file->cursor_pos / 16 - n_page_lines/2;
      if (file->top_line + n_page_lines > last_line)
        file->top_line = last_line - n_page_lines;
    }
  }
  scr->redraw_needed = true;
}

// Assembly:
pushq %r14
pushq %rbx
movq 0x628(%rdi), %rax
movzbl 0x29(%rax), %ecx
movslq 0x110(%rdi), %r8
xorq $0x1, %rcx
leaq (%rcx,%rcx,4), %rcx
addq %rcx, %r8
addq $-0xa, %r8
movq 0x18(%rax), %r10
movq 0x40(%rax), %r9
movq %r10, %rcx
shrq $0x4, %rcx
movl %r10d, %r11d
andl $0xf, %r11d
cmpq $0x1, %r11
sbbq $-0x1, %rcx
xorl %r11d, %r11d
movq %r10, %rbx
subq $0x1, %rbx
cmovaeq %rbx, %r11
cmpq %rsi, %r10
cmovaq %rsi, %r11
movq %r11, 0x38(%rax)
movq %r11, %rsi
shrq $0x4, %rsi
cmpq %r9, %rsi
jb 0x44ea
leaq (%r11,%rdx), %r14
movq %r10, %rbx
subq %r11, %rbx
cmpq %r10, %r14
cmovbq %rdx, %rbx
addq %r11, %rbx
shrq $0x4, %rbx
cmpq %r9, %rbx
jae 0x4517
movq %r8, %rdx
shrq %rdx
subq %rdx, %rsi
jae 0x44f9
xorl %ecx, %ecx
jmp 0x4508
movq %rsi, 0x40(%rax)
addq %r8, %rsi
cmpq %rcx, %rsi
jbe 0x450c
subq %r8, %rcx
movq %rcx, 0x40(%rax)
movb $0x1, 0x115(%rdi)
popq %rbx
popq %r14
retq
addq %r8, %r9
cmpq %r9, %rsi
ja 0x44ea
cmpq %r9, %rbx
jbe 0x450c
jmp 0x44ea
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: prompt_save_file
static int prompt_save_file(struct hed_editor *editor)
{
  char filename[256];
  if (editor->file->filename)
    snprintf(filename, sizeof(filename), "%s", editor->file->filename);
  else
    filename[0] = '\0';
  if (prompt_get_filename(editor, "Write file", filename, sizeof(filename)) < 0) {
    editor->screen.redraw_needed = true;
    return -1;
  }
  editor->screen.redraw_needed = true;
  return hed_write_file(editor->file, filename);
}

// Assembly:
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rdi, %rbx
movq 0x628(%rdi), %rax
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x5a5c
leaq 0x1ee2(%rip), %rdx      # 0x792d
movq %rsp, %rdi
movl $0x100, %esi            # imm = 0x100
xorl %eax, %eax
callq 0x2100
jmp 0x5a60
movb $0x0, (%rsp)
movl $0x1, 0x104(%rbx)
leaq 0x20ad(%rip), %rsi      # 0x7b1e
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x5e83
movb $0x1, 0x115(%rbx)
testl %eax, %eax
js 0x5a98
movq 0x628(%rbx), %rdi
movq %rsp, %rsi
callq 0x3486
jmp 0x5a9d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x100, %rsp            # imm = 0x100
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: perform_search
static int perform_search(struct hed_editor *editor)
{
  struct hed_file *file = editor->file;

  size_t search_len = strlen(editor->search_str);
  uint8_t *search_bytes;
  uint8_t search_buf[sizeof(editor->search_str)];
  if (file->pane == HED_PANE_TEXT) {
    search_bytes = (uint8_t *) editor->search_str;
  } else {
    search_len = conv_search_bytes(search_buf, sizeof(search_buf), editor->search_str);
    if (search_len == 0)
      return show_msg("Invalid byte sequence (must be a list pairs of hex numbers)");
    search_bytes = search_buf;
  }

  // TODO: Boyer-Moore search?
  bool found = false;
  size_t pos;
  for (pos = file->cursor_pos+1; pos + search_len < file->data_len; pos++) {
    if (memcmp(file->data + pos, search_bytes, search_len) == 0) {
      found = true;
      file->cursor_pos = pos;
      break;
    }
  }
  if (! found)
    return show_msg((file->pane == HED_PANE_HEX) ? "Byte sequence not found" : "Text not found");
  hed_set_cursor_pos(editor, pos, search_len);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
movq 0x628(%rdi), %r13
leaq 0x3(%rdi), %r15
movq %r15, %rdi
callq 0x20e0
movl 0x34(%r13), %esi
cmpl $0x1, %esi
jne 0x5ae5
movq %rax, %r14
movq %rbx, 0x8(%rsp)
movl %esi, %ebx
jmp 0x5b8b
xorl %r14d, %r14d
xorl %eax, %eax
movb (%r15), %cl
testb %cl, %cl
je 0x5b6b
cmpq $0x1ff, %rax            # imm = 0x1FF
ja 0x5b6b
incq %r15
leal -0x30(%rcx), %edx
cmpb $0xa, %dl
jb 0x5b3c
leal -0x61(%rcx), %edx
cmpb $0x5, %dl
jbe 0x5b32
leal -0x41(%rcx), %edx
cmpb $0x5, %dl
jbe 0x5b37
cmpb $0x2c, %cl
je 0x5b21
movzbl %cl, %ecx
cmpl $0x20, %ecx
jne 0x5b64
movb (%r15), %cl
incq %r15
testb %cl, %cl
jne 0x5afc
decq %r15
xorl %edx, %edx
jmp 0x5b3c
addb $-0x57, %cl
jmp 0x5b3a
addb $-0x37, %cl
movl %ecx, %edx
testb $0x1, %al
jne 0x5b4f
shlb $0x4, %dl
movq %rax, %rcx
shrq %rcx
movb %dl, 0x10(%rsp,%rcx)
jmp 0x5b59
movq %rax, %rcx
shrq %rcx
orb %dl, 0x10(%rsp,%rcx)
incq %rax
movb $0x1, %cl
testb %cl, %cl
jne 0x5aea
jmp 0x5b7a
decq %r15
xorl %ecx, %ecx
jmp 0x5b5e
movq %rax, %rcx
shrq %rcx
xorl %r14d, %r14d
testb $0x1, %al
cmoveq %rcx, %r14
testq %r14, %r14
je 0x5bf6
movq %rbx, 0x8(%rsp)
movl %esi, %ebx
leaq 0x10(%rsp), %r15
movq 0x18(%r13), %rbp
movq 0x38(%r13), %r12
incq %r12
leaq (%r14,%r12), %rax
cmpq %rbp, %rax
jae 0x5be0
movq 0x10(%r13), %rdi
addq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x21e0
incq %r12
testl %eax, %eax
jne 0x5b96
decq %r12
movq %r12, 0x38(%r13)
movq 0x8(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4466
testl %ebx, %ebx
leaq 0x1d8d(%rip), %rax      # 0x7976
leaq 0x1d9e(%rip), %rdi      # 0x798e
cmoveq %rax, %rdi
jmp 0x5bfd
leaq 0x1d3d(%rip), %rdi      # 0x793a
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d46
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: cursor_end_of_file
static void cursor_end_of_file(struct hed_editor *editor)
{
  struct hed_screen *scr = &editor->screen;
  struct hed_file *file = editor->file;
  size_t n_page_lines = get_num_displayed_file_lines(editor);
  size_t last_line = file->data_len / 16 + (file->data_len % 16 != 0);
  
  file->cursor_pos = file->data_len - 1;
  if (last_line < n_page_lines)
    file->top_line = 0;
  else
    file->top_line = last_line - n_page_lines;
  scr->redraw_needed = true;
}

// Assembly:
movq 0x628(%rdi), %rax
movzbl 0x29(%rax), %ecx
movslq 0x110(%rdi), %rdx
xorq $0x1, %rcx
leaq (%rcx,%rcx,4), %rcx
addq %rdx, %rcx
addq $-0xa, %rcx
movq 0x18(%rax), %rdx
movq %rdx, %rsi
shrq $0x4, %rsi
movl %edx, %r8d
andl $0xf, %r8d
cmpq $0x1, %r8
sbbq $-0x1, %rsi
decq %rdx
movq %rdx, 0x38(%rax)
xorl %edx, %edx
subq %rcx, %rsi
cmovaeq %rsi, %rdx
movq %rdx, 0x40(%rax)
movb $0x1, 0x115(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: cursor_right
static void cursor_right(struct hed_editor *editor)
{
  struct hed_screen *scr = &editor->screen;
  struct hed_file *file = editor->file;

  if (file->cursor_pos + 1 < file->data_len) {
    file->cursor_pos++;
    size_t n_page_lines = get_num_displayed_file_lines(editor);
    while (file->cursor_pos >= 16 * (file->top_line + n_page_lines))
      file->top_line++;
    scr->redraw_needed = true;
  }
}

// Assembly:
movq 0x628(%rdi), %rax
movq 0x38(%rax), %rcx
leaq 0x1(%rcx), %r8
cmpq 0x18(%rax), %r8
jae 0x5cea
movq %r8, 0x38(%rax)
movzbl 0x29(%rax), %edx
movslq 0x110(%rdi), %r9
xorq $0x1, %rdx
leaq (%rdx,%rdx,4), %r10
leaq (%r10,%r9), %rsi
movq 0x40(%rax), %rdx
addq %rdx, %rsi
addq $-0xa, %rsi
shlq $0x4, %rsi
cmpq %rsi, %r8
jb 0x5ce3
leaq (%r9,%r10), %r8
addq $-0xa, %r8
addq %rdx, %r8
shlq $0x4, %r8
addq $0x10, %r8
addq $0x2, %rcx
cmpq %rcx, %r8
cmovaq %r8, %rcx
notq %rsi
addq %rcx, %rsi
shrq $0x4, %rsi
leaq (%rdx,%rsi), %rcx
incq %rcx
movq %rcx, 0x40(%rax)
movb $0x1, 0x115(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: cursor_down
static void cursor_down(struct hed_editor *editor)
{
  struct hed_screen *scr = &editor->screen;
  struct hed_file *file = editor->file;

  if (file->cursor_pos + 16 < file->data_len) {
    file->cursor_pos += 16;
    size_t n_page_lines = get_num_displayed_file_lines(editor);
    while (file->cursor_pos >= 16 * (file->top_line + n_page_lines))
      file->top_line++;
    scr->redraw_needed = true;
  }
}

// Assembly:
movq 0x628(%rdi), %rax
movq 0x38(%rax), %rcx
leaq 0x10(%rcx), %r8
cmpq 0x18(%rax), %r8
jae 0x5d69
movq %r8, 0x38(%rax)
movzbl 0x29(%rax), %edx
movslq 0x110(%rdi), %r9
xorq $0x1, %rdx
leaq (%rdx,%rdx,4), %r10
leaq (%r10,%r9), %rsi
movq 0x40(%rax), %rdx
addq %rdx, %rsi
addq $-0xa, %rsi
shlq $0x4, %rsi
cmpq %rsi, %r8
jb 0x5d62
leaq (%r9,%r10), %r8
addq $-0xa, %r8
addq %rdx, %r8
shlq $0x4, %r8
addq $0x10, %r8
addq $0x11, %rcx
cmpq %rcx, %r8
cmovaq %r8, %rcx
notq %rsi
addq %rcx, %rsi
shrq $0x4, %rsi
leaq (%rdx,%rsi), %rcx
incq %rcx
movq %rcx, 0x40(%rax)
movb $0x1, 0x115(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: cursor_page_up
static void cursor_page_up(struct hed_editor *editor)
{
  struct hed_screen *scr = &editor->screen;
  struct hed_file *file = editor->file;
  int cursor_delta = file->cursor_pos - 16*file->top_line;
  size_t n_page_lines = get_num_displayed_file_lines(editor);

  if (file->top_line == 0)
    cursor_delta %= 16;
  else if (file->top_line >= n_page_lines)
    file->top_line -= n_page_lines;
  else
    file->top_line = 0;
  file->cursor_pos = 16*file->top_line + cursor_delta;
  scr->redraw_needed = true;
}

// Assembly:
movq 0x628(%rdi), %rax
movl 0x38(%rax), %ecx
movq 0x40(%rax), %rdx
movl %edx, %esi
shll $0x4, %esi
subl %esi, %ecx
testq %rdx, %rdx
je 0x5dad
movzbl 0x29(%rax), %esi
movslq 0x110(%rdi), %r8
xorq $0x1, %rsi
leaq (%rsi,%rsi,4), %rsi
addq %r8, %rsi
addq $-0xa, %rsi
subq %rsi, %rdx
jae 0x5dbc
movq $0x0, 0x40(%rax)
jmp 0x5dc0
leal 0xf(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
andl $-0x10, %edx
subl %edx, %ecx
jmp 0x5dc0
movq %rdx, 0x40(%rax)
movq 0x40(%rax), %rdx
shlq $0x4, %rdx
movslq %ecx, %rcx
addq %rdx, %rcx
movq %rcx, 0x38(%rax)
movb $0x1, 0x115(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/moefh[P]hed/src/editor.c
// Function: cursor_page_down
static void cursor_page_down(struct hed_editor *editor)
{
  struct hed_screen *scr = &editor->screen;
  struct hed_file *file = editor->file;
  int cursor_delta = file->cursor_pos - 16*file->top_line;
  size_t n_page_lines = get_num_displayed_file_lines(editor);
  size_t last_line = file->data_len / 16 + (file->data_len % 16 != 0);

  if (last_line < n_page_lines || file->top_line == last_line - n_page_lines) {
    if (last_line < n_page_lines)
      file->top_line = 0;
    cursor_delta = file->data_len - 16*file->top_line - 1;
  } else if (last_line > n_page_lines && file->top_line + 2*n_page_lines < last_line)
    file->top_line += n_page_lines;
  else
    file->top_line = last_line - n_page_lines;
  file->cursor_pos = 16*file->top_line + cursor_delta;
  scr->redraw_needed = true;
}

// Assembly:
movq 0x628(%rdi), %rax
movq 0x18(%rax), %rcx
movzbl 0x29(%rax), %edx
movslq 0x110(%rdi), %rsi
xorq $0x1, %rdx
leaq (%rdx,%rdx,4), %rdx
addq %rsi, %rdx
addq $-0xa, %rdx
movq %rcx, %rsi
shrq $0x4, %rsi
movl %ecx, %r8d
andl $0xf, %r8d
cmpq $0x1, %r8
sbbq $-0x1, %rsi
movq %rsi, %r8
subq %rdx, %r8
jae 0x5e27
movq $0x0, 0x40(%rax)
jmp 0x5e30
movq 0x40(%rax), %r9
cmpq %r8, %r9
jne 0x5e58
movq 0x40(%rax), %rdx
shlq $0x4, %rdx
notq %rdx
addq %rdx, %rcx
movq 0x40(%rax), %rdx
shlq $0x4, %rdx
movslq %ecx, %rcx
addq %rdx, %rcx
movq %rcx, 0x38(%rax)
movb $0x1, 0x115(%rdi)
retq
movq 0x38(%rax), %rcx
movq %r9, %r10
shlq $0x4, %r10
subq %r10, %rcx
cmpq %rdx, %rsi
jbe 0x5e7d
leaq (%r9,%rdx,2), %r10
cmpq %rsi, %r10
jae 0x5e7d
addq %rdx, %r9
movq %r9, 0x40(%rax)
jmp 0x5e3e
movq %r8, 0x40(%rax)
jmp 0x5e3e
// File: /workspace/github_c_makefile_star2_O1/ikbenlike[P]nngutils/src/rmdir.c
// Function: parse_arg
struct rmdir_args *parse_arg(struct rmdir_args *args, int argc, char **argv){
    args->paths = calloc(1, sizeof(char*) * argc);
    args->pcount = 0;
    for(int i = 0; i < argc; i++){
        if(!strcmp(argv[i], "--ignore-fail-on-non-empty")){
            args->ignore_fail = true;
        }
        else if(!strcmp(argv[i], "-p") || !strcmp(argv[i], "--parents")){
            args->parents = true;
        }
        else if(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--verbose")){
            args->verbose = true;
        }
        else if(argv[i][0] == '-'){
            fprintf(stderr, "%s: invalid operand '%s'\n", argv[0], argv[i]);
            exit(1);
        }
        else {
            args->paths[args->pcount++] = argv[i];
        }
    }
    return args;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r14
movslq %esi, %r12
leaq (,%r12,8), %rsi
movl $0x1, %edi
callq 0x1060
movq %rax, 0x8(%r14)
movl $0x0, 0x10(%r14)
testl %r12d, %r12d
jle 0x1330
movl %r15d, %r12d
xorl %r15d, %r15d
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0xd63(%rip), %rsi       # 0x2004
callq 0x1070
testl %eax, %eax
je 0x1319
movq %r13, %rdi
leaq 0xd6b(%rip), %rsi       # 0x201f
callq 0x1070
testl %eax, %eax
je 0x1312
movq %r13, %rdi
leaq 0xd5b(%rip), %rsi       # 0x2022
callq 0x1070
testl %eax, %eax
je 0x1312
movq %r13, %rdi
leaq 0xd52(%rip), %rsi       # 0x202c
callq 0x1070
testl %eax, %eax
je 0x131f
movq %r13, %rdi
leaq 0xd42(%rip), %rsi       # 0x202f
callq 0x1070
testl %eax, %eax
je 0x131f
cmpb $0x2d, (%r13)
je 0x1342
movq 0x8(%r14), %rax
movslq 0x10(%r14), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x10(%r14)
movq %r13, (%rax,%rcx,8)
jmp 0x1324
movb $0x1, 0x1(%r14)
jmp 0x1324
movb $0x1, (%r14)
jmp 0x1324
movb $0x1, 0x2(%r14)
incq %r15
cmpq %r15, %r12
jne 0x1293
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r13, %rsi
callq 0x10c0
// File: /workspace/github_c_makefile_star2_O1/ikbenlike[P]nngutils/src/rmdir.c
// Function: main
int main(int argc, char **argv){
    if(argc == 1){
        fprintf(stderr, "%s: missing operand\n", argv[0]);
        return 1;
    }
    struct rmdir_args *args = calloc(1, sizeof(struct rmdir_args));
    args = parse_arg(args, argc, argv);
    for(int i = 1; i < args->pcount; i++){
        if(args->verbose){
            fprintf(stdout, "%s: removing directory, '%s'\n", argv[0], args->paths[i]);
        }
        if(rmdir(args->paths[i]) == -1){
            if(errno == ENOTEMPTY && !args->ignore_fail){
                fprintf(stderr, "%s: failed to remove '%s': %s\n", argv[0], args->paths[i], strerror(errno));
                return 1;
            }
        }
    }
    free(args->paths);
    free(args);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
cmpl $0x1, %edi
je 0x1421
movl %edi, %r12d
movl $0x1, %r15d
movl $0x1, %edi
movl $0x18, %esi
callq 0x1060
movq %rax, %rbx
movq %rax, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x124c
cmpl $0x2, 0x10(%rbx)
setge %r13b
jl 0x13f7
leaq 0xcc7(%rip), %r12       # 0x2068
cmpb $0x1, 0x2(%rbx)
jne 0x13c6
movq 0x2c2a(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
movq (%r14), %rdx
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rcx
movq %r12, %rsi
xorl %eax, %eax
callq 0x1080
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x1050
cmpl $-0x1, %eax
jne 0x13e7
callq 0x1040
cmpl $0x27, (%rax)
jne 0x13e7
cmpb $0x0, (%rbx)
je 0x1430
incq %r15
movslq 0x10(%rbx), %rax
cmpq %rax, %r15
setl %r13b
jl 0x13a1
xorl %eax, %eax
testb $0x1, %r13b
jne 0x1412
movq 0x8(%rbx), %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x1138
movl $0x1, %eax
jmp 0x1412
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x10ed
movl $0x1, %eax
jmp 0x13f9
// File: /workspace/github_c_makefile_star2_O1/tarun388[P]myexpos_2019/expl/./ltranslate.c
// Function: append_table
void append_table(char *label, int addr)
{
	struct LTable *temp;
	temp = (struct LTable *)malloc(sizeof(struct LTable));
	temp->name = label;
	temp->addr = addr;

	if (LThead == NULL)
	{
		LThead = temp;
		LTtail = temp;
	}
	else
	{
		LTtail->next = temp;
		LTtail = LTtail->next;
	}
	return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl $0x18, %edi
callq 0x1130
movq %r14, (%rax)
movl %ebx, 0x8(%rax)
leaq 0x3e4c(%rip), %rcx      # 0x5108
movq 0x3e4d(%rip), %rdx      # 0x5110
addq $0x10, %rdx
cmpq $0x0, 0x3e39(%rip)      # 0x5108
cmoveq %rcx, %rdx
movq %rax, (%rdx)
movq %rax, 0x3e33(%rip)      # 0x5110
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/tarun388[P]myexpos_2019/expl/./ltranslate.c
// Function: find_map
int find_map(char *name)
{
	struct LTable *temp;

	temp = LThead;
	while (temp != NULL)
	{
		if (strcmp(name, temp->name) == 0)
			return temp->addr;

		temp = temp->next;
	}
	return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x3e17(%rip), %r15      # 0x5108
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %r15, %r15
je 0x131c
movq %rdi, %r14
movq (%r15), %rsi
movq %r14, %rdi
callq 0x10e0
testl %eax, %eax
je 0x1318
movq 0x10(%r15), %r15
testq %r15, %r15
jne 0x12fe
jmp 0x131c
movl 0x8(%r15), %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/openshmem-org[P]openshmem-examples/c/heapput.c
// Function: main
int
main()
{
    int me;

    shmem_init();

    me = shmem_my_pe();

    if (me == 0) {
        long src = 4321;
        shmem_long_put(&dest, &src, 1, 1);
    }

    shmem_barrier_all();

    printf("%d: dest = %ld\n", me, dest);

    shmem_finalize();

    return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
callq 0x1080
callq 0x1060
movl %eax, %ebx
testl %eax, %eax
jne 0x11c3
leaq 0x8(%rsp), %rsi
movq $0x10e1, (%rsi)         # imm = 0x10E1
leaq 0x2ea4(%rip), %rdi      # 0x4058
movl $0x1, %edx
movl $0x1, %ecx
callq 0x1040
callq 0x1070
movq 0x2e89(%rip), %rdx      # 0x4058
leaq 0xe2e(%rip), %rdi       # 0x2004
movl %ebx, %esi
xorl %eax, %eax
callq 0x1030
callq 0x1050
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/giometti[P]mastering_UNIX_programming/chapter_06/fstatus.c
// Function: main
int main(void)
{
	FILE *fp;
	char c;

	/* Open a file for writing */
	fp = fopen("file.txt", "w");
	if (!fp) {
		perror("fopen");
		return -1;
	}
	printf("file descriptor number is %d\n", fileno(fp));

	/* Try to read data from file */
	while (!ferror(fp))
		c = fgetc(fp);
	status(fp);

	/* Clear the error status and re-check it */
	clearerr(fp);
	status(fp);

	fclose(fp);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xe42(%rip), %rdi       # 0x2026
leaq 0xe44(%rip), %rsi       # 0x202f
callq 0x1090
testq %rax, %rax
je 0x128f
movq %rax, %rbx
movq %rax, %rdi
callq 0x1080
leaq 0xe2c(%rip), %rdi       # 0x2037
xorl %ebp, %ebp
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x1030
movq %rbx, %rdi
testl %eax, %eax
jne 0x122c
callq 0x1060
jmp 0x1216
callq 0x1030
testl %eax, %eax
leaq 0xde8(%rip), %r12       # 0x2022
leaq 0xdde(%rip), %r14       # 0x201f
movq %r14, %rsi
cmoveq %r12, %rsi
leaq 0xdb5(%rip), %r15       # 0x2004
movq %r15, %rdi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
callq 0x1030
testl %eax, %eax
cmoveq %r12, %r14
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x1040
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd9b(%rip), %rdi       # 0x2031
callq 0x10a0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x1284
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]libcperciva/tests/json/main.c
// Function: main
int
main(int argc, char * argv[])
{
	size_t i;
	const uint8_t * found;

	(void)argc; /* UNUSED */
	(void)argv; /* UNUSED */

	/* Iterate through the tests. */
	for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
		found = json_find((const uint8_t *)tests[i].json,
		    (const uint8_t *)tests[i].json + strlen(tests[i].json),
		    tests[i].tofind);
		if (strcmp((const char *)found, tests[i].answer)) {
			printf("Searching for key \"%s\" in object:\n%s\n"
			    "Found: %s\nExpected: %s\n",
			    tests[i].tofind, tests[i].json,
			    found, tests[i].answer);
			printf("FAILURE\n");
			goto err0;
		}
	}

	/* Everything went fine. */
	printf("SUCCESS\n");

	/* Success! */
	exit(0);

err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x10, %r13d
leaq 0x2aec(%rip), %rbp      # 0x3c90
movq -0x10(%r13,%rbp), %rbx
movq -0x8(%r13,%rbp), %r14
movq %rbx, %rdi
callq 0x1040
leaq (%rax,%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x122c
movq %rax, %r15
movq (%r13,%rbp), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x1070
testl %eax, %eax
jne 0x11fc
addq $0x18, %r13
cmpq $0x178, %r13            # imm = 0x178
jne 0x11a4
leaq 0xf97(%rip), %rdi       # 0x2187
callq 0x1030
xorl %edi, %edi
callq 0x1080
leaq 0xe01(%rip), %rdi       # 0x2004
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x1060
leaq 0xf72(%rip), %rdi       # 0x218f
callq 0x1030
movl $0x1, %edi
callq 0x1080
// File: /workspace/github_c_makefile_star2_O1/motet-a[P]libforks/examples/execve.c
// Function: main
int main() {
  libforks_ServerConn conn;
  assert(libforks_start(&conn) == libforks_OK);

  int exit_fd;

  assert(libforks_fork(
    conn,
    NULL, // pid_ptr
    NULL, // socket_fd_ptr
    &exit_fd, // exit_fd_ptr
    child_main
  ) == libforks_OK);

  libforks_ExitEvent ee;
  assert(read(exit_fd, &ee, sizeof ee) == sizeof ee);

  assert(libforks_stop(conn) == libforks_OK);
  return 0;
}

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rdi
callq 0x17e7
testl %eax, %eax
jne 0x136a
movq 0x8(%rsp), %rdi
leaq 0xbc(%rip), %r8         # 0x13e6
leaq 0x4(%rsp), %rcx
xorl %esi, %esi
xorl %edx, %edx
callq 0x223b
testl %eax, %eax
jne 0x1389
movl 0x4(%rsp), %edi
leaq 0x10(%rsp), %rsi
movl $0x8, %edx
callq 0x10f0
cmpq $0x8, %rax
jne 0x13a8
movq 0x8(%rsp), %rdi
callq 0x23f6
testl %eax, %eax
jne 0x13c7
xorl %eax, %eax
addq $0x18, %rsp
retq
leaq 0x1c93(%rip), %rdi      # 0x3004
leaq 0x1cb1(%rip), %rsi      # 0x3029
leaq 0x1cbc(%rip), %rcx      # 0x303b
movl $0x1b, %edx
callq 0x10b0
leaq 0x1cb6(%rip), %rdi      # 0x3046
leaq 0x1c92(%rip), %rsi      # 0x3029
leaq 0x1c9d(%rip), %rcx      # 0x303b
movl $0x25, %edx
callq 0x10b0
leaq 0x1cde(%rip), %rdi      # 0x308d
leaq 0x1c73(%rip), %rsi      # 0x3029
leaq 0x1c7e(%rip), %rcx      # 0x303b
movl $0x28, %edx
callq 0x10b0
leaq 0x1cea(%rip), %rdi      # 0x30b8
leaq 0x1c54(%rip), %rsi      # 0x3029
leaq 0x1c5f(%rip), %rcx      # 0x303b
movl $0x2a, %edx
callq 0x10b0