// File: atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::readTD0(int, bool)
void TDiskImage::readTD0(int hfile, bool readonly)
{
   long fsize = filelength(hfile);
   if(fsize < 0)
   {
      ShowError(ERR_GETLEN);
      return;
   }
   unsigned char *ptr = (unsigned char*)new char[fsize+256*20000];
   if(!ptr)
   {
      ShowError(ERR_NOMEM);
      return;
   }
   long rsize = read(hfile, ptr, fsize);

   TD0_MAIN_HEADER *td0hdr = (TD0_MAIN_HEADER*)ptr; 
   TD0_INFO_DATA *td0inf = (TD0_INFO_DATA*)(ptr+12);

   if(!rsize)
   {
      delete ptr;
      ShowError(ERR_CORRUPT);
      return;
   }
   if(rsize < 12)      // header
   {
      delete ptr;
      ShowError(ERR_CORRUPT);
      return;
   }

   if( (*(short*)ptr != WORD2('T','D'))&&(*(short*)ptr != WORD2('t','d')) )// non TD0
   {
      delete ptr;
      ShowError(ERR_FORMAT" TD0!");
      return;
   }
   if( TD0CRC(ptr,10) != td0hdr->CRC ) // CRC bad...
   {
      delete ptr;
      ShowError(ERR_FILECRC" TD0!");
      return;
   }
   if( (td0hdr->Ver > 21)||(td0hdr->Ver < 10) )           // 1.0 <= version <= 2.1...
   {
      delete ptr;
      ShowError(ERR_FILEVER" TD0!");
      return;
   }
   if( td0hdr->DataDOS != 0 )           // if DOS allocated sectors only...
   {
      delete ptr;
      ShowError(ERR_TD0DOSALLOC);
      return;
   }
   if(!unpack_td0(ptr, rsize))
   {
      delete ptr;
      ShowError(ERR_FORMAT" TD0!");
      return;
   }

// loading unpacked TD0...

   int tdOFF = 12;
   if(ptr[7] & 0x80) tdOFF += sizeof(TD0_INFO_DATA) + td0inf->strLen;

   TD0_TRACK_HEADER *tdtrk;
   TD0_SECT_HEADER *tdsect;

   MaxTrack = 0;
   MaxSide = 0;

   for(; tdOFF < rsize ;)
   {
      tdtrk = (TD0_TRACK_HEADER*)(ptr+tdOFF);
      tdOFF += sizeof(TD0_TRACK_HEADER);

      if(tdOFF >= rsize) break;
      if( tdtrk->SectorCount == 0xFF ) break;   // EOF marker


      unsigned trk = tdtrk->Track;
      unsigned side = tdtrk->Side;
      FTrackLength[trk][side] = 6250;

// make unformatted track...
      FTracksPtr[trk][side][0] = (unsigned char*)new char[FTrackLength[trk][side]+1024];      // trk img
      FTracksPtr[trk][side][1] = (unsigned char*)new char[FTrackLength[trk][side]+1024];      // clk img
      for(unsigned ij=0; ij < 6250; ij++)   
      {
         FTracksPtr[trk][side][0][ij] = 0x00;
         FTracksPtr[trk][side][1][ij] = 0x00;         
      }


      unsigned SecCount = tdtrk->SectorCount;

      unsigned int tmpOFF = tdOFF;

// Вычисляем необходимое число байт под данные:
      unsigned int trkdatalen = 0;
      unsigned int SL;
      for(unsigned int ilsec=0; ilsec < SecCount; ilsec++)
      {
         tdsect = (TD0_SECT_HEADER*)(ptr+tmpOFF); 
         tmpOFF += sizeof(TD0_SECT_HEADER)+tdsect->DataLength;

         trkdatalen += 2+6;     // for marks:   0xA1, 0xFE, 6bytes
         trkdatalen += 4;       // for data header/crc: 0xA1, 0xFB, ...,2bytes
//         SL = unsigned(tdsect->ADRM[3]);
//         if(!SL) SL = 128;
//         else SL = 128 << SL;
         SL = tdsect->DataLength-1;
         trkdatalen += SL;
      }

// проверка на возможность формата...
      if(trkdatalen + SecCount*(3+2) > 6250)    // 3x4E & 2x00 per sec checking
      {
         delete ptr;
         for(int t=0; t < 256; t++)
            for(int s=0; s < 256; s++)
            {
               FTrackLength[t][s] = 0;
               if(FTracksPtr[t][s][0]) delete FTracksPtr[t][s][0];
               FTracksPtr[t][s][0] = NULL;
               if(FTracksPtr[t][s][1]) delete FTracksPtr[t][s][1];
               FTracksPtr[t][s][1] = NULL;
            }
         ShowError(ERR_IMPOSSIBLE);
         return;
      }

      unsigned int FreeSpace = 6250 - (trkdatalen + SecCount*(3+2));

      unsigned int SynchroPulseLen = 1; // 1 уже учтен в trkdatalen...
      unsigned int FirstSpaceLen = 1;
      unsigned int SecondSpaceLen = 1;
      unsigned int ThirdSpaceLen = 1;
      unsigned int SynchroSpaceLen = 1;
      FreeSpace -= FirstSpaceLen+SecondSpaceLen+ThirdSpaceLen+SynchroSpaceLen;

// Распределяем длины пробелов и синхропромежутка:
      while(FreeSpace > 0)
      {
         if(FreeSpace>=(SecCount*2)) 
            if(SynchroSpaceLen < 12) {SynchroSpaceLen++; FreeSpace-=SecCount*2;} // Synchro for ADM & DATA
         if(FreeSpace < SecCount) break;

         if(FirstSpaceLen < 10) {FirstSpaceLen++; FreeSpace-=SecCount;}
         if(FreeSpace < SecCount) break;
         if(SecondSpaceLen < 22) {SecondSpaceLen++; FreeSpace-=SecCount;}
         if(FreeSpace < SecCount) break;
         if(ThirdSpaceLen < 60) {ThirdSpaceLen++; FreeSpace-=SecCount;}
         if(FreeSpace < SecCount) break;

         if((SynchroSpaceLen>=12)&&(FirstSpaceLen>=10)&&(SecondSpaceLen>=22)&&(ThirdSpaceLen>=60)) break;
      };
// по возможности делаем три синхроимпульса...
      if(FreeSpace > (SecCount*2)+10) { SynchroPulseLen++; FreeSpace-=SecCount; }
      if(FreeSpace > (SecCount*2)+9) SynchroPulseLen++; 

// Форматируем дорожку...

      unsigned int tptr=0;
      unsigned int ptrcrc;
      unsigned int r;
      unsigned short vgcrc;
      for(unsigned sec=0; sec < SecCount; sec++)
      {
         tdsect = (TD0_SECT_HEADER*)(ptr+tdOFF); 
         tdOFF += sizeof(TD0_SECT_HEADER)+1;

         for(r=0; r < FirstSpaceLen; r++)        // Первый пробел
         {
            FTracksPtr[trk][side][0][tptr] = 0x4E;
            FTracksPtr[trk][side][1][tptr++] = 0x00;
         }
         for(r=0; r < SynchroSpaceLen; r++)        // Синхропромежуток
         {
            FTracksPtr[trk][side][0][tptr] = 0x00;
            FTracksPtr[trk][side][1][tptr++] = 0x00;
         }
         ptrcrc = tptr;
         for(r=0; r < SynchroPulseLen; r++)        // Синхроимпульс
         {
            FTracksPtr[trk][side][0][tptr] = 0xA1;
            FTracksPtr[trk][side][1][tptr++] = 0xFF;
         }
         FTracksPtr[trk][side][0][tptr] = 0xFE;   // Метка "Адрес"
         FTracksPtr[trk][side][1][tptr++] = 0x00;

         FTracksPtr[trk][side][0][tptr] = tdsect->ADRM[0]; // cyl
         FTracksPtr[trk][side][1][tptr++] = 0x00;
         FTracksPtr[trk][side][0][tptr] = tdsect->ADRM[1]; // head 
         FTracksPtr[trk][side][1][tptr++] = 0x00;
         FTracksPtr[trk][side][0][tptr] = tdsect->ADRM[2]; // secN
         FTracksPtr[trk][side][1][tptr++] = 0x00;
         FTracksPtr[trk][side][0][tptr] = tdsect->ADRM[3]; // len code
         FTracksPtr[trk][side][1][tptr++] = 0x00;

         vgcrc = MakeVGCRC(FTracksPtr[trk][side][0]+ptrcrc, tptr-ptrcrc);
         FTracksPtr[trk][side][0][tptr] = (unsigned char)(vgcrc>>8); // VG93 CRC
         FTracksPtr[trk][side][1][tptr++] = 0x00;
         FTracksPtr[trk][side][0][tptr] = (unsigned char)(vgcrc&0xFF);
         FTracksPtr[trk][side][1][tptr++] = 0x00;

         for(r=0; r < SecondSpaceLen; r++)        // Второй пробел
         {
            FTracksPtr[trk][side][0][tptr] = 0x4E;
            FTracksPtr[trk][side][1][tptr++] = 0x00;
         }
         for(r=0; r < SynchroSpaceLen; r++)        // Синхропромежуток
         {
            FTracksPtr[trk][side][0][tptr] = 0x00;
            FTracksPtr[trk][side][1][tptr++] = 0x00;
         }

         if(tdsect->DataLength-1) // oh-oh, data area not present... ;-) 
         {
            ptrcrc = tptr;
            for(r=0; r < SynchroPulseLen; r++)        // Синхроимпульс
            {
               FTracksPtr[trk][side][0][tptr] = 0xA1;
               FTracksPtr[trk][side][1][tptr++] = 0xFF;
            }

            FTracksPtr[trk][side][0][tptr] = 0xFB;   // Метка "Данные"
            FTracksPtr[trk][side][1][tptr++] = 0x00;

//            SL = unsigned(tdsect->ADRM[3]);
//            if(!SL) SL = 128;
//            else SL = 128 << SL;
            SL = tdsect->DataLength-1;

            for(r=0; r < SL; r++)        // сектор SL байт
            {
               FTracksPtr[trk][side][0][tptr] = ptr[tdOFF+r];
               FTracksPtr[trk][side][1][tptr++] = 0x00;
            }
            tdOFF += SL;

            vgcrc = MakeVGCRC(FTracksPtr[trk][side][0]+ptrcrc, tptr-ptrcrc);


            FTracksPtr[trk][side][0][tptr] = (unsigned char)(vgcrc>>8); // VG93 CRC
            FTracksPtr[trk][side][1][tptr++] = 0x00;
            FTracksPtr[trk][side][0][tptr] = (unsigned char)(vgcrc&0xFF);
            FTracksPtr[trk][side][1][tptr++] = 0x00;
         }

         for(r=0; r < ThirdSpaceLen; r++)        // Третий пробел
         {
            FTracksPtr[trk][side][0][tptr] = 0x4E;
            FTracksPtr[trk][side][1][tptr++] = 0x00;
         }
      }
      for(int eoftrk=tptr; eoftrk < 6250; eoftrk++) 
      {
         FTracksPtr[trk][side][0][tptr] = 0x4E;
         FTracksPtr[trk][side][1][tptr++] = 0x00;
      }

      if(unsigned(MaxTrack) < trk) MaxTrack = trk;
      if(unsigned(MaxSide) < side) MaxSide = side;
   }

   delete ptr;
   ReadOnly = readonly;
   FType = DIT_TD0;
   DiskPresent = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movl -0xc(%rbp), %edi
callq 0xd6a0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x88ff
movq -0xb0(%rbp), %rdi
leaq 0x5a49(%rip), %rsi      # 0xe33e
callq 0x2c30
jmp 0x9c63
movq -0x18(%rbp), %rdi
addq $0x4e2000, %rdi         # imm = 0x4E2000
callq 0x1030
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x8932
movq -0xb0(%rbp), %rdi
leaq 0x5a34(%rip), %rsi      # 0xe35c
callq 0x2c30
jmp 0x9c63
movl -0xc(%rbp), %edi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x11a0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x899b
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
je 0x8983
movq -0xb8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x59dd(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x9c63
cmpq $0xc, -0x28(%rbp)
jge 0x89dc
movq -0x20(%rbp), %rax
movq %rax, -0xc0(%rbp)
cmpq $0x0, %rax
je 0x89c4
movq -0xc0(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x599c(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x9c63
movq -0x20(%rbp), %rax
movswl (%rax), %eax
cmpl $0x4454, %eax           # imm = 0x4454
je 0x8a32
movq -0x20(%rbp), %rax
movswl (%rax), %eax
cmpl $0x6474, %eax           # imm = 0x6474
je 0x8a32
movq -0x20(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, %rax
je 0x8a1a
movq -0xc8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x5cbe(%rip), %rsi      # 0xe6e6
callq 0x2c30
jmp 0x9c63
movq -0x20(%rbp), %rdi
movl $0xa, %esi
callq 0xc700
movzwl %ax, %eax
movq -0x30(%rbp), %rcx
movzwl 0xa(%rcx), %ecx
cmpl %ecx, %eax
je 0x8a89
movq -0x20(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, %rax
je 0x8a71
movq -0xd0(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x5c84(%rip), %rsi      # 0xe703
callq 0x2c30
jmp 0x9c63
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0x15, %eax
jg 0x8aa3
movq -0x30(%rbp), %rax
movzbl 0x4(%rax), %eax
cmpl $0xa, %eax
jge 0x8add
movq -0x20(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, %rax
je 0x8ac5
movq -0xd8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x5c49(%rip), %rsi      # 0xe71c
callq 0x2c30
jmp 0x9c63
movq -0x30(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
je 0x8b24
movq -0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, %rax
je 0x8b0c
movq -0xe0(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x5c21(%rip), %rsi      # 0xe73b
callq 0x2c30
jmp 0x9c63
movq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xc7a0
testb $0x1, %al
jne 0x8b6f
movq -0x20(%rbp), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, %rax
je 0x8b57
movq -0xe8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rdi
leaq 0x5b81(%rip), %rsi      # 0xe6e6
callq 0x2c30
jmp 0x9c63
movl $0xc, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x7(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x8ba0
movq -0x38(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, %ecx
addq $0xa, %rcx
movslq -0x3c(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x3c(%rbp)
movq -0xb0(%rbp), %rax
movb $0x0, 0x145007(%rax)
movb $0x0, 0x145008(%rax)
movslq -0x3c(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x9c1d
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movslq -0x3c(%rbp), %rax
addq $0x4, %rax
movl %eax, -0x3c(%rbp)
movslq -0x3c(%rbp), %rax
cmpq -0x28(%rbp), %rax
jl 0x8bec
jmp 0x9c1d
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
cmpl $0xff, %eax
jne 0x8bff
jmp 0x9c1d
movq -0xb0(%rbp), %rax
movq -0x48(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movl %ecx, -0x54(%rbp)
movq -0x48(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movl %ecx, -0x58(%rbp)
movl -0x54(%rbp), %ecx
movl %ecx, %edx
shlq $0xa, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
movl $0x186a, (%rcx,%rdx,4)  # imm = 0x186A
movl -0x54(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, %eax
movl %eax, %edi
callq 0x1030
movq %rax, %rdx
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %esi
shlq $0xc, %rsi
addq %rsi, %rcx
movl -0x58(%rbp), %esi
shlq $0x4, %rsi
addq %rsi, %rcx
movq %rdx, (%rcx)
movl -0x54(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, %eax
movl %eax, %edi
callq 0x1030
movq %rax, %rcx
movq -0xb0(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rax
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x5c(%rbp)
cmpl $0x186a, -0x5c(%rbp)    # imm = 0x186A
jae 0x8d33
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x5c(%rbp), %edx
movb $0x0, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x5c(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x8ccb
movq -0x48(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x64(%rbp)
movl $0x0, -0x68(%rbp)
movl $0x0, -0x70(%rbp)
movl -0x70(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x8db2
movq -0x20(%rbp), %rax
movl -0x64(%rbp), %ecx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x6(%rax), %eax
movl %eax, %ecx
addq $0x8, %rcx
movl -0x64(%rbp), %eax
addq %rcx, %rax
movl %eax, -0x64(%rbp)
movl -0x68(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movzwl 0x6(%rax), %eax
subl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x8d51
movl -0x68(%rbp), %eax
imull $0x5, -0x60(%rbp), %ecx
addl %ecx, %eax
cmpl $0x186a, %eax           # imm = 0x186A
jbe 0x8f91
movq -0x20(%rbp), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, %rax
je 0x8de8
movq -0xf0(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movl $0x0, -0x74(%rbp)
cmpl $0x100, -0x74(%rbp)     # imm = 0x100
jge 0x8f79
movl $0x0, -0x78(%rbp)
cmpl $0x100, -0x78(%rbp)     # imm = 0x100
jge 0x8f69
movq -0xb0(%rbp), %rax
movslq -0x74(%rbp), %rdx
shlq $0xa, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movslq -0x78(%rbp), %rdx
movl $0x0, (%rcx,%rdx,4)
addq $0x40000, %rax          # imm = 0x40000
movslq -0x74(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x8e98
movq -0xb0(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movslq -0x74(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, %rax
je 0x8e96
movq -0xf8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
jmp 0x8e98
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movslq -0x74(%rbp), %rdx
shlq $0xc, %rdx
addq %rdx, %rcx
movslq -0x78(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq $0x0, (%rcx)
addq $0x40000, %rax          # imm = 0x40000
movslq -0x74(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x8f30
movq -0xb0(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movslq -0x74(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, %rax
je 0x8f2e
movq -0x100(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
jmp 0x8f30
movq -0xb0(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movslq -0x74(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movslq -0x78(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, 0x8(%rax)
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x8e03
jmp 0x8f6b
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x8def
movq -0xb0(%rbp), %rdi
leaq 0x5546(%rip), %rsi      # 0xe4cd
callq 0x2c30
jmp 0x9c63
movl -0x68(%rbp), %ecx
imull $0x5, -0x60(%rbp), %eax
addl %eax, %ecx
movl $0x186a, %eax           # imm = 0x186A
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
movl $0x1, -0x80(%rbp)
movl $0x1, -0x84(%rbp)
movl $0x1, -0x88(%rbp)
movl $0x1, -0x8c(%rbp)
movl $0x1, -0x90(%rbp)
movl -0x84(%rbp), %ecx
addl -0x88(%rbp), %ecx
addl -0x8c(%rbp), %ecx
addl -0x90(%rbp), %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x7c(%rbp)
jbe 0x90f2
movl -0x7c(%rbp), %eax
movl -0x60(%rbp), %ecx
shll %ecx
cmpl %ecx, %eax
jb 0x9030
cmpl $0xc, -0x90(%rbp)
jae 0x902e
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
movl -0x60(%rbp), %ecx
shll %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
jmp 0x9030
movl -0x7c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x903d
jmp 0x90f2
cmpl $0xa, -0x84(%rbp)
jae 0x9060
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
movl -0x60(%rbp), %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x906d
jmp 0x90f2
cmpl $0x16, -0x88(%rbp)
jae 0x9090
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
movl -0x60(%rbp), %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x909a
jmp 0x90f2
cmpl $0x3c, -0x8c(%rbp)
jae 0x90bd
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
movl -0x60(%rbp), %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x90c7
jmp 0x90f2
cmpl $0xc, -0x90(%rbp)
jb 0x90ed
cmpl $0xa, -0x84(%rbp)
jb 0x90ed
cmpl $0x16, -0x88(%rbp)
jb 0x90ed
cmpl $0x3c, -0x8c(%rbp)
jb 0x90ed
jmp 0x90f2
jmp 0x8ff3
movl -0x7c(%rbp), %eax
movl -0x60(%rbp), %ecx
shll %ecx
addl $0xa, %ecx
cmpl %ecx, %eax
jbe 0x9115
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movl -0x60(%rbp), %ecx
movl -0x7c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl -0x60(%rbp), %ecx
shll %ecx
addl $0x9, %ecx
cmpl %ecx, %eax
jbe 0x912d
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movl $0x0, -0x94(%rbp)
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
cmpl -0x60(%rbp), %eax
jae 0x9b3f
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movslq -0x3c(%rbp), %rax
addq $0x9, %rax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x84(%rbp), %eax
jae 0x91fd
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $0x4e, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x9174
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x9290
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $0x0, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x9207
movl -0x94(%rbp), %eax
movl %eax, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x80(%rbp), %eax
jae 0x932c
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $-0x5f, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $-0x1, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x92a6
movq -0xb0(%rbp), %rdi
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x94(%rbp), %ecx
movb $-0x2, (%rax,%rcx)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb (%rax), %dl
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x94(%rbp), %ecx
movb %dl, (%rax,%rcx)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb 0x1(%rax), %dl
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x94(%rbp), %ecx
movb %dl, (%rax,%rcx)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb 0x2(%rax), %dl
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x94(%rbp), %ecx
movb %dl, (%rax,%rcx)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
movb 0x3(%rax), %dl
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl -0x94(%rbp), %ecx
movb %dl, (%rax,%rcx)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x98(%rbp), %eax
addq %rax, %rsi
movl -0x94(%rbp), %eax
subl -0x98(%rbp), %eax
movl %eax, %eax
movl %eax, %edx
callq 0x1fa0
movw %ax, %cx
movq -0xb0(%rbp), %rax
movw %cx, -0x9e(%rbp)
movzwl -0x9e(%rbp), %ecx
sarl $0x8, %ecx
movb %cl, %sil
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb %sil, (%rcx,%rdx)
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl -0x94(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x94(%rbp)
movl %edx, %edx
movb $0x0, (%rcx,%rdx)
movzwl -0x9e(%rbp), %ecx
andl $0xff, %ecx
movb %cl, %sil
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb %sil, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x88(%rbp), %eax
jae 0x96f7
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $0x4e, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x966e
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x90(%rbp), %eax
jae 0x978a
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $0x0, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x9701
movq -0x50(%rbp), %rax
movzwl 0x6(%rax), %eax
subl $0x1, %eax
cmpl $0x0, %eax
je 0x9a96
movl -0x94(%rbp), %eax
movl %eax, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x80(%rbp), %eax
jae 0x983a
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $-0x5f, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $-0x1, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x97b4
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $-0x5, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x50(%rbp), %rax
movzwl 0x6(%rax), %eax
subl $0x1, %eax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x6c(%rbp), %eax
jae 0x9956
movq -0xb0(%rbp), %rax
movq -0x20(%rbp), %rcx
movl -0x3c(%rbp), %edx
addl -0x9c(%rbp), %edx
movl %edx, %edx
movb (%rcx,%rdx), %sil
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb %sil, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x98b9
movq -0xb0(%rbp), %rdi
movl -0x6c(%rbp), %eax
addl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq %rdi, %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x98(%rbp), %eax
addq %rax, %rsi
movl -0x94(%rbp), %eax
subl -0x98(%rbp), %eax
movl %eax, %eax
movl %eax, %edx
callq 0x1fa0
movw %ax, %cx
movq -0xb0(%rbp), %rax
movw %cx, -0x9e(%rbp)
movzwl -0x9e(%rbp), %ecx
sarl $0x8, %ecx
movb %cl, %sil
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb %sil, (%rcx,%rdx)
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl -0x94(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x94(%rbp)
movl %edx, %edx
movb $0x0, (%rcx,%rdx)
movzwl -0x9e(%rbp), %ecx
andl $0xff, %ecx
movb %cl, %sil
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb %sil, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x9c(%rbp)
movl -0x9c(%rbp), %eax
cmpl -0x8c(%rbp), %eax
jae 0x9b29
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $0x4e, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0x9c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0x9aa0
jmp 0x9b2b
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x9141
movl -0x94(%rbp), %eax
movl %eax, -0xa8(%rbp)
cmpl $0x186a, -0xa8(%rbp)    # imm = 0x186A
jge 0x9bd2
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x54(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x58(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x94(%rbp), %edx
movb $0x4e, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x54(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x58(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x94(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x94(%rbp)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x9b4b
movq -0xb0(%rbp), %rax
movzbl 0x145007(%rax), %eax
cmpl -0x54(%rbp), %eax
jae 0x9bf5
movq -0xb0(%rbp), %rax
movl -0x54(%rbp), %ecx
movb %cl, 0x145007(%rax)
movq -0xb0(%rbp), %rax
movzbl 0x145008(%rax), %eax
cmpl -0x58(%rbp), %eax
jae 0x9c18
movq -0xb0(%rbp), %rax
movl -0x58(%rbp), %ecx
movb %cl, 0x145008(%rax)
jmp 0x8bb5
movq -0x20(%rbp), %rax
movq %rax, -0x108(%rbp)
cmpq $0x0, %rax
je 0x9c3f
movq -0x108(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0xb0(%rbp), %rax
movb -0xd(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x145005(%rax)
movl $0x4, 0x141000(%rax)
movb $0x1, 0x145006(%rax)
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopl (%rax)