LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_chr_replace
void print_usage_chr_replace() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    "-f | --format <format>", "Import from the selected format: raw or png; If not passed, the format will be guessed from the file extension of the sourcefile",
    "-o | --outfile <path>", "When replacing the bank, write the updated ROM file to this path rather than clobbering the source ROM",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<rom>", "The path to the source ROM file to replace the CHR bank",
    "<bank-index>", "The zero-based index of the bank to replace",
    "<sourcefile>", "The source CHR bank file; either a raw CHR bank or a png bitmap",
    NULL_COL
  };

  p_header(APPNAME " chr replace");
  p_indent(1,
      "Replace a CHR bank in a ROM file with the given bank or png image."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " chr replace <rom> [ <options> ... ] <bank-index> <chrbank>");
  p_newline();

  p_header("Arguments");
  p_cols(opts, arg_cols);
  p_newline();

  p_header("Options");
  p_cols(opts, option_cols);
  p_newline();

  p_header("Notes");
  p_indent(1,
      "When importing a PNG file, the file MUST contain 256 8x8 pixel tiles and\n"
      "be in indexed color mode. Only the colors 0-3 of the file's pallete will\n"
      "be used when importing into the ROM."
  );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x45e2(%rip), %rdi      # 0x8b7e
callq 0x3d20
movl $0x1, %edi
leaq 0x45e1(%rip), %rsi      # 0x8b8e
callq 0x3d70
callq 0x3d50
leaq 0x3b84(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4602(%rip), %rsi      # 0x8bd1
callq 0x3d70
callq 0x3d50
leaq 0x3ff9(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7e30(%rip), %rsi      # 0xc420
callq 0x3f00
callq 0x3d50
leaq 0x3adf(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7dcf(%rip), %rsi      # 0xc3e0
callq 0x3f00
callq 0x3d50
leaq 0x45ee(%rip), %rdi      # 0x8c10
callq 0x3d20
movl $0x1, %edi
leaq 0x45e3(%rip), %rsi      # 0x8c16
callq 0x3d70
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_title
void print_usage_title() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  p_header(APPNAME " title");
  p_indent(1,
      "Perform actions related to the title metadata in an NES ROM such as setting,\n"
      "getting and removing the metadata. Title metadata is stored at the end of\n"
      "the ROM file and is not consistently supported by emulators, however should\n"
      "not affect the playability of the file itself."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " title <action> [ <action-args> ... ]");
  p_newline();

  p_header("Actions");

  static struct help_cols action_cols[] = {
    { "get", "Read the title metadata from the given ROM and output to STDOUT" },
    { "set", "Set the title to the provided string value" },
    { "remove", "Remove the title metadata entirely from the given ROM file" },
    NULL_COL
  };

  p_cols(opts, action_cols);

  p_newline();

  printf("For additional usage information for the above actions run `%s title <action> --help`\n", APPNAME);

  p_newline();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x4661(%rip), %rdi      # 0x8ccd
callq 0x3d20
movl $0x1, %edi
leaq 0x465a(%rip), %rsi      # 0x8cd7
callq 0x3d70
callq 0x3d50
leaq 0x3ab4(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x474a(%rip), %rsi      # 0x8de9
callq 0x3d70
callq 0x3d50
leaq 0x3d51(%rip), %rdi      # 0x8401
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7da0(%rip), %rsi      # 0xc460
callq 0x3f00
callq 0x3d50
leaq 0x47e7(%rip), %rdi      # 0x8eb8
leaq 0x3a2a(%rip), %rsi      # 0x8102
movb $0x0, %al
callq 0x2120
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_title_get
void print_usage_title_get() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<rom>", "The path to the source ROM file to read the title",
    NULL_COL
  };

  p_header(APPNAME " title get");
  p_indent(1,
      "Read the title metadata (if there is any) and output to STDOUT.\n"
      "If there is no title metadata, nothing will be output."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " title get <rom>");
  p_newline();

  p_header("Arguments");
  p_cols(opts, arg_cols);
  p_newline();

  p_header("Options");
  p_cols(opts, option_cols);
  p_newline();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x4825(%rip), %rdi      # 0x8f41
callq 0x3d20
movl $0x1, %edi
leaq 0x4822(%rip), %rsi      # 0x8f4f
callq 0x3d70
callq 0x3d50
leaq 0x3a04(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4877(%rip), %rsi      # 0x8fc6
callq 0x3d70
callq 0x3d50
leaq 0x3e79(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7d50(%rip), %rsi      # 0xc4c0
callq 0x3f00
callq 0x3d50
leaq 0x395f(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7d0f(%rip), %rsi      # 0xc4a0
callq 0x3f00
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_title_set
void print_usage_title_set() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<rom>", "The path to the ROM file to set the title on",
    "<title>", "The new title to set (max: 256 chars)",
    NULL_COL
  };

  p_header(APPNAME " title set");
  p_indent(1,
      "Set the title metadata on the given ROM. Titles can be a maximum of 256 chars.\n"
      "If the title is an empty string, then remove the title entirely."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " title set <rom> <title>");
  p_newline();

  p_header("Arguments");
  p_cols(opts, arg_cols);
  p_newline();

  p_header("Options");
  p_cols(opts, option_cols);
  p_newline();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x4851(%rip), %rdi      # 0x902d
callq 0x3d20
movl $0x1, %edi
leaq 0x484e(%rip), %rsi      # 0x903b
callq 0x3d70
callq 0x3d50
leaq 0x3944(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x48bc(%rip), %rsi      # 0x90cb
callq 0x3d70
callq 0x3d50
leaq 0x3db9(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7cd0(%rip), %rsi      # 0xc500
callq 0x3f00
callq 0x3d50
leaq 0x389f(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7c8f(%rip), %rsi      # 0xc4e0
callq 0x3f00
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_title_remove
void print_usage_title_remove() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<rom>", "The path to the source ROM file to remove the title",
    NULL_COL
  };

  p_header(APPNAME " title remove");
  p_indent(1,
      "Remove the title metadata from the given ROM file."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " title remove <rom>");
  p_newline();

  p_header("Arguments");
  p_cols(opts, arg_cols);
  p_newline();

  p_header("Options");
  p_cols(opts, option_cols);
  p_newline();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x487f(%rip), %rdi      # 0x911b
callq 0x3d20
movl $0x1, %edi
leaq 0x487f(%rip), %rsi      # 0x912c
callq 0x3d70
callq 0x3d50
leaq 0x3884(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4890(%rip), %rsi      # 0x915f
callq 0x3d70
callq 0x3d50
leaq 0x3cf9(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7c60(%rip), %rsi      # 0xc550
callq 0x3f00
callq 0x3d50
leaq 0x37df(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7c1f(%rip), %rsi      # 0xc530
callq 0x3f00
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_chr2png
void print_usage_chr2png() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    "-w | --width=<width>", "Set the width (in tiles) of the output PNG",
    "-o | --outdir=<outdir>", "Set the output directory for the output PNG files (default is to output to same directory as source file)",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<chrfile>", "A raw CHR bank file; possibly exported from a ROM, for example",
    NULL_COL
  };

  p_header("chr2png");
  p_indent(1,
      "Convert stand-alone CHR bank files into indexed 4-color raster PNG files"
  );
  p_newline();

  p_header("Usage");
  p_indent(1, "chr2png [ <options> ... ] <chrfile> [ <chrfile> ... ]");
  p_newline();

  p_header("Arguments");
  p_cols(opts, arg_cols);
  p_newline();

  p_header("Options");
  p_cols(opts, option_cols);
  p_newline();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x4924(%rip), %rdi      # 0x9280
callq 0x3d20
movl $0x1, %edi
leaq 0x491b(%rip), %rsi      # 0x9288
callq 0x3d70
callq 0x3d50
leaq 0x37c4(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4942(%rip), %rsi      # 0x92d1
callq 0x3d70
callq 0x3d50
leaq 0x3c39(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7c00(%rip), %rsi      # 0xc5b0
callq 0x3f00
callq 0x3d50
leaq 0x371f(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7b9f(%rip), %rsi      # 0xc570
callq 0x3f00
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_png2chr
void print_usage_png2chr() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    "-o | --outdir=<outdir>", "Set the output directory for the output PNG files (default is to output to same directory as source file)",
    "-s | --size=<size>", "Set the number of tiles in the target CHR file. This can be an integer value (from 1 up to 512) or 'table' for 256 or 'chr' for 512.",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<pngfile>", "An indexed color raster PNG file",
    NULL_COL
  };

  p_header("png2chr");
  p_indent(1,
      "Convert raster PNG files into raw CHR banks. Input files must be indexed color mode\n"
      "and only the first 4 colors in the palette will be used"
  );
  p_newline();

  p_header("Usage");
  p_indent(1, "png2chr [ <options> ... ] <pngfile> [ <pngfile> ... ]");
  p_newline();

  p_header("Arguments");
  p_cols(opts, arg_cols);
  p_newline();

  p_header("Options");
  p_cols(opts, option_cols);
  p_newline();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x1, (%rax)
leaq 0x49ae(%rip), %rdi      # 0x93ca
callq 0x3d20
movl $0x1, %edi
leaq 0x49a5(%rip), %rsi      # 0x93d2
callq 0x3d70
callq 0x3d50
leaq 0x3704(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4a0f(%rip), %rsi      # 0x945e
callq 0x3d70
callq 0x3d50
leaq 0x3b79(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7ba0(%rip), %rsi      # 0xc610
callq 0x3f00
callq 0x3d50
leaq 0x365f(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7b3f(%rip), %rsi      # 0xc5d0
callq 0x3f00
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands.c
// Function: is_subcommand
bool is_subcommand(char *subcommand, ...) {
  va_list aliases;

  va_start(aliases, subcommand);

  char *alias = va_arg(aliases, char*);

  while(alias) {
    if (strcmp(alias, subcommand) == 0) {
      va_end(aliases);
      return true;
    }

    alias = va_arg(aliases, char*);
  }

  va_end(aliases);

  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
testb %al, %al
je 0x4aeb
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
movq %r9, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %rcx, -0xd8(%rbp)
movq %rdx, -0xe0(%rbp)
movq %rsi, -0xe8(%rbp)
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
leaq -0x30(%rbp), %rax
movq %rax, -0x100(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0xf4(%rbp)
cmpl $0x28, %eax
ja 0x4b71
movq -0x100(%rbp), %rcx
movl -0xf4(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x108(%rbp)
jmp 0x4b8e
movq -0x100(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x4c2e
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x21b0
cmpl $0x0, %eax
jne 0x4bc3
leaq -0x30(%rbp), %rax
movb $0x1, -0x1(%rbp)
jmp 0x4c36
leaq -0x30(%rbp), %rax
movq %rax, -0x118(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x10c(%rbp)
cmpl $0x28, %eax
ja 0x4bfe
movq -0x118(%rbp), %rcx
movl -0x10c(%rbp), %edx
movslq %edx, %rax
addq 0x10(%rcx), %rax
addl $0x8, %edx
movl %edx, (%rcx)
movq %rax, -0x120(%rbp)
jmp 0x4c1b
movq -0x118(%rbp), %rcx
movq 0x8(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x8(%rcx)
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x4b9c
leaq -0x30(%rbp), %rax
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/prg.c
// Function: filename_to_prg_output_format
prg_output_format filename_to_prg_output_format(char *filename) {
  // figure out the format if it's not passed
  const char *ext = filename_ext(filename);

  if (strcmp(ext, "prg") == 0) {
    return prg_raw_format;
  }

  return prg_null_format;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3c40
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x3417(%rip), %rsi      # 0x839b
callq 0x21b0
cmpl $0x0, %eax
jne 0x4f97
movl $0x1, -0x4(%rbp)
jmp 0x4f9e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/prg.c
// Function: subcommand_prg
void subcommand_prg(int argc, char **argv) {
  char *action = *(argv++);

  if (strcmp(action, "extract") == 0) {
    SUBCOMMAND(prg, extract);
  } else if (strcmp(action, "replace") == 0) {
    SUBCOMMAND(prg, replace);
  } else if (strcmp(action, "--help") == 0) {
    print_usage_prg();
    exit(EXIT_SUCCESS);
  } else {
    fprintf(stderr, "Invalid action: %s\n", action);
    exit(EXIT_FAILURE);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x10(%rbp)
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x30db(%rip), %rsi      # 0x856b
callq 0x21b0
cmpl $0x0, %eax
jne 0x54b3
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x4fb0
movq %rax, %rdi
callq 0x5540
jmp 0x552c
movq -0x18(%rbp), %rdi
leaq 0x31ff(%rip), %rsi      # 0x86bd
callq 0x21b0
cmpl $0x0, %eax
jne 0x54e1
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x51e0
movq %rax, %rdi
callq 0x5700
jmp 0x552a
movq -0x18(%rbp), %rdi
leaq 0x2fd6(%rip), %rsi      # 0x84c2
callq 0x21b0
cmpl $0x0, %eax
jne 0x5504
movb $0x0, %al
callq 0x41d0
xorl %edi, %edi
callq 0x2310
movq 0x6aed(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x416e(%rip), %rsi      # 0x9687
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
jmp 0x552c
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/chr.c
// Function: parse_chr_output_format
chr_output_format parse_chr_output_format(char *format) {
  if (strcmp(format, "raw") == 0) {
    return raw_format;
  } else if (strcmp(format, "png") == 0) {
    return png_format;
  }

  return null_format;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x3d2b(%rip), %rsi      # 0x9612
callq 0x21b0
cmpl $0x0, %eax
jne 0x58fa
movl $0x1, -0x4(%rbp)
jmp 0x5921
movq -0x10(%rbp), %rdi
leaq 0x2fa8(%rip), %rsi      # 0x88ad
callq 0x21b0
cmpl $0x0, %eax
jne 0x5918
movl $0x2, -0x4(%rbp)
jmp 0x5921
jmp 0x591a
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/chr.c
// Function: filename_to_chr_output_format
chr_output_format filename_to_chr_output_format(char *filename) {
  // figure out the format if it's not passed
  const char *ext = filename_ext(filename);

  if (strcmp(ext, "chr") == 0) {
    return raw_format;
  } else if (strcmp(ext, "png") == 0) {
    return png_format;
  }

  return null_format;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3c40
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x2dee(%rip), %rsi      # 0x8742
callq 0x21b0
cmpl $0x0, %eax
jne 0x5967
movl $0x1, -0x4(%rbp)
jmp 0x598e
movq -0x18(%rbp), %rdi
leaq 0x2f3b(%rip), %rsi      # 0x88ad
callq 0x21b0
cmpl $0x0, %eax
jne 0x5985
movl $0x2, -0x4(%rbp)
jmp 0x598e
jmp 0x5987
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/chr.c
// Function: subcommand_chr
void subcommand_chr(int argc, char **argv) {
  char *action = *(argv++);

  if (strcmp(action, "extract") == 0) {
    SUBCOMMAND(chr, extract);
  } else if (strcmp(action, "replace") == 0) {
    SUBCOMMAND(chr, replace);
  } else if (strcmp(action, "--help") == 0) {
    print_usage_chr();
    exit(EXIT_SUCCESS);
  } else {
    fprintf(stderr, "Invalid action: %s\n", action);
    exit(EXIT_FAILURE);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x10(%rbp)
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x266b(%rip), %rsi      # 0x856b
callq 0x21b0
cmpl $0x0, %eax
jne 0x5f23
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x59a0
movq %rax, %rdi
callq 0x5fb0
jmp 0x5f9c
movq -0x18(%rbp), %rdi
leaq 0x278f(%rip), %rsi      # 0x86bd
callq 0x21b0
cmpl $0x0, %eax
jne 0x5f51
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x5c50
movq %rax, %rdi
callq 0x6200
jmp 0x5f9a
movq -0x18(%rbp), %rdi
leaq 0x2566(%rip), %rsi      # 0x84c2
callq 0x21b0
cmpl $0x0, %eax
jne 0x5f74
movb $0x0, %al
callq 0x4400
xorl %edi, %edi
callq 0x2310
movq 0x607d(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x36fe(%rip), %rsi      # 0x9687
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
jmp 0x5f9c
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_get_parse
title_opts* subcommand_title_get_parse(int argc, char **argv) {
  title_opts *opts = (title_opts*)calloc(1, sizeof(title_opts));

  static struct option longopts[] = {
    { "help", no_argument, NULL, 'h' },
    { NULL, 0, NULL, 0 }
  };

  if (strcmp(argv[0], "--help") == 0) {
    print_usage_title_get();
    exit(EXIT_SUCCESS);
  }

  strcpy(opts->romfile_path, argv[0]); // don't shift the args

  int ch;

  while ((ch = getopt_long(argc, argv, "h", longopts, NULL)) != -1) {
    switch (ch) {
      case 'h':
        print_usage_title_get();
        exit(EXIT_SUCCESS);
        break;

      case 0:
        break;
      default:
        fprintf(stderr, "Invalid argument: -%c\n", ch);
        exit(EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  return opts;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, %edi
movl $0x8ff, %esi            # imm = 0x8FF
callq 0x21a0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x1e62(%rip), %rsi      # 0x84c2
callq 0x21b0
cmpl $0x0, %eax
jne 0x6678
movb $0x0, %al
callq 0x46f0
xorl %edi, %edi
callq 0x2310
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x2090
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x319c(%rip), %rdx      # 0x9832
leaq 0x6213(%rip), %rcx      # 0xc8b0
xorl %eax, %eax
movl %eax, %r8d
callq 0x2110
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x66fc
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
testl %eax, %eax
je 0x66d3
jmp 0x66bb
movl -0x20(%rbp), %eax
subl $0x68, %eax
jne 0x66d5
jmp 0x66c5
movb $0x0, %al
callq 0x46f0
xorl %edi, %edi
callq 0x2310
jmp 0x66fa
movq 0x591c(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x2f44(%rip), %rsi      # 0x962d
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
jmp 0x6688
movq 0x58c5(%rip), %rax      # 0xbfc8
movl (%rax), %ecx
movl -0x4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4(%rbp)
movq 0x58b4(%rip), %rax      # 0xbfc8
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_remove_parse
title_opts* subcommand_title_remove_parse(int argc, char **argv) {
  title_opts *opts = (title_opts*)calloc(1, sizeof(title_opts));

  static struct option longopts[] = {
    { "help", no_argument, NULL, 'h' },
    { "outfile", required_argument, NULL, 'o' },
    { NULL, 0, NULL, 0 }
  };

  if (strcmp(argv[0], "--help") == 0) {
    print_usage_title_remove();
    exit(EXIT_SUCCESS);
  }

  strcpy(opts->romfile_path, argv[0]); // don't shift the args

  int ch;

  while ((ch = getopt_long(argc, argv, "o:h", longopts, NULL)) != -1) {
    switch (ch) {
      case 'h':
        print_usage_title_remove();
        exit(EXIT_SUCCESS);
        break;

      case 'o':
        strcpy(opts->outfile_path, optarg);

        break;
      case 0:
        break;
      default:
        fprintf(stderr, "Invalid argument: -%c\n", ch);
        exit(EXIT_FAILURE);
    }
  }

  argc -= optind;
  argv += optind;

  return opts;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, %edi
movl $0x8ff, %esi            # imm = 0x8FF
callq 0x21a0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x1d52(%rip), %rsi      # 0x84c2
callq 0x21b0
cmpl $0x0, %eax
jne 0x6788
movb $0x0, %al
callq 0x4870
xorl %edi, %edi
callq 0x2310
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
callq 0x2090
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x308a(%rip), %rdx      # 0x9830
leaq 0x6143(%rip), %rcx      # 0xc8f0
xorl %eax, %eax
movl %eax, %r8d
callq 0x2110
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x6835
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
testl %eax, %eax
je 0x6809
jmp 0x67cb
movl -0x20(%rbp), %eax
subl $0x68, %eax
je 0x67df
jmp 0x67d5
movl -0x20(%rbp), %eax
subl $0x6f, %eax
je 0x67ed
jmp 0x680b
movb $0x0, %al
callq 0x4870
xorl %edi, %edi
callq 0x2310
movq -0x18(%rbp), %rdi
addq $0x4ff, %rdi            # imm = 0x4FF
movq 0x57d1(%rip), %rax      # 0xbfd0
movq (%rax), %rsi
callq 0x2090
jmp 0x6830
jmp 0x6830
movq 0x57e6(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl -0x1c(%rbp), %edx
leaq 0x2e0e(%rip), %rsi      # 0x962d
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
jmp 0x6798
movq 0x578c(%rip), %rax      # 0xbfc8
movl (%rax), %ecx
movl -0x4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4(%rbp)
movq 0x577b(%rip), %rax      # 0xbfc8
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title
void subcommand_title(int argc, char **argv) {
  char *action = *(argv++);

  if (strcmp(action, "set") == 0) {
    SUBCOMMAND(title, set);
  } else if (strcmp(action, "get") == 0) {
    SUBCOMMAND(title, get);
  } else if (strcmp(action, "remove") == 0) {
    SUBCOMMAND(title, remove);
  } else if (strcmp(action, "--help") == 0) {
    print_usage_title();
    exit(EXIT_SUCCESS);
  } else {
    fprintf(stderr, "Invalid action: %s\n", action);
    exit(EXIT_FAILURE);
  }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x10(%rbp)
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x2797(%rip), %rsi      # 0x9037
callq 0x21b0
cmpl $0x0, %eax
jne 0x68c6
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x6470
movq %rax, %rdi
callq 0x6980
jmp 0x696f
movq -0x18(%rbp), %rdi
leaq 0x267a(%rip), %rsi      # 0x8f4b
callq 0x21b0
cmpl $0x0, %eax
jne 0x68f4
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x6630
movq %rax, %rdi
callq 0x6a60
jmp 0x696d
movq -0x18(%rbp), %rdi
leaq 0x2826(%rip), %rsi      # 0x9125
callq 0x21b0
cmpl $0x0, %eax
jne 0x6922
movl -0x4(%rbp), %edi
subl $0x1, %edi
movq -0x10(%rbp), %rsi
callq 0x6740
movq %rax, %rdi
callq 0x6b30
jmp 0x696b
movq -0x18(%rbp), %rdi
leaq 0x1b95(%rip), %rsi      # 0x84c2
callq 0x21b0
cmpl $0x0, %eax
jne 0x6945
movb $0x0, %al
callq 0x4640
xorl %edi, %edi
callq 0x2310
movq 0x56ac(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x2d2d(%rip), %rsi      # 0x9687
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
jmp 0x696d
jmp 0x696f
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_set
void subcommand_title_set(title_opts *opts) {
  static char tempfile_path[] = "/tmp/nrt-rom.XXXXXX";

  // ok, let's read in the rom file, and replace the chr
  FILE *romfile = fopen(opts->romfile_path, "r");

  if (!romfile) {
    perror("Failed to open rom file for reading");
    exit(EXIT_FAILURE);
  }

  nrt_rom *rom = nrt_read_rom_from_file(romfile);
  fclose(romfile);

  // first we want to zero out the entire title in our in-memory rom
  // then strcpy() the new title in there
  bzero(rom->title, NRT_TITLE_MAX_LENGTH);
  strcpy(rom->title, opts->title);

  int fd = mkstemp(tempfile_path);
  FILE *tempfile = fdopen(fd, "w");

  nrt_rom_write_to_file(rom, tempfile);

  fclose(tempfile);
  nrt_rom_free(rom);

  rename(tempfile_path, opts->outfile_path);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1dad(%rip), %rsi      # 0x8744
callq 0x22a0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x69bd
leaq 0x2dc1(%rip), %rdi      # 0x976f
callq 0x22b0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rdi
callq 0x39b0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20e0
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
xorl %esi, %esi
movl $0xff, %edx
callq 0x2160
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x8(%rbp), %rsi
addq $0x400, %rsi            # imm = 0x400
callq 0x2090
leaq 0x5f4a(%rip), %rdi      # 0xc950
callq 0x2250
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %edi
leaq 0x2bfc(%rip), %rsi      # 0x9614
callq 0x2270
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3b20
movq -0x28(%rbp), %rdi
callq 0x20e0
movq -0x18(%rbp), %rdi
callq 0x3970
movq -0x8(%rbp), %rsi
addq $0x4ff, %rsi            # imm = 0x4FF
leaq 0x5efe(%rip), %rdi      # 0xc950
callq 0x22c0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_get
void subcommand_title_get(title_opts *opts) {
  FILE *romfile = fopen(opts->romfile_path, "r");

  if (!romfile) {
    perror("Failed to open rom file for reading");
    exit(EXIT_FAILURE);
  }

  nrt_rom *rom = nrt_read_rom_from_file(romfile);
  fclose(romfile);

  if (strnlen(rom->title, NRT_TITLE_MAX_LENGTH) == 0) {
    printf("<no-title>\n");
    nrt_rom_free(rom);
    free(opts);
    exit(EXIT_SUCCESS);
  }

  printf("%s\n", rom->title);
  nrt_rom_free(rom);
  free(opts);

  exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x1ccd(%rip), %rsi      # 0x8744
callq 0x22a0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x6a9d
leaq 0x2ce1(%rip), %rdi      # 0x976f
callq 0x22b0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rdi
callq 0x39b0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20e0
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movl $0xff, %esi
callq 0x2170
cmpq $0x0, %rax
jne 0x6af2
leaq 0x2d8c(%rip), %rdi      # 0x985e
movb $0x0, %al
callq 0x2120
movq -0x18(%rbp), %rdi
callq 0x3970
movq -0x8(%rbp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x2310
movq -0x18(%rbp), %rsi
addq $0x18, %rsi
leaq 0x2bd1(%rip), %rdi      # 0x96d2
movb $0x0, %al
callq 0x2120
movq -0x18(%rbp), %rdi
callq 0x3970
movq -0x8(%rbp), %rdi
callq 0x2040
xorl %edi, %edi
callq 0x2310
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/chr2png_main.c
// Function: validate_outdir
void validate_outdir(char *outdir) {
  // first, let's make sure the opts->outdir exists and is a directory before we get started
  // (assuming that it's specified)
  if (outdir[0] != '\0') {
    struct stat *outdir_stat = (struct stat*)malloc(sizeof(struct stat));

    if (stat(outdir, outdir_stat) != 0) {
      free(outdir_stat);
      perror(outdir);
      exit(EXIT_FAILURE);
    }

    if (!(outdir_stat->st_mode & S_IFDIR)) {
      free(outdir_stat);
      fprintf(stderr, "Output directory must be a directory.\n");
      exit(EXIT_FAILURE);
    }

    free(outdir_stat);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x75ad
movl $0x90, %edi
callq 0x2220
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x21e0
cmpl $0x0, %eax
je 0x7568
movq -0x10(%rbp), %rdi
callq 0x2040
movq -0x8(%rbp), %rdi
callq 0x22b0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0x75a4
movq -0x10(%rbp), %rdi
callq 0x2040
movq 0x4a6f(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x238c(%rip), %rsi      # 0x991f
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rdi
callq 0x2040
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/chr2png_main.c
// Function: validate_chrfile
void validate_chrfile(char *filepath) {
  struct stat *filestat = (struct stat*)malloc(sizeof(struct stat));

  if (stat(filepath, filestat) != 0) {
    free(filestat);
    perror(filepath);
    exit(EXIT_FAILURE);
  }

  if (!(filestat->st_mode & S_IFREG)) {
    free(filestat);
    fprintf(stderr, "CHR file must be a regular file.\n");
    exit(EXIT_FAILURE);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl $0x90, %edi
callq 0x2220
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x21e0
cmpl $0x0, %eax
je 0x7608
movq -0x10(%rbp), %rdi
callq 0x2040
movq -0x8(%rbp), %rdi
callq 0x22b0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x8000, %eax           # imm = 0x8000
cmpl $0x0, %eax
jne 0x7644
movq -0x10(%rbp), %rdi
callq 0x2040
movq 0x49cf(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x2313(%rip), %rsi      # 0x9946
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/chr2png_main.c
// Function: chr_tile_count
int chr_tile_count(char *chrfile) {
  struct stat *chrfile_stat = (struct stat*)malloc(sizeof(struct stat));

  if (stat(chrfile, chrfile_stat) != 0) {
    free(chrfile_stat);
    perror(chrfile);
    exit(EXIT_FAILURE);
  }

  int size = chrfile_stat->st_size;
  free(chrfile_stat);

  // the file must be a size that's a multiple of 16 (the size of a tile in CHR memory)
  if (size % NRT_TILE_SIZE != 0) {
    fprintf(stderr, "File is the wrong size. It is %d bytes and must be a multiple of %d.\n", size, NRT_TILE_SIZE);
    exit(EXIT_FAILURE);
  }

  return size / NRT_TILE_SIZE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movl $0x90, %edi
callq 0x2220
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x21e0
cmpl $0x0, %eax
je 0x7738
movq -0x10(%rbp), %rdi
callq 0x2040
movq -0x8(%rbp), %rdi
callq 0x22b0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2040
movl -0x14(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x7786
movq 0x4895(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x21f8(%rip), %rsi      # 0x9968
movl $0x10, %ecx
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
movl -0x14(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/openshmem-org[P]openshmem-examples/c/fip.c
// Function: main
int
main(void)
{
    float *f;
    int me;

    shmem_init();
    me = shmem_my_pe();

    f = (float *) shmem_malloc(sizeof(*f));

    *f = PI;
    shmem_barrier_all();

    if (me == 0) {
        shmem_float_p(f, E, 1);
    }

    shmem_barrier_all();

    if (me == 1) {
        printf("PE %d: %f, %s\n",
               me, *f, (fabsf(*f - E) < epsilon) ? "OK" : "FAIL");
    }

    shmem_free(f);

    shmem_finalize();

    return 0;
}

// Assembly:
subq $0x18, %rsp
movl $0x0, 0x14(%rsp)
callq 0x1090
callq 0x1060
movl %eax, 0x4(%rsp)
movl $0x4, %edi
callq 0x1070
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movss 0xe1e(%rip), %xmm0      # 0x2004
movss %xmm0, (%rax)
callq 0x1080
cmpl $0x0, 0x4(%rsp)
jne 0x120d
movq 0x8(%rsp), %rdi
movss 0xe05(%rip), %xmm0      # 0x2008
movl $0x1, %esi
callq 0x1040
callq 0x1080
cmpl $0x1, 0x4(%rsp)
jne 0x1275
movl 0x4(%rsp), %esi
movq 0x8(%rsp), %rax
movss (%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x8(%rsp), %rax
movss (%rax), %xmm2
movss 0xdcd(%rip), %xmm1      # 0x2008
subss %xmm1, %xmm2
movaps 0xdca(%rip), %xmm1      # 0x2010
pand %xmm1, %xmm2
movss 0xdba(%rip), %xmm1      # 0x200c
leaq 0xdd9(%rip), %rdx       # 0x2032
leaq 0xdcf(%rip), %rax       # 0x202f
ucomiss %xmm2, %xmm1
cmovaq %rax, %rdx
leaq 0xdb2(%rip), %rdi       # 0x2020
movb $0x1, %al
callq 0x1030
movq 0x8(%rsp), %rdi
callq 0x10a0
callq 0x1050
xorl %eax, %eax
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O0/keithnoguchi[P]pearls-in-action/0x2/squash_main.c
// Function: main
int main(void)
{
#define WORDMAX	100
	char word[WORDMAX], sig[WORDMAX], oldsig[WORDMAX];
	int linenum = 0;

	strcpy(oldsig, "");
	while (scanf("%s %s", sig, word) != EOF) {
		if (strcmp(oldsig, sig)) {
			if (linenum > 0)
				puts("");
			strcpy(oldsig, sig);
		}
		linenum++;
		printf("%s ", word);
	}
	puts("");
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movl $0x0, -0x4(%rbp)
movl $0x0, -0x154(%rbp)
leaq -0x150(%rbp), %rdi
leaq 0xe63(%rip), %rsi       # 0x200d
callq 0x1030
leaq -0xe0(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq 0xe43(%rip), %rdi       # 0x2004
movb $0x0, %al
callq 0x1070
cmpl $-0x1, %eax
je 0x1233
leaq -0x150(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1060
cmpl $0x0, %eax
je 0x120d
cmpl $0x0, -0x154(%rbp)
jle 0x11fa
leaq 0xe18(%rip), %rdi       # 0x200d
callq 0x1040
leaq -0x150(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x1030
movl -0x154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x154(%rbp)
leaq -0x70(%rbp), %rsi
leaq 0xde3(%rip), %rdi       # 0x200a
movb $0x0, %al
callq 0x1050
jmp 0x11af
leaq 0xdd3(%rip), %rdi       # 0x200d
callq 0x1040
xorl %eax, %eax
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/hoomanist[P]carrot/cp.c
// Function: main
int
main(int argc, char **argv)
{
	int c;
	FILE *fp;
	FILE *dest;

	fp = fopen(argv[1], "r");
	dest = fopen(argv[2], "w");
	if(fp == NULL) {
                perror("Error in opening file");
        } do {
                c = fgetc(fp);
                if( feof(fp) ) {
                        break ;
                }
                fputc(c, dest);
        } while(1);
        fclose(fp);


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0xe4f(%rip), %rsi       # 0x2004
callq 0x1070
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0xe39(%rip), %rsi       # 0x2006
callq 0x1070
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x11e9
leaq 0xe24(%rip), %rdi       # 0x2008
callq 0x1080
jmp 0x11eb
movq -0x20(%rbp), %rdi
callq 0x1040
movl %eax, -0x14(%rbp)
movq -0x20(%rbp), %rdi
callq 0x1060
cmpl $0x0, %eax
je 0x1207
jmp 0x121b
movl -0x14(%rbp), %edi
movq -0x28(%rbp), %rsi
callq 0x1050
movb $0x1, %al
testb $0x1, %al
jne 0x11eb
jmp 0x121b
movq -0x20(%rbp), %rdi
callq 0x1030
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: read_file
unsigned char *read_file(const char *fname, unsigned int *out_size)
{
	unsigned char *buf;
	struct stat st;
	int size, ret;
	FILE *fd;

	ret = stat(fname, &st);
	if (ret) {
		printf("Error: Could not stat %s\n", fname);
		return NULL;
	}

	size = st.st_size;
	if (size <= 0) {
		printf("Bad file size of %s: %d\n", fname, size);
		return NULL;
	}

	fd = fopen(fname, "rb");
	if (!fd) {
		printf("Error opening file %s\n", fname);
		return NULL;
	}
		
	buf = malloc(size);
	if (!buf) {
		printf("Could not allocate %d bytes\n", size);
		fclose(fd);
		return NULL;
	}

	ret = fread(buf, size, 1, fd);
	
	if (ret != 1) {
		printf("Error reading file %s: %d\n", fname, ret);
		free(buf);
		fclose(fd);
		return NULL;
	}

	*out_size = size;
	fclose(fd);
	
	return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x10a0
movl %eax, -0xb8(%rbp)
cmpl $0x0, -0xb8(%rbp)
je 0x1251
movq -0x10(%rbp), %rsi
leaq 0x1dd7(%rip), %rdi      # 0x3014
movb $0x0, %al
callq 0x1060
movq $0x0, -0x8(%rbp)
jmp 0x138f
movq -0x80(%rbp), %rax
movl %eax, -0xb4(%rbp)
cmpl $0x0, -0xb4(%rbp)
jg 0x1289
movq -0x10(%rbp), %rsi
movl -0xb4(%rbp), %edx
leaq 0x1db9(%rip), %rdi      # 0x302e
movb $0x0, %al
callq 0x1060
movq $0x0, -0x8(%rbp)
jmp 0x138f
movq -0x10(%rbp), %rdi
leaq 0x1db3(%rip), %rsi      # 0x3047
callq 0x10d0
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jne 0x12c9
movq -0x10(%rbp), %rsi
leaq 0x1d95(%rip), %rdi      # 0x304a
movb $0x0, %al
callq 0x1060
movq $0x0, -0x8(%rbp)
jmp 0x138f
movslq -0xb4(%rbp), %rdi
callq 0x10c0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x130d
movl -0xb4(%rbp), %esi
leaq 0x1d74(%rip), %rdi      # 0x3061
movb $0x0, %al
callq 0x1060
movq -0xc0(%rbp), %rdi
callq 0x1050
movq $0x0, -0x8(%rbp)
jmp 0x138f
movq -0x20(%rbp), %rdi
movslq -0xb4(%rbp), %rsi
movq -0xc0(%rbp), %rcx
movl $0x1, %edx
callq 0x1040
movl %eax, -0xb8(%rbp)
cmpl $0x1, -0xb8(%rbp)
je 0x136f
movq -0x10(%rbp), %rsi
movl -0xb8(%rbp), %edx
leaq 0x1d35(%rip), %rdi      # 0x307e
movb $0x0, %al
callq 0x1060
movq -0x20(%rbp), %rdi
callq 0x1030
movq -0xc0(%rbp), %rdi
callq 0x1050
movq $0x0, -0x8(%rbp)
jmp 0x138f
movl -0xb4(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0xc0(%rbp), %rdi
callq 0x1050
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: print_sections
void print_sections(struct section_info *sections, int num_sections)
{
	int i;
	printf("Section\t\t  Offset\t  Length\t     CRC\n");
	printf("========================================================\n");
	for (i = 0; i < num_sections; i++) {
		printf("section_%d\t%8d\t%8d\t%08x (%s)\n",
		       i, sections[i].offset, sections[i].length, sections[i].header_crc,
			(sections[i].header_crc == sections[i].actual_crc) ? "OK" : "MISMATCH!"
		);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x1ce3(%rip), %rdi      # 0x3099
movb $0x0, %al
callq 0x1060
leaq 0x1cfa(%rip), %rdi      # 0x30be
movb $0x0, %al
callq 0x1060
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x146c
movl -0x10(%rbp), %esi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %edx
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %ecx
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rdi
shlq $0x5, %rdi
addq %rdi, %rax
movl (%rax), %r8d
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %rdi
shlq $0x5, %rdi
addq %rdi, %rax
movl (%rax), %edi
movq -0x8(%rbp), %rax
movslq -0x10(%rbp), %r9
shlq $0x5, %r9
addq %r9, %rax
movl 0x4(%rax), %r10d
leaq 0x1cd7(%rip), %r9       # 0x3119
leaq 0x1ccd(%rip), %rax      # 0x3116
cmpl %r10d, %edi
cmoveq %rax, %r9
leaq 0x1ca1(%rip), %rdi      # 0x30f8
movb $0x0, %al
callq 0x1060
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x13d2
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: get_global_crc
unsigned int get_global_crc(unsigned char *buf, int size)
{
	if (size < GLOBAL_HEADER_SIZE) {
		printf("Invalid firmware size: %d\n", size);
		return 0;
	}
	
	return crc32(buf + GLOBAL_HEADER_SIZE, size - GLOBAL_HEADER_SIZE);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpl $0xe0, -0x14(%rbp)
jge 0x14b2
movl -0x14(%rbp), %esi
leaq 0x1c81(%rip), %rdi      # 0x3123
movb $0x0, %al
callq 0x1060
movl $0x0, -0x4(%rbp)
jmp 0x14ce
movq -0x10(%rbp), %rdi
addq $0xe0, %rdi
movl -0x14(%rbp), %esi
subl $0xe0, %esi
callq 0x2190
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: read_word_le
static uint32_t read_word_le(unsigned char *buf, int offset)
{
	return (buf[offset+0] << 0) |
	       (buf[offset+1] << 8) |
	       (buf[offset+2] << 16) |
	       (buf[offset+3] << 24);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
shll $0x0, %eax
movq -0x8(%rbp), %rcx
movl -0xc(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x8, %ecx
orl %ecx, %eax
movq -0x8(%rbp), %rcx
movl -0xc(%rbp), %edx
addl $0x2, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movq -0x8(%rbp), %rcx
movl -0xc(%rbp), %edx
addl $0x3, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
shll $0x18, %ecx
orl %ecx, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: find_magic
static int find_magic(unsigned char *buf, int size, int start_offset)
{
	int c;
	int state = 0;
	int offset = start_offset;
	
	while (offset < size) {
		c = buf[offset++];
		if (c < 0)
			return -1;

		switch (state) {
			case 0:
				if (c == 0x90)
					state = 1;
				else
					state = 0;

				break;
			case 1:
				if (c == 0xEB)
					state = 2;
				else
					state = 0;

				break;

			case 2:
				if (c == 0x24)
					state = 3;
				else
					state = 0;
				break;

			case 3:
				if (c == 0xA3) {
					return offset;

				} else
					state = 0;
				break;

			default:
				fprintf(stderr, "Unexpected state %u in find_magic", state);
				return -1;
		}

		if (c == 0x90)
			state = 1;
	}

	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x1978
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x24(%rbp)
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jge 0x18b6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x197f
movl -0x20(%rbp), %eax
movq %rax, -0x30(%rbp)
subq $0x3, %rax
ja 0x193f
movq -0x30(%rbp), %rax
leaq 0x1736(%rip), %rcx      # 0x3004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x90, -0x1c(%rbp)
jne 0x18e9
movl $0x1, -0x20(%rbp)
jmp 0x18f0
movl $0x0, -0x20(%rbp)
jmp 0x1963
cmpl $0xeb, -0x1c(%rbp)
jne 0x1904
movl $0x2, -0x20(%rbp)
jmp 0x190b
movl $0x0, -0x20(%rbp)
jmp 0x1963
cmpl $0x24, -0x1c(%rbp)
jne 0x191c
movl $0x3, -0x20(%rbp)
jmp 0x1923
movl $0x0, -0x20(%rbp)
jmp 0x1963
cmpl $0xa3, -0x1c(%rbp)
jne 0x1936
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x197f
movl $0x0, -0x20(%rbp)
jmp 0x1963
movq 0x46b2(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
movl -0x20(%rbp), %edx
leaq 0x244d(%rip), %rsi      # 0x3da0
movb $0x0, %al
callq 0x1090
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x197f
cmpl $0x90, -0x1c(%rbp)
jne 0x1973
movl $0x1, -0x20(%rbp)
jmp 0x187f
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: print_usage
static void print_usage(const char *name)
{
	printf("Usage: %s unpatched_firmware.bin section_filename section_number output_firmware.bin\n\n", name);
	printf("unpatched_firmware.bin - original, unpatched camera_firmware.bin file\n");
	printf("section_filename       - filename of replacement section being packed into the firmware\n");
	printf("section_number         - number of section to replace\n");
	printf("output_firmware.bin    - filename for where to write the modified camera_firmware.bin file\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
leaq 0x1d7b(%rip), %rdi      # 0x3dc2
movb $0x0, %al
callq 0x1060
leaq 0x1dc4(%rip), %rdi      # 0x3e19
movb $0x0, %al
callq 0x1060
leaq 0x1dfd(%rip), %rdi      # 0x3e60
movb $0x0, %al
callq 0x1060
leaq 0x1e48(%rip), %rdi      # 0x3eb9
movb $0x0, %al
callq 0x1060
leaq 0x1e71(%rip), %rdi      # 0x3ef0
movb $0x0, %al
callq 0x1060
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)