// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: triggersprite
void
triggersprite(short sn)
{
     int      datag;
     short     j;
     short     newext;

     if( option[4] != 0 ) {
          return;
     }

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(sn) ) {
          crashgame("messing w plrsprite at 5");
     }
    #endif

     if( sprptr[sn]->extra == -1 ) {
          return;
     }

	datag = sprptr[sn]->lotag;

     switch( datag ) {

          case SPR_LOTAG_MORPH:
               break;
          case SPR_LOTAG_SPAWNCHASE:
	          j = jsinsertsprite(sprptr[sn]->sectnum,  sprXTptr[ sprptr[sn]->extra ]->basestat);
               if ( j == -1 ) {
                    break;
               }
               newext=mapXT(j);
               if( !validext(newext) ) {
                    jsdeletesprite(j);
                    break;
               }
		     sprptr[j]->x = sprptr[sn]->x+( sintable[(sprptr[sn]->ang+512)&2047]>>6 );
		     sprptr[j]->y = sprptr[sn]->y+( sintable[sprptr[sn]->ang&2047]>>6 );
		     sprptr[j]->z = sprptr[sn]->z;
		     sprptr[j]->cstat = 0x101;
               sprptr[j]->picnum = sprXTptr[ sprptr[sn]->extra ]->basepic;
		     sprptr[j]->shade = sprptr[sn]->shade;
		     sprptr[j]->sectnum = sprptr[sn]->sectnum;
		     sprptr[j]->xrepeat = sprptr[sn]->xrepeat;
		     sprptr[j]->yrepeat = sprptr[sn]->yrepeat;
		     sprptr[j]->ang = sprptr[sn]->ang;
		     sprptr[j]->xvel = sprptr[sn]->xvel;
		     sprptr[j]->yvel = sprptr[sn]->yvel;
		     sprptr[j]->zvel = sprptr[sn]->zvel;
		     sprptr[j]->owner = -1;
		     sprptr[j]->lotag = 0;
		     sprptr[j]->hitag = 0;
               sprXTptr[ sprptr[j]->extra ]->basestat  = sprXTptr[ sprptr[sn]->extra ]->basestat;
               sprXTptr[ sprptr[j]->extra ]->basepic   = sprXTptr[ sprptr[sn]->extra ]->basepic;
               sprXTptr[ sprptr[j]->extra ]->walkpic   = sprXTptr[ sprptr[sn]->extra ]->walkpic;
               sprXTptr[ sprptr[j]->extra ]->standpic  = sprXTptr[ sprptr[sn]->extra ]->standpic;
               sprXTptr[ sprptr[j]->extra ]->runpic    = sprXTptr[ sprptr[sn]->extra ]->runpic;
               sprXTptr[ sprptr[j]->extra ]->attackpic = sprXTptr[ sprptr[sn]->extra ]->attackpic;
               sprXTptr[ sprptr[j]->extra ]->deathpic  = sprXTptr[ sprptr[sn]->extra ]->deathpic;
               sprXTptr[ sprptr[j]->extra ]->morphpic  = sprXTptr[ sprptr[sn]->extra ]->morphpic;
               sprXTptr[ sprptr[j]->extra ]->specialpic = sprXTptr[ sprptr[sn]->extra ]->specialpic;
               // delete trigger tag from old sprites
               sprptr[sn]->lotag=0;
               sprptr[sn]->hitag=0;
               clearXTpics(sn);
			break;
          default:
               newstatus(sn, sprXTptr[ sprptr[sn]->extra ]->basestat);
               break;
      }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xb1e28(%rip), %rax     # 0xd1978
