// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekgun.c
// Function: shootgun
void
shootgun(short snum,int x,int y,int z,short daang,int dahoriz,
     short dasectnum,char guntype)
{
     short hitsect,hitwall,hitsprite,daang2;
     short bloodhitsect,bloodhitwall,bloodhitsprite;
     int  bloodhitx,bloodhity,bloodhitz;
     int  cx,cy,i,j,daz2,hitx,hity,hitz,xydist,zdist;
     int   rv,pnum;

     if( health[snum] <= 0 ) {
          return;
     }

     guntype+=1;
     switch (guntype) {
     case GUN1FLAG:
          cx=x+(sintable[(daang+2560+128)&2047]>>6);
          cy=y+(sintable[(daang+2048+128)&2047]>>6);
          j=jsinsertsprite(dasectnum, FORCEPROJECTILESTAT);
          if( j != -1 ) {
               fillsprite(j,cx,cy,z,128+2,-16,0,12,16,16,0,0,FORCEBALLPIC,daang,
                          sintable[(daang+2560-11)&2047]>>5, // -17 = travel 3 degrees left
                          sintable[(daang+2048-11)&2047]>>5, // -17 = travel 3 degrees left
                          100-dahoriz,snum+MAXSPRITES,dasectnum,FORCEPROJECTILESTAT,0,0,-1);
          }
          break;
     case GUN2FLAG:
          ammo2[snum]--;
          if( ammo2[snum] < 0 ) {
               ammo2[snum]=0;
               break;
          }
          daang2=daang;
          daz2=(100-dahoriz)*2000;
          hitscan(x,y,z,dasectnum,sintable[(daang2+2560)&2047],
                  sintable[(daang2+2048)&2047],daz2,
                  &hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
          if( (hitsprite >= 0) && (sprptr[hitsprite]->statnum < MAXSTATUS)) {
               if( playerhit(hitsprite, &pnum) ) {
                    playerpainsound(pnum);
                    playerwoundplayer(pnum,snum,2);
               }
               else {
                    switch( sprptr[hitsprite]->picnum ) {
                    default:
                         rv=damagesprite(hitsprite,tekgundamage(guntype,x,y,z,hitsprite));
                         if( (rv == 1) && (goreflag) ) {
                              if( spewblood(hitsprite, hitz, daang) != 0 ) {
                                   sprptr[hitsprite]->cstat&=0xFEFE;  // non hitscan and non block
                                   // must preserve values from previous hitscan call,
                                   // thus the bloodxhitx, bloodwall, etc...
                                   hitscan(x,y,z,dasectnum,sintable[(daang2+2560)&2047],
                                           sintable[(daang2+2048)&2047],daz2,
                                           &bloodhitsect,&bloodhitwall,&bloodhitsprite,&bloodhitx,&bloodhity,&bloodhitz,CLIPMASK1);
                                   if( bloodhitwall != -1 ) {
                                        bloodonwall(bloodhitwall,sprptr[hitsprite]->x,sprptr[hitsprite]->y,sprptr[hitsprite]->z,
                                                    sprptr[hitsprite]->sectnum,daang2,bloodhitx,bloodhity,bloodhitz);
                                   }
                              }
                         }
                         if( rv == 1 ) {
                              killscore(hitsprite,snum,guntype);
                         }
                    break;
               }
               }
          }
          if( hitwall >= 0 ) {
               j=jsinsertsprite(hitsect, 3);
               if( j != -1 ) {
                    fillsprite(j,hitx,hity,hitz+(8<<8),2,0,0,32,22,22,0,0,
                               EXPLOSION,daang,0,0,0,snum+MAXSPRITES,hitsect,3,63,0,-1);
                    movesprite((short)j,
                               -(((int)sintable[(512+daang)&2047]*TICSPERFRAME)<<4),
                               -(((int)sintable[daang]*TICSPERFRAME)<<4),0L,4L<<8,4L<<8,1);
                    playsound(S_RIC1,hitx,hity,0,ST_NOUPDATE);
               }
          }
          break;
     case GUN3FLAG:
          ammo3[snum]--;
          if( ammo3[snum] < 0 ) {
               ammo3[snum]=0;
               break;
          }
          cx=x+(sintable[(daang+2560+256)&2047]>>6);
          cy=y+(sintable[(daang+2048+256)&2047]>>6);
          if( invaccutrak[snum] > 0 ) {
               j=jsinsertsprite(dasectnum, BOMBPROJECTILESTAT);
               if( j != -1 ) {
                    fillsprite(j,cx,cy,z+(4<<8),128,-16,0,32,16,16,0,0,BOMBPIC,daang,
                         sintable[(daang+2560-11)&2047]>>5, // -17 = travel 3 degrees left
                         sintable[(daang+2048-11)&2047]>>5, // -17 = travel 3 degrees left
                         100-dahoriz,snum,dasectnum,BOMBPROJECTILESTAT,0,0,-1);
                    sprptr[j]->owner=snum;
               }
          }
          else {
               j=jsinsertsprite(dasectnum, BOMBPROJECTILESTAT2);
               if( j != -1 ) {
                    fillsprite(j,cx,cy,z+(4<<8),128,-16,0,32,16,16,0,0,BOMBPIC,daang,
                         sintable[(daang+2560-11)&2047]>>5, // -17 = travel 3 degrees left
                         sintable[(daang+2048-11)&2047]>>5, // -17 = travel 3 degrees left
                         100-dahoriz,snum,dasectnum,BOMBPROJECTILESTAT2,0,0,-1);
                    sprptr[j]->owner=snum;
               }
          }
          break;
     case GUN4FLAG:
          ammo4[snum]--;
          if( ammo4[snum] < 0 ) {
               ammo4[snum]=0;
               break;
          }
          cx=x+(sintable[(daang+2560+128)&2047]>>6);
          cy=y+(sintable[(daang+2048+128)&2047]>>6);
          j=jsinsertsprite(dasectnum, DARTPROJECTILESTAT);
          if( j != -1 ) {
               fillsprite(j,cx,cy,z+(5<<8),128,-35,0,12,16,16,0,0, 338 ,daang,
                    sintable[(daang+2560-6)&2047]>>5, // -17 = travel 3 degrees left
                    sintable[(daang+2048-6)&2047]>>5, // -17 = travel 3 degrees left
                    100-dahoriz,snum,dasectnum,DARTPROJECTILESTAT,0,0,-1);
               sprptr[j]->owner=snum;
               playsound(S_RIC1,cx,cy,0,ST_NOUPDATE);

          }
          break;
     case GUN5FLAG:
          daang2=daang;
          daz2=(100-dahoriz)*2000;
          hitscan(x,y,z,dasectnum,sintable[(daang2+2560)&2047],
                  sintable[(daang2+2048)&2047],daz2,
                  &hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
          if( (hitsprite >= 0) && (sprptr[hitsprite]->statnum < MAXSTATUS)) {
               xydist=klabs(posx[snum]-sprptr[hitsprite]->x)+klabs(posy[snum]-sprptr[hitsprite]->y);
               zdist=klabs( (posz[snum]>>8)-((sprptr[hitsprite]->z>>8)-(tilesizy[sprptr[hitsprite]->picnum]>>1)) );
               if( (xydist > 768) || (zdist > 50) ) {
                    break;
               }
               if( playerhit(hitsprite, &pnum) ) {
                    playerpainsound(pnum);
                    playerwoundplayer(pnum,snum,5);
               }
               else {
                    rv=damagesprite(hitsprite,tekgundamage(guntype,x,y,z,hitsprite));
                    if( rv == 1 ) {
                         killscore(hitsprite, snum, guntype);
                    }
               }
          }
          break;
     case GUN6FLAG:
          ammo6[snum]--;
          if( ammo6[snum] < 0 ) {
               ammo6[snum]=0;
               break;
          }
          daang2=daang;
          daz2=(100-dahoriz)*2000;
          hitscan(x,y,z,dasectnum,sintable[(daang2+2560)&2047],
                  sintable[(daang2+2048)&2047],daz2,
                  &hitsect,&hitwall,&hitsprite,&hitx,&hity,&hitz,CLIPMASK1);
          if( (hitsprite >= 0) && (sprptr[hitsprite]->statnum < MAXSTATUS)) {
               xydist=klabs(posx[snum]-sprptr[hitsprite]->x)+klabs(posy[snum]-sprptr[hitsprite]->y);
               zdist=klabs( (posz[snum]>>8)-((sprptr[hitsprite]->z>>8)-(tilesizy[sprptr[hitsprite]->picnum]>>1)) );
               if( (xydist > 2560) || (zdist > 576) ) {
                    break;
               }
               if( playerhit(hitsprite, &pnum) ) {
                    if( playervirus(pnum, FIREPIC) ) {
                         playerwoundplayer(pnum,snum,6);
                    }
               }
               else {
                    attachvirus(hitsprite, FIREPIC);
               }
          }
          break;
     case GUN7FLAG:
          ammo7[snum]--;
          if( ammo7[snum] < 0 ) {
               ammo7[snum]=0;
               break;
          }
          for (i=0 ; i < 3 ; i++) {
               cx=x+(sintable[(daang+2560+256)&2047]>>6);
               cy=y+(sintable[(daang+2048+256)&2047]>>6);
               j=jsinsertsprite(dasectnum,ROCKETPROJECTILESTAT);
               if (j != -1) {
                    fillsprite(j,cx,cy,z+(4<<8),128,-24,0,12,16,16,0,0,335,daang,
                         sintable[(daang+2560-11)&2047]>>(2+i),
                         sintable[(daang+2048-11)&2047]>>(2+i),
                         (100-dahoriz)-(i<<2),
                         snum,dasectnum,ROCKETPROJECTILESTAT,0,0,-1);
               sprptr[j]->owner=snum;
               }
          }
          break;
     case GUN8FLAG:
          ammo8[snum]--;
          if( ammo8[snum] < 0 ) {
               ammo8[snum]=0;
               break;
          }
          cx=x+(sintable[(daang+2560)&2047]>>6);
          cy=y+(sintable[(daang+2048)&2047]>>6);
          j=jsinsertsprite(dasectnum, MATRIXPROJECTILESTAT);
          if( j != -1 ) {
               fillsprite(j,cx,cy,z+(5<<8),128,-35,0,12,16,16,0,0,3765,daang,
                    sintable[(daang+2560)&2047]>>5,
                    sintable[(daang+2048)&2047]>>5,
                    100-dahoriz,snum,dasectnum,MATRIXPROJECTILESTAT,0,0,-1);
               sprptr[j]->owner=snum;
          }
          break;
     default:
          break;
    }

    if( guntype != GUN1FLAG )
          playergunshot(snum);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movl %edx, 0x18(%rsp)
movl %esi, 0x1c(%rsp)
movq %rdi, 0x28(%rsp)
movslq %edi, %rbp
leaq 0xd4f62(%rip), %rax     # 0xe4590
cmpl $0x0, (%rax,%rbp,4)
jle 0x102f7
movb 0xb8(%rsp), %al
movsbl %al, %ecx
cmpl $0x7, %ecx
ja 0x102ed
movl %r9d, %r13d
movzwl 0xb0(%rsp), %eax
leal 0x1(%rcx), %esi
leaq 0x7fd34(%rip), %rdx     # 0x8f394
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movzwl 0x10(%rsp), %ebx
leal 0x280(%rbx), %ecx
movl $0x7ff, %ebp            # imm = 0x7FF
andl %ebp, %ecx
leaq 0x57054e(%rip), %r14    # 0x57fbd0
movzwl (%r14,%rcx,2), %r15d
leal 0x80(%rbx), %ecx
andl %ebp, %ecx
movzwl (%r14,%rcx,2), %r12d
movswl %ax, %edi
movl $0x2c6, %esi            # imm = 0x2C6
callq 0x1eac8
cmpw $-0x1, %ax
je 0x102f7
movswl %r12w, %esi
sarl $0x6, %esi
addl 0x18(%rsp), %esi
movswl %r15w, %r8d
sarl $0x6, %r8d
addl 0x1c(%rsp), %r8d
movswq %ax, %rdx
imulq $0x2c, %rdx, %rax
leaq 0x41e45e(%rip), %rcx    # 0x42db30
leaq (%rcx,%rax), %rdi
movl %r8d, (%rcx,%rax)
movl %esi, 0x4(%rcx,%rax)
movl 0x14(%rsp), %esi
movl %esi, 0x8(%rcx,%rax)
movl $0x5340082, 0xc(%rcx,%rax) # imm = 0x5340082
movw $0xf0, 0x10(%rcx,%rax)
movb $0xc, 0x12(%rcx,%rax)
movl $0x1010, 0x14(%rcx,%rax) # imm = 0x1010
movl 0x10(%rsp), %esi
movw %si, 0x1c(%rcx,%rax)
leal 0x1f5(%rbx), %esi
andl %ebp, %esi
movswl (%r14,%rsi,2), %esi
shrl $0x5, %esi
movw %si, 0x20(%rcx,%rax)
addl $0x7f5, %ebx            # imm = 0x7F5
andl %ebp, %ebx
movswl (%r14,%rbx,2), %esi
shrl $0x5, %esi
movw %si, 0x22(%rcx,%rax)
movl $0x64, %esi
subl %r13d, %esi
movw %si, 0x24(%rcx,%rax)
movq 0x28(%rsp), %rsi
addl $0x4000, %esi           # imm = 0x4000
movw %si, 0x1e(%rcx,%rax)
movl $0x0, 0x26(%rcx,%rax)
leaq (%rdx,%rdx,2), %rsi
shlq $0x2, %rsi
addq 0xc1847(%rip), %rsi     # 0xd0fb0
movw $0xffff, 0x2a(%rcx,%rax) # imm = 0xFFFF
movl $0x3, %edx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6110e
movl %esi, 0x40(%rsp)
movl $0x64, %ecx
subl %r13d, %ecx
imull $0x7d0, %ecx, %r10d     # imm = 0x7D0
movzwl 0x10(%rsp), %ecx
leal 0x200(%rcx), %edx
movl $0x7ff, %esi            # imm = 0x7FF
andl %esi, %edx
leaq 0x57041c(%rip), %rdi    # 0x57fbd0
movswl (%rdi,%rdx,2), %r8d
andl %esi, %ecx
movswl (%rdi,%rcx,2), %r9d
leaq 0x30(%rsp), %r11
leaq 0x34(%rsp), %rbx
leaq 0x38(%rsp), %r14
leaq 0xe(%rsp), %r15
leaq 0x24(%rsp), %r12
leaq 0x26(%rsp), %r13
movswl %ax, %ecx
movl 0x1c(%rsp), %edi
movl 0x18(%rsp), %esi
movl 0x14(%rsp), %edx
pushq $0x1000040              # imm = 0x1000040
pushq %r11
pushq %rbx
pushq %r14
pushq %r15
pushq %r12
pushq %r13
pushq %r10
callq 0x49337
addq $0x40, %rsp
movswq (%r15), %rdi
testq %rdi, %rdi
js 0x102ed
leaq 0x121a14(%rip), %rax    # 0x131230
movq (%rax,%rdi,8), %rax
cmpw $0x3ff, 0x1a(%rax)      # imm = 0x3FF
jg 0x102ed
leaq 0xd4c9d(%rip), %rcx     # 0xe44d0
movl (%rcx,%rbp,4), %ecx
subl (%rax), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
leaq 0xd4cca(%rip), %rcx     # 0xe4510
movl (%rcx,%rbp,4), %ecx
subl 0x4(%rax), %ecx
movl %ecx, %esi
negl %esi
cmovsl %ecx, %esi
addl %edx, %esi
leaq 0xd4cf4(%rip), %rcx     # 0xe4550
movl (%rcx,%rbp,4), %ecx
sarl $0x8, %ecx
movl 0x8(%rax), %edx
sarl $0x8, %edx
subl %edx, %ecx
movswq 0xe(%rax), %rax
leaq 0x5a2dea(%rip), %rdx    # 0x5b2660
movswl (%rdx,%rax,2), %edx
sarl %edx
addl %ecx, %edx
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
cmpl $0x300, %esi            # imm = 0x300
ja 0x102ed
cmpl $0x32, %eax
ja 0x102ed
leaq 0x20(%rsp), %rsi
callq 0x22de9
testl %eax, %eax
je 0x10174
movl 0x20(%rsp), %edi
callq 0xf582
movswl 0x20(%rsp), %edi
movswl 0x28(%rsp), %esi
movl $0x5, %edx
jmp 0xfddf
leaq 0x11f950(%rip), %rcx    # 0x12f220
decw (%rcx,%rbp,2)
js 0xff72
movzwl 0x10(%rsp), %ebx
leal 0x300(%rbx), %ecx
movl $0x7ff, %edx            # imm = 0x7FF
andl %edx, %ecx
leaq 0x5702dd(%rip), %r15    # 0x57fbd0
movswl (%r15,%rcx,2), %r12d
sarl $0x6, %r12d
addl 0x1c(%rsp), %r12d
leal 0x100(%rbx), %ecx
andl %edx, %ecx
movswl (%r15,%rcx,2), %r14d
sarl $0x6, %r14d
addl 0x18(%rsp), %r14d
leaq 0x1214f2(%rip), %rcx    # 0x130e10
cmpl $0x0, (%rcx,%rbp,4)
jle 0xff7d
movswl %ax, %edi
movl $0x2ca, %esi            # imm = 0x2CA
jmp 0xff85
leaq 0x11f904(%rip), %rcx    # 0x12f240
decw (%rcx,%rbp,2)
js 0xff72
movzwl 0x10(%rsp), %ebx
leal 0x280(%rbx), %ecx
movl $0x7ff, %edx            # imm = 0x7FF
andl %edx, %ecx
leaq 0x570271(%rip), %r15    # 0x57fbd0
movzwl (%r15,%rcx,2), %r14d
leal 0x80(%rbx), %ecx
andl %edx, %ecx
movzwl (%r15,%rcx,2), %ebp
movswl %ax, %edi
movl $0x2c8, %esi            # imm = 0x2C8
callq 0x1eac8
cmpw $-0x1, %ax
je 0x102ed
movswl %bp, %ebp
sarl $0x6, %ebp
addl 0x18(%rsp), %ebp
movl $0x7ff, %esi            # imm = 0x7FF
movswl %r14w, %r12d
sarl $0x6, %r12d
addl 0x1c(%rsp), %r12d
movswq %ax, %r14
imulq $0x2c, %r14, %rax
leaq 0x41e17d(%rip), %rcx    # 0x42db30
leaq (%rcx,%rax), %rdi
movl %r12d, (%rcx,%rax)
movl %ebp, 0x4(%rcx,%rax)
movl 0x14(%rsp), %edx
addl $0x500, %edx            # imm = 0x500
movl %edx, 0x8(%rcx,%rax)
movl $0x1520080, 0xc(%rcx,%rax) # imm = 0x1520080
movw $0xdd, 0x10(%rcx,%rax)
movb $0xc, 0x12(%rcx,%rax)
movl $0x1010, 0x14(%rcx,%rax) # imm = 0x1010
movl 0x10(%rsp), %edx
movw %dx, 0x1c(%rcx,%rax)
leal 0x1fa(%rbx), %edx
andl %esi, %edx
movswl (%r15,%rdx,2), %edx
shrl $0x5, %edx
movw %dx, 0x20(%rcx,%rax)
addl $0x7fa, %ebx            # imm = 0x7FA
andl %esi, %ebx
movswl (%r15,%rbx,2), %edx
shrl $0x5, %edx
movw %dx, 0x22(%rcx,%rax)
movl $0x64, %edx
subl %r13d, %edx
movw %dx, 0x24(%rcx,%rax)
movq 0x28(%rsp), %rbx
movw %bx, 0x1e(%rcx,%rax)
movl $0x0, 0x26(%rcx,%rax)
movw $0xffff, 0x2a(%rcx,%rax) # imm = 0xFFFF
leaq (%r14,%r14,2), %rsi
shlq $0x2, %rsi
addq 0xc155f(%rip), %rsi     # 0xd0fb0
movl $0x3, %edx
callq 0x6110e
leaq 0x1217ce(%rip), %rax    # 0x131230
movq (%rax,%r14,8), %rax
movw %bx, 0x1e(%rax)
movl $0x55, %edi
movl %r12d, %esi
movl %ebp, %edx
jmp 0x102e0
leaq 0x11f840(%rip), %rcx    # 0x12f2c0
decw (%rcx,%rbp,2)
js 0xff72
movzwl 0x10(%rsp), %ebx
leal 0x200(%rbx), %r14d
movl $0x7ff, %ecx            # imm = 0x7FF
andl %ecx, %r14d
leaq 0x57012b(%rip), %r15    # 0x57fbd0
movzwl (%r15,%r14,2), %ebp
andl %ecx, %ebx
movzwl (%r15,%rbx,2), %r12d
movswl %ax, %edi
movl $0x2d0, %esi            # imm = 0x2D0
callq 0x1eac8
cmpw $-0x1, %ax
je 0x102ed
movswl %r12w, %ecx
sarl $0x6, %ecx
addl 0x18(%rsp), %ecx
movswl %bp, %edx
sarl $0x6, %edx
addl 0x1c(%rsp), %edx
movswq %ax, %r12
imulq $0x2c, %r12, %rax
leaq 0x41e044(%rip), %rsi    # 0x42db30
leaq (%rsi,%rax), %rdi
movl %edx, (%rsi,%rax)
movl %ecx, 0x4(%rsi,%rax)
movl 0x14(%rsp), %ecx
addl $0x500, %ecx            # imm = 0x500
movl %ecx, 0x8(%rsi,%rax)
movl $0xeb50080, 0xc(%rsi,%rax) # imm = 0xEB50080
movw $0xdd, 0x10(%rsi,%rax)
movb $0xc, 0x12(%rsi,%rax)
movl $0x1010, 0x14(%rsi,%rax) # imm = 0x1010
movl 0x10(%rsp), %ecx
movw %cx, 0x1c(%rsi,%rax)
movswl (%r15,%r14,2), %ecx
shrl $0x5, %ecx
movw %cx, 0x20(%rsi,%rax)
movswl (%r15,%rbx,2), %ecx
shrl $0x5, %ecx
movw %cx, 0x22(%rsi,%rax)
movl $0x64, %ecx
subl %r13d, %ecx
movw %cx, 0x24(%rsi,%rax)
movq 0x28(%rsp), %rbx
movw %bx, 0x1e(%rsi,%rax)
movl $0x0, 0x26(%rsi,%rax)
movw $0xffff, 0x2a(%rsi,%rax) # imm = 0xFFFF
leaq (%r12,%r12,2), %rsi
shlq $0x2, %rsi
addq 0xc1437(%rip), %rsi     # 0xd0fb0
movl $0x3, %edx
callq 0x6110e
leaq 0x1216a6(%rip), %rax    # 0x131230
movq (%rax,%r12,8), %rax
jmp 0x1005f
leaq 0x11f666(%rip), %rcx    # 0x12f200
decw (%rcx,%rbp,2)
js 0xff72
movl %esi, 0x40(%rsp)
movl $0x64, %ecx
subl %r13d, %ecx
imull $0x7d0, %ecx, %ebp      # imm = 0x7D0
movzwl 0x10(%rsp), %ebx
leal 0x200(%rbx), %esi
movl $0x7ff, %ecx            # imm = 0x7FF
andl %ecx, %esi
leaq 0x570001(%rip), %rdx    # 0x57fbd0
movq %rsi, 0x48(%rsp)
movswl (%rdx,%rsi,2), %r8d
andl %ecx, %ebx
movswl (%rdx,%rbx,2), %r9d
leaq 0x30(%rsp), %r10
leaq 0x34(%rsp), %r11
leaq 0x38(%rsp), %r14
leaq 0xe(%rsp), %r15
leaq 0x24(%rsp), %r12
leaq 0x26(%rsp), %r13
movswl %ax, %ecx
movl 0x1c(%rsp), %edi
movl 0x18(%rsp), %esi
movl 0x14(%rsp), %edx
movl %ecx, 0x3c(%rsp)
pushq $0x1000040              # imm = 0x1000040
pushq %r10
pushq %r11
pushq %r14
pushq %r15
pushq %r12
pushq %r13
pushq %rbp
callq 0x49337
addq $0x40, %rsp
movswl (%r15), %edi
testl %edi, %edi
js 0x101d0
movzwl %di, %eax
leaq 0x1215ee(%rip), %r14    # 0x131230
movq (%r14,%rax,8), %rax
cmpw $0x3ff, 0x1a(%rax)      # imm = 0x3FF
jg 0x101d0
leaq 0x20(%rsp), %rsi
callq 0x22de9
testl %eax, %eax
je 0x10068
movl 0x20(%rsp), %edi
callq 0xf582
movswl 0x20(%rsp), %edi
movswl 0x28(%rsp), %esi
movl $0x2, %edx
callq 0xf3d7
jmp 0x101d0
leaq 0x11f5f3(%rip), %rcx    # 0x12f280
decw (%rcx,%rbp,2)
js 0xff72
movl $0x64, %ecx
subl %r13d, %ecx
imull $0x7d0, %ecx, %r10d     # imm = 0x7D0
movzwl 0x10(%rsp), %ecx
leal 0x200(%rcx), %edx
movl $0x7ff, %esi            # imm = 0x7FF
andl %esi, %edx
leaq 0x56ff11(%rip), %rdi    # 0x57fbd0
movswl (%rdi,%rdx,2), %r8d
andl %esi, %ecx
movswl (%rdi,%rcx,2), %r9d
leaq 0x30(%rsp), %r11
leaq 0x34(%rsp), %rbx
leaq 0x38(%rsp), %r14
leaq 0xe(%rsp), %r15
leaq 0x24(%rsp), %r12
leaq 0x26(%rsp), %r13
movswl %ax, %ecx
movl 0x1c(%rsp), %edi
movl 0x18(%rsp), %esi
movl 0x14(%rsp), %edx
pushq $0x1000040              # imm = 0x1000040
pushq %r11
pushq %rbx
pushq %r14
pushq %r15
pushq %r12
pushq %r13
pushq %r10
callq 0x49337
addq $0x40, %rsp
movswq (%r15), %rdi
testq %rdi, %rdi
js 0x102ed
leaq 0x121509(%rip), %rax    # 0x131230
movq (%rax,%rdi,8), %rax
cmpw $0x3ff, 0x1a(%rax)      # imm = 0x3FF
jg 0x102ed
leaq 0xd4792(%rip), %rcx     # 0xe44d0
movl (%rcx,%rbp,4), %ecx
subl (%rax), %ecx
movl %ecx, %edx
negl %edx
cmovsl %ecx, %edx
leaq 0xd47bf(%rip), %rcx     # 0xe4510
movl (%rcx,%rbp,4), %ecx
subl 0x4(%rax), %ecx
movl %ecx, %esi
negl %esi
cmovsl %ecx, %esi
addl %edx, %esi
leaq 0xd47e9(%rip), %rcx     # 0xe4550
movl (%rcx,%rbp,4), %ecx
sarl $0x8, %ecx
movl 0x8(%rax), %edx
sarl $0x8, %edx
subl %edx, %ecx
movswq 0xe(%rax), %rax
leaq 0x5a28df(%rip), %rdx    # 0x5b2660
movswl (%rdx,%rax,2), %edx
sarl %edx
addl %ecx, %edx
movl %edx, %eax
negl %eax
cmovsl %edx, %eax
cmpl $0xa00, %esi            # imm = 0xA00
ja 0x102ed
cmpl $0x240, %eax            # imm = 0x240
ja 0x102ed
leaq 0x20(%rsp), %rsi
callq 0x22de9
testl %eax, %eax
je 0x10306
movswl 0x20(%rsp), %edi
movl $0x1c2, %esi            # imm = 0x1C2
callq 0x20f1a
testl %eax, %eax
je 0x102ed
movswl 0x20(%rsp), %edi
movswl 0x28(%rsp), %esi
movl $0x6, %edx
callq 0xf3d7
jmp 0x102ed
leaq 0x11f4b0(%rip), %rcx    # 0x12f2a0
decw (%rcx,%rbp,2)
js 0xff72
movzwl 0x10(%rsp), %edx
leal 0x300(%rdx), %esi
movl $0x7ff, %ecx            # imm = 0x7FF
andl %ecx, %esi
movq %rsi, 0x40(%rsp)
leal 0x100(%rdx), %esi
andl %ecx, %esi
movq %rsi, 0x48(%rsp)
addl $0x400, 0x14(%rsp)      # imm = 0x400
leal 0x1f5(%rdx), %esi
andl %ecx, %esi
movq %rsi, 0x68(%rsp)
addl $0x7f5, %edx            # imm = 0x7F5
andl %ecx, %edx
movq %rdx, 0x70(%rsp)
movl $0x64, %r12d
subl %r13d, %r12d
movl $0x2, %r13d
leaq 0x56fd7a(%rip), %rbx    # 0x57fbd0
cwtl
movl %eax, 0x3c(%rsp)
leaq 0x41dcce(%rip), %r14    # 0x42db30
movq 0x40(%rsp), %rax
movzwl (%rbx,%rax,2), %r15d
movq 0x48(%rsp), %rax
movzwl (%rbx,%rax,2), %ebp
movl 0x3c(%rsp), %edi
movl $0x2ce, %esi            # imm = 0x2CE
callq 0x1eac8
cmpw $-0x1, %ax
je 0xff5c
movswl %r15w, %ecx
sarl $0x6, %ecx
addl 0x1c(%rsp), %ecx
movswq %ax, %r15
imulq $0x2c, %r15, %rax
movl %ecx, (%r14,%rax)
movswl %bp, %ecx
sarl $0x6, %ecx
addl 0x18(%rsp), %ecx
movl %ecx, 0x4(%r14,%rax)
movl 0x14(%rsp), %ecx
movl %ecx, 0x8(%r14,%rax)
movl $0x14f0080, 0xc(%r14,%rax) # imm = 0x14F0080
movw $0xe8, 0x10(%r14,%rax)
movb $0xc, 0x12(%r14,%rax)
movl $0x1010, 0x14(%r14,%rax) # imm = 0x1010
movq 0x68(%rsp), %rcx
movswl (%rbx,%rcx,2), %edx
movl %r13d, %ecx
sarl %cl, %edx
movl 0x10(%rsp), %ecx
movw %cx, 0x1c(%r14,%rax)
movw %dx, 0x20(%r14,%rax)
movq 0x70(%rsp), %rcx
movswl (%rbx,%rcx,2), %edx
movl %r13d, %ecx
sarl %cl, %edx
movw %dx, 0x22(%r14,%rax)
leaq (%r14,%rax), %rdi
movw %r12w, 0x24(%r14,%rax)
movq 0x28(%rsp), %rbp
movw %bp, 0x1e(%r14,%rax)
movl $0x0, 0x26(%r14,%rax)
movw $0xffff, 0x2a(%r14,%rax) # imm = 0xFFFF
leaq (%r15,%r15,2), %rsi
shlq $0x2, %rsi
addq 0xc106d(%rip), %rsi     # 0xd0fb0
movl $0x3, %edx
callq 0x6110e
leaq 0x1212dc(%rip), %rax    # 0x131230
movq (%rax,%r15,8), %rax
movw %bp, 0x1e(%rax)
addl $-0x4, %r12d
incl %r13d
cmpl $0x5, %r13d
jne 0xfe62
jmp 0x102ed
movw $0x0, (%rcx,%rbp,2)
jmp 0x102ed
movswl %ax, %edi
movl $0x2cc, %esi            # imm = 0x2CC
callq 0x1eac8
cmpw $-0x1, %ax
je 0x102ed
movq %r15, %r8
movswq %ax, %r15
imulq $0x2c, %r15, %rax
leaq 0x41db8a(%rip), %rcx    # 0x42db30
leaq (%rcx,%rax), %rdi
movl %r12d, (%rcx,%rax)
movl %r14d, 0x4(%rcx,%rax)
movl 0x14(%rsp), %edx
addl $0x400, %edx            # imm = 0x400
movl %edx, 0x8(%rcx,%rax)
movl $0x13a0080, 0xc(%rcx,%rax) # imm = 0x13A0080
movw $0xf0, 0x10(%rcx,%rax)
movb $0x20, 0x12(%rcx,%rax)
movl $0x1010, 0x14(%rcx,%rax) # imm = 0x1010
movl 0x10(%rsp), %edx
movw %dx, 0x1c(%rcx,%rax)
leal 0x1f5(%rbx), %edx
movl $0x7ff, %esi            # imm = 0x7FF
andl %esi, %edx
movswl (%r8,%rdx,2), %edx
shrl $0x5, %edx
movw %dx, 0x20(%rcx,%rax)
addl $0x7f5, %ebx            # imm = 0x7F5
andl %esi, %ebx
movswl (%r8,%rbx,2), %edx
shrl $0x5, %edx
movw %dx, 0x22(%rcx,%rax)
movl $0x64, %edx
subl %r13d, %edx
movw %dx, 0x24(%rcx,%rax)
movq 0x28(%rsp), %rbx
movw %bx, 0x1e(%rcx,%rax)
movl $0x0, 0x26(%rcx,%rax)
movw $0xffff, 0x2a(%rcx,%rax) # imm = 0xFFFF
leaq (%r15,%r15,2), %rsi
shlq $0x2, %rsi
addq 0xc0f66(%rip), %rsi     # 0xd0fb0
movl $0x3, %edx
callq 0x6110e
leaq 0x1211d5(%rip), %rax    # 0x131230
movq (%rax,%r15,8), %rax
movw %bx, 0x1e(%rax)
jmp 0x102ed
movswl 0xe(%rsp), %edi
leaq 0x120fb0(%rip), %rax    # 0x131024
cmpl $0x3, (%rax)
movl $0x6, %eax
movl $0xc, %esi
cmovbl %eax, %esi
callq 0x21ba2
cmpl $0x1, %eax
jne 0x101b7
cmpl $0x0, 0x11f2c7(%rip)    # 0x12f360
je 0x101b7
movswl 0xe(%rsp), %edi
movl 0x30(%rsp), %esi
movswl 0x10(%rsp), %r13d
movl %r13d, %edx
callq 0x20c53
testl %eax, %eax
je 0x101bc
movswq 0xe(%rsp), %rax
movq (%r14,%rax,8), %rax
andw $0xfefe, 0xc(%rax)      # imm = 0xFEFE
leaq 0x56fafb(%rip), %rax    # 0x57fbd0
movq 0x48(%rsp), %rcx
movswl (%rax,%rcx,2), %r8d
movswl (%rax,%rbx,2), %r9d
leaq 0x54(%rsp), %rax
leaq 0x58(%rsp), %r10
leaq 0x5c(%rsp), %r11
leaq 0x62(%rsp), %rbx
leaq 0x64(%rsp), %r15
leaq 0x66(%rsp), %r12
movl 0x1c(%rsp), %edi
movl 0x18(%rsp), %esi
movl 0x14(%rsp), %edx
movl 0x3c(%rsp), %ecx
pushq $0x1000040              # imm = 0x1000040
pushq %rax
pushq %r10
pushq %r11
pushq %rbx
pushq %r15
pushq %r12
pushq %rbp
callq 0x49337
addq $0x40, %rsp
movswl (%r15), %edi
cmpl $-0x1, %edi
je 0x101bc
movswq 0xe(%rsp), %rax
movq (%r14,%rax,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movl 0x8(%rax), %ecx
movswl 0x18(%rax), %r8d
movl 0x5c(%rsp), %eax
movl 0x58(%rsp), %r10d
movl 0x54(%rsp), %r11d
subq $0x8, %rsp
movl %r13d, %r9d
pushq %r11
pushq %r10
pushq %rax
callq 0x20a55
addq $0x20, %rsp
jmp 0x101bc
movswl 0xe(%rsp), %edi
leaq 0x120ea4(%rip), %rax    # 0x131024
cmpl $0x3, (%rax)
movl $0x6, %eax
movl $0xc, %esi
cmovbl %eax, %esi
callq 0x21ba2
cmpl $0x1, %eax
jne 0x102ed
movswl 0xe(%rsp), %edi
movswl 0x28(%rsp), %esi
movsbl 0x40(%rsp), %edx
callq 0xf46a
jmp 0x102ed
cmpl $0x1, %eax
jne 0x101d0
movswl 0xe(%rsp), %edi
movswl 0x28(%rsp), %esi
movsbl 0x40(%rsp), %edx
callq 0xf46a
cmpw $0x0, 0x24(%rsp)
js 0x102ed
movswl 0x26(%rsp), %edi
movl $0x3, %esi
callq 0x1eac8
cmpw $-0x1, %ax
je 0x102ed
movl %eax, %ebp
movswq %ax, %rax
imulq $0x2c, %rax, %rcx
leaq 0x41d92a(%rip), %rdx    # 0x42db30
movl 0x38(%rsp), %esi
movl %esi, (%rdx,%rcx)
movl 0x34(%rsp), %esi
movl %esi, 0x4(%rdx,%rcx)
movl $0x800, %esi            # imm = 0x800
addl 0x30(%rsp), %esi
leaq (%rdx,%rcx), %rdi
movl %esi, 0x8(%rdx,%rcx)
movl $0x1ab0002, 0xc(%rdx,%rcx) # imm = 0x1AB0002
movw $0x0, 0x10(%rdx,%rcx)
movb $0x20, 0x12(%rdx,%rcx)
movl $0x1616, 0x14(%rdx,%rcx) # imm = 0x1616
movl 0x10(%rsp), %ebx
movw %bx, 0x1c(%rdx,%rcx)
movq 0x28(%rsp), %rsi
addl $0x4000, %esi           # imm = 0x4000
movw %si, 0x1e(%rdx,%rcx)
movabsq $0x3f000000000000, %rsi # imm = 0x3F000000000000
movq %rsi, 0x20(%rdx,%rcx)
movl $0xffff0000, 0x28(%rdx,%rcx) # imm = 0xFFFF0000
leaq (%rax,%rax,2), %rsi
shlq $0x2, %rsi
addq 0xc0d2f(%rip), %rsi     # 0xd0fb0
movl $0x3, %edx
callq 0x6110e
leaq 0x56f93e(%rip), %rcx    # 0x57fbd0
movq 0x48(%rsp), %rax
movswl (%rcx,%rax,2), %eax
shll $0x4, %eax
leal (%rax,%rax,2), %esi
negl %esi
movswq %bx, %rax
movswl (%rcx,%rax,2), %eax
shll $0x4, %eax
leal (%rax,%rax,2), %edx
negl %edx
subq $0x8, %rsp
movswl %bp, %edi
xorl %ecx, %ecx
movl $0x400, %r8d            # imm = 0x400
movl $0x400, %r9d            # imm = 0x400
pushq $0x1
callq 0x1d136
addq $0x10, %rsp
movl 0x38(%rsp), %esi
movl 0x34(%rsp), %edx
movl $0x55, %edi
xorl %ecx, %ecx
movl $0x4, %r8d
callq 0x1c370
movswl 0x28(%rsp), %edi
callq 0x2230d
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movswl 0xe(%rsp), %edi
movl $0x1c2, %esi            # imm = 0x1C2
callq 0x2106c
jmp 0x102ed