// File: atsidaev[P]trx2x/DiskImage.cpp
// Function: TDiskImage::readUDI(int, bool)
void TDiskImage::readUDI(int hfile, bool ronly)
{
   long fsize = filelength(hfile);
   if(fsize < 0)
   {
      ShowError(ERR_GETLEN);
      return;
   }

   unsigned char *ptr = (unsigned char*)new char[fsize+1024*2048];
   if(!ptr)
   {
      ShowError(ERR_NOMEM);
      return;
   }

   unsigned long rsize = read(hfile, ptr, fsize+1024);
   if(rsize < 16+4)
   {
      delete ptr;
      ShowError(ERR_CORRUPT);
      return;
   }

   if(memcmp(ptr, "UDI!", 4) != 0) 
   {
      delete ptr;
      ShowError(ERR_FORMAT" UDI!");
      return;
   }

   UDI_HEADER *udi_hdr = (UDI_HEADER*)(ptr);

   if((udi_hdr->Version != 0x00)||(udi_hdr->_zero != 0x00)||(udi_hdr->ExtHdrLength != 0))
   {
      delete ptr;
      ShowError(ERR_FILEVER" UDI!");
      return;
   }
   if(rsize != (udi_hdr->UnpackedLength+4))
   {
      delete ptr;
      ShowError(ERR_CORRUPT);
      return;
   }

   MaxTrack = udi_hdr->MaxCylinder;
   MaxSide = udi_hdr->MaxSide;


// checking for corrupt...
   unsigned int udiOFF=0x10;

   unsigned int trk, side;

   for(trk=0; trk <= unsigned(MaxTrack); trk++)
      for(side=0; side <= unsigned(MaxSide); side++)
      {
         uint8_t frmt = ptr[udiOFF++];
         if(rsize < udiOFF+4)
         {
            delete ptr;
            ShowError(ERR_CORRUPT);
            return;
         }

         if(frmt)
         {
            udiOFF += *((uint32_t*)(ptr+udiOFF));
            udiOFF += 4;
            continue;
         }

         unsigned ccctlen = *((uint16_t*)(ptr+udiOFF));
         udiOFF += ccctlen;
         udiOFF += 2;
         if(rsize < udiOFF+4)
         {
            delete ptr;
            ShowError(ERR_CORRUPT);
            return;
         }

         udiOFF += ccctlen/8 + ((ccctlen-(ccctlen/8)*8)? 1:0);
         if(rsize < udiOFF+4)
         {
            delete ptr;
            ShowError(ERR_CORRUPT);
            return;
         }
      }


   udiOFF = 0x10;

   unsigned int trklen;

   for(trk=0; trk <= unsigned(MaxTrack); trk++)
      for(side=0; side <= unsigned(MaxSide); side++)
      {
         if(udiOFF >= rsize) break;

         if(ptr[udiOFF++] != 0)        // non MFM track?
         {
            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;         
            }

            udiOFF += *((unsigned long*)(ptr+udiOFF));
            udiOFF +=4;
            continue;
         }
         trklen = *((unsigned short*)(ptr+udiOFF));
         udiOFF += 2;
         FTrackLength[trk][side] = trklen;

// 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 < FTrackLength[trk][side]; ij++)   
         {
            FTracksPtr[trk][side][0][ij] = 0x00;
            FTracksPtr[trk][side][1][ij] = 0x00;         
         }

         memcpy(FTracksPtr[trk][side][0], ptr+udiOFF, FTrackLength[trk][side]);
         udiOFF += trklen;

         uint32_t MFMinfoLen = trklen/8 + ((trklen-(trklen/8)*8)? 1:0);

         unsigned char mask;
         for(unsigned i=0; i < MFMinfoLen; i++)
         {
            mask = 0x01;
            for(int j=0; j < 8; j++)
            {
               if(ptr[udiOFF] & mask) FTracksPtr[trk][side][1][i*8+j] = 0xFF;
               else FTracksPtr[trk][side][1][i*8+j] = 0x00;
               mask <<= 1;
            }
            udiOFF++;
         }
      }
   long CRC = -1l;
   for(unsigned int i=0; i < udiOFF; i++) CRC = CalcCRC32(CRC, ptr[i]);


   if(udiOFF < rsize) 
      if( *((uint32_t*)(ptr+udiOFF)) != CRC )
         ShowError(ERR_FILECRC" UDI!");

   delete ptr;
   ReadOnly = ronly;
   FType = DIT_UDI;
   DiskPresent = true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0xc(%rbp), %edi
