// File: /workspace/github_c_makefile_star2_O2/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
movl %esi, %ebx
movl %edi, %ebp
leaq 0x56ca51(%rip), %r15    # 0x588650
xorl %r12d, %r12d
leaq 0x562a1b(%rip), %r13    # 0x57e624
cmpl (%r13), %r12d
jge 0x1c234
movswl 0x2a(%r15), %r14d
movl %r14d, %edi
callq 0x1cfb8
testl %eax, %eax
je 0x1bc43
leaq 0x10b3fd(%rip), %rax    # 0x127028
cmpb $0x0, (%rax)
jne 0x1bc43
movslq %r14d, %rax
leaq 0x1b35f6(%rip), %rcx    # 0x1cf230
movq (%rcx,%rax,8), %rax
orw $0x10, 0x6(%rax)
movl (%r15), %edi
movl 0x4(%r15), %esi
subl %ebp, %edi
subl %ebx, %esi
callq 0x43e64
movl 0x1c(%r15), %ecx
subl %eax, %ecx
addl $0x480, %ecx            # imm = 0x480
shrl $0x8, %ecx
andl $0x7, %ecx
movzwl 0xe(%r15), %eax
movzwl %ax, %edx
leal -0x3fb(%rdx), %esi
cmpl $0x9, %esi
jb 0x1c0d0
leal -0x4ae(%rdx), %esi
cmpl $0x2, %esi
jb 0x1c1e6
cmpl $0x104, %edx            # imm = 0x104
je 0x1c0c3
cmpl $0x15e, %edx            # imm = 0x15E
je 0x1c0d0
cmpl $0x163, %edx            # imm = 0x163
je 0x1c0c3
cmpl $0x177, %edx            # imm = 0x177
je 0x1c0e8
cmpl $0x181, %edx            # imm = 0x181
je 0x1c0d0
cmpl $0x232, %edx            # imm = 0x232
je 0x1c211
cmpl $0x3e2, %edx            # imm = 0x3E2
je 0x1c0d0
cmpl $0x3e7, %edx            # imm = 0x3E7
je 0x1c0c3
cmpl $0x405, %edx            # imm = 0x405
je 0x1c0d0
cmpl $0x432, %edx            # imm = 0x432
je 0x1c1d7
cmpl $0x437, %edx            # imm = 0x437
je 0x1c1d7
cmpl $0x456, %edx            # imm = 0x456
je 0x1c0d0
cmpl $0x45b, %edx            # imm = 0x45B
je 0x1c0c3
cmpl $0x479, %edx            # imm = 0x479
je 0x1c0d0
cmpl $0x490, %edx            # imm = 0x490
je 0x1c0e8
cmpl $0x6d2, %edx            # imm = 0x6D2
je 0x1c0d0
cmpl $0x6d7, %edx            # imm = 0x6D7
je 0x1c0c3
cmpl $0x6eb, %edx            # imm = 0x6EB
je 0x1c0e8
cmpl $0x6fa, %edx            # imm = 0x6FA
je 0x1c0d0
cmpl $0x709, %edx            # imm = 0x709
je 0x1c0c3
cmpl $0x725, %edx            # imm = 0x725
je 0x1c0d0
cmpl $0x72a, %edx            # imm = 0x72A
je 0x1c0c3
cmpl $0x73e, %edx            # imm = 0x73E
je 0x1c0e8
cmpl $0x74d, %edx            # imm = 0x74D
je 0x1c0d0
cmpl $0x75a, %edx            # imm = 0x75A
je 0x1c0d0
cmpl $0x75f, %edx            # imm = 0x75F
je 0x1c0c3
cmpl $0x773, %edx            # imm = 0x773
je 0x1c0e8
cmpl $0x799, %edx            # imm = 0x799
je 0x1c0d0
cmpl $0x79e, %edx            # imm = 0x79E
je 0x1c0c3
cmpl $0x7b7, %edx            # imm = 0x7B7
je 0x1c0d0
cmpl $0x7ce, %edx            # imm = 0x7CE
je 0x1c0d0
cmpl $0x7d3, %edx            # imm = 0x7D3
je 0x1c0c3
cmpl $0x7e7, %edx            # imm = 0x7E7
je 0x1c0e8
cmpl $0x7f9, %edx            # imm = 0x7F9
je 0x1c0d0
cmpl $0x80c, %edx            # imm = 0x80C
je 0x1c0d0
cmpl $0x811, %edx            # imm = 0x811
je 0x1c0c3
cmpl $0x82e, %edx            # imm = 0x82E
je 0x1c0d0
cmpl $0x833, %edx            # imm = 0x833
je 0x1c0e8
cmpl $0x848, %edx            # imm = 0x848
je 0x1c0d0
cmpl $0x84d, %edx            # imm = 0x84D
je 0x1c0c3
cmpl $0x861, %edx            # imm = 0x861
je 0x1c0e8
cmpl $0x870, %edx            # imm = 0x870
je 0x1c0d0
cmpl $0x884, %edx            # imm = 0x884
je 0x1c0d0
cmpl $0x889, %edx            # imm = 0x889
je 0x1c0c3
cmpl $0x89e, %edx            # imm = 0x89E
je 0x1c0e8
cmpl $0x8ac, %edx            # imm = 0x8AC
je 0x1c0d0
cmpl $0x8ce, %edx            # imm = 0x8CE
je 0x1c0d0
cmpl $0x8d3, %edx            # imm = 0x8D3
je 0x1c0c3
cmpl $0x8e7, %edx            # imm = 0x8E7
je 0x1c0e8
cmpl $0x906, %edx            # imm = 0x906
je 0x1c0d0
cmpl $0x90b, %edx            # imm = 0x90B
je 0x1c0e8
cmpl $0x91c, %edx            # imm = 0x91C
je 0x1c0d0
cmpl $0x92d, %edx            # imm = 0x92D
je 0x1c0c3
cmpl $0x942, %edx            # imm = 0x942
je 0x1c0d0
cmpl $0x947, %edx            # imm = 0x947
je 0x1c0c3
cmpl $0x95b, %edx            # imm = 0x95B
je 0x1c0e8
cmpl $0x96a, %edx            # imm = 0x96A
je 0x1c0d0
cmpl $0x97e, %edx            # imm = 0x97E
je 0x1c0d0
cmpl $0x983, %edx            # imm = 0x983
je 0x1c0c3
cmpl $0x9a3, %edx            # imm = 0x9A3
je 0x1c0d0
cmpl $0x9c5, %edx            # imm = 0x9C5
je 0x1c0d0
cmpl $0x9ca, %edx            # imm = 0x9CA
je 0x1c0c3
cmpl $0x9e7, %edx            # imm = 0x9E7
je 0x1c0e8
cmpl $0xa00, %edx            # imm = 0xA00
je 0x1c0d0
cmpl $0xa05, %edx            # imm = 0xA05
je 0x1c0c3
cmpl $0xa19, %edx            # imm = 0xA19
je 0x1c0e8
cmpl $0xa28, %edx            # imm = 0xA28
je 0x1c0d0
cmpl $0xa3c, %edx            # imm = 0xA3C
je 0x1c0d0
cmpl $0xa41, %edx            # imm = 0xA41
je 0x1c0c3
cmpl $0xa55, %edx            # imm = 0xA55
je 0x1c0e8
cmpl $0xa78, %edx            # imm = 0xA78
je 0x1c0d0
cmpl $0xa7d, %edx            # imm = 0xA7D
je 0x1c0c3
cmpl $0xa91, %edx            # imm = 0xA91
je 0x1c0d0
cmpl $0xa9e, %edx            # imm = 0xA9E
je 0x1c0e8
cmpl $0xabb, %edx            # imm = 0xABB
je 0x1c0d0
cmpl $0xac0, %edx            # imm = 0xAC0
je 0x1c0c3
cmpl $0xad4, %edx            # imm = 0xAD4
je 0x1c0d0
cmpl $0xad9, %edx            # imm = 0xAD9
je 0x1c0e8
cmpl $0xafa, %edx            # imm = 0xAFA
je 0x1c0d0
cmpl $0xaff, %edx            # imm = 0xAFF
je 0x1c0c3
cmpl $0xb13, %edx            # imm = 0xB13
je 0x1c0e8
cmpl $0xb2b, %edx            # imm = 0xB2B
je 0x1c0d0
cmpl $0xb36, %edx            # imm = 0xB36
je 0x1c0d0
cmpl $0xb3b, %edx            # imm = 0xB3B
je 0x1c0c3
cmpl $0xb4f, %edx            # imm = 0xB4F
je 0x1c0e8
cmpl $0xb72, %edx            # imm = 0xB72
je 0x1c0d0
cmpl $0xb77, %edx            # imm = 0xB77
je 0x1c0c3
cmpl $0xb8b, %edx            # imm = 0xB8B
je 0x1c0e8
cmpl $0xb9b, %edx            # imm = 0xB9B
je 0x1c0d0
cmpl $0xbb4, %edx            # imm = 0xBB4
je 0x1c0d0
cmpl $0xee2, %edx            # imm = 0xEE2
je 0x1c0d0
cmpl $0xbcd, %edx            # imm = 0xBCD
je 0x1c0e8
cmpl $0xbdc, %edx            # imm = 0xBDC
je 0x1c0d0
cmpl $0xed8, %edx            # imm = 0xED8
je 0x1c0d0
cmpl $0xbb9, %edx            # imm = 0xBB9
jne 0x1c11a
movzwl %cx, %edx
cmpl $0x4, %ecx
ja 0x1c0ff
leal (%rax,%rdx,4), %eax
jmp 0x1c0f3
movzwl %cx, %edx
cmpl $0x4, %ecx
ja 0x1c0e1
addl %edx, %eax
movw %ax, 0xe(%r15)
jmp 0x1c0f8
subl %edx, %eax
addl $0x8, %eax
jmp 0x1c110
movzwl %cx, %edx
cmpl $0x4, %ecx
ja 0x1c109
leal (%rax,%rdx,2), %eax
movw %ax, 0xe(%r15)
andb $-0x5, 0xc(%r15)
jmp 0x1c11a
shll $0x2, %edx
subl %edx, %eax
addl $0x20, %eax
jmp 0x1c110
addl %edx, %edx
subl %edx, %eax
addl $0x10, %eax
movw %ax, 0xe(%r15)
orb $0x4, 0xc(%r15)
movzwl 0x1a(%r15), %eax
movl %eax, %ecx
decl %ecx
cmpw $0x8, %cx
setae %cl
cmpw $0x2, %ax
sete %al
orb %cl, %al
jne 0x1c1cb
movswq 0x1e(%r15), %rax
imulq $0xc, %rax, %rax
movl (%r15), %edx
leaq 0xc6b14(%rip), %rcx     # 0xe2c60
movl (%rcx,%rax), %ecx
movl %ecx, (%r15)
subl %ecx, %edx
je 0x1c170
leaq 0xbf823(%rip), %rsi     # 0xdb980
movslq (%rsi), %rsi
movslq %edx, %rdx
imulq %rsi, %rdx
shrq $0x10, %rdx
addl %edx, %ecx
movl %ecx, (%r15)
addq 0xaae41(%rip), %rax     # 0xc6fb8
movl 0x4(%r15), %edx
movl 0x4(%rax), %ecx
movl %ecx, 0x4(%r15)
subl %ecx, %edx
je 0x1c1a1
leaq 0xbf7f3(%rip), %rsi     # 0xdb980
movslq (%rsi), %rsi
movslq %edx, %rdx
imulq %rsi, %rdx
shrq $0x10, %rdx
addl %edx, %ecx
movl %ecx, 0x4(%r15)
movl 0x8(%r15), %ecx
movl 0x8(%rax), %eax
movl %eax, 0x8(%r15)
subl %eax, %ecx
je 0x1c1cb
leaq 0xbf7c9(%rip), %rdx     # 0xdb980
movslq (%rdx), %rdx
movslq %ecx, %rcx
imulq %rdx, %rcx
shrq $0x10, %rcx
addl %ecx, %eax
movl %eax, 0x8(%r15)
incl %r12d
addq $0x2c, %r15
jmp 0x1bc09
movzwl %cx, %edx
cmpl $0x4, %ecx
ja 0x1c1f8
addl %edx, %eax
jmp 0x1c110
movzwl %cx, %edx
cmpl $0x4, %ecx
ja 0x1c202
leal (%rdx,%rdx,2), %ecx
addl %ecx, %eax
jmp 0x1c0da
subl %edx, %eax
addl $0x8, %eax
jmp 0x1c0da
pushq $0x8
popq %rcx
subl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
addl %ecx, %eax
jmp 0x1c110
movzwl %cx, %eax
cmpl $0x4, %ecx
ja 0x1c223
addl $0x232, %eax            # imm = 0x232
jmp 0x1c0f3
movl $0x23a, %ecx            # imm = 0x23A
subl %eax, %ecx
movw %cx, 0xe(%r15)
jmp 0x1c115
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq