// File: /workspace/github_c_makefile_star2_O2/LenShustek[P]miditones/miditones_scroll.c
// Function: main
int main (int argc, char *argv[]) {
   int argno;
   char *filebasename;
#define MAXPATH 80
   char filename[MAXPATH];

   printf ("MIDITONES_SCROLL V%s, (C) 2011,2019 Len Shustek\n", VERSION);
   if (argc == 1) {             /* no arguments */
      SayUsage (argv[0]);
      return 1; }

   argno = HandleOptions (argc, argv);   /* process options */
   if (codeoutput) showbytestream = true;
   filebasename = argv[argno];

   strlcpy (filename, filebasename, MAXPATH);   // Open the input file
   strlcat (filename, ".bin", MAXPATH);
   infile = fopen (filename, "rb");
   if (!infile) {
      fprintf (stderr, "Unable to open input file %s", filename);
      return 8; }
   printf("Opening %s\n", filename);

   strlcpy (filename, filebasename, MAXPATH); // open the output file
   strlcat (filename, codeoutput ? ".c" : ".txt", MAXPATH);
   outfile = fopen (filename, "w");
   if (!outfile) {
      fprintf (stderr, "Unable to open output file %s", filename);
      return 8; }
   printf("Creating %s\n", filename);
   infofile = codeoutput ? stdout : outfile;

   /* Read the whole input file into memory */

   fseek (infile, 0, SEEK_END); /* find file size */
   buflen = ftell (infile);
   fseek (infile, 0, SEEK_SET);
   buffer = (unsigned char *) malloc (buflen + 1);
   if (!buffer) {
      fprintf (stderr, "Unable to allocate %ld bytes for the file", buflen);
      return 8; }
   fread (buffer, buflen, 1, infile);
   fclose (infile);

   /* write the prologue */

   time_t rawtime;
   time (&rawtime);
   printf ("Reading %s.bin with %ld bytes\n", filebasename, buflen);
   if (!codeoutput) {
      fprintf(outfile, "MIDITONES_SCROLL V%s on %s", VERSION, asctime(localtime(&rawtime)));
      fprintf(outfile, "command line: ");
      for (int i = 0; i < argc; i++) fprintf(outfile, "%s ", argv[i]);
      fprintf(outfile, "\n");
      fprintf(outfile, "reading %s.bin with %ld bytes\n", filebasename, buflen);
      if (num_tonegens < MAX_TONEGENS) fprintf(outfile, "displaying only %d tone generators.\n", num_tonegens); }
   else {
      fprintf (outfile, "// Playtune bytestream for file \"%s.bin\"", filebasename);
      fprintf (outfile, " created by MIDITONES_SCROLL V%s on %s\n", VERSION,
               asctime (localtime (&rawtime)));
      fprintf (outfile, "const byte PROGMEM score [] = {\n"); }
   bufptr = lastbufptr = buffer;

   /* Check for the optional self-describing file header */

   struct file_hdr_t *hdrptr = (struct file_hdr_t *) buffer;
   if (buflen > sizeof (struct file_hdr_t) && hdrptr->id1 == 'P' && hdrptr->id2 == 't') {
      fprintf(infofile, "\nfound Pt self-describing file header with flags %02X %02X\n", hdrptr->f1, hdrptr->f2);
      fprintf(infofile, "  number of tone generators used: %d\n", hdrptr->num_tgens);
      if (hdrptr->f1 & HDR_F1_VOLUME_PRESENT)      fprintf(infofile, "  volume levels are present\n");
      if (hdrptr->f1 & HDR_F1_INSTRUMENTS_PRESENT) fprintf(infofile, "  instrument changes are present\n");
      if (hdrptr->f1 & HDR_F1_PERCUSSION_PRESENT)  fprintf(infofile, "  percussion is encoded as notes 128 to 255\n");

      expect_volume = hdrptr->f1 & HDR_F1_VOLUME_PRESENT;
      bufptr += hdrptr->hdr_length;
      lastbufptr = bufptr;
      if (codeoutput) {
         fprintf (outfile, "'P','t', 6, 0x%02X, 0x%02X, %2d, // (Playtune file header)\n",
                  hdrptr->f1, hdrptr->f2, hdrptr->num_tgens); } }

   /* Do the titles */

   fprintf (outfile, "\n");
   if (codeoutput) fprintf (outfile, "//");
   fprintf (outfile, "       time   ");
   for (unsigned i = 0; i < num_tonegens; ++i)
      fprintf (outfile, expect_volume && !ignore_volume ? "   gen%-5d" : " gen%-2d", i);
   fprintf(outfile, "delay");
   if (showbytestream) fprintf(outfile, "  addr  bytestream code");
   fprintf(outfile, "\n\n");
   for (gen = 0; gen < num_tonegens; ++gen)
      gen_note[gen] = SILENT;

   unsigned tonegens_used = 0;
   bool gotcommand = true;

   /* Process the commmands in order */

   for (; bufptr < buffer + buflen; ++bufptr) {
      cmd = *bufptr;
      if (cmd < 0x80) {         /*  delay  */
         if (!gotcommand) {
            ++consecutive_delays;
            warning = true; }
         gotcommand = false;
         delay = ((unsigned int)cmd << 8) + *++bufptr;
         print_status();       // tone generator status now
         timenow += delay;      // advance time
         for (gen = 0; gen < MAX_TONEGENS; ++gen)
            gen_did_stopnote[gen] = false; }
      else if (cmd != 0xf0 && cmd != 0xe0) {   /* a command */
         gotcommand = true;
         gen = cmd & 0x0f;
         if (gen > max_tonegen_found)
            max_tonegen_found = gen;
         cmd = cmd & 0xf0;
         if (cmd == 0x90) {     /*  note on  */
            gen_note[gen] = *++bufptr;  // note number
            tonegens_used |= 1 << gen;  // record that we used this generator at least once
            ++instrument_count[gen_instrument[gen]]; // count a use of this instrument
            if (gen_did_stopnote[gen]) { // unnecesary stop note
               ++stopnotes_before_startnote;
               warning = true; }
            if (expect_volume) {
               unsigned volume = gen_volume[gen] = *++bufptr;     // volume
               if (volume > max_vol) max_vol = volume;
               if (volume < min_vol) min_vol = volume; }
            if (gen >= num_tonegens) ++notes_skipped; // won't be displaying this note
         }
         else if (cmd == 0x80) {        /*  note off  */
            if (gen_note[gen] == SILENT)
               file_error("tone generator not on", bufptr);
            gen_note[gen] = SILENT;
            gen_did_stopnote[gen] = true; }
         else if (cmd == 0xc0) {        /* change instrument */
            got_instruments = true;
            gen_instrument[gen] = *++bufptr & 0x7f;
            gen_instrument_changed[gen] = true; }
         else {
            file_error("unknown command", bufptr);
            fprintf(stderr, "*** unknown command in input bytestream; see output file\n");
            exit(8); } } }

   /*  Do the final cleanup  */

   delay = 0;
   --bufptr;
   if (codeoutput)
      --bufptr;                 //don't do 0xf0 for code, because we don't want the trailing comma
   print_status ();             // print final status
   if (codeoutput) {
      fprintf (outfile, " 0x%02x};\n", *(bufptr+1) & 0xf0);
      unsigned num_tonegens_used = countbits (tonegens_used);
      fprintf (outfile, "// This score contains %ld bytes, and %d tone generator%s used.\n",
               buflen, num_tonegens_used, num_tonegens_used == 1 ? " is" : "s are"); }
   else
      fprintf (outfile, "\n");

   fprintf (infofile, "At most %u tone generators were used.\n", max_tonegen_found + 1);
   if (notes_skipped)
      fprintf (infofile, "%u notes were not displayed because we were told to show only %u generators.\n",
               notes_skipped, num_tonegens);
   fprintf (infofile, "%u stopnote commands were unnecessary.\n", stopnotes_before_startnote);
   fprintf (infofile, "%u consecutive delays could have been merged.\n", consecutive_delays);
   if (stopnotes_before_startnote + consecutive_delays > 0) fprintf (infofile, "(Those locations are marked with \"!\")\n");
   if (got_instruments) {
      fprintf(infofile, "instruments used:\n");
      for (int i = 0; i < 128; ++i)
         if (instrument_count[i]) {
            fprintf(infofile, " %s (%3d, 0x%02X) %7d\n", instrumentname[i], i, i, instrument_count[i]); } }
   if (expect_volume)
      fprintf(infofile, "volume ranged from %d to %d\n", min_vol, max_vol);
   printf ("Done.\n"); }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
movl %edi, %r14d
leaq 0x1dad(%rip), %rdi      # 0x464a
leaq 0x1dd7(%rip), %rsi      # 0x467b
xorl %eax, %eax
callq 0x2090
cmpl $0x1, %r14d
jne 0x28be
callq 0x223c
pushq $0x1
popq %rax
jmp 0x3188
movl %r14d, %edi
movq %rbx, %rsi
callq 0x2288
cmpb $0x1, 0x4820(%rip)      # 0x70f0
jne 0x28d9
movb $0x1, 0x47db(%rip)      # 0x70b4
cltq
movq (%rbx,%rax,8), %r15
leaq 0x10(%rsp), %r12
pushq $0x50
popq %rbp
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x23c6
leaq 0x1b8e(%rip), %rsi      # 0x4489
movq %r12, %rdi
movl %ebp, %edx
callq 0x2402
leaq 0x1d74(%rip), %rsi      # 0x4680
movq %r12, %rdi
callq 0x2110
movq %rax, 0x4aed(%rip)      # 0x7408
testq %rax, %rax
je 0x3197
leaq 0x1d75(%rip), %rdi      # 0x46a0
leaq 0x10(%rsp), %r12
movq %r12, %rsi
xorl %eax, %eax
callq 0x2090
pushq $0x50
popq %rbp
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x23c6
leaq 0x1bf0(%rip), %rax      # 0x4541
leaq 0x1d54(%rip), %rsi      # 0x46ac
cmpb $0x0, 0x4791(%rip)      # 0x70f0
cmovneq %rax, %rsi
movq %r12, %rdi
movl %ebp, %edx
callq 0x2402
leaq 0x252e(%rip), %rsi      # 0x4ea2
movq %r12, %rdi
callq 0x2110
movq %rax, 0x497d(%rip)      # 0x7300
testq %rax, %rax
je 0x31aa
leaq 0x1d3c(%rip), %rdi      # 0x46cf
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x2090
cmpb $0x0, 0x474a(%rip)      # 0x70f0
je 0x29b1
movq 0x4621(%rip), %rax      # 0x6fd0
jmp 0x29b8
leaq 0x4948(%rip), %rax      # 0x7300
movq (%rax), %rax
movq %rax, 0x4a4e(%rip)      # 0x7410
movq 0x4a3f(%rip), %rdi      # 0x7408
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x2100
movq 0x4a2e(%rip), %rdi      # 0x7408
callq 0x20c0
movq %rax, 0x492a(%rip)      # 0x7310
movq 0x4a1b(%rip), %rdi      # 0x7408
xorl %esi, %esi
xorl %edx, %edx
callq 0x2100
movq 0x4913(%rip), %r12      # 0x7310
leaq 0x1(%r12), %rdi
callq 0x20e0
movq %rax, 0x48fa(%rip)      # 0x7308
testq %rax, %rax
je 0x31c2
movq 0x49ea(%rip), %rcx      # 0x7408
pushq $0x1
popq %rdx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2060
movq 0x49d5(%rip), %rdi      # 0x7408
callq 0x2070
leaq 0x8(%rsp), %rdi
callq 0x20d0
movq 0x48c7(%rip), %rdx      # 0x7310
leaq 0x1cb6(%rip), %rdi      # 0x4706
xorl %r13d, %r13d
movq %r15, %rsi
xorl %eax, %eax
callq 0x2090
movq 0x489c(%rip), %r12      # 0x7300
cmpb $0x0, 0x4685(%rip)      # 0x70f0
je 0x2ad3
leaq 0x1d23(%rip), %rsi      # 0x4797
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x20b0
movq 0x4878(%rip), %rbx      # 0x7300
leaq 0x8(%rsp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2080
leaq 0x1d1f(%rip), %rsi      # 0x47c0
leaq 0x1bd3(%rip), %rdx      # 0x467b
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x20b0
movq 0x4844(%rip), %rcx      # 0x7300
leaq 0x1d25(%rip), %rdi      # 0x47e8
pushq $0x20
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
jmp 0x2b93
leaq 0x8(%rsp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2080
leaq 0x1c39(%rip), %rsi      # 0x4725
leaq 0x1b88(%rip), %rdx      # 0x467b
movq %r12, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x20b0
movq 0x47f9(%rip), %rcx      # 0x7300
leaq 0x1c32(%rip), %rdi      # 0x4740
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
testl %r14d, %r14d
cmovlel %r13d, %r14d
leaq 0x1c28(%rip), %r12      # 0x474f
xorl %r13d, %r13d
movq 0x47cf(%rip), %rsi      # 0x7300
cmpq %r13, %r14
je 0x2b4c
movq (%rbx,%r13,8), %rdx
movq %rsi, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x20b0
incq %r13
jmp 0x2b2a
pushq $0xa
popq %rdi
callq 0x20a0
movq 0x47a5(%rip), %rdi      # 0x7300
movq 0x47ae(%rip), %rcx      # 0x7310
leaq 0x1bea(%rip), %rsi      # 0x4753
movq %r15, %rdx
xorl %eax, %eax
callq 0x20b0
movl 0x4537(%rip), %edx      # 0x70b0
cmpl $0x10, %edx
jae 0x2b93
movq 0x477b(%rip), %rdi      # 0x7300
leaq 0x1be6(%rip), %rsi      # 0x4772
xorl %eax, %eax
callq 0x20b0
movq 0x476e(%rip), %rbx      # 0x7308
movq %rbx, 0x4857(%rip)      # 0x73f8
movq %rbx, 0x4858(%rip)      # 0x7400
cmpq $0x7, 0x4760(%rip)      # 0x7310
jb 0x2cb0
cmpb $0x50, (%rbx)
jne 0x2cb0
cmpb $0x74, 0x1(%rbx)
jne 0x2cb0
movq 0x4840(%rip), %rdi      # 0x7410
movzbl 0x3(%rbx), %edx
movzbl 0x4(%rbx), %ecx
leaq 0x1c2a(%rip), %rsi      # 0x4809
xorl %eax, %eax
callq 0x20b0
movq 0x4823(%rip), %rdi      # 0x7410
movzbl 0x5(%rbx), %edx
leaq 0x1c4d(%rip), %rsi      # 0x4845
xorl %eax, %eax
callq 0x20b0
movb 0x3(%rbx), %al
testb %al, %al
jns 0x2c22
movq 0x4803(%rip), %rcx      # 0x7410
leaq 0x1c57(%rip), %rdi      # 0x486b
pushq $0x1c
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
movb 0x3(%rbx), %al
testb $0x40, %al
je 0x2c42
movq 0x47e3(%rip), %rcx      # 0x7410
leaq 0x1c54(%rip), %rdi      # 0x4888
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
movb 0x3(%rbx), %al
testb $0x20, %al
je 0x2c62
movq 0x47c3(%rip), %rcx      # 0x7410
leaq 0x1c56(%rip), %rdi      # 0x48aa
pushq $0x2c
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
movb 0x3(%rbx), %al
movl %eax, %ecx
shrb $0x7, %cl
movb %cl, 0x4484(%rip)       # 0x70f1
movzbl 0x2(%rbx), %ecx
addq 0x4788(%rip), %rcx      # 0x7400
movq %rcx, 0x4781(%rip)      # 0x7400
movq %rcx, 0x4772(%rip)      # 0x73f8
cmpb $0x1, 0x4463(%rip)      # 0x70f0
jne 0x2cb0
movq 0x466a(%rip), %rdi      # 0x7300
movzbl %al, %edx
movzbl 0x4(%rbx), %ecx
movzbl 0x5(%rbx), %r8d
leaq 0x1c2e(%rip), %rsi      # 0x48d7
xorl %eax, %eax
callq 0x20b0
movq 0x4649(%rip), %rsi      # 0x7300
pushq $0xa
popq %rdi
callq 0x20a0
cmpb $0x1, 0x442a(%rip)      # 0x70f0
jne 0x2ce1
movq 0x4631(%rip), %rcx      # 0x7300
leaq 0x1922(%rip), %rdi      # 0x45f8
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
movq 0x4618(%rip), %rcx      # 0x7300
leaq 0x1c24(%rip), %rdi      # 0x4913
pushq $0xe
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
leaq 0x1c2c(%rip), %r14      # 0x492d
leaq 0x1c1a(%rip), %r15      # 0x4922
xorl %ebx, %ebx
movq 0x45ef(%rip), %rcx      # 0x7300
cmpl 0x4399(%rip), %ebx      # 0x70b0
jae 0x2d43
testb $0x1, 0x43d2(%rip)      # 0x70f2
movq %r14, %rsi
jne 0x2d28
movq %r15, %rsi
cmpb $0x0, 0x43c2(%rip)      # 0x70f1
cmoveq %r14, %rsi
movq %rcx, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x20b0
incl %ebx
jmp 0x2d0a
leaq 0x1bec(%rip), %rdi      # 0x4936
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
cmpb $0x0, 0x4358(%rip)      # 0x70b4
je 0x2d77
movq 0x459b(%rip), %rcx      # 0x7300
leaq 0x1bd0(%rip), %rdi      # 0x493c
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
movq 0x4582(%rip), %rcx      # 0x7300
leaq 0x1bcf(%rip), %rdi      # 0x4954
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
movl 0x431a(%rip), %eax      # 0x70b0
movq %rax, %rcx
shlq $0x2, %rcx
xorl %edx, %edx
leaq 0x45ca(%rip), %r12      # 0x7370
cmpq %rdx, %rcx
je 0x2db6
orl $-0x1, (%rdx,%r12)
addq $0x4, %rdx
jmp 0x2da6
movb %al, 0x465c(%rip)       # 0x7418
movb $0x1, %al
xorl %ebx, %ebx
movq 0x4639(%rip), %rsi      # 0x7400
leaq 0x4652(%rip), %r13      # 0x7420
leaq 0x455b(%rip), %rbp      # 0x7330
leaq 0x4544(%rip), %r14      # 0x7320
leaq 0x431d(%rip), %r15      # 0x7100
movq 0x451e(%rip), %rcx      # 0x7308
addq 0x451f(%rip), %rcx      # 0x7310
cmpq %rcx, %rsi
jae 0x2fa4
movzbl (%rsi), %edx
movb %dl, 0x4616(%rip)       # 0x7419
testb %dl, %dl
js 0x2e64
testb $0x1, %al
jne 0x2e18
incl 0x42cb(%rip)            # 0x70dc
movb $0x1, 0x42c8(%rip)      # 0x70e0
shll $0x8, %edx
leaq 0x1(%rsi), %rax
movq %rax, 0x45da(%rip)      # 0x7400
movzbl 0x1(%rsi), %eax
orl %edx, %eax
movl %eax, 0x45be(%rip)      # 0x73f0
callq 0x2529
movl 0x45b3(%rip), %eax      # 0x73f0
addq %rax, 0x42a4(%rip)      # 0x70e8
xorl %eax, %eax
cmpq $0x10, %rax
je 0x2e56
movb $0x0, (%rax,%r13)
incq %rax
jmp 0x2e46
movb $0x10, 0x45bb(%rip)     # 0x7418
xorl %eax, %eax
jmp 0x2f8e
movl %edx, %ecx
andb $-0x11, %cl
cmpb $-0x20, %cl
je 0x2f8e
movl %edx, %ecx
andl $0xf, %ecx
movb %cl, 0x459b(%rip)       # 0x7418
cmpl %ecx, 0x424d(%rip)      # 0x70d0
jae 0x2e8b
movl %ecx, 0x4245(%rip)      # 0x70d0
movl %edx, %eax
andb $-0x10, %al
movb %al, 0x4584(%rip)       # 0x7419
movzbl %cl, %edi
cmpb $-0x80, %al
je 0x2f68
andl $-0x10, %edx
cmpl $0xc0, %edx
je 0x2f44
cmpl $0x90, %edx
jne 0x31e4
leaq 0x1(%rsi), %rax
movq %rax, 0x453a(%rip)      # 0x7400
movzbl 0x1(%rsi), %eax
leal (,%rcx,4), %edx
movslq (%rdx,%rbp), %rdi
incl (%r15,%rdi,4)
movl %eax, (%rdx,%r12)
cmpb $0x1, (%rcx,%r13)
jne 0x2ef1
incl 0x41ee(%rip)            # 0x70d8
movb $0x1, 0x41ef(%rip)      # 0x70e0
cmpb $0x1, 0x41f9(%rip)      # 0x70f1
jne 0x2f2f
leaq 0x2(%rsi), %rax
movq %rax, 0x44fb(%rip)      # 0x7400
movzbl 0x2(%rsi), %eax
leaq 0x44a0(%rip), %rdx      # 0x73b0
movl %eax, (%rdx,%rcx,4)
cmpl %eax, 0x41df(%rip)      # 0x70f8
jae 0x2f21
movl %eax, 0x41d7(%rip)      # 0x70f8
cmpl %eax, 0x4191(%rip)      # 0x70b8
jbe 0x2f2f
movl %eax, 0x4189(%rip)      # 0x70b8
btsl %ecx, %ebx
movb $0x1, %al
cmpl %ecx, 0x4176(%rip)      # 0x70b0
ja 0x2f8e
incl 0x4192(%rip)            # 0x70d4
jmp 0x2f8e
movb $0x1, %al
movb %al, 0x41a8(%rip)       # 0x70f4
leaq 0x1(%rsi), %rcx
movq %rcx, 0x44a9(%rip)      # 0x7400
movzbl 0x1(%rsi), %ecx
andl $0x7f, %ecx
movl %ecx, (%rbp,%rdi,4)
movb %al, (%rdi,%r14)
jmp 0x2f8e
cmpl $-0x1, (%r12,%rdi,4)
jne 0x2f82
leaq 0x19e1(%rip), %rdi      # 0x4957
callq 0x2461
movzbl 0x4496(%rip), %edi      # 0x7418
orl $-0x1, (%r12,%rdi,4)
movb $0x1, (%rdi,%r13)
movb $0x1, %al
movq 0x446b(%rip), %rsi      # 0x7400
incq %rsi
movq %rsi, 0x4461(%rip)      # 0x7400
jmp 0x2de3
andl $0x0, 0x4445(%rip)      # 0x73f0
leaq -0x1(%rsi), %rax
movq %rax, 0x444a(%rip)      # 0x7400
cmpb $0x1, 0x4133(%rip)      # 0x70f0
jne 0x2fca
addq $-0x2, %rsi
movq %rsi, 0x4436(%rip)      # 0x7400
callq 0x2529
movq 0x432a(%rip), %rax      # 0x7300
cmpb $0x1, 0x4113(%rip)      # 0x70f0
jne 0x303a
movq 0x441a(%rip), %rcx      # 0x7400
movzbl 0x1(%rcx), %edx
andl $-0x10, %edx
leaq 0x19c3(%rip), %rsi      # 0x49b7
movq %rax, %rdi
xorl %eax, %eax
callq 0x20b0
movl %ebx, %edi
callq 0x2870
movq 0x42f4(%rip), %rdi      # 0x7300
movq 0x42fd(%rip), %rdx      # 0x7310
cmpl $0x1, %eax
leaq 0x19e6(%rip), %rcx      # 0x4a03
leaq 0x19e3(%rip), %r8       # 0x4a07
cmoveq %rcx, %r8
leaq 0x1993(%rip), %rsi      # 0x49c2
movl %eax, %ecx
xorl %eax, %eax
callq 0x20b0
jmp 0x3045
pushq $0xa
popq %rdi
movq %rax, %rsi
callq 0x20a0
movq 0x43c4(%rip), %rdi      # 0x7410
movl 0x407e(%rip), %edx      # 0x70d0
incl %edx
leaq 0x19b2(%rip), %rsi      # 0x4a0d
xorl %eax, %eax
callq 0x20b0
movl 0x406c(%rip), %edx      # 0x70d4
testl %edx, %edx
je 0x3087
movq 0x439d(%rip), %rdi      # 0x7410
movl 0x4037(%rip), %ecx      # 0x70b0
leaq 0x19b4(%rip), %rsi      # 0x4a34
xorl %eax, %eax
callq 0x20b0
movq 0x4382(%rip), %rdi      # 0x7410
movl 0x4044(%rip), %edx      # 0x70d8
leaq 0x19e7(%rip), %rsi      # 0x4a82
xorl %eax, %eax
callq 0x20b0
movq 0x4367(%rip), %rdi      # 0x7410
movl 0x402d(%rip), %edx      # 0x70dc
leaq 0x19f4(%rip), %rsi      # 0x4aaa
xorl %eax, %eax
callq 0x20b0
movl 0x4015(%rip), %eax      # 0x70d8
addl 0x4013(%rip), %eax      # 0x70dc
je 0x30e4
movq 0x433e(%rip), %rcx      # 0x7410
leaq 0x1a00(%rip), %rdi      # 0x4ad9
pushq $0x26
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
cmpb $0x1, 0x4009(%rip)      # 0x70f4
jne 0x3150
movq 0x431c(%rip), %rcx      # 0x7410
leaq 0x1a05(%rip), %rdi      # 0x4b00
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
leaq 0x38d3(%rip), %r12      # 0x69e0
leaq 0x19ff(%rip), %rbx      # 0x4b13
xorl %r14d, %r14d
cmpq $0x80, %r14
je 0x3150
movl (%r15), %r9d
testl %r9d, %r9d
je 0x3143
movq 0x42e1(%rip), %rdi      # 0x7410
movq (%r12), %rdx
movq %rbx, %rsi
movl %r14d, %ecx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x20b0
incq %r14
addq $0x8, %r12
addq $0x4, %r15
jmp 0x3117
cmpb $0x1, 0x3f9a(%rip)      # 0x70f1
jne 0x317a
movq 0x42b0(%rip), %rdi      # 0x7410
movl 0x3f52(%rip), %edx      # 0x70b8
movl 0x3f8c(%rip), %ecx      # 0x70f8
leaq 0x19b7(%rip), %rsi      # 0x4b2a
xorl %eax, %eax
callq 0x20b0
leaq 0x22b3(%rip), %rdi      # 0x5434
callq 0x2050
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3e52(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x14db(%rip), %rsi      # 0x4683
jmp 0x31bb
movq 0x3e3f(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x14f6(%rip), %rsi      # 0x46b1
leaq 0x10(%rsp), %rdx
jmp 0x31d6
movq 0x3e27(%rip), %rax      # 0x6ff0
movq (%rax), %rdi
leaq 0x1509(%rip), %rsi      # 0x46dc
movq %r12, %rdx
xorl %eax, %eax
callq 0x20b0
pushq $0x8
jmp 0x28b8
leaq 0x1782(%rip), %rdi      # 0x496d
callq 0x2461
movq 0x3df9(%rip), %rax      # 0x6ff0
movq (%rax), %rcx
leaq 0x177c(%rip), %rdi      # 0x497d
pushq $0x39
popq %rsi
pushq $0x1
popq %rdx
callq 0x2130
pushq $0x8
popq %rdi
callq 0x2120