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

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

   argno = HandleOptions (argc, argv); // process options
   if (argno == 0) {
      fprintf (stderr, "\n*** No basefilename given\n\n");
      SayUsage (argv[0]);
      exit (4); }
   filebasename = argv[argno];
   
   // strip off trailing .mid or .MID extension if provided by user
   basenamelen = strlength(filebasename);
   if (basenamelen > 4 &&
         (charcmp (filebasename + basenamelen - 4, ".mid") ||
          charcmp (filebasename + basenamelen - 4, ".MID"))) {
      filebasename[basenamelen - 4] = 0; }

   if (logparse || loggen) { // open the log file
      miditones_strlcpy (filename, filebasename, MAXPATH);
      miditones_strlcat (filename, ".log", MAXPATH);
      logfile = fopen (filename, "w");
      if (!logfile) {
         fprintf (stderr, "Unable to open log file %s\n", filename);
         return 1; }
      fprintf (logfile, "MIDITONES V%s log file\n", VERSION);
      print_command_line(logfile, argc, argv); }
   if (loggen) {
      fprintf(logfile, "\nThere are %d independent time-ordered streams in this log file:\n", logparse ? 3 : 2);
      if (logparse) fprintf(logfile, " - the parsed MIDI events, marked with #\n");
      fprintf(logfile, " - the MIDI play/stop events being queued, announced with ->\n"
              " - the generated bytestream commands pulled from the queue, announced with <-\n\n"); }

   // open the input file
   miditones_strlcpy (filename, filebasename, MAXPATH);
   miditones_strlcat (filename, ".mid", MAXPATH);
   infile = fopen (filename, "rb");
   if (!infile) {
      fprintf (stderr, "Unable to open input file %s\n", filename);
      return 1; }

   // Read the whole input file into memory
   fseek (infile, 0, SEEK_END); // find its size
   buflen = ftell (infile);
   fseek (infile, 0, SEEK_SET);
   buffer = (byte *) malloc (buflen + 1);
   if (!buffer) {
      fprintf (stderr, "Unable to allocate %ld bytes for the file\n", buflen);
      return 1; }
   fread (buffer, buflen, 1, infile);
   fclose (infile);
   if (logparse) fprintf (logfile, "Processing %s, %ld bytes\n", filename, buflen);

   if (!parseonly) { // create the output file
      miditones_strlcpy (filename, filebasename, MAXPATH);
      if (binaryoutput) {
         miditones_strlcat (filename, ".bin", MAXPATH);
         outfile = fopen (filename, "wb"); }
      else {
         miditones_strlcat (filename,  asm_output ? (scorename ? ".inc" : ".asm") : (scorename ? ".h" : ".c"), MAXPATH);
         outfile = fopen (filename, "w"); }
      if (!outfile) {
         fprintf (stderr, "Unable to open output file %s\n", filename);
         return 1; }
      file_header.f1 = (volume_output ? HDR_F1_VOLUME_PRESENT : 0)
                       | (instrumentoutput ? HDR_F1_INSTRUMENTS_PRESENT : 0)
                       | (percussion_translate ? HDR_F1_PERCUSSION_PRESENT : 0);
      file_header.num_tgens = num_tonegens;
      if (!binaryoutput) {      /* create header of C file that initializes score data */
         time_t rawtime;
         time (&rawtime);
         fprintf (outfile, "%s Playtune bytestream for file \"%s.mid\" ", comment, filebasename);
         fprintf (outfile, "created by MIDITONES V%s on %s", VERSION,
                  asctime (localtime (&rawtime)));
         print_command_line (outfile, argc, argv);
         if (channel_mask != 0xffff)
            fprintf (outfile, "%s   Only the masked channels were processed: %04X\n", comment, channel_mask);
         if (keyshift != 0)
            fprintf (outfile, "%s   Keyshift was %d chromatic notes\n", comment, keyshift);
         if (define_progmem) {
            fprintf (outfile, "#ifdef __AVR__\n");
            fprintf (outfile, "#include <avr/pgmspace.h>\n");
            fprintf (outfile, "#else\n");
            fprintf (outfile, "#define PROGMEM\n");
            fprintf (outfile, "#endif\n"); }
         if (asm_output) // create the assembler label for the score
            fprintf(outfile, "\n%s:\n%s", filebasename, byteop);
         else fprintf (outfile, "const unsigned char PROGMEM %s [] = {\n",
                  scorename ? filebasename : "score");
         if (do_header) {       // write the initialization for the file header
            fprintf (outfile, "'P','t', 6, %s%02X, %s%02X, ", hex, file_header.f1, hex, file_header.f2);
            fflush (outfile);
            file_header_num_tgens_position = ftell (outfile);   // remember where the number of tone generators is
            fprintf (outfile, "%2d%s %s (Playtune file header)\n%s", file_header.num_tgens, asm_output ? "" : ",", comment, byteop);
            outfile_bytecount += 6; } }
      else if (do_header) {     // write the binary file header
         int i;
         for (i = 0; i < sizeof (file_header); ++i)
            fputc (((byte *) &file_header)[i], outfile);
         file_header_num_tgens_position = (char *) &file_header.num_tgens - (char *) &file_header;
         outfile_bytecount += sizeof (file_header); } }

   // process the MIDI file header
   hdrptr = buffer;   // point to the file and track headers
   process_file_header ();
   printf ("  Processing %d tracks.\n", num_tracks);
   if (num_tracks > MAX_TRACKS) midi_error ("Too many tracks", buffer);

   // initialize for processing of all the tracks
   tempo = DEFAULT_TEMPO;
   for (int tracknum = 0; tracknum < num_tracks; ++tracknum) {
      track[tracknum].tempo = DEFAULT_TEMPO;
      process_track_header (tracknum);
      find_next_note (tracknum);     /* position to the first note on/off */
      /* if we are in "parse only" mode, do the whole track,
         so we do them one at a time instead of time-synchronized. */
      if (parseonly)
         while (track[tracknum].cmd != CMD_TRACKDONE)
            find_next_note (tracknum); }