cmpb $0x0, 0x4(%rax)
je 0x1fb65
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %ebp
movswl %bp, %ebx
movl %ebx, %edi
callq 0x1eb81
testl %eax, %eax
je 0x1fb83
leaq 0x70a56(%rip), %rdi     # 0x905d2
xorl %eax, %eax
callq 0x2eb88
movswq %bp, %r15
leaq 0x1116a2(%rip), %r12    # 0x131230
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rax
cmpq $-0x1, %rax
je 0x1fb56
movzwl 0x26(%rcx), %edx
cmpl $0x7d3, %edx            # imm = 0x7D3
je 0x1fb56
cmpl $0x7d0, %edx            # imm = 0x7D0
jne 0x1fbfb
movswl 0x18(%rcx), %edi
leaq 0x1b9674(%rip), %r13    # 0x1d9230
movq (%r13,%rax,8), %rax
movswl 0x8(%rax), %esi
callq 0x1eac8
cmpw $-0x1, %ax
je 0x1fb56
movl %eax, %ebp
movswl %ax, %r14d
movl %r14d, %edi
callq 0x1ec7f
testl $0xc000, %eax           # imm = 0xC000
je 0x1fc1f
movl %r14d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1eb19
leaq 0x1b962e(%rip), %rcx    # 0x1d9230
movq (%rcx,%rax,8), %rax
movswl 0x8(%rax), %esi
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1fe98
movq (%r12,%r15,8), %rax
movl $0x200, %ecx            # imm = 0x200
addl 0x1c(%rax), %ecx
movl $0x7ff, %edx            # imm = 0x7FF
andl %edx, %ecx
leaq 0x55ff97(%rip), %rsi    # 0x57fbd0
movswl (%rsi,%rcx,2), %ecx
sarl $0x6, %ecx
addl (%rax), %ecx
movswq %bp, %rax
movq (%r12,%rax,8), %rdi
movl %ecx, (%rdi)
movq (%r12,%r15,8), %rcx
movzwl 0x1c(%rcx), %edi
andl %edx, %edi
movswl (%rsi,%rdi,2), %edx
sarl $0x6, %edx
addl 0x4(%rcx), %edx
movq (%r12,%rax,8), %rcx
movl %edx, 0x4(%rcx)
movq (%r12,%r15,8), %rcx
movl 0x8(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movl %ecx, 0x8(%rdx)
movq (%r12,%rax,8), %rcx
movw $0x101, 0xc(%rcx)       # imm = 0x101
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0xa(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movw %cx, 0xe(%rdx)
movq (%r12,%r15,8), %rcx
movb 0x10(%rcx), %cl
movq (%r12,%rax,8), %rdx
movb %cl, 0x10(%rdx)
movq (%r12,%r15,8), %rcx
movzwl 0x18(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movw %cx, 0x18(%rdx)
movq (%r12,%r15,8), %rcx
movb 0x14(%rcx), %cl
movq (%r12,%rax,8), %rdx
movb %cl, 0x14(%rdx)
movq (%r12,%r15,8), %rcx
movb 0x15(%rcx), %cl
movq (%r12,%rax,8), %rdx
movb %cl, 0x15(%rdx)
movq (%r12,%r15,8), %rcx
movzwl 0x1c(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movw %cx, 0x1c(%rdx)
movq (%r12,%r15,8), %rcx
movzwl 0x20(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movw %cx, 0x20(%rdx)
movq (%r12,%r15,8), %rcx
movzwl 0x22(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movw %cx, 0x22(%rdx)
movq (%r12,%r15,8), %rcx
movzwl 0x24(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movw %cx, 0x24(%rdx)
movq (%r12,%rax,8), %rcx
movw $0xffff, 0x1e(%rcx)     # imm = 0xFFFF
movq (%r12,%rax,8), %rdx
xorl %ecx, %ecx
movw %cx, 0x26(%rdx)
movq (%r12,%rax,8), %rdx
movw %cx, 0x28(%rdx)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0x8(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0x8(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0xa(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0xa(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0xe(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0xe(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0xc(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0xc(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0x10(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0x10(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0x12(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0x12(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0x14(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0x14(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0x1a(%rdx), %edx
movq (%r12,%rax,8), %rsi
movswq 0x2a(%rsi), %rsi
movq (%r13,%rsi,8), %rsi
movw %dx, 0x1a(%rsi)
movq (%r12,%r15,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movzwl 0x1c(%rdx), %edx
movq (%r12,%rax,8), %rax
movswq 0x2a(%rax), %rax
movq (%r13,%rax,8), %rax
movw %dx, 0x1c(%rax)
movq (%r12,%r15,8), %rax
movw %cx, 0x26(%rax)
movq (%r12,%r15,8), %rax
movw %cx, 0x28(%rax)
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ebe0