// File: /workspace/github_c_makefile_star2_O1/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 0x5682e5(%rip), %r15    # 0x585604
cmpl $0x0, (%r15)
jle 0x1dc13
movl %esi, %ebx
movl %edi, %ebp
xorl %r12d, %r12d
leaq 0x5722f9(%rip), %r13    # 0x58f630
movswl 0x2a(%r13), %r14d
movl %r14d, %edi
callq 0x1e9f9
testl %eax, %eax
je 0x1d367
leaq 0x110cb9(%rip), %rax    # 0x12e008
cmpb $0x0, (%rax)
jne 0x1d367
movslq %r14d, %rax
leaq 0x1b8eb2(%rip), %rcx    # 0x1d6210
movq (%rcx,%rax,8), %rax
orw $0x10, 0x6(%rax)
movl (%r13), %edi
movl 0x4(%r13), %esi
subl %ebp, %edi
subl %ebx, %esi
callq 0x469df
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 0x1d3e1
cmpl $0x6d6, %edx            # imm = 0x6D6
jg 0x1d443
cmpl $0x404, %edx            # imm = 0x404
jg 0x1d5a0
cmpl $0x3e1, %edx            # imm = 0x3E1
jle 0x1d5e1
leal -0x3fb(%rdx), %esi
cmpl $0x9, %esi
jae 0x1dac1
cmpl $0x4, %ecx
ja 0x1d436
movzwl %cx, %ecx
addl %eax, %ecx
movw %cx, 0xe(%r13)
jmp 0x1dae5
cmpl $0xa40, %edx            # imm = 0xA40
jle 0x1d490
cmpl $0xb2a, %edx            # imm = 0xB2A
jle 0x1d4dd
cmpl $0xb9a, %edx            # imm = 0xB9A
jg 0x1d616
cmpl $0xb4e, %edx            # imm = 0xB4E
jle 0x1d88c
cmpl $0xb76, %edx            # imm = 0xB76
jg 0x1d9f3
cmpl $0xb4f, %edx            # imm = 0xB4F
je 0x1da8e
cmpl $0xb72, %edx            # imm = 0xB72
je 0x1d3cd
jmp 0x1db01
movzwl %cx, %ecx
subl %ecx, %eax
addl $0x8, %eax
jmp 0x1daf7
cmpl $0x7b6, %edx            # imm = 0x7B6
jg 0x1d51e
cmpl $0x73d, %edx            # imm = 0x73D
jle 0x1d680
cmpl $0x75e, %edx            # imm = 0x75E
jle 0x1d907
cmpl $0x798, %edx            # imm = 0x798
jg 0x1da46
cmpl $0x75f, %edx            # imm = 0x75F
je 0x1dad5
cmpl $0x773, %edx            # imm = 0x773
je 0x1da8e
jmp 0x1db01
cmpl $0x95a, %edx            # imm = 0x95A
jg 0x1d55f
cmpl $0x8e6, %edx            # imm = 0x8E6
jle 0x1d6b5
cmpl $0x91b, %edx            # imm = 0x91B
jle 0x1d930
cmpl $0x941, %edx            # imm = 0x941
jg 0x1da5f
cmpl $0x91c, %edx            # imm = 0x91C
je 0x1d3cd
cmpl $0x92d, %edx            # imm = 0x92D
je 0x1dad5
jmp 0x1db01
cmpl $0xaba, %edx            # imm = 0xABA
jle 0x1d64b
cmpl $0xad8, %edx            # imm = 0xAD8
jle 0x1d8de
cmpl $0xafe, %edx            # imm = 0xAFE
jg 0x1da2d
cmpl $0xad9, %edx            # imm = 0xAD9
je 0x1da8e
cmpl $0xafa, %edx            # imm = 0xAFA
je 0x1d3cd
jmp 0x1db01
cmpl $0x810, %edx            # imm = 0x810
jle 0x1d6ea
cmpl $0x847, %edx            # imm = 0x847
jle 0x1d959
cmpl $0x860, %edx            # imm = 0x860
jg 0x1da78
cmpl $0x848, %edx            # imm = 0x848
je 0x1d3cd
cmpl $0x84d, %edx            # imm = 0x84D
je 0x1dad5
jmp 0x1db01
cmpl $0x9c9, %edx            # imm = 0x9C9
jle 0x1d71f
cmpl $0xa04, %edx            # imm = 0xA04
jle 0x1d982
cmpl $0xa27, %edx            # imm = 0xA27
jg 0x1daa7
cmpl $0xa05, %edx            # imm = 0xA05
je 0x1dad5
cmpl $0xa19, %edx            # imm = 0xA19
je 0x1da8e
jmp 0x1db01
cmpl $0x478, %edx            # imm = 0x478
jg 0x1d754
cmpl $0x436, %edx            # imm = 0x436
jle 0x1d9ab
cmpl $0x437, %edx            # imm = 0x437
je 0x1d9c3
cmpl $0x456, %edx            # imm = 0x456
je 0x1d3cd
cmpl $0x45b, %edx            # imm = 0x45B
je 0x1dad5
jmp 0x1db01
cmpl $0x176, %edx            # imm = 0x176
jg 0x1d785
cmpl $0x104, %edx            # imm = 0x104
je 0x1dad5
cmpl $0x15e, %edx            # imm = 0x15E
je 0x1d3cd
cmpl $0x163, %edx            # imm = 0x163
je 0x1dad5
jmp 0x1db01
cmpl $0xbcc, %edx            # imm = 0xBCC
jle 0x1d8b5
cmpl $0xed7, %edx            # imm = 0xED7
jg 0x1da10
cmpl $0xbcd, %edx            # imm = 0xBCD
je 0x1da8e
cmpl $0xbdc, %edx            # imm = 0xBDC
je 0x1d3cd
jmp 0x1db01
cmpl $0xa7c, %edx            # imm = 0xA7C
jg 0x1d7bf
cmpl $0xa41, %edx            # imm = 0xA41
je 0x1dad5
cmpl $0xa55, %edx            # imm = 0xA55
je 0x1da8e
cmpl $0xa78, %edx            # imm = 0xA78
je 0x1d3cd
jmp 0x1db01
cmpl $0x708, %edx            # imm = 0x708
jg 0x1d7e8
cmpl $0x6d7, %edx            # imm = 0x6D7
je 0x1dad5
cmpl $0x6eb, %edx            # imm = 0x6EB
je 0x1da8e
cmpl $0x6fa, %edx            # imm = 0x6FA
je 0x1d3cd
jmp 0x1db01
cmpl $0x8ab, %edx            # imm = 0x8AB
jg 0x1d811
cmpl $0x884, %edx            # imm = 0x884
je 0x1d3cd
cmpl $0x889, %edx            # imm = 0x889
je 0x1dad5
cmpl $0x89e, %edx            # imm = 0x89E
je 0x1da8e
jmp 0x1db01
cmpl $0x7e6, %edx            # imm = 0x7E6
jg 0x1d83a
cmpl $0x7b7, %edx            # imm = 0x7B7
je 0x1d3cd
cmpl $0x7ce, %edx            # imm = 0x7CE
je 0x1d3cd
cmpl $0x7d3, %edx            # imm = 0x7D3
je 0x1dad5
jmp 0x1db01
cmpl $0x982, %edx            # imm = 0x982
jg 0x1d863
cmpl $0x95b, %edx            # imm = 0x95B
je 0x1da8e
cmpl $0x96a, %edx            # imm = 0x96A
je 0x1d3cd
cmpl $0x97e, %edx            # imm = 0x97E
je 0x1d3cd
jmp 0x1db01
cmpl $0x4ad, %edx            # imm = 0x4AD
jle 0x1d9d6
leal -0x4ae(%rdx), %esi
cmpl $0x2, %esi
jae 0x1dbcb
cmpl $0x4, %ecx
ja 0x1dbdc
movzwl %cx, %ecx
leal (%rcx,%rcx,2), %ecx
addl %ecx, %eax
jmp 0x1dbf8
cmpl $0x177, %edx            # imm = 0x177
je 0x1da8e
cmpl $0x181, %edx            # imm = 0x181
je 0x1d3cd
cmpl $0x232, %edx            # imm = 0x232
jne 0x1db01
movzwl %cx, %eax
cmpl $0x4, %ecx
ja 0x1dc02
addl $0x232, %eax            # imm = 0x232
jmp 0x1dae0
cmpl $0xa7d, %edx            # imm = 0xA7D
je 0x1dad5
cmpl $0xa91, %edx            # imm = 0xA91
je 0x1d3cd
cmpl $0xa9e, %edx            # imm = 0xA9E
je 0x1da8e
jmp 0x1db01
cmpl $0x709, %edx            # imm = 0x709
je 0x1dad5
cmpl $0x725, %edx            # imm = 0x725
je 0x1d3cd
cmpl $0x72a, %edx            # imm = 0x72A
je 0x1dad5
jmp 0x1db01
cmpl $0x8ac, %edx            # imm = 0x8AC
je 0x1d3cd
cmpl $0x8ce, %edx            # imm = 0x8CE
je 0x1d3cd
cmpl $0x8d3, %edx            # imm = 0x8D3
je 0x1dad5
jmp 0x1db01
cmpl $0x7e7, %edx            # imm = 0x7E7
je 0x1da8e
cmpl $0x7f9, %edx            # imm = 0x7F9
je 0x1d3cd
cmpl $0x80c, %edx            # imm = 0x80C
je 0x1d3cd
jmp 0x1db01
cmpl $0x983, %edx            # imm = 0x983
je 0x1dad5
cmpl $0x9a3, %edx            # imm = 0x9A3
je 0x1d3cd
cmpl $0x9c5, %edx            # imm = 0x9C5
je 0x1d3cd
jmp 0x1db01
cmpl $0xb2b, %edx            # imm = 0xB2B
je 0x1d3cd
cmpl $0xb36, %edx            # imm = 0xB36
je 0x1d3cd
cmpl $0xb3b, %edx            # imm = 0xB3B
je 0x1dad5
jmp 0x1db01
cmpl $0xb9b, %edx            # imm = 0xB9B
je 0x1d3cd
cmpl $0xbb4, %edx            # imm = 0xBB4
je 0x1d3cd
cmpl $0xbb9, %edx            # imm = 0xBB9
je 0x1dad5
jmp 0x1db01
cmpl $0xabb, %edx            # imm = 0xABB
je 0x1d3cd
cmpl $0xac0, %edx            # imm = 0xAC0
je 0x1dad5
cmpl $0xad4, %edx            # imm = 0xAD4
je 0x1d3cd
jmp 0x1db01
cmpl $0x73e, %edx            # imm = 0x73E
je 0x1da8e
cmpl $0x74d, %edx            # imm = 0x74D
je 0x1d3cd
cmpl $0x75a, %edx            # imm = 0x75A
je 0x1d3cd
jmp 0x1db01
cmpl $0x8e7, %edx            # imm = 0x8E7
je 0x1da8e
cmpl $0x906, %edx            # imm = 0x906
je 0x1d3cd
cmpl $0x90b, %edx            # imm = 0x90B
je 0x1da8e
jmp 0x1db01
cmpl $0x811, %edx            # imm = 0x811
je 0x1dad5
cmpl $0x82e, %edx            # imm = 0x82E
je 0x1d3cd
cmpl $0x833, %edx            # imm = 0x833
je 0x1da8e
jmp 0x1db01
cmpl $0x9ca, %edx            # imm = 0x9CA
je 0x1dad5
cmpl $0x9e7, %edx            # imm = 0x9E7
je 0x1da8e
cmpl $0xa00, %edx            # imm = 0xA00
je 0x1d3cd
jmp 0x1db01
cmpl $0x405, %edx            # imm = 0x405
je 0x1d3cd
cmpl $0x432, %edx            # imm = 0x432
jne 0x1db01
cmpl $0x4, %ecx
ja 0x1dbf0
movzwl %cx, %ecx
addl %eax, %ecx
jmp 0x1dc09
cmpl $0x479, %edx            # imm = 0x479
je 0x1d3cd
cmpl $0x490, %edx            # imm = 0x490
je 0x1da8e
jmp 0x1db01
cmpl $0xb77, %edx            # imm = 0xB77
je 0x1dad5
cmpl $0xb8b, %edx            # imm = 0xB8B
je 0x1da8e
jmp 0x1db01
cmpl $0xed8, %edx            # imm = 0xED8
je 0x1d3cd
cmpl $0xee2, %edx            # imm = 0xEE2
je 0x1d3cd
jmp 0x1db01
cmpl $0xaff, %edx            # imm = 0xAFF
je 0x1dad5
cmpl $0xb13, %edx            # imm = 0xB13
je 0x1da8e
jmp 0x1db01
cmpl $0x799, %edx            # imm = 0x799
je 0x1d3cd
cmpl $0x79e, %edx            # imm = 0x79E
je 0x1dad5
jmp 0x1db01
cmpl $0x942, %edx            # imm = 0x942
je 0x1d3cd
cmpl $0x947, %edx            # imm = 0x947
je 0x1dad5
jmp 0x1db01
cmpl $0x861, %edx            # imm = 0x861
je 0x1da8e
cmpl $0x870, %edx            # imm = 0x870
je 0x1d3cd
jmp 0x1db01
cmpl $0x4, %ecx
ja 0x1da9b
movzwl %cx, %ecx
leal (%rax,%rcx,2), %eax
jmp 0x1dae0
movzwl %cx, %ecx
addl %ecx, %ecx
subl %ecx, %eax
addl $0x10, %eax
jmp 0x1daf7
cmpl $0xa28, %edx            # imm = 0xA28
je 0x1d3cd
cmpl $0xa3c, %edx            # imm = 0xA3C
je 0x1d3cd
jmp 0x1db01
cmpl $0x3e2, %edx            # imm = 0x3E2
je 0x1d3cd
cmpl $0x3e7, %edx            # imm = 0x3E7
jne 0x1db01
cmpl $0x4, %ecx
ja 0x1daec
movzwl %cx, %ecx
leal (%rax,%rcx,4), %eax
movw %ax, 0xe(%r13)
andb $-0x5, 0xc(%r13)
jmp 0x1db01
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 0x1dbb9
movswq 0x1e(%r13), %rax
leaq (%rax,%rax,2), %rax
movl (%r13), %edx
leaq 0xcc12c(%rip), %rcx     # 0xe9c60
movl (%rcx,%rax,4), %ecx
movl %ecx, (%r13)
subl %ecx, %edx
je 0x1db5a
leaq 0xc4e3a(%rip), %rsi     # 0xe2980
movslq (%rsi), %rsi
movslq %edx, %rdx
imulq %rsi, %rdx
shrq $0x10, %rdx
addl %edx, %ecx
movl %ecx, (%r13)
leaq 0xcc0ff(%rip), %rcx     # 0xe9c60
leaq (%rcx,%rax,4), %rax
movl 0x4(%r13), %edx
movl 0x4(%rax), %ecx
movl %ecx, 0x4(%r13)
subl %ecx, %edx
je 0x1db8f
leaq 0xc4e05(%rip), %rsi     # 0xe2980
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 0x1dbb9
leaq 0xc4ddb(%rip), %rdx     # 0xe2980
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 0x1d337
jmp 0x1dc13
cmpl $0x6d2, %edx            # imm = 0x6D2
je 0x1d3cd
jmp 0x1db01
movzwl %cx, %ecx
movl $0x8, %edx
subl %ecx, %edx
leal (%rdx,%rdx,2), %ecx
addl %ecx, %eax
jmp 0x1daf7
movzwl %cx, %ecx
subl %ecx, %eax
addl $0x8, %eax
movw %ax, 0xe(%r13)
jmp 0x1dae5
movl $0x23a, %ecx            # imm = 0x23A
subl %eax, %ecx
movw %cx, 0xe(%r13)
jmp 0x1dafc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq