// File: /workspace/github_c_makefile_star2_O1/jonof[P]jftekwar/src/tekgame.c
// Function: drawscreen
void
drawscreen(short snum, int dasmoothratio)
{
     int      i, j, charsperline, tempint;
     int      x1, y1, x2, y2, ox1, oy1, ox2, oy2;
     int      cposx, cposy, cposz, choriz, czoom;
     short     cang;

     smoothratio = max(min(dasmoothratio,65536),0);

     cposx = oposx[snum]+mulscale(posx[snum]-oposx[snum],smoothratio,16);
     cposy = oposy[snum]+mulscale(posy[snum]-oposy[snum],smoothratio,16);
     cposz = oposz[snum]+mulscale(posz[snum]-oposz[snum],smoothratio,16);
     if( frameinterpolate == 0 ) {
          cposx = posx[snum]; cposy = posy[snum]; cposz = posz[snum];
     }
     cposz+=headbob;
     choriz = ohoriz[snum]+mulscale(horiz[snum]-ohoriz[snum],smoothratio,16);
     czoom = ozoom[snum]+mulscale(zoom[snum]-ozoom[snum],smoothratio,16);
     cang = oang[snum]+mulscale(((ang[snum]+1024-oang[snum])&2047)-1024,smoothratio,16);

     if( dimensionmode[snum] != 2 ) {
          if( (numplayers > 1) && (option[4] == 0) ) {
               for( i=connecthead; i>=0; i=connectpoint2[i] ) {
                    frame2draw[i] = 1;
               }
               redrawbackfx();
               for( i=connecthead,j=0; i>=0; i=connectpoint2[i],j++ ) {
                    if( frame2draw[i] != 0 ) {
                         if( numplayers <= 4 ) {
                              switch( j ) {
                                   case 0: setview(0,0,(xdim>>1)-1,(ydim>>1)-1); break;
                                   case 1: setview((xdim>>1),0,xdim-1,(ydim>>1)-1); break;
                                   case 2: setview(0,(ydim>>1),(xdim>>1)-1,ydim-1); break;
                                   case 3: setview((xdim>>1),(ydim>>1),xdim-1,ydim-1); break;
                              }
                         }
                         else {
                              switch( j ) {
                                   case 0: setview(0,0,(xdim>>2)-1,(ydim>>2)-1); break;
                                   case 1: setview(xdim>>2,0,(xdim>>1)-1,(ydim>>2)-1); break;
                                   case 2: setview(xdim>>1,0,xdim-(xdim>>2)-1,(ydim>>2)-1); break;
                                   case 3: setview(xdim-(xdim>>2),0,xdim-1,(ydim>>2)-1); break;
                                   case 4: setview(0,ydim>>2,(xdim>>2)-1,(ydim>>1)-1); break;
                                   case 5: setview(xdim>>2,ydim>>2,(xdim>>1)-1,(ydim>>1)-1); break;
                                   case 6: setview(xdim>>1,ydim>>2,xdim-(xdim>>2)-1,(ydim>>1)-1); break;
                                   case 7: setview(xdim-(xdim>>2),ydim>>2,xdim-1,(ydim>>1)-1); break;
                                   case 8: setview(0,ydim>>1,(xdim>>2)-1,ydim-(ydim>>2)-1); break;
                                   case 9: setview(xdim>>2,ydim>>1,(xdim>>1)-1,ydim-(ydim>>2)-1); break;
                                   case 10: setview(xdim>>1,ydim>>1,xdim-(xdim>>2)-1,ydim-(ydim>>2)-1); break;
                                   case 11: setview(xdim-(xdim>>2),ydim>>1,xdim-1,ydim-(ydim>>2)-1); break;
                                   case 12: setview(0,ydim-(ydim>>2),(xdim>>2)-1,ydim-1); break;
                                   case 13: setview(xdim>>2,ydim-(ydim>>2),(xdim>>1)-1,ydim-1); break;
                                   case 14: setview(xdim>>1,ydim-(ydim>>2),xdim-(xdim>>2)-1,ydim-1); break;
                                   case 15: setview(xdim-(xdim>>2),ydim-(ydim>>2),xdim-1,ydim-1); break;
                              }
                         }
                         if( i == snum ) {
                              drawrooms(cposx,cposy,cposz,cang,choriz,cursectnum[i]);
                         }
                         else {
                              drawrooms(posx[i],posy[i],posz[i],ang[i],horiz[i],cursectnum[i]);
                         }
                         analyzesprites(posx[i],posy[i]);
                         drawmasks();
                         tekdrawgun((syncbits[i]>>13)&15,i);
                    }
               }
          }
          else {
               redrawbackfx();
               drawrooms(cposx,cposy,cposz,cang,choriz,cursectnum[snum]);
               analyzesprites(posx[snum],posy[snum]);
               drawmasks();
               tekdrawgun((syncbits[screenpeek]>>13)&15,screenpeek);
          }
     }

     // move back pivot point for map
     if( dimensionmode[snum] != 3 ) {
          cposx += (sintable[(cang+512)&2047]<<6) / czoom;
          cposy += (sintable[cang&2047]<<6) / czoom;
          if( dimensionmode[snum] == 2 ) {
               clearview(0L);  //Clear screen to specified color
               drawmapview(cposx,cposy,czoom,cang);
          }
          drawoverheadmap(cposx,cposy,czoom,cang);
     }

     if( typemode != 0 ) {
          charsperline = 40;
          for( i=0; i<=typemessageleng; i+=charsperline ) {
               for( j=0; j<charsperline; j++ ) {
                    tempbuf[j] = typemessage[i+j];
               }
               if( typemessageleng < i+charsperline ) {
                    tempbuf[(typemessageleng-i)] = '_';
                    tempbuf[(typemessageleng-i)+1] = 0;
               }
               else {
                    tempbuf[charsperline] = 0;
               }
          }
     }
     else {
          if( dimensionmode[myconnectindex] == 3 ) {
               tempint = screensize;
               if( ((locbits&32) > (screensizeflag&32)) && (screensize > 64) ) {
                    ox1 = (xdim>>1)-(screensize>>1);
                    ox2 = ox1+screensize-1;
                    oy1 = ((ydim-32)>>1)-(((screensize*(ydim-32))/xdim)>>1);
                    oy2 = oy1+((screensize*(ydim-32))/xdim)-1;
                    tekview(&ox1,&oy1, &ox2,&oy2);
                    screensize -= (screensize>>3);
                    if( tempint > xdim ) {
                         screensize = xdim;
                         permanentwritesprite((xdim-320)>>1,ydim-32,STATUSBAR,0,0,0,xdim-1,ydim-1,0);
                         i = ((xdim-320)>>1);
                         while( i >= 8 ) {
                              i -= 8, permanentwritesprite(i,ydim-32,STATUSBARFILL8,0,0,0,xdim-1,ydim-1,0);
                         }
                         if( i >= 4 ) {
                              i -= 4, permanentwritesprite(i,ydim-32,STATUSBARFILL4,0,0,0,xdim-1,ydim-1,0);
                         }
                         i = ((xdim-320)>>1)+320;
                         while( i <= xdim-8 ) {
                              permanentwritesprite(i,ydim-32,STATUSBARFILL8,0,0,0,xdim-1,ydim-1,0), i += 8;
                         }
                         if( i <= xdim-4 ) {
                              permanentwritesprite(i,ydim-32,STATUSBARFILL4,0,0,0,xdim-1,ydim-1,0), i += 4;
                         }
                    }
                    x1 = (xdim>>1)-(screensize>>1);
                    x2 = x1+screensize-1;
                    y1 = ((ydim-32)>>1)-(((screensize*(ydim-32))/xdim)>>1);
                    y2 = y1+((screensize*(ydim-32))/xdim)-1;
                    tekview(&x1,&y1,&x2,&y2);
                    setview(x1,y1>>detailmode,x2,y2>>detailmode);
                    permanentwritespritetile(0L,0L,BACKGROUND,0,ox1,oy1,x1-1,oy2,0);
                    permanentwritespritetile(0L,0L,BACKGROUND,0,x2+1,oy1,ox2,oy2,0);
                    permanentwritespritetile(0L,0L,BACKGROUND,0,x1,oy1,x2,y1-1,0);
                    permanentwritespritetile(0L,0L,BACKGROUND,0,x1,y2+1,x2,oy2,0);
               }
               if( ((locbits&16) > (screensizeflag&16)) && (screensize <= xdim) ) {
                    screensize += (screensize>>3);
                    if( (screensize > xdim) && (tempint == xdim) ) {
                         screensize = xdim+1;
                         x1 = 0; y1 = 0;
                         x2 = xdim-1; y2 = ydim-1;
                    }
                    else {
                         if (screensize > xdim) screensize = xdim;
                         x1 = (xdim>>1)-(screensize>>1);
                         x2 = x1+screensize-1;
                         y1 = ((ydim-32)>>1)-(((screensize*(ydim-32))/xdim)>>1);
                         y2 = y1+((screensize*(ydim-32))/xdim)-1;
                    }
                    tekview(&x1,&y1,&x2,&y2);
                    setview(x1,y1>>detailmode,x2,y2>>detailmode);
               }
               screensizeflag = locbits;
          }
     }

     if( getmessageleng > 0 ) {
          charsperline = 40;
          for( i=0; i<=getmessageleng; i+=charsperline ) {
               for( j=0; j<charsperline; j++ ) {
                    tempbuf[j] = getmessage[i+j];
               }
               if( getmessageleng < i+charsperline ) {
                    tempbuf[(getmessageleng-i)] = 0;
               }
               else {
                    tempbuf[charsperline] = 0;
               }
               printext256(0L,((i/charsperline)<<3)+(200-32-8)-(((getmessageleng-1)/charsperline)<<3),151,-1,(char *)tempbuf,0);
          }
          if( totalclock > getmessagetimeoff ) {
               getmessageleng = 0;
          }
     }

     // you are looking thru an opponent plaeyer's eyes
     if( (numplayers >= 2) && (screenpeek != myconnectindex) ) {
          strcpy((char *)tempbuf,"Other");
     }

    #ifdef OUTOFSYNCMESSAGE
     if( syncstat != 0 ) {
          printext256(68L,84L,31,0,"OUT OF SYNC!",0);
     }
     if( syncstate != 0 ) {
          printext256(68L,92L,31,0,"Missed Network packet!",0);
     }
    #endif

     tekscreenfx();

    #ifdef  NETWORKDIAGNOSTICS
     if( (option[4] > 0) ) {
          for( i=connecthead ; i >= 0 ; i=connectpoint2[i] ) {
               sprintf(tektempbuf,"%2d %5d %5d %5d %5d %3d %4d", i,posx[i],posy[i],posz[i],ang[i],horiz[i],health[i]);
               printext(2,i*8+2,tektempbuf,ALPHABET,255);
          }
          if( myconnectindex == connecthead ) {
               sprintf(tektempbuf,"%2d %s",myconnectindex,"M");
          }
          else {
               sprintf(tektempbuf,"%2d %s",myconnectindex,"S");
          }
          printext(windowx2-48,windowy2-64,tektempbuf,ALPHABET2,255);
     }
    #endif

     nextpage();
     if( dofadein != 0 ) {
          fadein(0,255,dofadein);
     }

    #ifdef OOGIE
     // F5 key
     if( keystatus[0x3f] > 0 ) {
          keystatus[0x3f] = 0;
          detailmode ^= 1;
          if( detailmode == 0 ) {
               setview(windowx1,windowy1<<1,windowx2,(windowy2<<1)+1);
               outp(0x3d4,0x9); outp(0x3d5,(inp(0x3d5)&~31)|1);
          }
          else {
               setview(windowx1,windowy1>>detailmode,windowx2,windowy2>>detailmode);
               setaspect(yxaspect>>1);
               outp(0x3d4,0x9); outp(0x3d5,(inp(0x3d5)&~31)|3);
          }
     }
    #endif

     // F12 key
     if( keystatus[0x58] > 0 ) {
          keystatus[0x58] = 0;
          screencapture("captxxxx.pcx",keystatus[0x2a]|keystatus[0x36]);
     }

    #ifdef STEREOMODE_ADJUSTMENT_ACTIVE
     if( stereofps != 0 ) {
          if( (keystatus[0x2a]|keystatus[0x36]) > 0 ) {
               if (keystatus[0x1a] > 0) stereopixelwidth--;   //Shift [
               if (keystatus[0x1b] > 0) stereopixelwidth++;   //Shift ]
          }
          else {
               if (keystatus[0x1a] > 0) stereowidth -= 512;   //[
               if (keystatus[0x1b] > 0) stereowidth += 512;   //]
          }
     }
    #endif

    #ifdef FAKEMULTIPLAYER_ACTIVE
     if( option[4] == 0 ) {
          if( keystatus[0xd2] > 0 ) {
               keystatus[0xd2] = 0;
               if( numplayers < MAXPLAYERS ) {
                    connectpoint2[numplayers-1] = numplayers;
                    connectpoint2[numplayers] = -1;
                    initplayersprite(numplayers);
                    clearallviews(0L);
                    numplayers++;
               }
          }
          if( keystatus[0xd3] > 0 ) {
               keystatus[0xd3] = 0;
               if( numplayers > 1 ) {
                    numplayers--;
                    connectpoint2[numplayers-1] = -1;
                    deletesprite(playersprite[numplayers]);
                    playersprite[numplayers] = -1;
                    if( myconnectindex >= numplayers ) {
                         myconnectindex = 0;
                    }
                    if( screenpeek >= numplayers ) {
                         screenpeek = 0;
                    }
                    if( numplayers < 2 ) {
                         setup3dscreen();
                    }
                    else {
                         clearallviews(0L);
                    }
               }
          }
          // scroll lock
          if( keystatus[0x46] > 0 ) {
               keystatus[0x46] = 0;
               myconnectindex = connectpoint2[myconnectindex];
               if( myconnectindex < 0 ) {
                    myconnectindex = connecthead;
               }
               screenpeek = myconnectindex;
          }
     }
    #endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %edi, %ebp
movl $0x10000, %eax          # imm = 0x10000
cmpl %eax, %esi
cmovll %esi, %eax
xorl %r9d, %r9d
testl %eax, %eax
cmovgl %eax, %r9d
movl %r9d, 0xd73f3(%rip)     # 0xe2980
movslq %edi, %rbx
leaq 0xd73f9(%rip), %rax     # 0xe2990
movl (%rax,%rbx,4), %ecx
leaq 0xd5f2f(%rip), %r10     # 0xe14d0
movl (%r10,%rbx,4), %eax
movl %eax, %edx
subl %ecx, %edx
movslq %edx, %r8
imulq %r9, %r8
shrq $0x10, %r8
addl %ecx, %r8d
leaq 0xd7412(%rip), %rcx     # 0xe29d0
movl (%rcx,%rbx,4), %ecx
leaq 0xd5f48(%rip), %r14     # 0xe1510
movl (%r14,%rbx,4), %edx
movl %edx, %esi
subl %ecx, %esi
movslq %esi, %r11
imulq %r9, %r11
shrq $0x10, %r11
addl %ecx, %r11d
leaq 0xd742b(%rip), %rcx     # 0xe2a10
movl (%rcx,%rbx,4), %ecx
leaq 0xd5f61(%rip), %rsi     # 0xe1550
movl (%rsi,%rbx,4), %esi
movl %esi, %edi
subl %ecx, %edi
movslq %edi, %rdi
imulq %r9, %rdi
shrq $0x10, %rdi
addl %ecx, %edi
cmpb $0x0, 0xc34f6(%rip)     # 0xceb00
cmovel %eax, %r8d
movq %r8, 0x38(%rsp)
cmovel %edx, %r11d
movq %r11, 0x30(%rsp)
cmovel %esi, %edi
movq %rdi, 0x20(%rsp)
leaq 0xd7465(%rip), %rax     # 0xe2a90
movslq (%rax,%rbx,4), %rax
movq %rax, 0x68(%rsp)
leaq 0xd7295(%rip), %rax     # 0xe28d0
movslq (%rax,%rbx,4), %rax
movq %rax, 0x70(%rsp)
leaq 0xd7485(%rip), %rax     # 0xe2ad0
movzwl (%rax,%rbx,2), %eax
leaq 0xd5e5a(%rip), %rcx     # 0xe14b0
movzwl (%rcx,%rbx,2), %r13d
xorl $0x400, %r13d           # imm = 0x400
subl %eax, %r13d
andl $0x7ff, %r13d           # imm = 0x7FF
addl $0xfffffc00, %r13d      # imm = 0xFFFFFC00
movq %r9, 0x58(%rsp)
imull %r9d, %r13d
shrl $0x10, %r13d
addl %eax, %r13d
leaq 0xd7236(%rip), %rax     # 0xe28c0
movq %rbx, 0x28(%rsp)
cmpb $0x2, (%rbx,%rax)
je 0xbb72
leaq 0x3204a0(%rip), %rax    # 0x32bb40
leaq 0xd73a9(%rip), %rcx     # 0xe2a50
movq 0x28(%rsp), %rsi
movslq (%rcx,%rsi,4), %rcx
leaq 0xd71a9(%rip), %rdx     # 0xe2860
movslq (%rdx,%rsi,4), %rdx
subq %rcx, %rdx
imulq 0x58(%rsp), %rdx
shrq $0x10, %rdx
addl %ecx, %edx
movq %rdx, 0x60(%rsp)
leaq 0x797436(%rip), %rdx    # 0x7a2b0c
movq 0x20(%rsp), %rcx
addl (%rax), %ecx
movq %rcx, 0x20(%rsp)
cmpl $0x2, (%rdx)
jl 0xbb0d
cmpb $0x0, 0xc328a(%rip)     # 0xce97c
jne 0xbb0d
leaq 0x797411(%rip), %rbx    # 0x7a2b10
movl (%rbx), %eax
leaq 0xd73e8(%rip), %r15     # 0xe2af0
testl %eax, %eax
js 0xb721
leaq 0x79740d(%rip), %rcx    # 0x7a2b20
movl %eax, %eax
movb $0x1, (%rax,%r15)
movl (%rcx,%rax,4), %eax
testl %eax, %eax
jns 0xb713
callq 0x150c2
movl (%rbx), %eax
testl %eax, %eax
leaq 0xd5d9f(%rip), %r10     # 0xe14d0
js 0xbb72
movswl %bp, %ecx
movl %ecx, 0x48(%rsp)
xorl %ebp, %ebp
movswl %r13w, %ecx
movl %ecx, 0x44(%rsp)
movl %eax, %ebx
cmpb $0x0, (%rbx,%r15)
je 0xbaa0
leaq 0x7973b0(%rip), %rax    # 0x7a2b0c
cmpl $0x4, (%rax)
movl %ebp, %eax
jg 0xb796
cmpl $0x3, %ebp
ja 0xba07
leaq 0x80689(%rip), %rcx     # 0x8bdfc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5aa6c9(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
sarl %edx
decl %edx
leaq 0x5aa6c0(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
sarl %ecx
jmp 0xb7c9
cmpl $0xf, %ebp
ja 0xba07
leaq 0x80616(%rip), %rcx     # 0x8bdbc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5aa696(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
sarl $0x2, %edx
decl %edx
leaq 0x5aa68c(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
sarl $0x2, %ecx
decl %ecx
xorl %edi, %edi
jmp 0xb989
leaq 0x5aa677(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %esi
sarl %esi
leaq 0x5aa666(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
sarl %edx
jmp 0xb8be
leaq 0x5aa656(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %edi
sarl %edi
leaq 0x5aa64d(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %esi
sarl %esi
jmp 0xb9d1
leaq 0x5aa637(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %edi
sarl %edi
decl %edx
leaq 0x5aa62c(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
sarl %ecx
jmp 0xb987
leaq 0x5aa618(%rip), %rax    # 0x5b5e4c
movl (%rax), %edi
movl %edi, %edx
sarl $0x2, %edx
notl %edx
addl %edi, %edx
sarl %edi
leaq 0x5aa608(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %eax
sarl $0x2, %eax
movl %ecx, %esi
subl %eax, %esi
jmp 0xb9f9
leaq 0x5aa5ed(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %eax
sarl $0x2, %eax
movl %edx, %edi
subl %eax, %edi
leaq 0x5aa5df(%rip), %rax    # 0x5b5e50
movl (%rax), %esi
movl %esi, %ecx
sarl $0x2, %ecx
notl %ecx
addl %esi, %ecx
sarl %esi
jmp 0xb8ed
leaq 0x5aa5c9(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %esi
sarl $0x2, %esi
leaq 0x5aa5b7(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
sarl $0x2, %edx
decl %edx
sarl %ecx
jmp 0xb8c0
leaq 0x5aa5a9(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %eax
sarl $0x2, %eax
movl %ecx, %esi
subl %eax, %esi
leaq 0x5aa593(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
sarl $0x2, %edx
decl %edx
decl %ecx
xorl %edi, %edi
jmp 0xb9fb
leaq 0x5aa57c(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %edi
sarl $0x2, %edi
leaq 0x5aa572(%rip), %rax    # 0x5b5e50
movl (%rax), %esi
movl %esi, %ecx
sarl $0x2, %ecx
notl %ecx
addl %esi, %ecx
sarl %esi
sarl %edx
decl %edx
jmp 0xb9fb
leaq 0x5aa551(%rip), %rax    # 0x5b5e4c
movl (%rax), %edi
movl %edi, %edx
sarl $0x2, %edx
notl %edx
addl %edi, %edx
sarl %edi
jmp 0xb97b
leaq 0x5aa53b(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %eax
sarl $0x2, %eax
movl %edx, %edi
subl %eax, %edi
leaq 0x5aa52d(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %eax
sarl $0x2, %eax
movl %ecx, %esi
subl %eax, %esi
jmp 0xb9d1
leaq 0x5aa512(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %eax
sarl $0x2, %eax
movl %edx, %edi
subl %eax, %edi
jmp 0xb979
leaq 0x5aa4fe(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %eax
sarl $0x2, %eax
movl %edx, %edi
subl %eax, %edi
leaq 0x5aa4f0(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %esi
sarl $0x2, %esi
jmp 0xb9ab
leaq 0x5aa4dc(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %edi
sarl $0x2, %edi
sarl %edx
decl %edx
leaq 0x5aa4ce(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
sarl $0x2, %ecx
decl %ecx
xorl %esi, %esi
jmp 0xb9fb
leaq 0x5aa4b8(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %edi
sarl $0x2, %edi
leaq 0x5aa4ae(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %esi
sarl $0x2, %esi
sarl %edx
decl %edx
jmp 0xb9f7
leaq 0x5aa496(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
movl %edx, %edi
sarl $0x2, %edi
leaq 0x5aa48c(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %eax
sarl $0x2, %eax
movl %ecx, %esi
subl %eax, %esi
sarl %edx
decl %edx
jmp 0xb9f9
leaq 0x5aa470(%rip), %rax    # 0x5b5e4c
movl (%rax), %edi
movl %edi, %edx
sarl $0x2, %edx
notl %edx
addl %edi, %edx
sarl %edi
leaq 0x5aa460(%rip), %rax    # 0x5b5e50
movl (%rax), %ecx
movl %ecx, %esi
sarl $0x2, %esi
sarl %ecx
decl %ecx
callq 0x44922
leaq 0xd5ac9(%rip), %r10     # 0xe14d0
cmpl 0x48(%rsp), %ebx
jne 0xba33
leaq 0xd6d0c(%rip), %rax     # 0xe2720
movswl (%rax,%rbx,2), %r9d
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdx
movl 0x44(%rsp), %ecx
movq 0x60(%rsp), %r8
jmp 0xba67
movl (%r10,%rbx,4), %edi
movl (%r14,%rbx,4), %esi
leaq 0xd5b0e(%rip), %rax     # 0xe1550
movl (%rax,%rbx,4), %edx
leaq 0xd5a64(%rip), %rax     # 0xe14b0
movswl (%rax,%rbx,2), %ecx
leaq 0xd6e09(%rip), %rax     # 0xe2860
movl (%rax,%rbx,4), %r8d
leaq 0xd6cbe(%rip), %rax     # 0xe2720
movswl (%rax,%rbx,2), %r9d
movq %r14, %r12
movq %r10, %r14
callq 0x36ada
movl (%r14,%rbx,4), %edi
movl (%r12,%rbx,4), %esi
callq 0x1d30d
callq 0x3a5fa
leaq 0xd5a05(%rip), %rax     # 0xe1490
movzwl (%rax,%rbx,2), %edi
shrl $0xd, %edi
movswl %bx, %esi
callq 0x118b8
movq %r14, %r10
movq %r12, %r14
incl %ebp
leaq 0x797077(%rip), %rax    # 0x7a2b20
movl (%rax,%rbx,4), %eax
testl %eax, %eax
jns 0xb748
jmp 0xbb72
leaq 0x5aa38c(%rip), %rax    # 0x5b5e4c
movl (%rax), %edi
movl %edi, %edx
sarl $0x2, %edx
notl %edx
addl %edi, %edx
sarl %edi
leaq 0x5aa37c(%rip), %rax    # 0x5b5e50
movl (%rax), %esi
movl %esi, %ecx
sarl $0x2, %ecx
notl %ecx
addl %esi, %ecx
sarl %esi
jmp 0xb9fb
leaq 0x5aa363(%rip), %rax    # 0x5b5e50
movl (%rax), %esi
movl %esi, %ecx
sarl $0x2, %ecx
notl %ecx
addl %esi, %ecx
sarl %esi
leaq 0x5aa34b(%rip), %rax    # 0x5b5e4c
movl (%rax), %edx
sarl $0x2, %edx
decl %edx
jmp 0xb8c2
movq %r10, %rbx
callq 0x150c2
leaq 0xd6c04(%rip), %rax     # 0xe2720
movq 0x28(%rsp), %r15
movswl (%rax,%r15,2), %r9d
movswl %r13w, %ecx
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x60(%rsp), %r8
callq 0x36ada
movl (%rbx,%r15,4), %edi
movl (%r14,%r15,4), %esi
callq 0x1d30d
callq 0x3a5fa
movswl 0xd5902(%rip), %eax     # 0xe145e
movslq %eax, %rsi
leaq 0xd592a(%rip), %rax     # 0xe1490
movzwl (%rax,%rsi,2), %edi
shrl $0xd, %edi
callq 0x118b8
leaq 0xd6d47(%rip), %r12     # 0xe28c0
movq 0x28(%rsp), %rax
movb (%rax,%r12), %cl
cmpb $0x3, %cl
je 0xbc0f
movq 0x70(%rsp), %r15
movq 0x68(%rsp), %rax
subq %rax, %r15
imulq 0x58(%rsp), %r15
shrq $0x10, %r15
addl %eax, %r15d
movzwl %r13w, %esi
leal 0x200(%rsi), %eax
movl $0x7ff, %edi            # imm = 0x7FF
andl %edi, %eax
leaq 0x570ff3(%rip), %r8     # 0x57cbb0
movswl (%r8,%rax,2), %eax
shll $0x6, %eax
cltd
idivl %r15d
movl %eax, %ebp
addl 0x38(%rsp), %ebp
andl %edi, %esi
movswl (%r8,%rsi,2), %eax
shll $0x6, %eax
cltd
idivl %r15d
movl %eax, %ebx
addl 0x30(%rsp), %ebx
cmpb $0x2, %cl
jne 0xbbff
xorl %edi, %edi
callq 0x4c5d5
movswl %r13w, %ecx
movl %ebp, %edi
movl %ebx, %esi
movl %r15d, %edx
callq 0x3e449
movswl %r13w, %ecx
movl %ebp, %edi
movl %ebx, %esi
movl %r15d, %edx
callq 0x13700
cmpl $0x0, 0xd5856(%rip)     # 0xe146c
je 0xbca8
movslq 0xd5845(%rip), %rcx     # 0xe1468
testq %rcx, %rcx
js 0xc11b
leaq 0xd59bd(%rip), %rax     # 0xe15f0
leaq (%rcx,%rax), %rsi
incq %rsi
movabsq $0x666666666666667, %rdx # imm = 0x666666666666667
movq %rcx, %rax
mulq %rdx
leaq (%rdx,%rdx,4), %rax
leaq 0x28(,%rax,8), %rax
xorl %edx, %edx
leaq 0xd6ea1(%rip), %rdi     # 0xe2b00
movq 0x20(%rdx,%rdi), %r8
movq %r8, 0xd59a5(%rip)      # 0xe1610
movups (%rdx,%rdi), %xmm0
movups 0x10(%rdx,%rdi), %xmm1
movaps %xmm1, 0xd5985(%rip)    # 0xe1600
movaps %xmm0, 0xd596e(%rip)    # 0xe15f0
addq $0x28, %rdx
cmpq %rcx, %rdx
jbe 0xbc93
movw $0x5f, -0x1(%rsi)
jmp 0xbc9a
movb $0x0, 0xd597e(%rip)     # 0xe1618
addq $-0x28, %rsi
cmpq %rdx, %rax
jne 0xbc5f
jmp 0xc11b
leaq 0x796e55(%rip), %rax    # 0x7a2b04
movslq (%rax), %rax
cmpb $0x3, (%rax,%r12)
jne 0xc11b
movzwl 0xd6ede(%rip), %eax     # 0xe2ba2
movswl %ax, %r13d
movzwl 0xd6ed5(%rip), %eax     # 0xe2ba4
andl $0x20, %eax
movzwl 0xd578b(%rip), %ecx     # 0xe1464
andl $0x20, %ecx
cmpw %cx, %ax
seta %al
cmpw $0x41, %r13w
setge %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xbffc
leaq 0x5aa150(%rip), %r14    # 0x5b5e4c
movl (%r14), %ecx
movl %ecx, %eax
sarl %eax
movl %r13d, %edx
shrl %edx
subl %edx, %eax
leaq 0x50(%rsp), %rdi
movl %eax, (%rdi)
addl %r13d, %eax
decl %eax
leaq 0x4c(%rsp), %r8
movl %eax, (%r8)
leaq 0x5aa12b(%rip), %r15    # 0x5b5e50
movl (%r15), %eax
addl $-0x20, %eax
movl %eax, %r9d
sarl %r9d
imull %r13d, %eax
cltd
idivl %ecx
movl %eax, %ecx
sarl %ecx
subl %ecx, %r9d
leaq 0x10(%rsp), %rsi
movl %r9d, (%rsi)
addl %r9d, %eax
decl %eax
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
movq %r8, %rdx
callq 0x1b4ea
movswl 0xd6e40(%rip), %eax     # 0xe2ba2
movl %eax, %ecx
sarl $0x3, %ecx
subl %ecx, %eax
movw %ax, 0xd6e32(%rip)      # 0xe2ba2
movl (%r14), %eax
cmpl %r13d, %eax
jge 0xbec0
movw %ax, 0xd6e1f(%rip)      # 0xe2ba2
movl $0xfffffec0, %r12d      # imm = 0xFFFFFEC0
leal (%rax,%r12), %edi
sarl %edi
movl (%r15), %r10d
leal -0x20(%r10), %esi
decl %eax
decl %r10d
subq $0x8, %rsp
movl $0x19e, %edx            # imm = 0x19E
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %r10
pushq %rax
callq 0x9efc
addq $0x20, %rsp
addl (%r14), %r12d
sarl %r12d
cmpl $0x8, %r12d
jl 0xbe05
leal -0x8(%r12), %ebx
movl (%r15), %eax
leal -0x20(%rax), %esi
movl (%r14), %r10d
decl %r10d
decl %eax
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b7, %edx            # imm = 0x1B7
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %rax
pushq %r10
callq 0x9efc
addq $0x20, %rsp
cmpl $0xf, %r12d
movl %ebx, %r12d
jg 0xbdc6
jmp 0xbe08
movl %r12d, %ebx
cmpl $0x4, %ebx
jl 0xbe3f
addl $-0x4, %ebx
movl (%r15), %eax
leal -0x20(%rax), %esi
movl (%r14), %r10d
decl %r10d
decl %eax
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b9, %edx            # imm = 0x1B9
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %rax
pushq %r10
callq 0x9efc
addq $0x20, %rsp
movl (%r14), %eax
leal -0x140(%rax), %ebx
sarl %ebx
addl $0x140, %ebx            # imm = 0x140
leal -0x8(%rax), %ecx
cmpl %ecx, %ebx
jg 0xbe8c
movl (%r15), %r10d
leal -0x20(%r10), %esi
decl %eax
decl %r10d
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b7, %edx            # imm = 0x1B7
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %r10
pushq %rax
callq 0x9efc
addq $0x20, %rsp
addl $0x8, %ebx
movl (%r14), %eax
jmp 0xbe50
leal -0x4(%rax), %ecx
cmpl %ecx, %ebx
jg 0xbec0
movl (%r15), %r10d
leal -0x20(%r10), %esi
decl %eax
decl %r10d
subq $0x8, %rsp
movl %ebx, %edi
movl $0x1b9, %edx            # imm = 0x1B9
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x0
pushq %r10
pushq %rax
callq 0x9efc
addq $0x20, %rsp
movl (%r14), %ecx
movl %ecx, %eax
sarl %eax
movswl 0xd6cd4(%rip), %edx     # 0xe2ba2
movl %edx, %esi
sarl %esi
subl %esi, %eax
leaq 0x1c(%rsp), %rbx
movl %eax, (%rbx)
addl %edx, %eax
decl %eax
leaq 0x14(%rsp), %r14
movl %eax, (%r14)
movl (%r15), %eax
addl $-0x20, %eax
movl %eax, %esi
sarl %esi
imull %edx, %eax
cltd
idivl %ecx
movl %eax, %ecx
sarl %ecx
subl %ecx, %esi
leaq 0x18(%rsp), %r12
movl %esi, (%r12)
addl %esi, %eax
decl %eax
leaq 0x54(%rsp), %r15
movl %eax, (%r15)
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x1b4ea
movl (%r12), %esi
movb 0xd5525(%rip), %cl      # 0xe1452
sarl %cl, %esi
movl (%rbx), %edi
movl (%r14), %edx
movl (%r15), %eax
sarl %cl, %eax
movl %eax, %ecx
callq 0x44922
movl 0x50(%rsp), %r8d
movl 0x10(%rsp), %r9d
movl (%rbx), %eax
decl %eax
movl 0xc(%rsp), %r10d
subq $0x8, %rsp
xorl %ebp, %ebp
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
pushq %rbp
pushq %r10
pushq %rax
callq 0x9f3f
addq $0x20, %rsp
movl (%r14), %r8d
incl %r8d
movl 0x10(%rsp), %r9d
movl 0x4c(%rsp), %eax
movl 0xc(%rsp), %r10d
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
pushq %rbp
pushq %r10
pushq %rax
callq 0x9f3f
addq $0x20, %rsp
movl (%rbx), %r8d
movl 0x10(%rsp), %r9d
movl (%r14), %eax
movl (%r12), %r10d
decl %r10d
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
pushq %rbp
pushq %r10
pushq %rax
callq 0x9f3f
addq $0x20, %rsp
movl (%rbx), %r8d
movl (%r15), %r9d
incl %r9d
movl (%r14), %eax
movl 0xc(%rsp), %r10d
subq $0x8, %rsp
xorl %edi, %edi
xorl %esi, %esi
movl $0x196, %edx            # imm = 0x196
xorl %ecx, %ecx
pushq %rbp
pushq %r10
pushq %rax
callq 0x9f3f
addq $0x20, %rsp
movzwl 0xd6ba1(%rip), %eax     # 0xe2ba4
andl $0x10, %eax
movzwl 0xd5457(%rip), %ecx     # 0xe1464
andl $0x10, %ecx
cmpw %cx, %ax
jbe 0xc10d
movswl 0xd6b82(%rip), %eax     # 0xe2ba2
leaq 0x5a9e25(%rip), %rcx    # 0x5b5e4c
movl (%rcx), %ecx
cmpl %eax, %ecx
jl 0xc10d
movswl %ax, %edx
sarl $0x3, %edx
addl %eax, %edx
movw %dx, 0xd6b62(%rip)      # 0xe2ba2
movswl %dx, %eax
cmpl %eax, %ecx
setl %dl
cmpl %r13d, %ecx
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0xc07d
leal 0x1(%rcx), %eax
movw %ax, 0xd6b40(%rip)      # 0xe2ba2
xorl %eax, %eax
movl %eax, 0x1c(%rsp)
movl %eax, 0x18(%rsp)
decl %ecx
movl %ecx, 0x14(%rsp)
leaq 0x5a9dd7(%rip), %rax    # 0x5b5e50
movl (%rax), %esi
jmp 0xc0c7
cmpl %eax, %ecx
jge 0xc088
movw %cx, 0xd6b1a(%rip)      # 0xe2ba2
movl %ecx, %eax
sarl %eax
movswl 0xd6b0f(%rip), %edx     # 0xe2ba2
movl %edx, %esi
sarl %esi
subl %esi, %eax
movl %eax, 0x1c(%rsp)
addl %edx, %eax
decl %eax
movl %eax, 0x14(%rsp)
leaq 0x5a9da4(%rip), %rax    # 0x5b5e50
movl (%rax), %eax
addl $-0x20, %eax
movl %eax, %esi
sarl %esi
imull %edx, %eax
cltd
idivl %ecx
movl %eax, %ecx
sarl %ecx
subl %ecx, %esi
movl %esi, 0x18(%rsp)
addl %eax, %esi
decl %esi
leaq 0x54(%rsp), %rbx
movl %esi, (%rbx)
leaq 0x1c(%rsp), %r14
leaq 0x18(%rsp), %r15
leaq 0x14(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1b4ea
movl (%r15), %esi
movb 0xd5359(%rip), %cl      # 0xe1452
sarl %cl, %esi
movl (%r14), %edi
movl (%r12), %edx
movl (%rbx), %eax
sarl %cl, %eax
movl %eax, %ecx
callq 0x44922
movzwl 0xd6a90(%rip), %eax     # 0xe2ba4
movw %ax, 0xd5349(%rip)      # 0xe1464
cmpb $0x0, 0xd6a84(%rip)     # 0xe2ba6
jle 0xc1f9
movsbl 0xd6a77(%rip), %eax     # 0xe2ba6
testl %eax, %eax
js 0xc1e1
leaq 0xd54b2(%rip), %rbx     # 0xe15f0
xorl %r14d, %r14d
leaq 0xd6a68(%rip), %r15     # 0xe2bb0
movq %rbx, %r12
xorl %r13d, %r13d
movq 0x20(%r13,%r15), %rcx
movq %rcx, 0xd54b6(%rip)     # 0xe1610
movups (%r13,%r15), %xmm0
movups 0x10(%r13,%r15), %xmm1
movaps %xmm1, 0xd5493(%rip)    # 0xe1600
movaps %xmm0, 0xd547c(%rip)    # 0xe15f0
leal 0x28(%r13), %ecx
cmpl %eax, %ecx
jle 0xc186
movslq %eax, %rcx
movb $0x0, (%r12,%rcx)
jmp 0xc18d
movb $0x0, 0xd548b(%rip)     # 0xe1618
decl %eax
cltq
imulq $-0x66666667, %rax, %rax # imm = 0x99999999
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x24, %rax
addl %ecx, %eax
addl %r14d, %eax
leal 0xa0(,%rax,8), %esi
xorl %edi, %edi
movl $0x97, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq %rbx, %r8
xorl %r9d, %r9d
callq 0x4d7cf
movsbl 0xd69d9(%rip), %eax     # 0xe2ba6
addq $0x28, %r13
addq $-0x28, %r12
incl %r14d
cmpl %eax, %r13d
jle 0xc14e
leaq 0x54e160(%rip), %rax    # 0x55a348
movl (%rax), %eax
cmpl 0xd6a64(%rip), %eax     # 0xe2c54
jle 0xc1f9
movb $0x0, 0xd69ad(%rip)     # 0xe2ba6
leaq 0x79690c(%rip), %rax    # 0x7a2b0c
cmpl $0x2, (%rax)
jl 0xc22a
movswl 0xd5252(%rip), %eax     # 0xe145e
leaq 0x7968f1(%rip), %rcx    # 0x7a2b04
cmpl %eax, (%rcx)
je 0xc22a
movw $0x72, 0xd53d4(%rip)    # 0xe15f4
movl $0x6568744f, 0xd53c6(%rip) # imm = 0x6568744F
callq 0x15db2
callq 0x44e75
leaq 0x1202bd(%rip), %rax    # 0x12c4f8
movsbl (%rax), %edx
testl %edx, %edx
je 0xc24e
xorl %edi, %edi
movl $0xff, %esi
callq 0x14594
leaq 0x31feab(%rip), %rax    # 0x32c100
cmpb $0x0, 0x58(%rax)
jle 0xc274
movb $0x0, 0x58(%rax)
movb 0x36(%rax), %cl
orb 0x2a(%rax), %cl
movsbl %cl, %esi
leaq 0x800a1(%rip), %rdi     # 0x8c310
callq 0x45ac4
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq