// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekspr.c
// Function: analyzesprites
void
analyzesprites(int dax, int day)
{
     int           i, k;
     int            ext;
     point3d        *ospr;
     spritetype     *tspr;

     for( i=0,tspr=&tsprite[0]; i<spritesortcnt; i++,tspr++ ) {

          ext=tspr->extra;
          if( validext(ext) ) {
               if( rearviewdraw == 0 ) {
                    sprXTptr[ext]->aimask|=AI_WASDRAWN;
               }
          }

          k = getangle(tspr->x-dax,tspr->y-day);
          k = (((tspr->ang+3072+128-k)&2047)>>8)&7;

          switch( tspr->picnum ) {
          case DOOMGUY:
          case RUBWALKPIC:
          case FRGWALKPIC:
          case SAMWALKPIC:
          case COP1WALKPIC:
          case ANTWALKPIC:
          case SARAHWALKPIC:
          case MAWALKPIC:
          case ERWALKPIC:
          case DIWALKPIC:
          case RATPIC:
          case SUNGWALKPIC:
          case COWWALKPIC:
          case COPBWALKPIC:
          case NIKAWALKPIC:
          case REBRWALKPIC:
          case TRENWALKPIC:
          case WINGWALKPIC:
          case HALTWALKPIC:
          case REDHWALKPIC:
          case ORANWALKPIC:
          case BLKSWALKPIC:
          case SFROWALKPIC:
          case SSALWALKPIC:
          case SGOLWALKPIC:
          case SWATWALKPIC:
               if( k <= 4 ) {
                    tspr->picnum += (k<<2);
                    tspr->cstat &= ~4;   //clear x-flipping bit
               }
               else {
                    tspr->picnum += ((8-k)<<2);
                    tspr->cstat |= 4;    //set x-flipping bit
               }
               break;
          case AUTOGUN:
               if (k <= 4) {
                    tspr->picnum += k;
                    tspr->cstat &= ~4;
               }
               else {
                    tspr->picnum += (8-k);
                    tspr->cstat |= 4;
               }
               break;
          case JAKESTANDPIC:
          case RUBSTANDPIC:
          case FRGSTANDPIC:
          case SAMSTANDPIC:
          case COP1STNDPIC:
          case ANTSTANDPIC:
          case MASTANDPIC:
          case DISTANDPIC:
          case ERSTANDPIC:
          case SUNGSTANDPIC:
          case COWSTANDPIC:
          case COPBSTANDPIC:
          case NIKASTANDPIC:
          case REBRSTANDPIC:
          case TRENSTANDPIC:
          case WINGSTANDPIC:
          case HALTSTANDPIC:
          case REDHSTANDPIC:
          case ORANSTANDPIC:
          case BLKSSTANDPIC:
          case SFROSTANDPIC:
          case SSALSTANDPIC:
          case SGOLSTANDPIC:
          case SWATSTANDPIC:
          case PROBE1:
          case RS232:
               if (k <= 4) {
                    tspr->picnum += k;
                    tspr->cstat &= ~4;
               }
               else {
                    tspr->picnum += ((8-k));
                    tspr->cstat |= 4;
               }
               break;
          case RUBATAKPIC:
          case FRGATTACKPIC:
          case SAMATTACKPIC:
          case COPATTACKPIC:
          case ANTATTACKPIC:
          case MAATTACKPIC:
          case DIATTACKPIC:
          case SUNGATTACKPIC:
          case COWATTACKPIC:
          case COPBATTACKPIC:
          case NIKAATTACKPIC:
          case REBRATTACKPIC:
          case WINGATTACKPIC:
          case HALTATTACKPIC:
          case REDHATTACKPIC:
          case ORANATTACKPIC:
          case BLKSATTACKPIC:
          case SFROATTACKPIC:
          case SSALATTACKPIC:
          case SGOLATTACKPIC:
          case SWATATTACKPIC:
               if( k <= 4 ) {
                    tspr->picnum += (k<<1);
                    tspr->cstat &= ~4;   //clear x-flipping bit
               }
               else {
                    tspr->picnum += ((8-k)<<1);
                    tspr->cstat |= 4;
               }
               break;
          case JAKEPAINPIC:
          case RUBPAINPIC:
          case FRGPAINPIC:
          case SAMPAINPIC:
          case COP1PAINPIC:
          case ANTPAINPIC:
          case MAPAINPIC:
          case ERPAINPIC:
          case SUNGPAINPIC:
          case COWPAINPIC:
          case NIKAPAINPIC:
          case REBRPAINPIC:
          case TRENPAINPIC:
          case HALTPAINPIC:
          case ORANPAINPIC:
          case BLKSPAINPIC:
          case SFROPAINPIC:
          case SGOLPAINPIC:
          case SWATPAINPIC:
          case JAKEDEATHPIC:
          case JAKEDEATHPIC+1:
          case JAKEDEATHPIC+2:
          case JAKEDEATHPIC+3:
          case JAKEDEATHPIC+4:
          case JAKEDEATHPIC+5:
          case JAKEDEATHPIC+6:
          case JAKEDEATHPIC+7:
          case JAKEDEATHPIC+8:
               if( k <= 4 ) {
                    tspr->picnum += (k);
                    tspr->cstat &= ~4;   //clear x-flipping bit
               }
               else {
                    tspr->picnum += ((8-k));
                    tspr->cstat |= 4;
               }
               break;
          // mirrorman
          case 1079:
          case 1074:
               if( k <= 4 ) {
                    tspr->picnum += (k);
                    tspr->cstat |= 4;
               }
               else {
                    tspr->picnum += ((8-k));
                    tspr->cstat &= ~4;   //clear x-flipping bit
               }
               break;
          case JAKEATTACKPIC:
          case JAKEATTACKPIC+1:
               if (k <= 4) {
                    tspr->picnum+=(k*3);
                    tspr->cstat&=~4;
               }
               else {
                    tspr->picnum+=((8-k)*3);
                    tspr->cstat|=4;
               }
               break;
          default:
               break;
          }

          k=tspr->statnum;
          if( (k >= 1) && (k <= 8) && (k != 2) ) {  //Interpolate moving sprite
               ospr = &osprite[tspr->owner];
               k = tspr->x-ospr->x; tspr->x = ospr->x;
               if (k != 0) tspr->x += mulscale(k,smoothratio,16);
               k = tspr->y-ospr->y; tspr->y = ospr->y;
               if (k != 0) tspr->y += mulscale(k,smoothratio,16);
               k = tspr->z-ospr->z; tspr->z = ospr->z;
               if (k != 0) tspr->z += mulscale(k,smoothratio,16);
          }

     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x56b18e(%rip), %r15    # 0x588624
cmpl $0x0, (%r15)
jle 0x1dd8a
movl %esi, %ebx
movl %edi, %ebp
xorl %r12d, %r12d
leaq 0x5751a2(%rip), %r13    # 0x592650
movswl 0x2a(%r13), %r14d
movl %r14d, %edi
callq 0x1eb75
testl %eax, %eax
je 0x1d4de
leaq 0x113b62(%rip), %rax    # 0x131028
cmpb $0x0, (%rax)
jne 0x1d4de
movslq %r14d, %rax
leaq 0x1bbd5b(%rip), %rcx    # 0x1d9230
movq (%rcx,%rax,8), %rax
orw $0x10, 0x6(%rax)
movl (%r13), %edi
movl 0x4(%r13), %esi
subl %ebp, %edi
subl %ebx, %esi
callq 0x48943
movl 0x1c(%r13), %ecx
subl %eax, %ecx
addl $0x480, %ecx            # imm = 0x480
shrl $0x8, %ecx
andl $0x7, %ecx
movzwl 0xe(%r13), %eax
movzwl %ax, %edx
cmpl $0x883, %edx            # imm = 0x883
jg 0x1d558
cmpl $0x6d6, %edx            # imm = 0x6D6
jg 0x1d5ba
cmpl $0x404, %edx            # imm = 0x404
jg 0x1d717
cmpl $0x3e1, %edx            # imm = 0x3E1
jle 0x1d758
leal -0x3fb(%rdx), %esi
cmpl $0x9, %esi
jae 0x1dc38
cmpl $0x4, %ecx
ja 0x1d5ad
movzwl %cx, %ecx
addl %eax, %ecx
movw %cx, 0xe(%r13)
jmp 0x1dc5c
cmpl $0xa40, %edx            # imm = 0xA40
jle 0x1d607
cmpl $0xb2a, %edx            # imm = 0xB2A
jle 0x1d654
cmpl $0xb9a, %edx            # imm = 0xB9A
jg 0x1d78d
cmpl $0xb4e, %edx            # imm = 0xB4E
jle 0x1da03
cmpl $0xb76, %edx            # imm = 0xB76
jg 0x1db6a
cmpl $0xb4f, %edx            # imm = 0xB4F
je 0x1dc05
cmpl $0xb72, %edx            # imm = 0xB72
je 0x1d544
jmp 0x1dc78
movzwl %cx, %ecx
subl %ecx, %eax
addl $0x8, %eax
jmp 0x1dc6e
cmpl $0x7b6, %edx            # imm = 0x7B6
jg 0x1d695
cmpl $0x73d, %edx            # imm = 0x73D
jle 0x1d7f7
cmpl $0x75e, %edx            # imm = 0x75E
jle 0x1da7e
cmpl $0x798, %edx            # imm = 0x798
jg 0x1dbbd
cmpl $0x75f, %edx            # imm = 0x75F
je 0x1dc4c
cmpl $0x773, %edx            # imm = 0x773
je 0x1dc05
jmp 0x1dc78
cmpl $0x95a, %edx            # imm = 0x95A
jg 0x1d6d6
cmpl $0x8e6, %edx            # imm = 0x8E6
jle 0x1d82c
cmpl $0x91b, %edx            # imm = 0x91B
jle 0x1daa7
cmpl $0x941, %edx            # imm = 0x941
jg 0x1dbd6
cmpl $0x91c, %edx            # imm = 0x91C
je 0x1d544
cmpl $0x92d, %edx            # imm = 0x92D
je 0x1dc4c
jmp 0x1dc78
cmpl $0xaba, %edx            # imm = 0xABA
jle 0x1d7c2
cmpl $0xad8, %edx            # imm = 0xAD8
jle 0x1da55
cmpl $0xafe, %edx            # imm = 0xAFE
jg 0x1dba4
cmpl $0xad9, %edx            # imm = 0xAD9
je 0x1dc05
cmpl $0xafa, %edx            # imm = 0xAFA
je 0x1d544
jmp 0x1dc78
cmpl $0x810, %edx            # imm = 0x810
jle 0x1d861
cmpl $0x847, %edx            # imm = 0x847
jle 0x1dad0
cmpl $0x860, %edx            # imm = 0x860
jg 0x1dbef
cmpl $0x848, %edx            # imm = 0x848
je 0x1d544
cmpl $0x84d, %edx            # imm = 0x84D
je 0x1dc4c
jmp 0x1dc78
cmpl $0x9c9, %edx            # imm = 0x9C9
jle 0x1d896
cmpl $0xa04, %edx            # imm = 0xA04
jle 0x1daf9
cmpl $0xa27, %edx            # imm = 0xA27
jg 0x1dc1e
cmpl $0xa05, %edx            # imm = 0xA05
je 0x1dc4c
cmpl $0xa19, %edx            # imm = 0xA19
je 0x1dc05
jmp 0x1dc78
cmpl $0x478, %edx            # imm = 0x478
jg 0x1d8cb
cmpl $0x436, %edx            # imm = 0x436
jle 0x1db22
cmpl $0x437, %edx            # imm = 0x437
je 0x1db3a
cmpl $0x456, %edx            # imm = 0x456
je 0x1d544
cmpl $0x45b, %edx            # imm = 0x45B
je 0x1dc4c
jmp 0x1dc78
cmpl $0x176, %edx            # imm = 0x176
jg 0x1d8fc
cmpl $0x104, %edx            # imm = 0x104
je 0x1dc4c
cmpl $0x15e, %edx            # imm = 0x15E
je 0x1d544
cmpl $0x163, %edx            # imm = 0x163
je 0x1dc4c
jmp 0x1dc78
cmpl $0xbcc, %edx            # imm = 0xBCC
jle 0x1da2c
cmpl $0xed7, %edx            # imm = 0xED7
jg 0x1db87
cmpl $0xbcd, %edx            # imm = 0xBCD
je 0x1dc05
cmpl $0xbdc, %edx            # imm = 0xBDC
je 0x1d544
jmp 0x1dc78
cmpl $0xa7c, %edx            # imm = 0xA7C
jg 0x1d936
cmpl $0xa41, %edx            # imm = 0xA41
je 0x1dc4c
cmpl $0xa55, %edx            # imm = 0xA55
je 0x1dc05
cmpl $0xa78, %edx            # imm = 0xA78
je 0x1d544
jmp 0x1dc78
cmpl $0x708, %edx            # imm = 0x708
jg 0x1d95f
cmpl $0x6d7, %edx            # imm = 0x6D7
je 0x1dc4c
cmpl $0x6eb, %edx            # imm = 0x6EB
je 0x1dc05
cmpl $0x6fa, %edx            # imm = 0x6FA
je 0x1d544
jmp 0x1dc78
cmpl $0x8ab, %edx            # imm = 0x8AB
jg 0x1d988
cmpl $0x884, %edx            # imm = 0x884
je 0x1d544
cmpl $0x889, %edx            # imm = 0x889
je 0x1dc4c
cmpl $0x89e, %edx            # imm = 0x89E
je 0x1dc05
jmp 0x1dc78
cmpl $0x7e6, %edx            # imm = 0x7E6
jg 0x1d9b1
cmpl $0x7b7, %edx            # imm = 0x7B7
je 0x1d544
cmpl $0x7ce, %edx            # imm = 0x7CE
je 0x1d544
cmpl $0x7d3, %edx            # imm = 0x7D3
je 0x1dc4c
jmp 0x1dc78
cmpl $0x982, %edx            # imm = 0x982
jg 0x1d9da
cmpl $0x95b, %edx            # imm = 0x95B
je 0x1dc05
cmpl $0x96a, %edx            # imm = 0x96A
je 0x1d544
cmpl $0x97e, %edx            # imm = 0x97E
je 0x1d544
jmp 0x1dc78
cmpl $0x4ad, %edx            # imm = 0x4AD
jle 0x1db4d
leal -0x4ae(%rdx), %esi
cmpl $0x2, %esi
jae 0x1dd42
cmpl $0x4, %ecx
ja 0x1dd53
movzwl %cx, %ecx
leal (%rcx,%rcx,2), %ecx
addl %ecx, %eax
jmp 0x1dd6f
cmpl $0x177, %edx            # imm = 0x177
je 0x1dc05
cmpl $0x181, %edx            # imm = 0x181
je 0x1d544
cmpl $0x232, %edx            # imm = 0x232
jne 0x1dc78
movzwl %cx, %eax
cmpl $0x4, %ecx
ja 0x1dd79
addl $0x232, %eax            # imm = 0x232
jmp 0x1dc57
cmpl $0xa7d, %edx            # imm = 0xA7D
je 0x1dc4c
cmpl $0xa91, %edx            # imm = 0xA91
je 0x1d544
cmpl $0xa9e, %edx            # imm = 0xA9E
je 0x1dc05
jmp 0x1dc78
cmpl $0x709, %edx            # imm = 0x709
je 0x1dc4c
cmpl $0x725, %edx            # imm = 0x725
je 0x1d544
cmpl $0x72a, %edx            # imm = 0x72A
je 0x1dc4c
jmp 0x1dc78
cmpl $0x8ac, %edx            # imm = 0x8AC
je 0x1d544
cmpl $0x8ce, %edx            # imm = 0x8CE
je 0x1d544
cmpl $0x8d3, %edx            # imm = 0x8D3
je 0x1dc4c
jmp 0x1dc78
cmpl $0x7e7, %edx            # imm = 0x7E7
je 0x1dc05
cmpl $0x7f9, %edx            # imm = 0x7F9
je 0x1d544
cmpl $0x80c, %edx            # imm = 0x80C
je 0x1d544
jmp 0x1dc78
cmpl $0x983, %edx            # imm = 0x983
je 0x1dc4c
cmpl $0x9a3, %edx            # imm = 0x9A3
je 0x1d544
cmpl $0x9c5, %edx            # imm = 0x9C5
je 0x1d544
jmp 0x1dc78
cmpl $0xb2b, %edx            # imm = 0xB2B
je 0x1d544
cmpl $0xb36, %edx            # imm = 0xB36
je 0x1d544
cmpl $0xb3b, %edx            # imm = 0xB3B
je 0x1dc4c
jmp 0x1dc78
cmpl $0xb9b, %edx            # imm = 0xB9B
je 0x1d544
cmpl $0xbb4, %edx            # imm = 0xBB4
je 0x1d544
cmpl $0xbb9, %edx            # imm = 0xBB9
je 0x1dc4c
jmp 0x1dc78
cmpl $0xabb, %edx            # imm = 0xABB
je 0x1d544
cmpl $0xac0, %edx            # imm = 0xAC0
je 0x1dc4c
cmpl $0xad4, %edx            # imm = 0xAD4
je 0x1d544
jmp 0x1dc78
cmpl $0x73e, %edx            # imm = 0x73E
je 0x1dc05
cmpl $0x74d, %edx            # imm = 0x74D
je 0x1d544
cmpl $0x75a, %edx            # imm = 0x75A
je 0x1d544
jmp 0x1dc78
cmpl $0x8e7, %edx            # imm = 0x8E7
je 0x1dc05
cmpl $0x906, %edx            # imm = 0x906
je 0x1d544
cmpl $0x90b, %edx            # imm = 0x90B
je 0x1dc05
jmp 0x1dc78
cmpl $0x811, %edx            # imm = 0x811
je 0x1dc4c
cmpl $0x82e, %edx            # imm = 0x82E
je 0x1d544
cmpl $0x833, %edx            # imm = 0x833
je 0x1dc05
jmp 0x1dc78
cmpl $0x9ca, %edx            # imm = 0x9CA
je 0x1dc4c
cmpl $0x9e7, %edx            # imm = 0x9E7
je 0x1dc05
cmpl $0xa00, %edx            # imm = 0xA00
je 0x1d544
jmp 0x1dc78
cmpl $0x405, %edx            # imm = 0x405
je 0x1d544
cmpl $0x432, %edx            # imm = 0x432
jne 0x1dc78
cmpl $0x4, %ecx
ja 0x1dd67
movzwl %cx, %ecx
addl %eax, %ecx
jmp 0x1dd80
cmpl $0x479, %edx            # imm = 0x479
je 0x1d544
cmpl $0x490, %edx            # imm = 0x490
je 0x1dc05
jmp 0x1dc78
cmpl $0xb77, %edx            # imm = 0xB77
je 0x1dc4c
cmpl $0xb8b, %edx            # imm = 0xB8B
je 0x1dc05
jmp 0x1dc78
cmpl $0xed8, %edx            # imm = 0xED8
je 0x1d544
cmpl $0xee2, %edx            # imm = 0xEE2
je 0x1d544
jmp 0x1dc78
cmpl $0xaff, %edx            # imm = 0xAFF
je 0x1dc4c
cmpl $0xb13, %edx            # imm = 0xB13
je 0x1dc05
jmp 0x1dc78
cmpl $0x799, %edx            # imm = 0x799
je 0x1d544
cmpl $0x79e, %edx            # imm = 0x79E
je 0x1dc4c
jmp 0x1dc78
cmpl $0x942, %edx            # imm = 0x942
je 0x1d544
cmpl $0x947, %edx            # imm = 0x947
je 0x1dc4c
jmp 0x1dc78
cmpl $0x861, %edx            # imm = 0x861
je 0x1dc05
cmpl $0x870, %edx            # imm = 0x870
je 0x1d544
jmp 0x1dc78
cmpl $0x4, %ecx
ja 0x1dc12
movzwl %cx, %ecx
leal (%rax,%rcx,2), %eax
jmp 0x1dc57
movzwl %cx, %ecx
addl %ecx, %ecx
subl %ecx, %eax
addl $0x10, %eax
jmp 0x1dc6e
cmpl $0xa28, %edx            # imm = 0xA28
je 0x1d544
cmpl $0xa3c, %edx            # imm = 0xA3C
je 0x1d544
jmp 0x1dc78
cmpl $0x3e2, %edx            # imm = 0x3E2
je 0x1d544
cmpl $0x3e7, %edx            # imm = 0x3E7
jne 0x1dc78
cmpl $0x4, %ecx
ja 0x1dc63
movzwl %cx, %ecx
leal (%rax,%rcx,4), %eax
movw %ax, 0xe(%r13)
andb $-0x5, 0xc(%r13)
jmp 0x1dc78
movzwl %cx, %ecx
shll $0x2, %ecx
subl %ecx, %eax
addl $0x20, %eax
movw %ax, 0xe(%r13)
orb $0x4, 0xc(%r13)
movzwl 0x1a(%r13), %eax
movl %eax, %ecx
decl %ecx
cmpw $0x8, %cx
setae %cl
cmpw $0x2, %ax
sete %al
orb %cl, %al
jne 0x1dd30
movswq 0x1e(%r13), %rax
leaq (%rax,%rax,2), %rax
movl (%r13), %edx
leaq 0xcefb5(%rip), %rcx     # 0xecc60
movl (%rcx,%rax,4), %ecx
movl %ecx, (%r13)
subl %ecx, %edx
je 0x1dcd1
leaq 0xc7cc3(%rip), %rsi     # 0xe5980
movslq (%rsi), %rsi
movslq %edx, %rdx
imulq %rsi, %rdx
shrq $0x10, %rdx
addl %edx, %ecx
movl %ecx, (%r13)
leaq 0xcef88(%rip), %rcx     # 0xecc60
leaq (%rcx,%rax,4), %rax
movl 0x4(%r13), %edx
movl 0x4(%rax), %ecx
movl %ecx, 0x4(%r13)
subl %ecx, %edx
je 0x1dd06
leaq 0xc7c8e(%rip), %rsi     # 0xe5980
movslq (%rsi), %rsi
movslq %edx, %rdx
imulq %rsi, %rdx
shrq $0x10, %rdx
addl %edx, %ecx
movl %ecx, 0x4(%r13)
movl 0x8(%r13), %ecx
movl 0x8(%rax), %eax
movl %eax, 0x8(%r13)
subl %eax, %ecx
je 0x1dd30
leaq 0xc7c64(%rip), %rdx     # 0xe5980
movslq (%rdx), %rdx
movslq %ecx, %rcx
imulq %rdx, %rcx
shrq $0x10, %rcx
addl %ecx, %eax
movl %eax, 0x8(%r13)
incl %r12d
addq $0x2c, %r13
cmpl (%r15), %r12d
jl 0x1d4ae
jmp 0x1dd8a
cmpl $0x6d2, %edx            # imm = 0x6D2
je 0x1d544
jmp 0x1dc78
movzwl %cx, %ecx
movl $0x8, %edx
subl %ecx, %edx
leal (%rdx,%rdx,2), %ecx
addl %ecx, %eax
jmp 0x1dc6e
movzwl %cx, %ecx
subl %ecx, %eax
addl $0x8, %eax
movw %ax, 0xe(%r13)
jmp 0x1dc5c
movl $0x23a, %ecx            # imm = 0x23A
subl %eax, %ecx
movw %cx, 0xe(%r13)
jmp 0x1dc73
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq