LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_remove_parse
title_opts* subcommand_title_remove_parse(int argc, char **argv) {
  title_opts *opts = (title_opts*)calloc(1, sizeof(title_opts));

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

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

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

  int ch;

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

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

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

  argc -= optind;
  argv += optind;

  return opts;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
movl $0x1, %edi
movl $0x8ff, %esi            # imm = 0x8FF
callq 0x21c0
movq %rax, %r14
movq (%rbx), %r15
leaq 0x18f0(%rip), %rsi      # 0x74c2
movq %r15, %rdi
callq 0x21d0
testl %eax, %eax
je 0x5c59
movq %r14, %rdi
movq %r15, %rsi
callq 0x20a0
movq %r14, (%rsp)
movq %r14, %r15
addq $0x4ff, %r15            # imm = 0x4FF
leaq 0x2c31(%rip), %r12      # 0x882f
leaq 0x6cfb(%rip), %r13      # 0xc900
movq 0x63c4(%rip), %r14      # 0xbfd0
movl %ebp, %edi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0x2130
cmpl $0x67, %eax
jg 0x5c2a
testl %eax, %eax
je 0x5c0c
jmp 0x5c3c
cmpl $0x6f, %eax
jne 0x5c54
movq (%r14), %rsi
movq %r15, %rdi
callq 0x20a0
jmp 0x5c0c
cmpl $-0x1, %eax
jne 0x5c67
movq (%rsp), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x68, %eax
jne 0x5c67
xorl %eax, %eax
callq 0x46b1
xorl %edi, %edi
callq 0x2330
movl %eax, %edi
callq 0x2816
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title
void subcommand_title(int argc, char **argv) {
  char *action = *(argv++);

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

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
movq (%rsi), %r14
addq $0x8, %rbx
leaq 0x23b2(%rip), %rsi      # 0x8037
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
je 0x5cdb
leaq 0x22b3(%rip), %rsi      # 0x7f4b
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
je 0x5cf6
leaq 0x247a(%rip), %rsi      # 0x8125
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x5d0a
decl %ebp
movl %ebp, %edi
movq %rbx, %rsi
callq 0x5ba6
movq %rax, %rbx
leaq 0x400(%rax), %rdi
movl $0xff, %edx
xorl %esi, %esi
callq 0x2180
jmp 0x5cea
decl %ebp
movl %ebp, %edi
movq %rbx, %rsi
callq 0x59f4
movq %rax, %rbx
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5d33
decl %ebp
movl %ebp, %edi
movq %rbx, %rsi
callq 0x5b16
movq %rax, %rdi
callq 0x5de8
leaq 0x17b1(%rip), %rsi      # 0x74c2
movq %r14, %rdi
callq 0x21d0
testl %eax, %eax
jne 0x5d2b
xorl %eax, %eax
callq 0x443a
xorl %edi, %edi
callq 0x2330
movq %r14, %rdi
callq 0x2839
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_set
void subcommand_title_set(title_opts *opts) {
  static char tempfile_path[] = "/tmp/nrt-rom.XXXXXX";

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

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

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

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

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

  nrt_rom_write_to_file(rom, tempfile);

  fclose(tempfile);
  nrt_rom_free(rom);

  rename(tempfile_path, opts->outfile_path);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x19ff(%rip), %rsi      # 0x7744
callq 0x22c0
testq %rax, %rax
je 0x5de3
movq %rax, %r15
movq %rax, %rdi
callq 0x38df
movq %rax, %r14
movq %r15, %rdi
callq 0x2100
leaq 0x18(%r14), %r15
movl $0xff, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2180
leaq 0x400(%rbx), %rsi
movq %r15, %rdi
callq 0x20a0
leaq 0x6bce(%rip), %r15      # 0xc960
movq %r15, %rdi
callq 0x2270
leaq 0x2873(%rip), %rsi      # 0x8614
movl %eax, %edi
callq 0x2290
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0x3a0a
movq %r12, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x38c0
addq $0x4ff, %rbx            # imm = 0x4FF
movq %r15, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x22e0
callq 0x285d
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/subcommands/title.c
// Function: subcommand_title_get
void subcommand_title_get(title_opts *opts) {
  FILE *romfile = fopen(opts->romfile_path, "r");

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

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

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

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

  exit(EXIT_SUCCESS);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x194d(%rip), %rsi      # 0x7744
callq 0x22c0
testq %rax, %rax
jne 0x5e17
leaq 0x2967(%rip), %rdi      # 0x876f
callq 0x22d0
movl $0x1, %edi
callq 0x2330
movq %rax, %r15
movq %rax, %rdi
callq 0x38df
movq %rax, %r14
movq %r15, %rdi
callq 0x2100
cmpb $0x0, 0x18(%r14)
jne 0x5e3d
leaq 0x2a22(%rip), %rdi      # 0x885d
jmp 0x5e44
movq %r14, %rdi
addq $0x18, %rdi
callq 0x20b0
movq %r14, %rdi
callq 0x38c0
movq %rbx, %rdi
callq 0x2040
xorl %edi, %edi
callq 0x2330
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/chr2png_main.c
// Function: validate_outdir
void validate_outdir(char *outdir) {
  // first, let's make sure the opts->outdir exists and is a directory before we get started
  // (assuming that it's specified)
  if (outdir[0] != '\0') {
    struct stat *outdir_stat = (struct stat*)malloc(sizeof(struct stat));

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

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

    free(outdir_stat);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, (%rdi)
je 0x64e5
movq %rdi, %rbx
movl $0x90, %edi
callq 0x2240
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2200
testl %eax, %eax
jne 0x64ed
movl 0x18(%r14), %ebx
movq %r14, %rdi
callq 0x2040
btl $0xe, %ebx
jae 0x64f8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2a0c
callq 0x2a25
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/chr2png_main.c
// Function: validate_chrfile
void validate_chrfile(char *filepath) {
  struct stat *filestat = (struct stat*)malloc(sizeof(struct stat));

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

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

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x90, %edi
callq 0x2240
movq %rax, %rbx
movq %r14, %rdi
movq %rax, %rsi
callq 0x2200
testl %eax, %eax
jne 0x652e
testb $-0x80, 0x19(%rbx)
je 0x6539
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2a4a
movq %rbx, %rdi
callq 0x2a63
// File: /workspace/github_c_makefile_star2_O1/sadistech[P]nesromtool2/./src/chr2png_main.c
// Function: chr_tile_count
int chr_tile_count(char *chrfile) {
  struct stat *chrfile_stat = (struct stat*)malloc(sizeof(struct stat));

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

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

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

  return size / NRT_TILE_SIZE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x90, %edi
callq 0x2240
movq %rax, %r14
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2200
testl %eax, %eax
jne 0x65cf
movl 0x30(%r14), %ebx
movq %r14, %rdi
callq 0x2040
testb $0xf, %bl
jne 0x65da
sarl $0x4, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2acb
movl %ebx, %edi
callq 0x2ae4
// File: /workspace/github_c_makefile_star2_O1/openshmem-org[P]openshmem-examples/c/fip.c
// Function: main
int
main(void)
{
    float *f;
    int me;

    shmem_init();
    me = shmem_my_pe();

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

    *f = PI;
    shmem_barrier_all();

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

    shmem_barrier_all();

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

    shmem_free(f);

    shmem_finalize();

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
callq 0x1090
callq 0x1060
movl %eax, %ebp
movl $0x4, %edi
callq 0x1070
movq %rax, %rbx
movl $0x40490fdb, (%rax)     # imm = 0x40490FDB
callq 0x1080
testl %ebp, %ebp
jne 0x11ec
movss 0xe25(%rip), %xmm0      # 0x2004
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1040
callq 0x1080
cmpl $0x1, %ebp
jne 0x1240
movss (%rbx), %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
addss 0xdff(%rip), %xmm1      # 0x2008
andps 0xe00(%rip), %xmm1      # 0x2010
movss 0xdf4(%rip), %xmm2      # 0x200c
ucomiss %xmm1, %xmm2
leaq 0xe0d(%rip), %rax       # 0x202f
leaq 0xe09(%rip), %rdx       # 0x2032
cmovaq %rax, %rdx
leaq 0xdec(%rip), %rdi       # 0x2020
movl $0x1, %esi
movb $0x1, %al
callq 0x1030
movq %rbx, %rdi
callq 0x10a0
callq 0x1050
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/keithnoguchi[P]pearls-in-action/0x2/squash_main.c
// Function: main
int main(void)
{
#define WORDMAX	100
	char word[WORDMAX], sig[WORDMAX], oldsig[WORDMAX];
	int linenum = 0;

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movb $0x0, (%rsp)
leaq 0xe6c(%rip), %rdi       # 0x2004
leaq 0x70(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
xorl %eax, %eax
callq 0x1070
cmpl $-0x1, %eax
je 0x121d
movq %rsp, %rbx
leaq 0x70(%rsp), %r14
leaq 0xe4a(%rip), %r15       # 0x200a
leaq 0xe0(%rsp), %r12
leaq 0xe35(%rip), %r13       # 0x2004
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
testl %eax, %eax
je 0x11f9
testl %ebp, %ebp
je 0x11ee
movl $0xa, %edi
callq 0x1030
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1040
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x1050
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1070
decl %ebp
cmpl $-0x1, %eax
jne 0x11d1
movl $0xa, %edi
callq 0x1030
xorl %eax, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: read_file
unsigned char *read_file(const char *fname, unsigned int *out_size)
{
	unsigned char *buf;
	struct stat st;
	int size, ret;
	FILE *fd;

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

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

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r13
movq %rdi, %r14
leaq 0x8(%rsp), %rsi
callq 0x10c0
testl %eax, %eax
je 0x1269
leaq 0xdcc(%rip), %rdi       # 0x2014
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x1080
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rsp), %r12
testl %r12d, %r12d
jle 0x12c1
leaq 0xdcd(%rip), %rsi       # 0x2047
movq %r14, %rdi
callq 0x10f0
testq %rax, %rax
je 0x12dc
movq %rax, %r15
movl %r12d, %ebp
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq %rbp, %rdi
callq 0x10e0
testq %rax, %rax
je 0x12e8
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
movq %r15, %rcx
callq 0x1060
cmpl $0x1, %eax
jne 0x1308
movl %r12d, (%r13)
jmp 0x12fb
leaq 0xd66(%rip), %rdi       # 0x202e
xorl %ebx, %ebx
movq %r14, %rsi
movl %r12d, %edx
xorl %eax, %eax
callq 0x1080
jmp 0x1254
leaq 0xd67(%rip), %rdi       # 0x204a
jmp 0x1248
leaq 0xd72(%rip), %rdi       # 0x2061
xorl %ebx, %ebx
movl %r12d, %esi
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
callq 0x1070
jmp 0x1254
leaq 0xd6f(%rip), %rdi       # 0x207e
movq %r14, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x1080
movq %rbx, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x1070
xorl %ebx, %ebx
jmp 0x1254
// File: /workspace/github_c_makefile_star2_O1/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: print_sections
void print_sections(struct section_info *sections, int num_sections)
{
	int i;
	printf("Section\t\t  Offset\t  Length\t     CRC\n");
	printf("========================================================\n");
	for (i = 0; i < num_sections; i++) {
		printf("section_%d\t%8d\t%8d\t%08x (%s)\n",
		       i, sections[i].offset, sections[i].length, sections[i].header_crc,
			(sections[i].header_crc == sections[i].actual_crc) ? "OK" : "MISMATCH!"
		);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x126f(%rip), %rdi      # 0x25b8
callq 0x1050
leaq 0x1287(%rip), %rdi      # 0x25dc
callq 0x1050
testl %ebp, %ebp
jle 0x13ab
movl %ebp, %r12d
addq $0x1c, %rbx
leaq 0xd4b(%rip), %r13       # 0x20b7
leaq 0xd47(%rip), %rbp       # 0x20ba
leaq 0xd1f(%rip), %r14       # 0x2099
xorl %r15d, %r15d
movl -0x1c(%rbx), %r8d
movq %r13, %r9
cmpl -0x18(%rbx), %r8d
je 0x138d
movq %rbp, %r9
movl -0x4(%rbx), %edx
movl (%rbx), %ecx
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x1080
incq %r15
addq $0x20, %rbx
cmpq %r15, %r12
jne 0x137d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: get_global_crc
unsigned int get_global_crc(unsigned char *buf, int size)
{
	if (size < GLOBAL_HEADER_SIZE) {
		printf("Invalid firmware size: %d\n", size);
		return 0;
	}
	
	return crc32(buf + GLOBAL_HEADER_SIZE, size - GLOBAL_HEADER_SIZE);
}

// Assembly:
pushq %rbx
cmpl $0xdf, %esi
jg 0x13d5
leaq 0xcfa(%rip), %rdi       # 0x20c4
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1080
jmp 0x13ea
addq $0xe0, %rdi
addl $0xffffff20, %esi       # imm = 0xFFFFFF20
callq 0x1bc4
movq %rax, %rbx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/evilwombat[P]gopro-fw-tools/h4-section-patch.c
// Function: save_file
static int save_file(const char *output_name, int size, unsigned char *buf)
{
	FILE *ofd;
	int ret;
	ofd = fopen(output_name, "wb+");
	if (!ofd) {
		printf("Could not write to %s\n", output_name);
		return -1;
	}
	ret = fwrite(buf, size, 1, ofd);
	fclose(ofd);

	return ret == 1 ? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
leaq 0xa33(%rip), %rsi       # 0x259d
callq 0x10f0
testq %rax, %rax
je 0x1ba1
movq %rax, %r14
movslq %ebp, %rsi
movl $0x1, %edx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x1110
movq %rax, %rbx
movq %r14, %rdi
callq 0x1070
xorl %eax, %eax
cmpl $0x1, %ebx
setne %al
negl %eax
jmp 0x1bb7
leaq 0x9f9(%rip), %rdi       # 0x25a1
movq %r15, %rsi
xorl %eax, %eax
callq 0x1080
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ryuichiueda[P]glueutils/src/flip12.c
// Function: usage
void usage(void){
	fputs("flip12: flip stdout and stderr\n", stderr);
	fputs("usage: flip12 <command> [args]\n", stderr);
	fputs("\nCopyright (C) 2021 Ryuichi Ueda\n", stderr);
	fputs("Released under the MIT License.\n", stderr);
	fputs("https://github.com/ryuichiueda/glueutils\n", stderr);
}

// Assembly:
pushq %rbx
movq 0x2f40(%rip), %rbx      # 0x3ff8
movq (%rbx), %rsi
leaq 0xf42(%rip), %rdi       # 0x2004
callq 0x1060
movq (%rbx), %rsi
leaq 0xf53(%rip), %rdi       # 0x2024
callq 0x1060
movq (%rbx), %rsi
leaq 0xf64(%rip), %rdi       # 0x2044
callq 0x1060
movq (%rbx), %rsi
leaq 0xf77(%rip), %rdi       # 0x2066
callq 0x1060
movq (%rbx), %rsi
leaq 0xf89(%rip), %rdi       # 0x2087
popq %rbx
jmp 0x1060
// File: /workspace/github_c_makefile_star2_O1/ryuichiueda[P]glueutils/src/flip12.c
// Function: main
int main(int argc, char * argv[])
{
	if(argc < 2){
		usage();
		exit(1);
	}

	trydup2(1, 3);
	trydup2(2, 1);
	trydup2(3, 2);

	return - execvp(argv[1], &argv[1]);
}

// Assembly:
pushq %rbx
cmpl $0x1, %edi
jle 0x128a
movq %rsi, %rbx
movl $0x1, %edi
movl $0x3, %esi
callq 0x120c
movl $0x2, %edi
movl $0x1, %esi
callq 0x120c
movl $0x3, %edi
movl $0x2, %esi
callq 0x120c
movq 0x8(%rbx), %rdi
addq $0x8, %rbx
movq %rbx, %rsi
callq 0x1070
negl %eax
popq %rbx
retq
callq 0x1104
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: strdump
void
strdump(void)
{
	size_t i;
	uint c;

	fprintf(stderr, "ESC%c", strescseq.type);
	for (i = 0; i < strescseq.len; i++) {
		c = strescseq.buf[i] & 0xff;
		if (c == '\0') {
			putc('\n', stderr);
			return;
		} else if (isprint(c)) {
			putc(c, stderr);
		} else if (c == '\n') {
			fprintf(stderr, "(\\n)");
		} else if (c == '\r') {
			fprintf(stderr, "(\\r)");
		} else if (c == 0x1b) {
			fprintf(stderr, "(\\e)");
		} else {
			fprintf(stderr, "(%02x)", c);
		}
	}
	fprintf(stderr, "ESC\\\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x125fe(%rip), %r12     # 0x18ff0
movq (%r12), %rdi
movsbl 0x16cab(%rip), %edx     # 0x1d6a8
leaq 0xbfa8(%rip), %rsi      # 0x129ac
xorl %eax, %eax
callq 0x68e0
cmpq $0x0, 0x16cad(%rip)     # 0x1d6c0
je 0x6ac6
pushq $0x4
popq %r14
pushq $0x1
popq %r15
leaq 0xbf99(%rip), %rbp      # 0x129c1
xorl %r13d, %r13d
movq 0x16c7e(%rip), %rax     # 0x1d6b0
movzbl (%rax,%r13), %ebx
testl %ebx, %ebx
je 0x6aac
callq 0x63b0
movq (%rax), %rax
testb $0x40, 0x1(%rax,%rbx,2)
movq (%r12), %rcx
je 0x6a66
movl %ebx, %edi
movq %rcx, %rsi
callq 0x6510
incq %r13
cmpq 0x16c5e(%rip), %r13     # 0x1d6c0
jb 0x6a2b
jmp 0x6ac6
cmpl $0x1b, %ebx
je 0x6a87
cmpl $0xd, %ebx
je 0x6a7e
cmpl $0xa, %ebx
jne 0x6a9b
leaq 0xbf36(%rip), %rdi      # 0x129b2
jmp 0x6a8e
leaq 0xbf32(%rip), %rdi      # 0x129b7
jmp 0x6a8e
leaq 0xbf2e(%rip), %rdi      # 0x129bc
movq %r14, %rsi
movq %r15, %rdx
callq 0x6870
jmp 0x6a58
movq %rcx, %rdi
movq %rbp, %rsi
movl %ebx, %edx
xorl %eax, %eax
callq 0x68e0
jmp 0x6a58
movq (%r12), %rsi
pushq $0xa
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6510
movq (%r12), %rcx
leaq 0xbef7(%rip), %rdi      # 0x129c8
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6870
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: tinsync
int
tinsync(uint timeout)
{
    struct timespec now;
    if (su && !clock_gettime(CLOCK_MONOTONIC, &now)
           && TIMEDIFF(now, sutv) >= timeout)
        su = 0;
    return su;
}

// Assembly:
cmpb $0x1, 0x135bd(%rip)     # 0x1a4d0
jne 0x6f7d
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
movq %rsp, %rsi
movl $0x1, %edi
callq 0x6130
testl %eax, %eax
jne 0x6f78
movq (%rsp), %rax
subq 0x135a0(%rip), %rax     # 0x1a4d8
movq 0x8(%rsp), %rcx
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
cvtsi2sd %rax, %xmm0
subq 0x13590(%rip), %rcx     # 0x1a4e0
cvtsi2sd %rcx, %xmm1
divsd 0xb0ab(%rip), %xmm1     # 0x12008
addsd %xmm0, %xmm1
movl %ebx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
ucomisd %xmm0, %xmm1
jb 0x6f78
movb $0x0, 0x13558(%rip)     # 0x1a4d0
addq $0x10, %rsp
popq %rbx
movzbl 0x1354c(%rip), %eax     # 0x1a4d0
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: utf8encode
size_t
utf8encode(Rune u, char *c)
{
    size_t len, i;

    len = utf8validate(&u, 0);
    if (len > UTF_SIZ)
        return 0;

    for (i = len - 1; i != 0; --i) {
        c[i] = utf8encodebyte(u, 0);
        u >>= 6;
    }
    c[0] = utf8encodebyte(u, len);

    return len;
}

// Assembly:
movl %edi, %eax
andl $0xfffff800, %eax       # imm = 0xFFFFF800
cmpl $0xd800, %eax           # imm = 0xD800
movl $0xfffd, %eax           # imm = 0xFFFD
movl %edi, %ecx
cmovel %eax, %ecx
cmpl $0x110000, %edi         # imm = 0x110000
cmovael %eax, %ecx
xorl %eax, %eax
leaq 0xb3db(%rip), %rdx      # 0x124a0
movq %rax, %rdi
incq %rax
cmpl 0x4(%rdx,%rdi,4), %ecx
ja 0x70c5
cmpq $0x4, %rax
jbe 0x70da
xorl %eax, %eax
retq
cmpq $0x1, %rax
je 0x70fa
leaq -0x1(%rax), %rdx
movl %ecx, %edi
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, (%rsi,%rdx)
shrl $0x6, %ecx
decq %rdx
jne 0x70e4
leaq 0xb36b(%rip), %rdx      # 0x1246c
leaq 0xb369(%rip), %rdi      # 0x12471
movzbl (%rax,%rdi), %edi
notl %edi
andl %ecx, %edi
orb (%rax,%rdx), %dil
movb %dil, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: selstart
void
selstart(int col, int row, int snap)
{
    selclear();
    sel.mode = SEL_EMPTY;
    sel.type = SEL_REGULAR;
    sel.alt = IS_SET(MODE_ALTSCREEN);
    sel.snap = snap;
    sel.oe.x = sel.ob.x = col;
    sel.oe.y = sel.ob.y = row;
    selnormalize();

    if (sel.snap != 0)
        sel.mode = SEL_READY;
    tsetdirt(sel.nb.y, sel.ne.y);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %r14d
movl %esi, %ebx
movl %edi, %ebp
cmpl $-0x1, 0x133c1(%rip)    # 0x1a504
je 0x716a
movl $0x0, 0x13399(%rip)     # 0x1a4e8
movl $0xffffffff, 0x133ab(%rip) # imm = 0xFFFFFFFF
movl 0x13399(%rip), %edi     # 0x1a4f8
movl 0x1339b(%rip), %esi     # 0x1a500
callq 0x7304
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x1336d(%rip)     # 0x1a4e8
movl 0x1438b(%rip), %eax     # 0x1b50c
shrl $0x2, %eax
andl $0x1, %eax
movl %eax, 0x13387(%rip)     # 0x1a514
movl %r14d, 0x1335c(%rip)    # 0x1a4f0
movl %ebp, 0x1336a(%rip)     # 0x1a504
movl %ebp, 0x1336c(%rip)     # 0x1a50c
movl %ebx, 0x13362(%rip)     # 0x1a508
movl %ebx, 0x13364(%rip)     # 0x1a510
callq 0x7208
cmpl $0x0, 0x13338(%rip)     # 0x1a4f0
je 0x71c4
movl $0x2, 0x13324(%rip)     # 0x1a4e8
movl 0x1332e(%rip), %edi     # 0x1a4f8
movl 0x13330(%rip), %esi     # 0x1a500
popq %rbx
popq %r14
popq %rbp
jmp 0x7304
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: selclear
void
selclear(void)
{
    if (sel.ob.x == -1)
        return;
    sel.mode = SEL_IDLE;
    sel.ob.x = -1;
    tsetdirt(sel.nb.y, sel.ne.y);
}

// Assembly:
cmpl $-0x1, 0x13324(%rip)    # 0x1a504
je 0x7207
movl $0x0, 0x132fc(%rip)     # 0x1a4e8
movl $0xffffffff, 0x1330e(%rip) # imm = 0xFFFFFFFF
movl 0x132fc(%rip), %edi     # 0x1a4f8
movl 0x132fe(%rip), %esi     # 0x1a500
jmp 0x7304
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: selextend
void
selextend(int col, int row, int type, int done)
{
    int oldey, oldex, oldsby, oldsey, oldtype;

    if (sel.mode == SEL_IDLE)
        return;
    if (done && sel.mode == SEL_EMPTY) {
        selclear();
        return;
    }

    oldey = sel.oe.y;
    oldex = sel.oe.x;
    oldsby = sel.nb.y;
    oldsey = sel.ne.y;
    oldtype = sel.type;

    sel.oe.x = col;
    sel.oe.y = row;
    selnormalize();
    sel.type = type;

    if (oldey != sel.oe.y || oldex != sel.oe.x || oldtype != sel.type || sel.mode == SEL_EMPTY)
        tsetdirt(MIN(sel.nb.y, oldsby), MAX(sel.ne.y, oldsey));

    sel.mode = done ? SEL_IDLE : SEL_READY;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x13183(%rip), %eax     # 0x1a4e8
testl %eax, %eax
je 0x7452
movl %ecx, %ebx
testl %ecx, %ecx
sete %cl
cmpl $0x1, %eax
setne %al
orb %cl, %al
jne 0x73be
cmpl $-0x1, 0x1317f(%rip)    # 0x1a504
je 0x7452
movl $0x0, 0x13153(%rip)     # 0x1a4e8
movl $0xffffffff, 0x13165(%rip) # imm = 0xFFFFFFFF
movl 0x13153(%rip), %edi     # 0x1a4f8
movl 0x13155(%rip), %esi     # 0x1a500
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7304
movl %edx, %ebp
movl 0x13149(%rip), %r12d    # 0x1a510
movl 0x1313e(%rip), %r13d    # 0x1a50c
movl 0x13123(%rip), %r14d    # 0x1a4f8
movl 0x13124(%rip), %r15d    # 0x1a500
movl 0x1310a(%rip), %eax     # 0x1a4ec
movl %eax, 0x4(%rsp)
movl %edi, 0x13120(%rip)     # 0x1a50c
movl %esi, 0x1311e(%rip)     # 0x1a510
callq 0x7208
movl %ebp, 0x130ef(%rip)     # 0x1a4ec
cmpl 0x1310c(%rip), %r12d    # 0x1a510
jne 0x741e
cmpl 0x130ff(%rip), %r13d    # 0x1a50c
jne 0x741e
cmpl %ebp, 0x4(%rsp)
jne 0x741e
cmpl $0x1, 0x130cc(%rip)     # 0x1a4e8
jne 0x7443
movl 0x130d4(%rip), %eax     # 0x1a4f8
cmpl %r14d, %eax
cmovll %eax, %r14d
movl 0x130cf(%rip), %eax     # 0x1a500
cmpl %r15d, %eax
cmovgl %eax, %r15d
movl %r14d, %edi
movl %r15d, %esi
callq 0x7304
xorl %eax, %eax
testl %ebx, %ebx
sete %al
addl %eax, %eax
movl %eax, 0x13096(%rip)     # 0x1a4e8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: tlinelen
int
tlinelen(int y)
{
    int i = term.col;

    if (TLINE(y)[i - 1].mode & ATTR_WRAP)
        return i;

    while (i > 0 && TLINE(y)[i - 1].u == ' ')
        --i;

    return i;
}

// Assembly:
movl 0x12dd0(%rip), %eax     # 0x1a51c
movslq %eax, %r8
movl 0x13d7f(%rip), %ecx     # 0x1b4d4
movl %edi, %esi
leaq 0x12dba(%rip), %rdx     # 0x1a518
subl %ecx, %esi
jge 0x77a2
movl 0x13d67(%rip), %r9d     # 0x1b4d0
addl %esi, %r9d
addl $0x1f5, %r9d            # imm = 0x1F5
movslq %r9d, %r9
imulq $0x10624dd3, %r9, %r10  # imm = 0x10624DD3
movq %r10, %r11
shrq $0x3f, %r11
sarq $0x25, %r10
addl %r11d, %r10d
imull $0x1f4, %r10d, %r10d    # imm = 0x1F4
subl %r10d, %r9d
movslq %r9d, %r9
leaq (%rdx,%r9,8), %r9
addq $0x18, %r9
jmp 0x77b0
movslq %esi, %r9
shlq $0x3, %r9
addq 0x12d70(%rip), %r9      # 0x1a520
movq (%r9), %r9
movq %r8, %r10
shlq $0x4, %r10
testb $0x1, -0xb(%r9,%r10)
sete %r9b
testl %r8d, %r8d
setg %r8b
andb %r9b, %r8b
cmpb $0x1, %r8b
jne 0x7841
movslq %esi, %r8
shlq $0x3, %r8
addq 0x12d3e(%rip), %r8      # 0x1a520
movl 0x13ce7(%rip), %r9d     # 0x1b4d0
addl %r9d, %esi
addl $0x1f5, %esi            # imm = 0x1F5
movslq %esi, %rsi
imulq $0x10624dd3, %rsi, %r9  # imm = 0x10624DD3
movq %r9, %r10
shrq $0x3f, %r10
sarq $0x25, %r9
addl %r10d, %r9d
imull $0x1f4, %r9d, %r9d      # imm = 0x1F4
subl %r9d, %esi
cmpl %ecx, %edi
movslq %esi, %rcx
leaq 0x18(%rdx,%rcx,8), %rcx
cmovgeq %r8, %rcx
movq (%rcx), %rcx
addq $-0x10, %rcx
movl %eax, %edx
shlq $0x4, %rdx
cmpl $0x20, (%rcx,%rdx)
jne 0x7841
leal -0x1(%rax), %edx
cmpl $0x1, %eax
movl %edx, %eax
jg 0x7829
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: ttyread
size_t
ttyread(void)
{
	static char buf[BUFSIZ];
	static int buflen = 0;
	int ret, written;

	/* append read bytes to unprocessed bytes */
	ret = twrite_aborted ? 1 : read(cmdfd, buf+buflen, LEN(buf)-buflen);

	switch (ret) {
	case 0:
		exit(0);
	case -1:
		die("couldn't read from shell: %s\n", strerror(errno));
	default:
		buflen += twrite_aborted ? 0 : ret;
		written = twrite(buf, buflen, 0);
		buflen -= written;
		/* keep any incomplete UTF-8 byte sequence for the next call */
		if (buflen > 0)
			memmove(buf, buf + written, buflen);
		return ret;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x1, %ebx
cmpb $0x0, 0x137f3(%rip)     # 0x1b538
jne 0x7d6e
movl 0x137e3(%rip), %edi     # 0x1b530
movslq 0x157ec(%rip), %rax     # 0x1d540
leaq 0x137e5(%rip), %rsi     # 0x1b540
addq %rax, %rsi
movl $0x2000, %edx           # imm = 0x2000
subq %rax, %rdx
callq 0x61e0
movq %rax, %rbx
cmpl $-0x1, %ebx
je 0x7dcd
testl %ebx, %ebx
je 0x7dea
xorl %eax, %eax
cmpb $0x0, 0x137b8(%rip)     # 0x1b538
movl %ebx, %esi
cmovnel %eax, %esi
addl 0x157b5(%rip), %esi     # 0x1d540
movl %esi, 0x157af(%rip)     # 0x1d540
leaq 0x137a8(%rip), %r14     # 0x1b540
movq %r14, %rdi
xorl %edx, %edx
callq 0x7df1
movl 0x15798(%rip), %ecx     # 0x1d540
subl %eax, %ecx
movl %ecx, 0x15790(%rip)     # 0x1d540
jle 0x7dc2
movslq %eax, %rsi
addq %r14, %rsi
movl %ecx, %edx
movq %r14, %rdi
callq 0x6530
movslq %ebx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x65c0
movl (%rax), %edi
callq 0x6470
leaq 0xa88c(%rip), %rdi      # 0x1266c
movq %rax, %rsi
xorl %eax, %eax
callq 0x6faf
xorl %edi, %edi
callq 0x6190
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: twrite
int
twrite(const char *buf, int buflen, int show_ctrl)
{
	int charsize;
	Rune u;
	int n;

	int su0 = su;
	twrite_aborted = 0;

	for (n = 0; n < buflen; n += charsize) {
		if (IS_SET(MODE_UTF8)) {
			/* process a complete utf8 char */
			charsize = utf8decode(buf + n, &u, buflen - n);
			if (charsize == 0)
				break;
		} else {
			u = buf[n] & 0xFF;
			charsize = 1;
		}
		if (su0 && !su) {
			twrite_aborted = 1;
			break;  // ESU - allow rendering before a new BSU
		}
		if (show_ctrl && ISCONTROL(u)) {
			if (u & 0x80) {
				u &= 0x7f;
				tputc('^');
				tputc('[');
			} else if (u != '\n' && u != '\r' && u != '\t') {
				u ^= 0x40;
				tputc('^');
			}
		}
		tputc(u);
	}
	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb 0x126cd(%rip), %r12b    # 0x1a4d0
movb $0x0, 0x1372e(%rip)     # 0x1b538
testl %esi, %esi
jle 0x7eee
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
xorb $0x1, %r12b
xorl %ebx, %ebx
movslq %ebx, %rdi
addq %r15, %rdi
testb $0x40, 0x136df(%rip)    # 0x1b50c
jne 0x7e3e
movzbl (%rdi), %eax
movl %eax, 0x4(%rsp)
movl $0x1, %r13d
jmp 0x7e5c
movl %r14d, %eax
subl %ebx, %eax
movslq %eax, %rdx
leaq 0x4(%rsp), %rsi
callq 0x9dd7
movq %rax, %r13
testl %r13d, %r13d
je 0x7ef9
movb 0x1266e(%rip), %al      # 0x1a4d0
orb %r12b, %al
testb $0x1, %al
je 0x7ef2
testl %ebp, %ebp
je 0x7ed7
movl 0x4(%rsp), %eax
cmpl $0x20, %eax
setae %cl
cmpl $0x7f, %eax
setne %dl
movl %eax, %esi
andl $-0x20, %esi
cmpl $0x80, %esi
setne %sil
andb %dl, %sil
testb %cl, %sil
jne 0x7ed7
cmpl $0x80, %eax
jae 0x7ebc
cmpl $0xd, %eax
ja 0x7eae
movl $0x2600, %ecx           # imm = 0x2600
btl %eax, %ecx
jb 0x7ed7
xorl $0x40, %eax
movl %eax, 0x4(%rsp)
movl $0x5e, %edi
jmp 0x7ed2
andl $0x7f, %eax
movl %eax, 0x4(%rsp)
movl $0x5e, %edi
callq 0xa3c4
movl $0x5b, %edi
callq 0xa3c4
movl 0x4(%rsp), %edi
callq 0xa3c4
addl %r13d, %ebx
cmpl %r14d, %ebx
jl 0x7e20
jmp 0x7ef9
xorl %ebx, %ebx
jmp 0x7ef9
movb $0x1, 0x1363f(%rip)     # 0x1b538
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: selscroll
void
selscroll(int orig, int n)
{
	if (sel.ob.x == -1 || sel.alt != IS_SET(MODE_ALTSCREEN))
		return;

	if (BETWEEN(sel.nb.y, orig, term.bot) != BETWEEN(sel.ne.y, orig, term.bot)) {
		selclear();
	} else if (BETWEEN(sel.nb.y, orig, term.bot)) {
		sel.ob.y += n;
		sel.oe.y += n;
		if (sel.ob.y < term.top || sel.ob.y > term.bot ||
		    sel.oe.y < term.top || sel.oe.y > term.bot) {
			selclear();
		} else {
			selnormalize();
		}
	}
}

// Assembly:
cmpl $-0x1, 0x11b86(%rip)    # 0x1a504
je 0x8a40
movl 0x11b8a(%rip), %eax     # 0x1a514
btl $0x2, 0x12b7a(%rip)     # 0x1b50c
sbbl $0x0, %eax
jne 0x8a40
movl %edi, %ecx
movl 0x11b55(%rip), %edi     # 0x1a4f8
cmpl %ecx, %edi
setge %al
movl 0x12b5a(%rip), %edx     # 0x1b508
cmpl %edx, %edi
setle %r8b
andb %al, %r8b
movl 0x11b43(%rip), %eax     # 0x1a500
cmpl %ecx, %eax
setl %r9b
cmpl %edx, %eax
setg %r10b
orb %r9b, %r10b
cmpb %r10b, %r8b
je 0x8a25
cmpl %edx, %edi
setle %r8b
cmpl %ecx, %edi
setge %cl
andb %r8b, %cl
cmpb $0x1, %cl
jne 0x8a40
movl 0x11b1e(%rip), %ecx     # 0x1a508
addl %esi, %ecx
movl %ecx, 0x11b16(%rip)     # 0x1a508
addl 0x11b18(%rip), %esi     # 0x1a510
movl %esi, 0x11b12(%rip)     # 0x1a510
movl 0x12aff(%rip), %r8d     # 0x1b504
cmpl %r8d, %ecx
jl 0x8a25
cmpl %edx, %ecx
setg %cl
cmpl %r8d, %esi
setl %r8b
cmpl %edx, %esi
setg %dl
orb %cl, %dl
orb %r8b, %dl
cmpb $0x1, %dl
jne 0x8a41
movl $0x0, 0x11ab9(%rip)     # 0x1a4e8
movl $0xffffffff, 0x11acb(%rip) # imm = 0xFFFFFFFF
movl %eax, %esi
jmp 0x7304
retq
jmp 0x7208
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: osc4_color_response
void
osc4_color_response(int num)
{
	int n;
	char buf[32];
	unsigned char r, g, b;

	if (xgetcolor(num, &r, &g, &b)) {
		fprintf(stderr, "erresc: failed to fetch osc4 color %d\n", num);
		return;
	}

	n = snprintf(buf, sizeof buf, "\033]4;%d;rgb:%02x%02x/%02x%02x/%02x%02x\007",
		     num, r, r, g, g, b, b);

	ttywrite(buf, n, 1);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movl %edi, %ebx
leaq 0xf(%rsp), %rsi
leaq 0xe(%rsp), %rdx
leaq 0xd(%rsp), %rcx
callq 0xca0a
testl %eax, %eax
jne 0x8b2b
movzbl 0xf(%rsp), %r8d
movzbl 0xe(%rsp), %r10d
movzbl 0xd(%rsp), %r11d
leaq 0x9be4(%rip), %rdx      # 0x126d2
leaq 0x10(%rsp), %r14
movl $0x20, %esi
movq %r14, %rdi
movl %ebx, %ecx
movl %r8d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r11
pushq %r10
pushq %r10
callq 0x60b0
addq $0x20, %rsp
movslq %eax, %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x7f0a
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq 0x104be(%rip), %rax     # 0x18ff0
movq (%rax), %rdi
leaq 0x9b6f(%rip), %rsi      # 0x126ab
movl %ebx, %edx
xorl %eax, %eax
callq 0x68e0
jmp 0x8b23
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: osc_color_response
void
osc_color_response(int index, int num)
{
	int n;
	char buf[32];
	unsigned char r, g, b;

	if (xgetcolor(index, &r, &g, &b)) {
		fprintf(stderr, "erresc: failed to fetch osc color %d\n", index);
		return;
	}

	n = snprintf(buf, sizeof buf, "\033]%d;rgb:%02x%02x/%02x%02x/%02x%02x\007",
		     num, r, r, g, g, b, b);

	ttywrite(buf, n, 1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %esi, %ebx
movl %edi, %ebp
leaq 0xf(%rsp), %rsi
leaq 0xe(%rsp), %rdx
leaq 0xd(%rsp), %rcx
callq 0xca0a
testl %eax, %eax
jne 0x8bc2
movzbl 0xf(%rsp), %r8d
movzbl 0xe(%rsp), %r10d
movzbl 0xd(%rsp), %r11d
leaq 0x9b9b(%rip), %rdx      # 0x1271f
leaq 0x10(%rsp), %r14
movl $0x20, %esi
movq %r14, %rdi
movl %ebx, %ecx
movl %r8d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r11
pushq %r10
pushq %r10
callq 0x60b0
addq $0x20, %rsp
movslq %eax, %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x7f0a
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x10427(%rip), %rax     # 0x18ff0
movq (%rax), %rdi
leaq 0x9b26(%rip), %rsi      # 0x126f9
movl %ebp, %edx
xorl %eax, %eax
callq 0x68e0
jmp 0x8bb9
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: drawregion
void
drawregion(int x1, int y1, int x2, int y2)
{
	int y;

	for (y = y1; y < y2; y++) {
		if (!term.dirty[y])
			continue;

		term.dirty[y] = 0;
		xdrawline(TLINE(y), x1, y, x2);
	}
}

// Assembly:
cmpl %edx, %edi
jge 0x96d4
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movslq %edi, %r14
leaq (,%r14,8), %r15
leaq 0x10ed9(%rip), %r12     # 0x1a518
movq 0x11e92(%rip), %rax     # 0x1b4d8
cmpl $0x0, (%rax,%r14,4)
je 0x96bc
movl $0x0, (%rax,%r14,4)
movslq 0x11e78(%rip), %rax     # 0x1b4d4
cmpq %rax, %r14
jge 0x969c
movl 0x11e69(%rip), %ecx     # 0x1b4d0
subl %eax, %ecx
leal (%r14,%rcx), %eax
addl $0x1f5, %eax            # imm = 0x1F5
cltq
imulq $0x10624dd3, %rax, %rcx # imm = 0x10624DD3
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x25, %rcx
addl %edx, %ecx
imull $0x1f4, %ecx, %ecx      # imm = 0x1F4
subl %ecx, %eax
cltq
leaq (%r12,%rax,8), %rcx
addq $0x18, %rcx
jmp 0x96ad
movq 0x10e7d(%rip), %rcx     # 0x1a520
shlq $0x3, %rax
subq %rax, %rcx
addq %r15, %rcx
movq (%rcx), %rdi
xorl %esi, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0xcf60
incq %r14
addq $0x8, %r15
cmpl %r14d, %ebx
jne 0x963f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: select_or_drawcursor
void select_or_drawcursor(int selectsearch_mode, int type) {
	int done = 0;

	if ( selectsearch_mode & 1 ) {
		selextend(term.c.x, term.c.y, type, done);
		xsetsel(getsel());
	}
	else
		xdrawcursor(term.c.x, term.c.y, term.line[term.c.y][term.c.x],
			    term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
}

// Assembly:
subq $0x28, %rsp
movl %esi, %edx
movl %edi, %eax
movslq 0x118a9(%rip), %rdi     # 0x1b4f0
movslq 0x118a6(%rip), %rsi     # 0x1b4f4
testb $0x1, %al
jne 0x9ca3
movq 0x108c7(%rip), %rax     # 0x1a520
movq (%rax,%rsi,8), %rcx
movq %rdi, %r10
shlq $0x4, %r10
movslq 0x11891(%rip), %r8      # 0x1b4fc
movslq 0x1188e(%rip), %r9      # 0x1b500
movq (%rax,%r9,8), %rax
movq %r8, %r11
shlq $0x4, %r11
movq (%rcx,%r10), %rdx
movq 0x8(%rcx,%r10), %rcx
movups (%rax,%r11), %xmm0
movaps %xmm0, 0x10(%rsp)
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rsp)
callq 0xcac7
addq $0x28, %rsp
retq
xorl %ecx, %ecx
callq 0x7354
callq 0x74ed
movq %rax, %rdi
addq $0x28, %rsp
jmp 0xc71e
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: search
void search(int selectsearch_mode, Rune *target, int ptarget, int incr, int type, TCursor *cu) {
	Rune *r;
	int i, bound = (term.col * cu->y + cu->x) * (incr > 0) + incr;

	for (i = term.col * term.c.y + term.c.x + incr; i != bound; i += incr) {
		for (r = target; r - target < ptarget; r++) {
			if ( *r == term.line[(i + r - target) / term.col][(i + r - target) % term.col].u ) {
				if ( r - target == ptarget - 1 )     break;
			} else {
				r = NULL;
				break;
			}
		}
		if ( r != NULL )    break;
	}

	if ( i != bound ) {
		term.c.y = i / term.col, term.c.x = i % term.col;
		select_or_drawcursor(selectsearch_mode, type);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %r8d, -0x1c(%rsp)
movq %rsi, %r10
movl %edi, -0x20(%rsp)
movslq 0x10844(%rip), %r11     # 0x1a51c
movl 0x14(%r9), %edi
imull %r11d, %edi
addl 0x10(%r9), %edi
xorl %eax, %eax
testl %ecx, %ecx
cmovlel %eax, %edi
movl 0x11803(%rip), %eax     # 0x1b4f4
imull %r11d, %eax
addl 0x117f5(%rip), %eax     # 0x1b4f0
leal -0x1(%rdx), %esi
movslq %esi, %r9
movq %rdx, -0x8(%rsp)
movslq %edx, %rbx
movq 0x10810(%rip), %r14     # 0x1a520
cltq
movslq %ecx, %r15
movslq %edi, %rcx
movq %rcx, -0x18(%rsp)
leaq (%r15,%rax), %r13
shlq $0x2, %r13
leaq (,%r15,4), %rcx
movq %rcx, -0x10(%rsp)
cmpq -0x18(%rsp), %rax
je 0x9da5
movq %rax, %rbp
movq %r10, %rsi
cmpl $0x0, -0x8(%rsp)
jle 0x9d90
movl $0x4, %edi
movq %r13, %r12
xorl %r8d, %r8d
movq %r10, %rsi
movl (%rsi), %ecx
movq %r12, %rax
sarq $0x2, %rax
cqto
idivq %r11
movq (%r14,%rax,8), %rax
shlq $0x4, %rdx
cmpl (%rax,%rdx), %ecx
jne 0x9d8e
cmpq %r9, %r8
je 0x9d90
addq $0x4, %rsi
movq %rdi, %r8
sarq $0x2, %r8
addq $0x4, %r12
addq $0x4, %rdi
cmpq %rbx, %r8
jl 0x9d54
jmp 0x9d90
xorl %esi, %esi
leaq (%r15,%rbp), %rax
addq -0x10(%rsp), %r13
testq %rsi, %rsi
je 0x9d32
cmpq -0x18(%rsp), %rbp
jne 0x9db0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cltd
idivl %r11d
movl %eax, 0x1173a(%rip)     # 0x1b4f4
movl %edx, 0x11730(%rip)     # 0x1b4f0
movl -0x20(%rsp), %edi
movl -0x1c(%rsp), %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9c38
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: utf8decode
size_t
utf8decode(const char *c, Rune *u, size_t clen)
{
    size_t i, j, len, type;
    Rune udecoded;

    *u = UTF_INVALID;
    if (!clen)
        return 0;
    udecoded = utf8decodebyte(c[0], &len);
    if (!BETWEEN(len, 1, UTF_SIZ))
        return 1;
    for (i = 1, j = 1; i < clen && j < len; ++i, ++j) {
        udecoded = (udecoded << 6) | utf8decodebyte(c[i], &type);
        if (type != 0)
            return j;
    }
    if (j < len)
        return 0;
    *u = udecoded;
    utf8validate(u, len);

    return len;
}

// Assembly:
movl $0xfffd, (%rsi)         # imm = 0xFFFD
testq %rdx, %rdx
je 0x9e23
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movzbl (%rdi), %eax
xorl %ecx, %ecx
leaq 0x867d(%rip), %r9       # 0x12471
leaq 0x8671(%rip), %r10      # 0x1246c
movzbl (%rcx,%r9), %r8d
movl %r8d, %r11d
andl %eax, %r11d
movzbl (%rcx,%r10), %ebx
cmpl %ebx, %r11d
je 0x9e26
incq %rcx
cmpq $0x5, %rcx
jne 0x9dfb
xorl %r8d, %r8d
movl $0x5, %ecx
jmp 0x9e2c
xorl %eax, %eax
retq
notl %r8d
andl %eax, %r8d
leaq -0x1(%rcx), %r11
movl $0x1, %eax
cmpq $0x3, %r11
ja 0x9ef0
cmpq $0x1, %rdx
sete %al
cmpq $0x2, %rcx
setae %r11b
setb %bl
orb %al, %bl
jne 0x9eb0
movl $0x1, %eax
movzbl (%rdi,%rax), %ebx
xorl %r14d, %r14d
movzbl (%r14,%r9), %r11d
movl %r11d, %ebp
andl %ebx, %ebp
movzbl (%r14,%r10), %r15d
cmpl %r15d, %ebp
je 0x9e85
incq %r14
cmpq $0x5, %r14
jne 0x9e61
xorl %ebx, %ebx
xorl %r11d, %r11d
jmp 0x9e91
notl %r11d
andl %ebx, %r11d
testq %r14, %r14
sete %bl
testb %bl, %bl
je 0x9ef0
shll $0x6, %r8d
orl %r11d, %r8d
incq %rax
cmpq %rcx, %rax
setb %r11b
cmpq %rdx, %rax
jae 0x9eb0
cmpq %rcx, %rax
jb 0x9e5a
testb %r11b, %r11b
je 0x9eb9
xorl %eax, %eax
jmp 0x9ef0
movl %r8d, (%rsi)
leaq 0x85bd(%rip), %rax      # 0x12480
cmpl %r8d, (%rax,%rcx,4)
jbe 0x9ed1
movl $0xfffd, (%rsi)         # imm = 0xFFFD
jmp 0x9eed
movl %r8d, %eax
andl $0xfffff800, %eax       # imm = 0xFFFFF800
cmpl $0xd800, %eax           # imm = 0xD800
je 0x9ec9
leaq 0x85b9(%rip), %rax      # 0x124a0
cmpl (%rax,%rcx,4), %r8d
ja 0x9ec9
movq %rcx, %rax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: tscrollup
void
tscrollup(int orig, int n, int copyhist)
{
	int i;
	Line temp;

	LIMIT(n, 0, term.bot-orig+1);

	if (copyhist) {
		term.histi = (term.histi + 1) % HISTSIZE;
		temp = term.hist[term.histi];
		term.hist[term.histi] = term.line[orig];
		term.line[orig] = temp;
	}

	if (term.scr > 0 && term.scr < HISTSIZE)
		term.scr = MIN(term.scr + n, HISTSIZE-1);

	tclearregion(0, orig, term.col-1, orig+n-1);
	tsetdirt(orig+n, term.bot);

	for (i = orig; i <= term.bot-n; i++) {
		temp = term.line[i];
		term.line[i] = term.line[i+n];
		term.line[i+n] = temp;
	}

	if (term.scr == 0)
		selscroll(orig, -n);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
testl %esi, %esi
js 0xbdb4
movl 0xf763(%rip), %r14d     # 0x1b508
subl %ebx, %r14d
incl %r14d
cmpl %esi, %r14d
cmovgel %esi, %r14d
jmp 0xbdb7
xorl %r14d, %r14d
movslq %ebx, %r15
testl %edx, %edx
je 0xbe1b
leaq 0xe753(%rip), %rax      # 0x1a518
movl 0xf705(%rip), %ecx      # 0x1b4d0
movl %ecx, %edx
incl %edx
movslq %edx, %rdx
imulq $0x10624dd3, %rdx, %rdx # imm = 0x10624DD3
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x25, %rdx
addl %esi, %edx
imull $0x1f4, %edx, %edx      # imm = 0x1F4
negl %edx
addl %edx, %ecx
incl %ecx
movl %ecx, 0xf6d8(%rip)      # 0x1b4d0
movslq %ecx, %rcx
movq 0x18(%rax,%rcx,8), %rdx
movq 0xe719(%rip), %rsi      # 0x1a520
movq (%rsi,%r15,8), %rsi
movq %rsi, 0x18(%rax,%rcx,8)
movq 0xe709(%rip), %rax      # 0x1a520
movq %rdx, (%rax,%r15,8)
movl 0xf6b3(%rip), %eax      # 0x1b4d4
leal -0x1(%rax), %ecx
cmpl $0x1f2, %ecx            # imm = 0x1F2
ja 0xbe3f
addl %r14d, %eax
movl $0x1f3, %ecx            # imm = 0x1F3
cmpl %ecx, %eax
cmovgel %ecx, %eax
movl %eax, 0xf695(%rip)      # 0x1b4d4
movl 0xe6d7(%rip), %edx      # 0x1a51c
decl %edx
leal (%r14,%rbx), %ebp
leal (%r14,%rbx), %ecx
decl %ecx
xorl %edi, %edi
movl %ebx, %esi
callq 0x927e
movl 0xf6a8(%rip), %esi      # 0x1b508
movl %ebp, %edi
callq 0x7304
movl 0xf69b(%rip), %eax      # 0x1b508
movl %eax, %ecx
subl %r14d, %ecx
cmpl %ebx, %ecx
jl 0xbea8
movslq %r14d, %rcx
addq %r15, %rcx
notl %eax
addl %ebp, %eax
movq 0xe699(%rip), %rdx      # 0x1a520
movq (%rdx,%r15,8), %rsi
movq (%rdx,%rcx,8), %rdi
movq %rdi, (%rdx,%r15,8)
movq 0xe686(%rip), %rdx      # 0x1a520
movq %rsi, (%rdx,%rcx,8)
incq %r15
incq %rcx
incl %eax
jne 0xbe80
cmpl $0x0, 0xf625(%rip)      # 0x1b4d4
je 0xbebc
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
negl %r14d
movl %ebx, %edi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x8977
// File: /workspace/github_c_makefile_star2_O1/mrdotx[P]st/st.c
// Function: tscrolldown
void
tscrolldown(int orig, int n, int copyhist)
{
	int i;
	Line temp;

	LIMIT(n, 0, term.bot-orig+1);

	if (copyhist) {
		term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
		temp = term.hist[term.histi];
		term.hist[term.histi] = term.line[term.bot];
		term.line[term.bot] = temp;
	}

	tsetdirt(orig, term.bot-n);
	tclearregion(0, term.bot-n+1, term.col-1, term.bot);

	for (i = term.bot; i >= orig+n; i--) {
		temp = term.line[i];
		term.line[i] = term.line[i-n];
		term.line[i-n] = temp;
	}

	if (term.scr == 0)
		selscroll(orig, n);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
testl %esi, %esi
js 0xbef3
movl 0xf624(%rip), %r14d     # 0x1b508
subl %ebx, %r14d
incl %r14d
cmpl %esi, %r14d
cmovgel %esi, %r14d
jmp 0xbef6
xorl %r14d, %r14d
testl %edx, %edx
je 0xbf66
leaq 0xe617(%rip), %rax      # 0x1a518
movl 0xf5c9(%rip), %ecx      # 0x1b4d0
movl %ecx, %edx
addl $0x1f3, %edx            # imm = 0x1F3
movslq %edx, %rdx
imulq $0x10624dd3, %rdx, %rdx # imm = 0x10624DD3
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x25, %rdx
addl %esi, %edx
imull $0x1f4, %edx, %edx      # imm = 0x1F4
negl %edx
addl %edx, %ecx
addl $0x1f3, %ecx            # imm = 0x1F3
movl %ecx, 0xf594(%rip)      # 0x1b4d0
movslq %ecx, %rcx
movq 0x18(%rax,%rcx,8), %rdx
movq 0xe5d5(%rip), %rsi      # 0x1a520
movslq 0xf5b6(%rip), %rdi      # 0x1b508
movq (%rsi,%rdi,8), %rsi
movq %rsi, 0x18(%rax,%rcx,8)
movq 0xe5be(%rip), %rax      # 0x1a520
movq %rdx, (%rax,%rdi,8)
movl 0xf59c(%rip), %esi      # 0x1b508
subl %r14d, %esi
movl %ebx, %edi
callq 0x7304
movl 0xf58c(%rip), %ecx      # 0x1b508
movl %ecx, %esi
subl %r14d, %esi
incl %esi
movl 0xe593(%rip), %edx      # 0x1a51c
decl %edx
xorl %edi, %edi
callq 0x927e
movslq 0xf56f(%rip), %rax      # 0x1b508
leal (%r14,%rbx), %edx
cmpl %edx, %eax
jl 0xbfe2
movslq %r14d, %rcx
movslq %edx, %rdx
incq %rax
shlq $0x3, %rcx
negq %rcx
movq 0xe568(%rip), %rsi      # 0x1a520
leaq (%rsi,%rax,8), %rdi
movq -0x8(%rsi,%rax,8), %r8
movq -0x8(%rcx,%rdi), %rdi
movq %rdi, -0x8(%rsi,%rax,8)
movq 0xe54e(%rip), %rsi      # 0x1a520
addq %rcx, %rsi
movq %r8, -0x8(%rsi,%rax,8)
decq %rax
cmpq %rdx, %rax
jg 0xbfb1
cmpl $0x0, 0xf4eb(%rip)      # 0x1b4d4
je 0xbff3
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl %ebx, %edi
movl %r14d, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8977