#if 0
   // TEMP test queuing routines
   show_queue_cmd(12, CMD_PLAYNOTE, 100);
   show_queue_cmd(12, CMD_PLAYNOTE, 101);
   show_queue_cmd(12, CMD_PLAYNOTE, 103);
   show_queue_cmd(20, CMD_STOPNOTE, 101);
   show_queue_cmd(15, CMD_STOPNOTE, 103);
   show_queue_cmd(21, CMD_PLAYNOTE, 104);
   show_queue_cmd(20, CMD_STOPNOTE, 100);
   show_queue_cmd(20, CMD_STOPNOTE, 104);
   show_queue_cmd(22, CMD_PLAYNOTE, 109);
   flush_queue();
#endif
   if (!parseonly) {

      process_track_data();    // do all the tracks interleaved, like a 1950's multiway merge

      // generate the ending commentary
      if (!binaryoutput) {
         fprintf(outfile, "\n%s This %ld byte score contains %d notes and uses %d tone generator%s.\n",
                 comment, outfile_bytecount, note_on_commands, num_tonegens_used,
                 num_tonegens_used == 1 ? "" : "s");
         fprintf(outfile, "%s It encodes %u.%03u seconds of music with %d tempo change%s.\n",
            comment, (unsigned)(timenow_usec / 1000000), (unsigned)(timenow_usec / 1000 % 1000),
            tempo_changes, tempo_changes == 1 ? "" : "s");
         if (notes_skipped)
            fprintf(outfile, "%s %d notes had to be skipped.\n", comment, notes_skipped); }
      printf("  %s %d tone generators were used.\n",
             num_tonegens_used < num_tonegens ? "Only" : "All", num_tonegens_used);
      if (notes_skipped)
         printf("  %d notes were skipped because there weren't enough tone generators.\n",
                notes_skipped);
      if (consecutive_delays)
         printf("  %d consecutive delays could be eliminated\n", consecutive_delays);
      if (events_delayed)
         printf("  %d \"stop note\" commands were delayed because the %d-element output queue is too small\n",
                events_delayed, QUEUE_SIZE);
      if (noteinfo_overflow + noteinfo_notfound > 0)
         printf("  %d notes couldn't be recorded in the track status, so then %d notes couldn't be found\n"
                "  (Consider recompiling with MAX_TRACKNOTES bigger than %d, to allow more simultaneous notes.)\n",
                noteinfo_overflow, noteinfo_notfound, MAX_CHANNELNOTES);
      printf("  %ld bytes of score data were generated, ", outfile_bytecount);
      printf("encoding %u.%03u seconds of music with %d tempo change%s.\n",
             (unsigned)(timenow_usec / 1000000), (unsigned)(timenow_usec / 1000 % 1000), 
             tempo_changes, tempo_changes == 1 ? "" : "s");
      if (delaymin_usec)
         printf("  %ld delays were removed because the minimum delay of  %u msec caused events to be merged\n",
                delays_saved, (unsigned)(delaymin_usec / 1000));
      if (loggen) {
         fprintf(logfile, "%d note-on commands, %d instrument changes.\n",
                 note_on_commands, instrument_changes);
         fprintf(logfile, "%d stop-notes without start-notes, %d start-notes without stop-notes\n",
                 stopnotes_without_playnotes, playnotes_without_stopnotes);
         if (attacktime_usec > 0) fprintf(logfile, "%d sustain phases done, and %d skipped because the notes were too short\n",
                                             sustainphases_done, sustainphases_skipped); }
      if (0 && do_header) {             // rewrite the file header with the actual number of tone generators used
         if (fseek(outfile, file_header_num_tgens_position, SEEK_SET) != 0)
            fprintf(stderr, "Can't seek to number of tone generators in the header\n");
         else {
            if (binaryoutput)
               putc(num_tonegens_used, outfile);
            else
               fprintf(outfile, "%2d", num_tonegens_used); } }
      fclose(outfile); }

   if (loggen || logparse)
      fclose (logfile);
   printf ("  Done.\n");
   return 0; }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rsi, %r14
