LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/melynx[P]peekaboo/libpeekaboo/libpeekaboo.c
// Function: regfile_pp
void regfile_pp(peekaboo_insn_t *insn)
{
	switch (insn->arch)
	{
		case ARCH_AMD64:
			amd64_regfile_pp(insn->regfile);
			break;
		case ARCH_AARCH64:
			aarch64_regfile_pp(insn->regfile);
			break;
		case ARCH_X86:
			x86_regfile_pp(insn->regfile);
			break;
		default:
			PEEKABOO_DIE("libpeekaboo: Unsupported Architecture!\n");
			break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x128(%rax), %eax
movl %eax, -0xc(%rbp)
subl $0x1, %eax
je 0x5b36
jmp 0x5b10
movl -0xc(%rbp), %eax
subl $0x2, %eax
je 0x5b48
jmp 0x5b1a
movl -0xc(%rbp), %eax
subl $0x3, %eax
jne 0x5b5a
jmp 0x5b24
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x4100
jmp 0x5b7c
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x4040
jmp 0x5b7c
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x41e0
jmp 0x5b7c
movq 0x448f(%rip), %rax      # 0x9ff0
movq (%rax), %rdi
leaq 0x1609(%rip), %rsi      # 0x7174
movb $0x0, %al
callq 0x4190
movl $0x1, %edi
callq 0x4260
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/melynx[P]peekaboo/libpeekaboo/libpeekaboo.c
// Function: free_peekaboo_insn
void free_peekaboo_insn(peekaboo_insn_t *insn_ptr)
{
	if (insn_ptr != NULL)
	{
		if (insn_ptr->regfile != NULL)
		{
			free(insn_ptr->regfile);
			insn_ptr->regfile = NULL;
		}
		free(insn_ptr);
		insn_ptr = NULL;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x5be1
movq -0x8(%rbp), %rax
cmpq $0x0, 0x130(%rax)
je 0x5bd0
movq -0x8(%rbp), %rax
movq 0x130(%rax), %rdi
callq 0x4070
movq -0x8(%rbp), %rax
movq $0x0, 0x130(%rax)
movq -0x8(%rbp), %rdi
callq 0x4070
movq $0x0, -0x8(%rbp)
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt/error.c
// Function: nrt_append_error
void nrt_append_error(nrt_error *error, char *msg) {
  if (error->count >= NRT_MAX_ERRORS) {
    fprintf(stderr, "Cannot add additional errors.\n");
    exit(EXIT_FAILURE);
  }

  int len = strlen(msg);

  error->errors[error->count] = (char*)malloc(len + 1);
  strcpy(error->errors[error->count], msg);
  error->count++;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x10, (%rax)
jl 0x24fb
movq 0x9b18(%rip), %rax      # 0xbff8
movq (%rax), %rdi
leaq 0x5b1a(%rip), %rsi      # 0x8004
movb $0x0, %al
callq 0x21d0
movl $0x1, %edi
callq 0x2310
movq -0x10(%rbp), %rdi
callq 0x20f0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x2220
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
movq %rdx, 0x8(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq (%rcx), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rsi
callq 0x2090
movq -0x8(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt/util.c
// Function: nrt_validate_file
void nrt_validate_file(FILE *rom, nrt_error *error) {
  nrt_header *header = NRT_HEADER_ALLOC;
  char msg[256] = "";

  if (! fread(header, 1, sizeof(nrt_header), rom) ) {
    nrt_append_error(error, "Failed to read header from file.");
    return;
  }

  if (! nrt_validate_header_magic_word(header)) {
    sprintf(msg, "Magic word does not match: %s", header->magic_word);
    nrt_append_error(error, msg);
  }

  if (! nrt_validate_header_prg_count(header)) {
    sprintf(msg, "PRG count is invalid: %d", header->prg_count);
    nrt_append_error(error, msg);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x10, %edi
callq 0x2220
movq %rax, -0x18(%rbp)
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2160
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %esi
movl $0x10, %edx
callq 0x20a0
cmpq $0x0, %rax
jne 0x25c3
movq -0x10(%rbp), %rdi
leaq 0x5a67(%rip), %rsi      # 0x8023
callq 0x24c0
jmp 0x2633
movq -0x18(%rbp), %rdi
callq 0x2710
testb $0x1, %al
jne 0x25f9
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x5a62(%rip), %rsi      # 0x8044
movb $0x0, %al
callq 0x2300
movq -0x10(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x24c0
movq -0x18(%rbp), %rdi
callq 0x2740
testb $0x1, %al
jne 0x2633
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rax
movzbl 0x4(%rax), %edx
leaq 0x5a46(%rip), %rsi      # 0x8062
movb $0x0, %al
callq 0x2300
movq -0x10(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x24c0
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt/header.c
// Function: nrt_header_create
nrt_header* nrt_header_create(int prg_count, int chr_count) {
  nrt_header* header = NRT_HEADER_ALLOC;

  memcpy(header->magic_word, NRT_MAGIC_WORD, NRT_MAGIC_WORD_SIZE);

  header->prg_count = prg_count;
  header->chr_count = chr_count;

  return header;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl $0x10, %edi
callq 0x2220
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x5a15(%rip), %ecx      # 0x807b
movl %ecx, (%rax)
movl -0x4(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x4(%rax)
movl -0x8(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt/tile.c
// Function: nrt_tile_to_bitmap
void nrt_tile_to_bitmap(nrt_tile *tile, nrt_tile_bitmap *bitmap) {
  int i, j;

  // iterate over each byte (row of pixels)
  for (i = 0; i < NRT_TILE_CHANNEL_SIZE; i++) {
    // now, let's iterate over the bits in the row and write the pixels
    for (j = 0; j < 8; j++) {
      int pixel_offset = (i * NRT_TILE_WIDTH_PX) + j;
      bitmap->pixels[pixel_offset] = nrt_get_tile_pixel(i, j, tile);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x14(%rbp)
jge 0x289a
movl $0x0, -0x18(%rbp)
cmpl $0x8, -0x18(%rbp)
jge 0x288d
movl -0x14(%rbp), %eax
shll $0x3, %eax
addl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movq -0x8(%rbp), %rdx
callq 0x28a0
movb %al, %dl
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2854
jmp 0x288f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2847
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt/tile.c
// Function: nrt_bitmap_to_tile
void nrt_bitmap_to_tile(nrt_tile_bitmap *bitmap, nrt_tile *tile) {
  // iterate over the bitmap pixels
  int x, y;
  int pixel;

  for (y = 0; y < NRT_TILE_HEIGHT_PX; y++) {
    for (x = 0; x < NRT_TILE_WIDTH_PX; x++) {
      // shift the current byte over first
      tile->chan_a[y] <<= 1;
      tile->chan_b[y] <<= 1;

      // write the bit to each channel
      pixel = bitmap->pixels[x + (y * NRT_TILE_WIDTH_PX)];
      tile->chan_a[y] += pixel & 1;
      tile->chan_b[y] += pixel >> 1 & 1;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
cmpl $0x8, -0x18(%rbp)
jge 0x29a4
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x14(%rbp)
jge 0x2994
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %edx
shll %edx
movb %dl, (%rax,%rcx)
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsbl 0x8(%rax,%rcx), %edx
shll %edx
movb %dl, 0x8(%rax,%rcx)
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %edx
shll $0x3, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
andl $0x1, %esi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsbl (%rax,%rcx), %edx
addl %esi, %edx
movb %dl, (%rax,%rcx)
movl -0x1c(%rbp), %esi
sarl %esi
andl $0x1, %esi
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movsbl 0x8(%rax,%rcx), %edx
addl %esi, %edx
movb %dl, 0x8(%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2914
jmp 0x2996
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2903
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt/title.c
// Function: nrt_read_title_from_file
int nrt_read_title_from_file(FILE* rom, nrt_header* header, char* buf) {
  // first seek to end of file
  int offset = NRT_HEADER_SIZE + (header->prg_count * NRT_PRG_BANK_SIZE) + (header->chr_count * NRT_CHR_BANK_SIZE);

  fseek(rom, offset, SEEK_SET);

  return fread(buf, NRT_TITLE_MAX_LENGTH, 1, rom);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x4(%rax), %eax
shll $0xe, %eax
addl $0x10, %eax
movq -0x10(%rbp), %rcx
movzbl 0x5(%rcx), %ecx
shll $0xd, %ecx
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movslq -0x1c(%rbp), %rsi
xorl %edx, %edx
callq 0x2260
movq -0x18(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0xff, %esi
movl $0x1, %edx
callq 0x20a0
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_list_create
nrt_prg_list* nrt_prg_list_create(void)
{
  nrt_prg_list* list = (nrt_prg_list*)malloc(sizeof(nrt_prg_list));
  list->count = 0;
  list->list = NULL;

  return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x10, %edi
callq 0x2220
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_listitem_create
nrt_prg_listitem* nrt_prg_listitem_create(nrt_prgbank* prg, nrt_prg_listitem* next)
{
  nrt_prg_listitem *list = NRT_PRG_LISTITEM_ALLOC;
  list->prg = prg;
  list->next = next;

  return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x10, %edi
callq 0x2220
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x3220
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x32eb
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x332a
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
subl $0x1, %esi
callq 0x3410
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x3410
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x33a0
movq $0x0, -0x8(%rbp)
jmp 0x3401
cmpl $0x0, -0x14(%rbp)
jne 0x33cb
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3401
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
callq 0x3410
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_listitem_at
nrt_prg_listitem* nrt_prg_listitem_at(nrt_prg_list* list, int index)
{
  nrt_prg_listitem *l = list->list;
  int counter = 0;

  while (l) {
    if (counter == index) {
      return l;
    }

    counter++;
    l = l->next;
  }

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x345e
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x3447
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3466
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x342e
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_listitem_last
nrt_prg_listitem* nrt_prg_listitem_last(nrt_prg_list* list)
{
  nrt_prg_listitem *l = list->list;

  while (l) {
    if (!l->next) {
      return l;
    }

    l = l->next;
  }

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x34ae
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x34a0
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x34b6
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x3484
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_prg_listitem_count
int nrt_prg_listitem_count(nrt_prg_listitem *list) {
  nrt_prg_listitem *l = list;
  int counter = 0;

  while (l != NULL) {
    counter++;

    l = l->next;
  }

  return counter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x34f5
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x34d7
movl -0x14(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3560
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x3541
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2040
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x3524
movq -0x8(%rbp), %rdi
callq 0x2040
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x18(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x35b0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x1c(%rbp)
jne 0x367b
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x36ba
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
subl $0x1, %esi
callq 0x37a0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x37a0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x3730
movq $0x0, -0x8(%rbp)
jmp 0x3791
cmpl $0x0, -0x14(%rbp)
jne 0x375b
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3791
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $-0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
subl $0x1, %esi
callq 0x37a0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_chr_listitem_at
nrt_chr_listitem* nrt_chr_listitem_at(nrt_chr_list* list, int index)
{
  nrt_chr_listitem *l = list->list;
  int counter = 0;

  while (l) {
    if (counter == index) {
      return l;
    }

    counter++;
    l = l->next;
  }

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x37ee
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0x37d7
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x37f6
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x37be
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_chr_listitem_last
nrt_chr_listitem* nrt_chr_listitem_last(nrt_chr_list* list)
{
  nrt_chr_listitem *l = list->list;

  while (l) {
    if (!l->next) {
      return l;
    }

    l = l->next;
  }

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x383e
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x3830
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3846
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x3814
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_chr_listitem_count
int nrt_chr_listitem_count(nrt_chr_listitem *list) {
  nrt_chr_listitem *l = list;
  int counter = 0;

  while (l != NULL) {
    counter++;

    l = l->next;
  }

  return counter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x3885
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x3867
movl -0x14(%rbp), %eax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x38f0
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x38d1
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2040
movq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x38b4
movq -0x8(%rbp), %rdi
callq 0x2040
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/nrt.c
// Function: nrt_rom_create
nrt_rom* nrt_rom_create(void) {
  nrt_rom* rom = NRT_ROM_ALLOC;

  rom->header = NRT_HEADER_ALLOC;
  rom->prgs = nrt_prg_list_create();
  rom->chrs = nrt_chr_list_create();

  bzero(rom->title, NRT_TITLE_MAX_LENGTH);

  return rom;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x118, %edi            # imm = 0x118
callq 0x2220
movq %rax, -0x8(%rbp)
movl $0x10, %edi
callq 0x2220
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
callq 0x31e0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
callq 0x3570
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
xorl %esi, %esi
movl $0xff, %edx
callq 0x2160
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
callq 0x3900
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x2260
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x2690
cmpl $0x1, %eax
je 0x39ff
movq -0x18(%rbp), %rdi
callq 0x3970
movq $0x0, -0x8(%rbp)
jmp 0x3b16
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movzbl 0x4(%rcx), %ecx
cmpl %ecx, %eax
jge 0x3a76
movl $0x4000, %edi           # imm = 0x4000
callq 0x2220
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x28(%rbp), %rdx
callq 0x27e0
cmpl $0x1, %eax
je 0x3a5a
movq -0x18(%rbp), %rdi
callq 0x3970
movq -0x28(%rbp), %rdi
callq 0x2040
movq $0x0, -0x8(%rbp)
jmp 0x3b16
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x28(%rbp), %rsi
callq 0x3340
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3a06
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movzbl 0x5(%rcx), %ecx
cmpl %ecx, %eax
jge 0x3af6
movl $0x1, %edi
movl $0x2000, %esi           # imm = 0x2000
callq 0x21a0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movl -0x1c(%rbp), %edx
movq -0x30(%rbp), %rcx
callq 0x3040
cmpl $0x1, %eax
je 0x3ada
movq -0x18(%rbp), %rdi
callq 0x3970
movq -0x30(%rbp), %rdi
callq 0x2040
movq $0x0, -0x8(%rbp)
jmp 0x3b16
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rsi
callq 0x36d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3a7d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
addq $0x18, %rdx
callq 0x3120
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x34c0
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x4(%rax)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rdi
callq 0x3850
movb %al, %cl
movq -0x8(%rbp), %rax
movq (%rax), %rax
movb %cl, 0x5(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rcx
movl $0x10, %esi
movl $0x1, %edx
callq 0x2320
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3bc3
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rcx
movl $0x4000, %esi           # imm = 0x4000
movl $0x1, %edx
callq 0x2320
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x3b94
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x3c02
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rcx
movl $0x2000, %esi           # imm = 0x2000
movl $0x1, %edx
callq 0x2320
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x3bd3
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
callq 0x20f0
cmpq $0x0, %rax
jbe 0x3c30
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movq -0x10(%rbp), %rcx
movl $0xff, %esi
movl $0x1, %edx
callq 0x2320
movb $0x1, %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/sadistech[P]nesromtool2/./src/util.c
// Function: filename_no_ext
char *filename_no_ext(const char *filename) {
  char *newfilename = (char*)calloc(1, strlen(filename + 1));
  strcpy(newfilename, filename);
  char *dot = strrchr(newfilename, '.');

  if (!dot || dot == newfilename) return newfilename;

  *dot = '\0';

  return newfilename;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
callq 0x20f0
movq %rax, %rsi
movl $0x1, %edi
callq 0x21a0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2090
movq -0x18(%rbp), %rdi
movl $0x2e, %esi
callq 0x2140
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3cfa
movq -0x20(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x3d04
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3d13
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2160
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2160
movq -0x10(%rbp), %rdi
callq 0x2330
movq %rax, -0x20(%rbp)
movq %rax, -0x28(%rbp)
movl $0x0, -0x134(%rbp)
movl $0x0, -0x134(%rbp)
movl -0x134(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x3e0d
movslq -0x134(%rbp), %rax
movb $0x20, -0x130(%rbp,%rax)
movl -0x134(%rbp), %eax
shll %eax
addl $0x1, %eax
cltq
movb $0x20, -0x130(%rbp,%rax)
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x3dcd
jmp 0x3e0f
leaq -0x20(%rbp), %rdi
leaq 0x427f(%rip), %rsi      # 0x8099
callq 0x2230
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x3e44
leaq -0x130(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq 0x4298(%rip), %rdi      # 0x80d3
movb $0x0, %al
callq 0x2120
jmp 0x3e0f
movq -0x28(%rbp), %rdi
callq 0x2040
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x4, %edi
movl $0x1, %esi
callq 0x21a0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movq -0x8(%rbp), %rdi
callq 0x3d20
movq -0x10(%rbp), %rsi
movl $0x1, %edi
callq 0x3d70
cmpq $0x0, -0x18(%rbp)
je 0x3ecc
leaq 0x421f(%rip), %rdi      # 0x80d9
callq 0x3d20
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3f00
cmpq $0x0, -0x20(%rbp)
je 0x3eec
leaq 0x4206(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3f00
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4020
movl %eax, -0x1c(%rbp)
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2160
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2160
movl $0x0, -0x124(%rbp)
movl $0x0, -0x124(%rbp)
movl -0x124(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x3fa4
movslq -0x124(%rbp), %rax
movb $0x20, -0x120(%rbp,%rax)
movl -0x124(%rbp), %eax
shll %eax
addl $0x1, %eax
cltq
movb $0x20, -0x120(%rbp,%rax)
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x3f61
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2160
leaq -0x230(%rbp), %rdi
leaq -0x120(%rbp), %rdx
movl -0x1c(%rbp), %ecx
addl $0x2, %ecx
leaq 0x4116(%rip), %rsi      # 0x80e8
movb $0x0, %al
callq 0x2300
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4012
leaq -0x230(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movb $0x0, %al
callq 0x2120
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
movq %rax, -0x18(%rbp)
jmp 0x3fd9
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x407b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x20f0
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x4069
movl -0x18(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x8(%rbp)
movq %rax, -0x10(%rbp)
jmp 0x4042
movl -0x14(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/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 %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 0x4026(%rip), %rdi      # 0x8102
callq 0x3d20
movl $0x1, %edi
leaq 0x4019(%rip), %rsi      # 0x8106
callq 0x3d70
callq 0x3d50
leaq 0x4044(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4039(%rip), %rsi      # 0x8148
callq 0x3d70
callq 0x3d50
leaq 0x4053(%rip), %rdi      # 0x8173
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x80a0(%rip), %rsi      # 0xc1d0
callq 0x3f00
callq 0x3d50
leaq 0x4148(%rip), %rdi      # 0x8289
leaq 0x3fba(%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_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 %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 0x4148(%rip), %rdi      # 0x82d4
callq 0x3d20
movl $0x1, %edi
leaq 0x4140(%rip), %rsi      # 0x82dd
callq 0x3d70
callq 0x3d50
leaq 0x3f94(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x41c9(%rip), %rsi      # 0x8388
callq 0x3d70
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/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 %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 0x419b(%rip), %rdi      # 0x8397
callq 0x3d20
movl $0x1, %edi
leaq 0x4192(%rip), %rsi      # 0x839f
callq 0x3d70
callq 0x3d50
leaq 0x3f24(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x41ab(%rip), %rsi      # 0x83da
callq 0x3d70
callq 0x3d50
leaq 0x41c1(%rip), %rdi      # 0x8401
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7fe0(%rip), %rsi      # 0xc230
callq 0x3f00
callq 0x3d50
leaq 0x420c(%rip), %rdi      # 0x846d
leaq 0x3e9a(%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_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 %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 0x42b7(%rip), %rdi      # 0x8563
callq 0x3d20
movl $0x1, %edi
leaq 0x42b6(%rip), %rsi      # 0x8573
callq 0x3d70
callq 0x3d50
leaq 0x3e74(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x42bb(%rip), %rsi      # 0x859a
callq 0x3d70
callq 0x3d50
leaq 0x42e9(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7f80(%rip), %rsi      # 0xc280
callq 0x3f00
callq 0x3d50
leaq 0x3dcf(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7f3f(%rip), %rsi      # 0xc260
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_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 %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 0x4349(%rip), %rdi      # 0x86b5
callq 0x3d20
movl $0x1, %edi
leaq 0x4348(%rip), %rsi      # 0x86c5
callq 0x3d70
callq 0x3d50
leaq 0x3db4(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4360(%rip), %rsi      # 0x86ff
callq 0x3d70
callq 0x3d50
leaq 0x4229(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7f30(%rip), %rsi      # 0xc2f0
callq 0x3f00
callq 0x3d50
leaq 0x3d0f(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7edf(%rip), %rsi      # 0xc2c0
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_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 %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 0x4312(%rip), %rdi      # 0x873e
callq 0x3d20
movl $0x1, %edi
leaq 0x4309(%rip), %rsi      # 0x8746
callq 0x3d70
callq 0x3d50
leaq 0x3cf4(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x4322(%rip), %rsi      # 0x8781
callq 0x3d70
callq 0x3d50
leaq 0x3f91(%rip), %rdi      # 0x8401
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7eb0(%rip), %rsi      # 0xc330
callq 0x3f00
callq 0x3d50
leaq 0x438a(%rip), %rdi      # 0x881b
leaq 0x3c6a(%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_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 %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 0x448b(%rip), %rdi      # 0x8967
callq 0x3d20
movl $0x1, %edi
leaq 0x448a(%rip), %rsi      # 0x8977
callq 0x3d70
callq 0x3d50
leaq 0x3c44(%rip), %rdi      # 0x8142
callq 0x3d20
movl $0x1, %edi
leaq 0x452a(%rip), %rsi      # 0x8a39
callq 0x3d70
callq 0x3d50
leaq 0x40b9(%rip), %rdi      # 0x85d9
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7e70(%rip), %rsi      # 0xc3a0
callq 0x3f00
callq 0x3d50
leaq 0x3b9f(%rip), %rdi      # 0x80e0
callq 0x3d20
movq -0x8(%rbp), %rdi
leaq 0x7e0f(%rip), %rsi      # 0xc360
callq 0x3f00
callq 0x3d50
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)