LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_list_insert
nrt_prg_list* nrt_prg_list_insert(nrt_prg_list* list, nrt_prgbank* prg, int index)
{
  // initialize our new listitem.
  nrt_prg_listitem *new_item = nrt_prg_listitem_create(prg, NULL);

  list->count++;

  // we're prepending, so this is super-simple
  if ( index == 0 ) {
    new_item->next = list->list;
    list->list = new_item;
    return list;
  }

  nrt_prg_listitem *before = nrt_prg_listitem_at(list, index - 1);
  nrt_prg_listitem *after = before->next;

  before->next = new_item;
  new_item->next = after;

  return list;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x10, %edi
callq 0x2240
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
incl (%rbx)
testl %ebp, %ebp
je 0x35e0
decl %ebp
movq %rbx, %rcx
movq 0x8(%rcx), %rcx
subl $0x1, %ebp
setb %dl
testq %rcx, %rcx
je 0x35d2
testb %dl, %dl
je 0x35bf
movq 0x8(%rcx), %rdx
movq %rax, 0x8(%rcx)
movq %rdx, 0x8(%rax)
jmp 0x35ec
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_list_delete
nrt_prg_listitem* nrt_prg_list_delete(nrt_prg_list* list, int index)
{
  // first get the item in question
  nrt_prg_listitem* item = nrt_prg_listitem_at(list, index);

  // if we didn't get anything, just return null and don't do anything.
  if (!item) {
    return NULL;
  }

  // next, if index is zero, we need to basically just shift everyting over and we're done.
  if (index == 0) {
    list->count--;
    list->list = item->next;
    return item;
  }

  // otherwise, we need to surgically remove the item.
  // get the previous item, set previous->next to item->next
  list->count--;
  nrt_prg_listitem* prev = nrt_prg_listitem_at(list, index - 1);
  prev->next = item->next;

  return item;
}

// Assembly:
movl %esi, %ecx
movq %rdi, %rax
movq 0x8(%rax), %rax
subl $0x1, %ecx
setb %dl
testq %rax, %rax
je 0x3613
testb %dl, %dl
je 0x3600
testq %rax, %rax
je 0x363b
decl (%rdi)
testl %esi, %esi
je 0x3633
decl %esi
movq 0x8(%rdi), %rdi
subl $0x1, %esi
setb %cl
testq %rdi, %rdi
je 0x3633
testb %cl, %cl
je 0x3620
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_list_free
void nrt_prg_list_free(nrt_prg_list *list) {
  nrt_prg_listitem *l = list->list;
  nrt_prg_listitem *next = l->next;

  while (l) {
    if (l->prg) {
      free(l->prg);
    }

    next = l->next;
    free(l);

    l = next;
  }

  free(list);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x36ab
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3697
callq 0x2040
movq 0x8(%r14), %r15
movq %r14, %rdi
callq 0x2040
movq %r15, %r14
testq %r15, %r15
jne 0x368a
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_chr_list_insert
nrt_chr_list* nrt_chr_list_insert(nrt_chr_list* list, nrt_chrbank* chr, int index)
{
  // initialize our new listitem.
  nrt_chr_listitem *new_item = nrt_chr_listitem_create(chr, NULL);

  list->count++;

  // we're prepending, so this is super-simple
  if ( index == 0 ) {
    new_item->next = list->list;
    list->list = new_item;
    return list;
  }

  nrt_chr_listitem *before = nrt_chr_listitem_at(list, index - 1);
  nrt_chr_listitem *after = before->next;

  before->next = new_item;
  new_item->next = after;

  return list;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl $0x10, %edi
callq 0x2240
movq %r14, (%rax)
movq $0x0, 0x8(%rax)
incl (%rbx)
testl %ebp, %ebp
je 0x3774
decl %ebp
movq %rbx, %rcx
movq 0x8(%rcx), %rcx
subl $0x1, %ebp
setb %dl
testq %rcx, %rcx
je 0x3766
testb %dl, %dl
je 0x3753
movq 0x8(%rcx), %rdx
movq %rax, 0x8(%rcx)
movq %rdx, 0x8(%rax)
jmp 0x3780
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_chr_list_delete
nrt_chr_listitem* nrt_chr_list_delete(nrt_chr_list* list, int index)
{
  // first get the item in question
  nrt_chr_listitem* item = nrt_chr_listitem_at(list, index);

  // if we didn't get anything, just return null and don't do anything.
  if (!item) {
    return NULL;
  }

  // next, if index is zero, we need to basically just shift everyting over and we're done.
  if (index == 0) {
    list->count--;
    list->list = item->next;
    return item;
  }

  // otherwise, we need to surgically remove the item.
  // get the previous item, set previous->next to item->next
  list->count--;
  nrt_chr_listitem* prev = nrt_chr_listitem_at(list, index - 1);
  prev->next = item->next;

  return item;
}

// Assembly:
movl %esi, %ecx
movq %rdi, %rax
movq 0x8(%rax), %rax
subl $0x1, %ecx
setb %dl
testq %rax, %rax
je 0x37a7
testb %dl, %dl
je 0x3794
testq %rax, %rax
je 0x37cf
decl (%rdi)
testl %esi, %esi
je 0x37c7
decl %esi
movq 0x8(%rdi), %rdi
subl $0x1, %esi
setb %cl
testq %rdi, %rdi
je 0x37c7
testb %cl, %cl
je 0x37b4
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_chr_list_free
void nrt_chr_list_free(nrt_chr_list *list) {
  nrt_chr_listitem *l = list->list;
  nrt_chr_listitem *next = l->next;

  while (l) {
    if (l->chr) {
      free(l->chr);
    }

    next = l->next;
    free(l);

    l = next;
  }

  free(list);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x383f
movq (%r14), %rdi
testq %rdi, %rdi
je 0x382b
callq 0x2040
movq 0x8(%r14), %r15
movq %r14, %rdi
callq 0x2040
movq %r15, %r14
testq %r15, %r15
jne 0x381e
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_read_rom_from_file
nrt_rom* nrt_read_rom_from_file(FILE* romfile) {
  nrt_rom* rom = nrt_rom_create();

  fseek(romfile, 0, SEEK_SET);

  if (nrt_header_extract(romfile, rom->header) != 1) {
    nrt_rom_free(rom);
    return NULL;
  }

  int i;
  for (i = 0; i < rom->header->prg_count; i++) {
    nrt_prgbank* prg = NRT_PRG_ALLOC;

    if (nrt_extract_prg(romfile, i, prg) != 1) {
      nrt_rom_free(rom);
      free(prg);
      return NULL;
    }

    nrt_prg_list_append(rom->prgs, prg);
  }

  for (i = 0; i < rom->header->chr_count; i++) {
    nrt_chrbank* chr = NRT_CHR_ALLOC;

    if (nrt_extract_chr(romfile, rom->header, i, chr) != 1) {
      nrt_rom_free(rom);
      free(chr);
      return NULL;
    }

    nrt_chr_list_append(rom->chrs, chr);
  }

  nrt_read_title_from_file(romfile, rom->header, rom->title);

  return rom;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
callq 0x384c
movq %rax, %rbx
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2280
movq (%rbx), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2d49
cmpl $0x1, %eax
jne 0x39a9
cmpb $0x0, 0x4(%r15)
je 0x394c
xorl %ebp, %ebp
movl $0x4000, %edi           # imm = 0x4000
callq 0x2240
movq %rax, %r12
movq %r14, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x2de0
cmpl $0x1, %eax
jne 0x39b3
movq 0x8(%rbx), %rdi
movl (%rdi), %edx
movq %r12, %rsi
callq 0x3593
incl %ebp
movzbl 0x4(%r15), %eax
cmpl %eax, %ebp
jb 0x3910
cmpb $0x0, 0x5(%r15)
je 0x3995
xorl %ebp, %ebp
movl $0x1, %edi
movl $0x2000, %esi           # imm = 0x2000
callq 0x21c0
movq %rax, %r12
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
movq %rax, %rcx
callq 0x3411
cmpl $0x1, %eax
jne 0x39b3
movq 0x10(%rbx), %rdi
movl (%rdi), %edx
movq %r12, %rsi
callq 0x3727
incl %ebp
movzbl 0x5(%r15), %eax
cmpl %eax, %ebp
jb 0x3955
movq %rbx, %rdx
addq $0x18, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x349c
jmp 0x39c5
movq %rbx, %rdi
callq 0x38b2
jmp 0x39c3
movq %rbx, %rdi
callq 0x38b2
movq %r12, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_rom_write_to_file
bool nrt_rom_write_to_file(nrt_rom *rom, FILE *outfile) {
  int i;

  rom->header->prg_count = nrt_prg_listitem_count(rom->prgs->list);
  rom->header->chr_count = nrt_chr_listitem_count(rom->chrs->list);

  fwrite(rom->header, NRT_HEADER_SIZE, 1, outfile);

  nrt_prg_listitem *prg_listitem = rom->prgs->list;
  while (prg_listitem) {
    fwrite(prg_listitem->prg, NRT_PRG_BANK_SIZE, 1, outfile);
    prg_listitem = prg_listitem->next;
  }

  nrt_chr_listitem *chr_listitem = rom->chrs->list;
  while (chr_listitem) {
    fwrite(chr_listitem->chr, NRT_CHR_BANK_SIZE, 1, outfile);
    chr_listitem = chr_listitem->next;
  }

  // only write the title if it has one.
  if (strlen(rom->title) > 0) {
    fwrite(rom->title, NRT_TITLE_MAX_LENGTH, 1, outfile);
  }

  return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rdi), %rax
movq 0x8(%rax), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x39f3
incb %al
movq 0x8(%rcx), %rcx
jmp 0x39e6
movq (%r14), %rdi
movb %al, 0x4(%rdi)
movq 0x10(%r14), %rax
movq 0x8(%rax), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x3a10
incb %al
movq 0x8(%rcx), %rcx
jmp 0x3a03
movb %al, 0x5(%rdi)
movl $0x10, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2340
movq 0x8(%r14), %rax
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x3a4d
movq (%r15), %rdi
movl $0x4000, %esi           # imm = 0x4000
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2340
movq 0x8(%r15), %r15
jmp 0x3a2d
movq 0x10(%r14), %rax
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x3a75
movq (%r15), %rdi
movl $0x2000, %esi           # imm = 0x2000
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2340
movq 0x8(%r15), %r15
jmp 0x3a55
cmpb $0x0, 0x18(%r14)
je 0x3a95
addq $0x18, %r14
movl $0xff, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x2340
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: p_indent
void p_indent(int level, char *str) {
  char *token, *newstr, *tofree;
  char indent_string[256] = "";
  bzero(indent_string, 256);

  tofree = newstr = strdup(str);

  int i = 0;

  for (i = 0; i < level; i++) {
    indent_string[i] = ' ';
    indent_string[i * 2 + 1] = ' ';
  }

  while((token = strsep(&newstr, "\n")) != NULL) {
    printf("%s%s\n", indent_string, token);
  }

  free(tofree);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x10(%rsp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x2180
movq %rbx, %rdi
callq 0x2350
movq %rax, %rbx
movq %rax, 0x8(%rsp)
testl %ebp, %ebp
jle 0x3b90
movl %ebp, %eax
xorl %ecx, %ecx
movb $0x20, %dl
movb %dl, 0x10(%rsp,%rcx)
movb %dl, 0x11(%rsp,%rcx,2)
incq %rcx
cmpq %rcx, %rax
jne 0x3b80
leaq 0x3502(%rip), %rsi      # 0x7099
leaq 0x8(%rsp), %rdi
callq 0x2250
testq %rax, %rax
je 0x3bde
leaq 0x3526(%rip), %r14      # 0x70d3
leaq 0x10(%rsp), %r15
leaq 0x34e0(%rip), %r12      # 0x7099
leaq 0x8(%rsp), %r13
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2140
movq %r13, %rdi
movq %r12, %rsi
callq 0x2250
testq %rax, %rax
jne 0x3bbe
movq %rbx, %rdi
callq 0x2040
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: p_section
void p_section(char *header, char *usage, struct help_cols *fields, struct help_cols *out_opts) {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  p_header(header);

  p_indent(1, usage);

  if (fields) {
    p_header("Fields");
    p_cols(opts, fields);
  }

  if (out_opts) {
    p_header("Options");
    p_cols(opts, out_opts);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %r14
movl $0x1, (%rax)
leaq 0x3497(%rip), %rdi      # 0x70c3
movq %r13, %rsi
xorl %eax, %eax
callq 0x2140
movl $0x1, %edi
movq %r12, %rsi
callq 0x3b3f
testq %r15, %r15
je 0x3c68
leaq 0x3474(%rip), %rdi      # 0x70c3
leaq 0x3483(%rip), %rsi      # 0x70d9
xorl %eax, %eax
callq 0x2140
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ca0
testq %rbx, %rbx
je 0x3c96
leaq 0x344f(%rip), %rdi      # 0x70c3
leaq 0x3465(%rip), %rsi      # 0x70e0
xorl %eax, %eax
callq 0x2140
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3ca0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: p_cols
void p_cols(help_opts *opts, struct help_cols *cols) {
  struct help_cols *t = cols;
  int usage_width = widest_cols_left(cols);
  char indent_string[256] = "";
  bzero(indent_string, 256);
  int i = 0;

  for (i = 0; i < opts->indent; i++) {
    // 2-space indent
    indent_string[i] = ' ';
    indent_string[i * 2 + 1] = ' ';
  }

  char fmt_string[256] = "";

  sprintf(fmt_string, "%s%%-%ds %%s\n", indent_string, usage_width + 2);

  while(t->usage) {
    printf(fmt_string, t->usage, t->desc);
    t = ++cols;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %rbx
movq %rdi, %r15
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x3ce9
leaq 0x10(%rbx), %r12
xorl %r14d, %r14d
movl %r14d, %ebp
callq 0x2110
movq %rax, %r14
cmpl %r14d, %ebp
cmovgl %ebp, %r14d
movq (%r12), %rdi
addq $0x10, %r12
testq %rdi, %rdi
jne 0x3cc4
addl $0x2, %r14d
jmp 0x3cef
movl $0x2, %r14d
movq %rsp, %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x2180
movl (%r15), %eax
testq %rax, %rax
je 0x3d19
xorl %ecx, %ecx
movb $0x20, %dl
movb %dl, (%rsp,%rcx)
movb %dl, 0x1(%rsp,%rcx,2)
incq %rcx
cmpq %rcx, %rax
jne 0x3d0a
leaq 0x100(%rsp), %r15
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x2180
leaq 0x33b1(%rip), %rsi      # 0x70e8
movq %rsp, %rdx
movq %r15, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x2320
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x3d75
addq $0x10, %rbx
leaq 0x100(%rsp), %r14
movq -0x8(%rbx), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
movq (%rbx), %rsi
addq $0x10, %rbx
testq %rsi, %rsi
jne 0x3d5b
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: widest_cols_left
int widest_cols_left(struct help_cols *cols) {
  struct help_cols *t = cols;
  int longest = 0;
  int current = 0;

  while(t->usage) {
    current = strlen(t->usage);
    if (current > longest) {
      longest = current;
    }

    t = ++cols;
  }

  return longest;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x3db3
addq $0x10, %rbx
xorl %ebp, %ebp
callq 0x2110
cmpl %eax, %ebp
cmovgl %ebp, %eax
movq (%rbx), %rdi
addq $0x10, %rbx
movl %eax, %ebp
testq %rdi, %rdi
jne 0x3d99
jmp 0x3db5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage
void print_usage() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  p_header(APPNAME);
  p_indent(1, "A tool for working with NES ROM files in the iNES v1 format");
  p_newline();

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

  p_header("Subcommands");

  static struct help_cols subcommand_table[] = {
    { "help", "Print the usage for the given subcommand" },
    { "info", "Print an information dump about the given rom" },
    { "prg", "Perform PRG bank actions such as extraction and replacement" },
    { "chr", "Perform CHR bank actions such as extraction and replacement" },
    { "title", "Perform Title metadata actions such as reading and setting" },
    NULL_COL
  };

  p_cols(opts, subcommand_table);

  p_newline();

  printf(
    "For usage information on the above subcommands run `%s help <subcommand>'\n",
    APPNAME
  );

  p_newline();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %r14
movl $0x1, (%rax)
leaq 0x32d7(%rip), %r15      # 0x70c3
leaq 0x330f(%rip), %rbx      # 0x7102
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2140
leaq 0x32ff(%rip), %rsi      # 0x7106
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x3320(%rip), %rsi      # 0x7142
movq %r15, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3315(%rip), %rsi      # 0x7148
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x3325(%rip), %rsi      # 0x7173
movq %r15, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x8381(%rip), %rsi      # 0xc1e0
movq %r14, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x3411(%rip), %rdi      # 0x7289
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2140
movl $0xa, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_info
void print_usage_info() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  p_header(APPNAME " info");
  p_indent(1,
      "Print verbose information about the given ROM file including whether it's valid,\n"
      "the number of PRG and CHR banks, region and mapper information as well as title metadata."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " info <rom>");
  p_newline();
}

// Assembly:
pushq %rbx
leaq 0x322a(%rip), %rbx      # 0x70c3
leaq 0x3434(%rip), %rsi      # 0x72d4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x342c(%rip), %rsi      # 0x72dd
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x3276(%rip), %rsi      # 0x7142
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x34ab(%rip), %rsi      # 0x7388
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
popq %rbx
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_prg
void print_usage_prg() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  p_header(APPNAME " prg");
  p_indent(1, "Perform PRG bank action such as extraction and replacement");
  p_newline();

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

  p_header("Actions");

  static struct help_cols action_cols[] = {
    "extract", "Extract the given PRG bank index to a raw PRG bank",
    "replace", "Replace a PRG bank index with the given PRG bank",
    NULL_COL
  };

  p_cols(opts, action_cols);

  p_newline();

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

  p_newline();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x31ae(%rip), %r14      # 0x70c3
leaq 0x347b(%rip), %rsi      # 0x7397
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3472(%rip), %rsi      # 0x739f
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x31fa(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3481(%rip), %rsi      # 0x73da
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x348d(%rip), %rsi      # 0x7401
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x82bb(%rip), %rsi      # 0xc240
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x34cf(%rip), %rdi      # 0x746d
leaq 0x315d(%rip), %rsi      # 0x7102
xorl %eax, %eax
callq 0x2140
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_prg_extract
void print_usage_prg_extract() {
  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 extract from",
    "<bank-index>", "The zero-based index of the PRG bank to extract",
    "<outflie>", "The output file.",
    NULL_COL
  };

  p_header(APPNAME " prg extract");
  p_indent(1,
    "Extract a PRG bank to a separate file."
  );
  p_newline();

  p_header("Usage");
  p_indent(1, APPNAME " prg extract <rom> [ <options> ... ] <bank-index> <outfile>");
  p_newline();

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x30e3(%rip), %r14      # 0x70c3
leaq 0x357c(%rip), %rsi      # 0x7563
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x357b(%rip), %rsi      # 0x7573
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x312f(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3576(%rip), %rsi      # 0x759a
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x359a(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x8240(%rip), %rsi      # 0xc290
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x3077(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x81f6(%rip), %rsi      # 0xc270
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_prg_replace
void print_usage_prg_replace() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    "-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 extract from",
    "<bank-index>", "The zero-based index of the bank to replace",
    "<prgbank>", "The source PRG bank file; a raw PRG bank",
    NULL_COL
  };

  p_header(APPNAME " prg replace");
  p_indent(1,
      "Replace a PRG bank in a ROM file with the given bank file"
  );
  p_newline();

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

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x300d(%rip), %r14      # 0x70c3
leaq 0x35f8(%rip), %rsi      # 0x76b5
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x35f7(%rip), %rsi      # 0x76c5
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x3059(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3605(%rip), %rsi      # 0x76ff
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x34c4(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x81da(%rip), %rsi      # 0xc300
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x2fa1(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x8180(%rip), %rsi      # 0xc2d0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_chr
void print_usage_chr() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  p_header(APPNAME " chr");
  p_indent(1, "Perform CHR bank action such as extraction and replacement");
  p_newline();

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

  p_header("Actions");

  static struct help_cols action_cols[] = {
    { "extract", "Extract the given CHR to either a raw CHR bank or a PNG file" },
    { "replace", "Replace a CHR bank with the given PNG or raw CHR bank" },
    NULL_COL
  };

  p_cols(opts, action_cols);

  p_newline();

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

  p_newline();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2f37(%rip), %r14      # 0x70c3
leaq 0x35ab(%rip), %rsi      # 0x773e
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x35a2(%rip), %rsi      # 0x7746
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2f83(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x35b1(%rip), %rsi      # 0x7781
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x3216(%rip), %rsi      # 0x7401
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x8144(%rip), %rsi      # 0xc340
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x3606(%rip), %rdi      # 0x781b
leaq 0x2ee6(%rip), %rsi      # 0x7102
xorl %eax, %eax
callq 0x2140
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/help.c
// Function: print_usage_chr_extract
void print_usage_chr_extract() {
  help_opts *opts = HELP_ALLOC_OPTS;
  opts->indent = 1;

  static struct help_cols option_cols[] = {
    "--help", "Display this help",
    "-f | --format <format>", "Export to the selected format: raw or png",
    "-w | --width <width>", "Applicable only for PNG output: The number of tiles wide the final image should be (default: 16)",
    NULL_COL
  };

  static struct help_cols arg_cols[] = {
    "<rom>", "The path to the source ROM file to extract from",
    "<bank-index>", "The zero-based index of the CHR bank to extract",
    "<outflie>", "The output file",
    NULL_COL
  };

  p_header(APPNAME " chr extract");
  p_indent(1,
      "Extract a CHR bank from a ROM file to either a raw CHR bank file or a PNG bitmap\n"
      "The format is determined by either the file extension of the output file or\n"
      "the value of the -f or --format flag"
  );
  p_newline();

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

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2e6c(%rip), %r14      # 0x70c3
leaq 0x3709(%rip), %rsi      # 0x7967
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3708(%rip), %rsi      # 0x7977
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2eb8(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x379e(%rip), %rsi      # 0x7a39
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x3323(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x80e9(%rip), %rsi      # 0xc3b0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x2e00(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x807f(%rip), %rsi      # 0xc370
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %r14
movl $0x1, (%rax)
leaq 0x2d96(%rip), %rbx      # 0x70c3
leaq 0x384a(%rip), %rsi      # 0x7b7e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3849(%rip), %rsi      # 0x7b8e
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2de2(%rip), %rsi      # 0x7142
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3860(%rip), %rsi      # 0x7bd1
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x324d(%rip), %rsi      # 0x75d9
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x8093(%rip), %rsi      # 0xc430
movq %r14, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x2d2a(%rip), %rsi      # 0x70e0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x8029(%rip), %rsi      # 0xc3f0
movq %r14, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x3830(%rip), %rsi      # 0x7c10
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3825(%rip), %rsi      # 0x7c16
movl $0x1, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3b3f
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2c9e(%rip), %r14      # 0x70c3
leaq 0x38a1(%rip), %rsi      # 0x7ccd
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x389a(%rip), %rsi      # 0x7cd7
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2cea(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3980(%rip), %rsi      # 0x7de9
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2f7d(%rip), %rsi      # 0x7401
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7fdb(%rip), %rsi      # 0xc470
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x3a0a(%rip), %rdi      # 0x7eb8
leaq 0x2c4d(%rip), %rsi      # 0x7102
xorl %eax, %eax
callq 0x2140
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2bd3(%rip), %r14      # 0x70c3
leaq 0x3a4a(%rip), %rsi      # 0x7f41
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3a47(%rip), %rsi      # 0x7f4f
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2c1f(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3a92(%rip), %rsi      # 0x7fc6
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x308a(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7f70(%rip), %rsi      # 0xc4d0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x2b67(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7f26(%rip), %rsi      # 0xc4b0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2afd(%rip), %r14      # 0x70c3
leaq 0x3a60(%rip), %rsi      # 0x802d
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3a5d(%rip), %rsi      # 0x803b
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2b49(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3ac1(%rip), %rsi      # 0x80cb
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2fb4(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7eda(%rip), %rsi      # 0xc510
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x2a91(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7e90(%rip), %rsi      # 0xc4f0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2a27(%rip), %r14      # 0x70c3
leaq 0x3a78(%rip), %rsi      # 0x811b
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3a78(%rip), %rsi      # 0x812c
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2a73(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3a7f(%rip), %rsi      # 0x815f
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2ede(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7e54(%rip), %rsi      # 0xc560
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x29bb(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7e0a(%rip), %rsi      # 0xc540
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x2951(%rip), %r14      # 0x70c3
leaq 0x3b07(%rip), %rsi      # 0x8280
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3afe(%rip), %rsi      # 0x8288
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x299d(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3b1b(%rip), %rsi      # 0x82d1
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2e08(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7dde(%rip), %rsi      # 0xc5c0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x28e5(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7d74(%rip), %rsi      # 0xc580
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/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 %r14
pushq %rbx
pushq %rax
movl $0x4, %edi
movl $0x1, %esi
callq 0x21c0
movq %rax, %rbx
movl $0x1, (%rax)
leaq 0x287b(%rip), %r14      # 0x70c3
leaq 0x3b7b(%rip), %rsi      # 0x83ca
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3b72(%rip), %rsi      # 0x83d2
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x28c7(%rip), %rsi      # 0x7142
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x3bd2(%rip), %rsi      # 0x845e
movl $0x1, %edi
callq 0x3b3f
movl $0xa, %edi
callq 0x2050
leaq 0x2d32(%rip), %rsi      # 0x75d9
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7d68(%rip), %rsi      # 0xc620
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
callq 0x2050
leaq 0x280f(%rip), %rsi      # 0x70e0
movq %r14, %rdi
xorl %eax, %eax
callq 0x2140
leaq 0x7cfe(%rip), %rsi      # 0xc5e0
movq %rbx, %rdi
callq 0x3ca0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2050
nop
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
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 0x4960
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 %rdi, 0x10(%rsp)
leaq 0x100(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsp)
movl $0x8, %ebp
movl $0x8, %eax
cmpq $0x28, %rax
ja 0x499d
addq 0x10(%rsp), %rax
addl $0x8, %ebp
movl %ebp, (%rsp)
jmp 0x49ab
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rdi
testq %rdi, %rdi
je 0x49f8
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %r14
movq %rbx, %rsi
callq 0x21d0
testl %eax, %eax
sete %al
je 0x49fa
cmpl $0x28, %ebp
ja 0x49e2
movq %r15, %rcx
movl %ebp, %r15d
addq %r14, %r15
addl $0x8, %ebp
movl %ebp, (%rsp)
jmp 0x49eb
leaq 0x8(%r15), %rcx
movq %rcx, 0x8(%rsp)
movq (%r15), %rdi
movq %rcx, %r15
testq %rdi, %rdi
jne 0x49bd
jmp 0x49fa
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
movq (%rsi), %rbx
addq $0x8, %r14
leaq 0x2653(%rip), %rsi      # 0x756b
movq %rbx, %rdi
callq 0x21d0
testl %eax, %eax
je 0x4f4f
leaq 0x2792(%rip), %rsi      # 0x76bd
movq %rbx, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x4f63
decl %ebp
movl %ebp, %edi
movq %r14, %rsi
callq 0x4d60
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x50e4
decl %ebp
movl %ebp, %edi
movq %r14, %rsi
callq 0x4c10
movq %rax, %rdi
callq 0x4f8c
leaq 0x2558(%rip), %rsi      # 0x74c2
movq %rbx, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x4f84
xorl %eax, %eax
callq 0x3ef2
xorl %edi, %edi
callq 0x2330
movq %rbx, %rdi
callq 0x2528
// File: /workspace/github_c_makefile_star2_O3/sadistech[P]nesromtool2/./src/subcommands/prg.c
// Function: subcommand_prg_extract
void subcommand_prg_extract(prg_opts *opts) {
  // now we're ready to write this stuff out.
  FILE *ifile = fopen(opts->romfile_path, "r");
  if (!ifile) {
    fprintf(stderr, "Failed to open file: %s\n", opts->romfile_path);
    exit(EXIT_FAILURE);
  }

  nrt_header *header = NRT_HEADER_ALLOC;
  nrt_header_extract(ifile, header);

  if (! nrt_validate_header(header)) {
    fprintf(stderr, "Rom file does not look valid: %s\n", opts->romfile_path);
    fclose(ifile);
    free(header);
    free(opts);
    exit(EXIT_FAILURE);
  }

  free(header);

  nrt_prgbank *prg = NRT_PRG_ALLOC;
  if (!nrt_extract_prg(ifile, opts->bank_index, prg)) {
    fprintf(stderr, "Failed to read PRG bank %d from %s\n", opts->bank_index, opts->romfile_path);
    fclose(ifile);
    free(prg);
    free(opts);
    exit(EXIT_FAILURE);
  }

  fclose(ifile);

  // ok, now let's write out the PRG
  FILE *ofile = fopen(opts->outfile_path, "w");

  if (!ofile) {
    perror("Failed to open file for writing");
    exit(EXIT_FAILURE);
  }

  if (opts->format == prg_raw_format) {
    // just write out the data to the file.

    fwrite(prg, NRT_PRG_BANK_SIZE, 1, ofile);

    fclose(ofile);
    free(prg);
  }

  free(opts);
  exit(EXIT_SUCCESS);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x27a9(%rip), %rsi      # 0x7744
callq 0x22c0
testq %rax, %rax
jne 0x4fc5
movq 0x704c(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x36e5(%rip), %rsi      # 0x869b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x21f0
jmp 0x506c
movq %rax, %r14
movl $0x10, %edi
callq 0x2240
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
callq 0x2d49
movq %r15, %rdi
callq 0x2d78
testb %al, %al
je 0x5039
movq %r15, %rdi
callq 0x2040
movl $0x4000, %edi           # imm = 0x4000
callq 0x2240
movq %rax, %r15
movl 0x404(%rbx), %esi
movq %r14, %rdi
movq %rax, %rdx
callq 0x2de0
testl %eax, %eax
jne 0x5076
movq 0x6fdb(%rip), %rax      # 0xbff8
movq (%rax), %rdi
movl 0x404(%rbx), %edx
leaq 0x36a9(%rip), %rsi      # 0x86d6
movq %rbx, %rcx
xorl %eax, %eax
callq 0x21f0
jmp 0x5054
movq 0x6fb8(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x366a(%rip), %rsi      # 0x86b4
movq %rbx, %rdx
xorl %eax, %eax
callq 0x21f0
movq %r14, %rdi
callq 0x2100
movq %r15, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
movl $0x1, %edi
callq 0x2330
movq %r14, %rdi
callq 0x2100
leaq 0x808(%rbx), %rdi
leaq 0x3588(%rip), %rsi      # 0x8614
callq 0x22c0
testq %rax, %rax
jne 0x50a4
leaq 0x365d(%rip), %rdi      # 0x86fa
callq 0x22d0
jmp 0x506c
cmpl $0x1, 0x400(%rbx)
jne 0x50d5
movq %rax, %r14
movl $0x4000, %esi           # imm = 0x4000
movl $0x1, %edx
movq %r15, %rdi
movq %rax, %rcx
callq 0x2340
movq %r14, %rdi
callq 0x2100
movq %r15, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %edi, %edi
callq 0x2330