movl %edi, %ebp
leaq 0x23e9(%rip), %rdi      # 0x650c
leaq 0x240c(%rip), %rsi      # 0x6536
xorl %eax, %eax
callq 0x1080
cmpl $0x1, %ebp
je 0x4a9f
movl %ebp, %edi
movq %r14, %rsi
callq 0x154e
testl %eax, %eax
je 0x4b14
cltq
movq (%r14,%rax,8), %rbx
movq $-0x1, %rcx
cmpb $0x0, 0x1(%rbx,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x4159
cmpq $0x5, %rcx
jb 0x41bc
movl %ecx, %eax
leaq (%rbx,%rax), %rdx
addq $-0x4, %rdx
xorl %esi, %esi
leaq 0xf8d(%rip), %rdi       # 0x510a
movb (%rdx,%rsi), %r8b
cmpb (%rsi,%rdi), %r8b
jne 0x4192
incq %rsi
cmpq $0x4, %rsi
jne 0x417d
jmp 0x41b7
movl %ecx, %ecx
addq %rbx, %rcx
addq $-0x4, %rcx
xorl %edx, %edx
leaq 0x23b3(%rip), %rsi      # 0x6557
movb (%rcx,%rdx), %dil
cmpb (%rdx,%rsi), %dil
jne 0x41bc
incq %rdx
cmpq $0x4, %rdx
jne 0x41a4
movb $0x0, -0x4(%rbx,%rax)
cmpb $0x0, 0x5002(%rip)      # 0x91c5
jne 0x41d3
movb 0x4ff8(%rip), %al       # 0x91c3
cmpb $0x1, %al
jne 0x4257
xorl %eax, %eax
cmpq $0x77, %rax
je 0x41eb
movb (%rbx,%rax), %cl
movb %cl, 0x10(%rsp,%rax)
incq %rax
testb %cl, %cl
jne 0x41d5
jmp 0x41f0
movb $0x0, 0x10(%rsp,%rax)
leaq 0xf7b(%rip), %rsi       # 0x5172
leaq 0x10(%rsp), %r15
movl $0x78, %edx
movq %r15, %rdi
callq 0x1c13
leaq 0x234c(%rip), %rsi      # 0x655c
movq %r15, %rdi
callq 0x1120
movq %rax, 0x4fb9(%rip)      # 0x91d8
testq %rax, %rax
je 0x4acf
leaq 0x234b(%rip), %rsi      # 0x657a
leaq 0x2300(%rip), %rdx      # 0x6536
movq %rax, %rdi
xorl %eax, %eax
callq 0x10b0
movq 0x4f91(%rip), %rdi      # 0x91d8
movl %ebp, %esi
movq %r14, %rdx
callq 0x1a89
movb 0x4f6c(%rip), %al       # 0x91c3
testb $0x1, %al
je 0x42bd
movq 0x4f76(%rip), %rdi      # 0x91d8
movzbl 0x4f5c(%rip), %edx      # 0x91c5
orl $0x2, %edx
leaq 0x231f(%rip), %rsi      # 0x6592
xorl %eax, %eax
callq 0x10b0
cmpb $0x1, 0x4f44(%rip)      # 0x91c5
jne 0x42a0
movq 0x4f4e(%rip), %rcx      # 0x91d8
leaq 0x2343(%rip), %rdi      # 0x65d4
movl $0x29, %esi
movl $0x1, %edx
callq 0x1150
movq 0x4f31(%rip), %rcx      # 0x91d8
leaq 0x2350(%rip), %rdi      # 0x65fe
movl $0x8c, %esi
movl $0x1, %edx
callq 0x1150
xorl %eax, %eax
cmpq $0x77, %rax
je 0x42d5
movb (%rbx,%rax), %cl
movb %cl, 0x10(%rsp,%rax)
incq %rax
testb %cl, %cl
jne 0x42bf
jmp 0x42da
movb $0x0, 0x10(%rsp,%rax)
leaq 0xe29(%rip), %rsi       # 0x510a
leaq 0x10(%rsp), %r15
movl $0x78, %edx
movq %r15, %rdi
callq 0x1c13
leaq 0x2391(%rip), %rsi      # 0x668b
movq %r15, %rdi
callq 0x1120
movq %rax, 0x79ff(%rip)      # 0xbd08
testq %rax, %rax
je 0x4aa6
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1110
movq 0x79e0(%rip), %rdi      # 0xbd08
callq 0x10c0
movq %rax, 0x4eb4(%rip)      # 0x91e8
movq 0x79cd(%rip), %rdi      # 0xbd08
xorl %esi, %esi
xorl %edx, %edx
callq 0x1110
movq 0x4e9d(%rip), %r15      # 0x91e8
leaq 0x1(%r15), %rdi
callq 0x10e0
movq %rax, 0x4e85(%rip)      # 0x91e0
testq %rax, %rax
je 0x4ab9
movq 0x799d(%rip), %rcx      # 0xbd08
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x1050
movq 0x7986(%rip), %rdi      # 0xbd08
callq 0x1060
cmpb $0x1, 0x4e37(%rip)      # 0x91c5
jne 0x43b1
movq 0x4e41(%rip), %rdi      # 0x91d8
movq 0x4e4a(%rip), %rcx      # 0x91e8
leaq 0x2332(%rip), %rsi      # 0x66d7
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x10b0
cmpb $0x0, 0x4e0e(%rip)      # 0x91c6
jne 0x4724
xorl %eax, %eax
cmpq $0x77, %rax
je 0x43d6
movb (%rbx,%rax), %cl
movb %cl, 0x10(%rsp,%rax)
incq %rax
testb %cl, %cl
jne 0x43c0
jmp 0x43db
movb $0x0, 0x10(%rsp,%rax)
cmpb $0x0, 0x4dde(%rip)      # 0x91c0
je 0x43f4
leaq 0x230b(%rip), %r15      # 0x66f6
leaq 0x22ff(%rip), %rsi      # 0x66f1
jmp 0x4431
leaq 0xd50(%rip), %rax       # 0x514b
leaq 0x22f7(%rip), %rcx      # 0x66f9
testb $0x1, 0x4dc5(%rip)      # 0x91ce
cmovneq %rax, %rcx
leaq 0x22ea(%rip), %rax      # 0x66fe
leaq 0x22e6(%rip), %rsi      # 0x6701
cmovneq %rax, %rsi
cmpb $0x0, 0x4da4(%rip)      # 0x91ca
cmovneq %rcx, %rsi
leaq 0x212b(%rip), %r15      # 0x655c
leaq 0x10(%rsp), %r12
movl $0x78, %edx
movq %r12, %rdi
callq 0x1c13
movq %r12, %rdi
movq %r15, %rsi
callq 0x1120
movq %rax, 0x4d9b(%rip)      # 0x91f0
testq %rax, %rax
je 0x4ae2
movb 0x4d67(%rip), %al       # 0x91cb
shlb $0x7, %al
movb 0x4d57(%rip), %cl       # 0x91c4
shlb $0x6, %cl
orb %al, %cl
movb 0x4d50(%rip), %al       # 0x91c8
shlb $0x5, %al
orb %cl, %al
movb %al, 0x4c90(%rip)       # 0x9113
movb 0x4c63(%rip), %al       # 0x90ec
movb %al, 0x4c86(%rip)       # 0x9115
cmpb $0x0, 0x4d2a(%rip)      # 0x91c0
je 0x44d8
cmpb $0x1, 0x4d22(%rip)      # 0x91c1
jne 0x4724
xorl %ebx, %ebx
leaq 0x4c62(%rip), %r14      # 0x9110
movzbl (%rbx,%r14), %edi
movq 0x4d36(%rip), %rsi      # 0x91f0
callq 0x1090
incq %rbx
cmpq $0x6, %rbx
jne 0x44ae
movq $0x5, 0x783d(%rip) # 0xbd10
jmp 0x471c
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x10d0
movq 0x4d04(%rip), %rdi      # 0x91f0
movq 0x4bdd(%rip), %rdx      # 0x90d0
leaq 0x2229(%rip), %rsi      # 0x6723
movq %rbx, %rcx
xorl %eax, %eax
callq 0x10b0
movq 0x4ce5(%rip), %r12      # 0x91f0
movq %r15, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1070
leaq 0x222b(%rip), %rsi      # 0x674d
leaq 0x200d(%rip), %rdx      # 0x6536
movq %r12, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x10b0
movq 0x4cb3(%rip), %rdi      # 0x91f0
movl %ebp, %esi
movq %r14, %rdx
callq 0x1a89
movl 0x4ba3(%rip), %ecx      # 0x90f0
cmpl $0xffff, %ecx           # imm = 0xFFFF
je 0x4571
movq 0x4c94(%rip), %rdi      # 0x91f0
movq 0x4b6d(%rip), %rdx      # 0x90d0
leaq 0x2202(%rip), %rsi      # 0x676c
xorl %eax, %eax
callq 0x10b0
movl 0x4bf5(%rip), %ecx      # 0x916c
testl %ecx, %ecx
je 0x4597
movq 0x4c6e(%rip), %rdi      # 0x91f0
movq 0x4b47(%rip), %rdx      # 0x90d0
leaq 0x2210(%rip), %rsi      # 0x67a0
xorl %eax, %eax
callq 0x10b0
cmpb $0x1, 0x4c24(%rip)      # 0x91c2
jne 0x4635
movq 0x4c45(%rip), %rcx      # 0x91f0
leaq 0x2214(%rip), %rdi      # 0x67c6
movl $0xf, %esi
movl $0x1, %edx
callq 0x1150
movq 0x4c28(%rip), %rcx      # 0x91f0
leaq 0x2207(%rip), %rdi      # 0x67d6
movl $0x1a, %esi
movl $0x1, %edx
callq 0x1150
movq 0x4c0b(%rip), %rcx      # 0x91f0
leaq 0x2205(%rip), %rdi      # 0x67f1
movl $0x6, %esi
movl $0x1, %edx
callq 0x1150
movq 0x4bee(%rip), %rcx      # 0x91f0
leaq 0x21ef(%rip), %rdi      # 0x67f8
movl $0x10, %esi
movl $0x1, %edx
callq 0x1150
movq 0x4bd1(%rip), %rcx      # 0x91f0
leaq 0x21e3(%rip), %rdi      # 0x6809
movl $0x7, %esi
movl $0x1, %edx
callq 0x1150
movq 0x4bb4(%rip), %rdi      # 0x91f0
cmpb $0x1, 0x4b87(%rip)      # 0x91ca
jne 0x465f
movq 0x4a94(%rip), %rcx      # 0x90e0
leaq 0x21be(%rip), %rsi      # 0x6811
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10b0
jmp 0x467f
leaq 0x21da(%rip), %rdx      # 0x6840
cmpb $0x0, 0x4b61(%rip)      # 0x91ce
cmovneq %rbx, %rdx
leaq 0x21a1(%rip), %rsi      # 0x6819
xorl %eax, %eax
callq 0x10b0
cmpb $0x1, 0x4b3b(%rip)      # 0x91c1
jne 0x4724
movq 0x4b5d(%rip), %rdi      # 0x91f0
movq 0x4a3e(%rip), %rdx      # 0x90d8
movzbl 0x4a72(%rip), %ecx      # 0x9113
movzbl 0x4a6b(%rip), %r9d      # 0x9114
leaq 0x2196(%rip), %rsi      # 0x6846
movq %rdx, %r8
xorl %eax, %eax
callq 0x10b0
movq 0x4b2f(%rip), %rdi      # 0x91f0
callq 0x10f0
movq 0x4b23(%rip), %rdi      # 0x91f0
callq 0x10c0
movq %rax, 0x7637(%rip)      # 0xbd10
movq 0x4b10(%rip), %rdi      # 0x91f0
movzbl 0x4a2e(%rip), %edx      # 0x9115
leaq 0x1f9c(%rip), %rax      # 0x668a
leaq 0x2191(%rip), %rcx      # 0x6886
cmpb $0x0, 0x4ace(%rip)      # 0x91ca
cmovneq %rax, %rcx
movq 0x49c9(%rip), %r8       # 0x90d0
movq 0x49d2(%rip), %r9       # 0x90e0
leaq 0x214e(%rip), %rsi      # 0x6863
xorl %eax, %eax
callq 0x10b0
addq $0x6, 0x4a64(%rip)      # 0x9188
movq 0x4ab5(%rip), %rax      # 0x91e0
movq %rax, 0x75be(%rip)      # 0xbcf0
callq 0x3015
movl 0x75bb(%rip), %esi      # 0xbcf8
leaq 0x2144(%rip), %rdi      # 0x6888
xorl %eax, %eax
callq 0x1080
movl 0x75a7(%rip), %eax      # 0xbcf8
cmpl $0x19, %eax
jge 0x4b19
movq $0x7a120, 0x759b(%rip) # imm = 0x7A120
testl %eax, %eax
jle 0x47bc
xorl %ebx, %ebx
leaq 0x4c4e(%rip), %r14      # 0x93c0
leaq (%rbx,%rbx,2), %r15
shlq $0x4, %r15
movq $0x7a120, 0x18(%r15,%r14) # imm = 0x7A120
movl %ebx, %edi
callq 0x315d
movl %ebx, %edi
callq 0x328d
cmpb $0x1, 0x4a2e(%rip)      # 0x91c6
jne 0x47ad
addq %r14, %r15
cmpb $-0x1, 0x24(%r15)
je 0x47ad
movl %ebx, %edi
callq 0x328d
jmp 0x479d
incq %rbx
movslq 0x7541(%rip), %rax      # 0xbcf8
cmpq %rax, %rbx
jl 0x4772
cmpb $0x0, 0x4a03(%rip)      # 0x91c6
jne 0x4a71
callq 0x3bd8
cmpb $0x0, 0x49eb(%rip)      # 0x91c0
jne 0x48ae
movq 0x4a0e(%rip), %rdi      # 0x91f0
movq 0x48e7(%rip), %rdx      # 0x90d0
movq 0x4998(%rip), %rcx      # 0x9188
movl 0x4949(%rip), %r8d      # 0x9140
movl 0x493a(%rip), %r9d      # 0x9138
cmpl $0x1, %r9d
leaq 0x1e81(%rip), %r14      # 0x668a
leaq 0x2074(%rip), %rbx      # 0x6884
movq %rbx, %rax
cmoveq %r14, %rax
movq %rax, (%rsp)
leaq 0x208f(%rip), %rsi      # 0x68b1
xorl %eax, %eax
callq 0x10b0
movq 0x49c0(%rip), %rdi      # 0x91f0
movq 0x4899(%rip), %rdx      # 0x90d0
movl 0x495b(%rip), %eax      # 0x9198
imulq $0x431bde83, %rax, %rcx # imm = 0x431BDE83
shrq $0x32, %rcx
imulq $0x10624dd3, %rax, %r8  # imm = 0x10624DD3
shrq $0x26, %r8
imulq $0x83126f, %r8, %rax    # imm = 0x83126F
shrq $0x21, %rax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %r8d
movl 0x4942(%rip), %r9d      # 0x91b0
cmpl $0x1, %r9d
cmoveq %r14, %rbx
movq %rbx, (%rsp)
leaq 0x2079(%rip), %rsi      # 0x68fa
xorl %eax, %eax
callq 0x10b0
movl 0x48b6(%rip), %ecx      # 0x9144
testl %ecx, %ecx
je 0x48ae
movq 0x4957(%rip), %rdi      # 0x91f0
movq 0x4830(%rip), %rdx      # 0x90d0
leaq 0x2093(%rip), %rsi      # 0x693a
xorl %eax, %eax
callq 0x10b0
movl 0x4884(%rip), %edx      # 0x9138
cmpl 0x4832(%rip), %edx      # 0x90ec
leaq 0x20bd(%rip), %rax      # 0x697e
leaq 0x20bb(%rip), %rsi      # 0x6983
cmovlq %rax, %rsi
leaq 0x2087(%rip), %rdi      # 0x695a
xorl %eax, %eax
callq 0x1080
movl 0x4864(%rip), %esi      # 0x9144
testl %esi, %esi
je 0x48f2
leaq 0x209c(%rip), %rdi      # 0x6987
xorl %eax, %eax
callq 0x1080
movl 0x4864(%rip), %esi      # 0x915c
testl %esi, %esi
je 0x490a
leaq 0x20cb(%rip), %rdi      # 0x69ce
xorl %eax, %eax
callq 0x1080
movl 0x4838(%rip), %esi      # 0x9148
testl %esi, %esi
je 0x4927
leaq 0x20e0(%rip), %rdi      # 0x69fb
movl $0x64, %edx
xorl %eax, %eax
callq 0x1080
movl 0x4837(%rip), %esi      # 0x9164
movl 0x4835(%rip), %edx      # 0x9168
movl %edx, %eax
addl %esi, %eax
jle 0x494c
leaq 0x2114(%rip), %rdi      # 0x6a54
movl $0x10, %ecx
xorl %eax, %eax
callq 0x1080
movq 0x4835(%rip), %rsi      # 0x9188
leaq 0x21b2(%rip), %rdi      # 0x6b0c
xorl %eax, %eax
callq 0x1080
movl 0x4831(%rip), %eax      # 0x9198
imulq $0x431bde83, %rax, %rsi # imm = 0x431BDE83
shrq $0x32, %rsi
imulq $0x10624dd3, %rax, %rdx # imm = 0x10624DD3
shrq $0x26, %rdx
imulq $0x83126f, %rdx, %rax   # imm = 0x83126F
shrq $0x21, %rax
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %edx
movl 0x481a(%rip), %ecx      # 0x91b0
cmpl $0x1, %ecx
leaq 0x1cea(%rip), %rax      # 0x668a
leaq 0x1edd(%rip), %r8       # 0x6884
cmoveq %rax, %r8
leaq 0x2185(%rip), %rdi      # 0x6b37
xorl %eax, %eax
callq 0x1080
movq 0x47b0(%rip), %rax      # 0x9170
testq %rax, %rax
je 0x49ef
movq 0x47ec(%rip), %rsi      # 0x91b8
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
mulq %rcx
shrq $0x4, %rdx
leaq 0x218a(%rip), %rdi      # 0x6b72
xorl %eax, %eax
callq 0x1080
cmpb $0x1, 0x47cd(%rip)      # 0x91c3
jne 0x4a65
movq 0x47d9(%rip), %rdi      # 0x91d8
movl 0x473b(%rip), %edx      # 0x9140
movl 0x4731(%rip), %ecx      # 0x913c
leaq 0x21bc(%rip), %rsi      # 0x6bce
xorl %eax, %eax
callq 0x10b0
movq 0x47b8(%rip), %rdi      # 0x91d8
movl 0x4726(%rip), %edx      # 0x914c
movl 0x4724(%rip), %ecx      # 0x9150
leaq 0x21c8(%rip), %rsi      # 0x6bfb
xorl %eax, %eax
callq 0x10b0
cmpq $0x0, 0x473e(%rip)      # 0x9180
je 0x4a65
movq 0x478d(%rip), %rdi      # 0x91d8
movl 0x4707(%rip), %edx      # 0x9158
movl 0x46fd(%rip), %ecx      # 0x9154
leaq 0x21e3(%rip), %rsi      # 0x6c41
xorl %eax, %eax
callq 0x10b0
movq 0x4784(%rip), %rdi      # 0x91f0
callq 0x1060
cmpb $0x0, 0x474b(%rip)      # 0x91c3
jne 0x4a83
cmpb $0x1, 0x4744(%rip)      # 0x91c5
jne 0x4a8f
movq 0x474e(%rip), %rdi      # 0x91d8
callq 0x1060
leaq 0x21f4(%rip), %rdi      # 0x6c8a
callq 0x1040
xorl %eax, %eax
jmp 0x4b04
callq 0x12a7
jmp 0x4aff
movq 0x454b(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1bd7(%rip), %rsi      # 0x668e
jmp 0x4af3
movq 0x4538(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1be2(%rip), %rsi      # 0x66ac
movq %r15, %rdx
jmp 0x4af8
movq 0x4522(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1a7e(%rip), %rsi      # 0x655e
jmp 0x4af3
movq 0x450f(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x1c11(%rip), %rsi      # 0x6704
leaq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x10b0
movl $0x1, %eax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x127d
movq 0x46c0(%rip), %rsi      # 0x91e0
leaq 0x1d7a(%rip), %rdi      # 0x68a1
callq 0x1b04