callq 0xd6a0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jge 0x8059
movq -0x78(%rbp), %rdi
leaq 0x62ef(%rip), %rsi      # 0xe33e
callq 0x2c30
jmp 0x889d
movq -0x18(%rbp), %rdi
addq $0x200000, %rdi         # imm = 0x200000
callq 0x1030
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x8089
movq -0x78(%rbp), %rdi
leaq 0x62dd(%rip), %rsi      # 0xe35c
callq 0x2c30
jmp 0x889d
movl -0xc(%rbp), %edi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x400, %rdx            # imm = 0x400
callq 0x11a0
movq %rax, -0x28(%rbp)
cmpq $0x14, -0x28(%rbp)
jae 0x80dc
movq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, %rax
je 0x80c7
movq -0x80(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x629c(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x889d
movq -0x20(%rbp), %rax
movl (%rax), %eax
subl $0x21494455, %eax       # imm = 0x21494455
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x8129
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0x8114
movq -0x88(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x6270(%rip), %rsi      # 0xe38f
callq 0x2c30
jmp 0x889d
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzbl 0x8(%rax), %eax
cmpl $0x0, %eax
jne 0x8155
movq -0x30(%rbp), %rax
movzbl 0xb(%rax), %eax
cmpl $0x0, %eax
jne 0x8155
movq -0x30(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x818c
movq -0x20(%rbp), %rax
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
je 0x8177
movq -0x90(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x622a(%rip), %rsi      # 0xe3ac
callq 0x2c30
jmp 0x889d
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0x4(%rcx), %ecx
addl $0x4, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
je 0x81d8
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, %rax
je 0x81c3
movq -0x98(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x61a0(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x889d
movq -0x78(%rbp), %rax
movq -0x30(%rbp), %rcx
movb 0x9(%rcx), %cl
movb %cl, 0x145007(%rax)
movq -0x30(%rbp), %rcx
movb 0xa(%rcx), %cl
movb %cl, 0x145008(%rax)
movl $0x10, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x78(%rbp), %rcx
movl -0x38(%rbp), %eax
movzbl 0x145007(%rcx), %ecx
cmpl %ecx, %eax
ja 0x83b3
movl $0x0, -0x3c(%rbp)
movq -0x78(%rbp), %rcx
movl -0x3c(%rbp), %eax
movzbl 0x145008(%rcx), %ecx
cmpl %ecx, %eax
ja 0x83a3
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0x3d(%rbp)
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x4, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x8296
movq -0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, %rax
je 0x8281
movq -0xa0(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x60e2(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x889d
cmpb $0x0, -0x3d(%rbp)
je 0x82ba
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movl (%rax,%rcx), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x34(%rbp)
jmp 0x8395
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movzwl (%rax,%rcx), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x4, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x8322
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, %rax
je 0x830d
movq -0xa8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x6056(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x889d
movl -0x44(%rbp), %eax
shrl $0x3, %eax
movl -0x44(%rbp), %esi
movl -0x44(%rbp), %ecx
shrl $0x3, %ecx
shll $0x3, %ecx
subl %ecx, %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rax
movl -0x34(%rbp), %ecx
addl $0x4, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x8393
movq -0x20(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, %rax
je 0x837e
movq -0xb0(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rdi
leaq 0x5fe5(%rip), %rsi      # 0xe36e
callq 0x2c30
jmp 0x889d
jmp 0x8395
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x8221
jmp 0x83a5
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x8204
movl $0x10, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x78(%rbp), %rcx
movl -0x38(%rbp), %eax
movzbl 0x145007(%rcx), %ecx
cmpl %ecx, %eax
ja 0x87f1
movl $0x0, -0x3c(%rbp)
movq -0x78(%rbp), %rcx
movl -0x3c(%rbp), %eax
movzbl 0x145008(%rcx), %ecx
cmpl %ecx, %eax
ja 0x87e1
movl -0x34(%rbp), %eax
cmpq -0x28(%rbp), %rax
jb 0x8402
jmp 0x87e1
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x34(%rbp)
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x8554
movq -0x78(%rbp), %rax
movl -0x38(%rbp), %ecx
movl %ecx, %edx
shlq $0xa, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movl -0x3c(%rbp), %edx
movl $0x186a, (%rcx,%rdx,4)  # imm = 0x186A
movl -0x38(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, %eax
movl %eax, %edi
callq 0x1030
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x38(%rbp), %esi
shlq $0xc, %rsi
addq %rsi, %rcx
movl -0x3c(%rbp), %esi
shlq $0x4, %rsi
addq %rsi, %rcx
movq %rdx, (%rcx)
movl -0x38(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, %eax
movl %eax, %edi
callq 0x1030
movq %rax, %rcx
movq -0x78(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x38(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rax
movl -0x3c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4c(%rbp)
cmpl $0x186a, -0x4c(%rbp)    # imm = 0x186A
jae 0x8532
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x38(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x3c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x4c(%rbp), %edx
movb $0x0, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x38(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x84cd
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx), %rcx
movl -0x34(%rbp), %eax
addq %rcx, %rax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x34(%rbp)
jmp 0x87d3
movq -0x78(%rbp), %rax
movq -0x20(%rbp), %rcx
movl -0x34(%rbp), %edx
movzwl (%rcx,%rdx), %ecx
movl %ecx, -0x48(%rbp)
movl -0x34(%rbp), %ecx
addl $0x2, %ecx
movl %ecx, -0x34(%rbp)
movl -0x48(%rbp), %esi
movl -0x38(%rbp), %ecx
movl %ecx, %edx
shlq $0xa, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movl -0x3c(%rbp), %edx
movl %esi, (%rcx,%rdx,4)
movl -0x38(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, %eax
movl %eax, %edi
callq 0x1030
movq %rax, %rdx
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x38(%rbp), %esi
shlq $0xc, %rsi
addq %rsi, %rcx
movl -0x3c(%rbp), %esi
shlq $0x4, %rsi
addq %rsi, %rcx
movq %rdx, (%rcx)
movl -0x38(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
addl $0x400, %eax            # imm = 0x400
movl %eax, %eax
movl %eax, %edi
callq 0x1030
movq %rax, %rcx
movq -0x78(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x38(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rax
movl -0x3c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x50(%rbp)
movq -0x78(%rbp), %rcx
movl -0x50(%rbp), %eax
movl -0x38(%rbp), %edx
shlq $0xa, %rdx
addq %rdx, %rcx
movl -0x3c(%rbp), %edx
cmpl (%rcx,%rdx,4), %eax
jae 0x868c
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x38(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x3c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
movl -0x50(%rbp), %edx
movb $0x0, (%rcx,%rdx)
addq $0x40000, %rax          # imm = 0x40000
movl -0x38(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x50(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x8617
movq -0x78(%rbp), %rax
movq %rax, %rcx
addq $0x40000, %rcx          # imm = 0x40000
movl -0x38(%rbp), %edx
shlq $0xc, %rdx
addq %rdx, %rcx
movl -0x3c(%rbp), %edx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdi
movq -0x20(%rbp), %rsi
movl -0x34(%rbp), %ecx
addq %rcx, %rsi
movl -0x38(%rbp), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, %edx
callq 0x10c0
movl -0x48(%rbp), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x48(%rbp), %eax
shrl $0x3, %eax
movl -0x48(%rbp), %esi
movl -0x48(%rbp), %ecx
shrl $0x3, %ecx
shll $0x3, %ecx
subl %ecx, %esi
xorl %ecx, %ecx
movl $0x1, %edx
cmpl $0x0, %esi
cmovnel %edx, %ecx
addl %ecx, %eax
movl %eax, -0x54(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x54(%rbp), %eax
jae 0x87d1
movb $0x1, -0x55(%rbp)
movl $0x0, -0x60(%rbp)
cmpl $0x8, -0x60(%rbp)
jge 0x87ba
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movzbl -0x55(%rbp), %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x8772
movq -0x78(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x38(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x5c(%rbp), %ecx
shll $0x3, %ecx
addl -0x60(%rbp), %ecx
movl %ecx, %ecx
movb $-0x1, (%rax,%rcx)
jmp 0x87a3
movq -0x78(%rbp), %rax
addq $0x40000, %rax          # imm = 0x40000
movl -0x38(%rbp), %ecx
shlq $0xc, %rcx
addq %rcx, %rax
movl -0x3c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl -0x5c(%rbp), %ecx
shll $0x3, %ecx
addl -0x60(%rbp), %ecx
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movzbl -0x55(%rbp), %eax
shll %eax
movb %al, -0x55(%rbp)
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x871f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x8708
jmp 0x87d3
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x83de
jmp 0x87e3
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x83c1
movq $-0x1, -0x68(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x882f
movq -0x68(%rbp), %rax
movl %eax, %edi
movq -0x20(%rbp), %rax
movl -0x6c(%rbp), %ecx
movzbl (%rax,%rcx), %esi
callq 0x1b20
cltq
movq %rax, -0x68(%rbp)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x8800
movl -0x34(%rbp), %eax
cmpq -0x28(%rbp), %rax
jae 0x885a
movq -0x20(%rbp), %rax
movl -0x34(%rbp), %ecx
movl (%rax,%rcx), %eax
cmpq -0x68(%rbp), %rax
je 0x8858
movq -0x78(%rbp), %rdi
leaq 0x5b78(%rip), %rsi      # 0xe3cb
callq 0x2c30
jmp 0x885a
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
cmpq $0x0, %rax
je 0x887c
movq -0xb8(%rbp), %rdi
movl $0x1, %esi
callq 0x1130
movq -0x78(%rbp), %rax
movb -0xd(%rbp), %cl
andb $0x1, %cl
movb %cl, 0x145005(%rax)
movl $0x5, 0x141000(%rax)
movb $0x1, 0x145006(%rax)
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)