// File: /workspace/github_c_makefile_star2_O2/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 0xa9b56(%rip), %rax     # 0xc7978
cmpb $0x0, 0x4(%rax)
je 0x1de37
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 0x1cfc4
testl %eax, %eax
je 0x1de55
leaq 0x646e8(%rip), %rdi     # 0x82536
xorl %eax, %eax
callq 0x2acb8
movswq %bp, %r15
leaq 0x1093d0(%rip), %r12    # 0x127230
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rax
cmpq $-0x1, %rax
je 0x1de28
movzwl 0x26(%rcx), %edx
cmpl $0x7d3, %edx            # imm = 0x7D3
je 0x1de28
cmpl $0x7d0, %edx            # imm = 0x7D0
jne 0x1decc
movswl 0x18(%rcx), %edi
leaq 0x1b13a2(%rip), %r13    # 0x1cf230
movq (%r13,%rax,8), %rax
movswl 0x8(%rax), %esi
callq 0x1cf0c
cmpw $-0x1, %ax
je 0x1de28
movl %eax, %ebp
movswl %ax, %r14d
movl %r14d, %edi
callq 0x1d0c7
testw $0xc000, %ax            # imm = 0xC000
je 0x1def0
movl %r14d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cf5e
leaq 0x1b135d(%rip), %rcx    # 0x1cf230
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 0x1e16a
movq (%r12,%r15,8), %rax
movl $0x200, %ecx            # imm = 0x200
addl 0x1c(%rax), %ecx
movl $0x7ff, %edx            # imm = 0x7FF
andl %edx, %ecx
leaq 0x557cc6(%rip), %rsi    # 0x575bd0
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
orw $-0x1, 0x1e(%rcx)
movq (%r12,%rax,8), %rcx
andw $0x0, 0x26(%rcx)
movq (%r12,%rax,8), %rcx
andw $0x0, 0x28(%rcx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0x8(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0x8(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0xa(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0xa(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0xe(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0xe(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0xc(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0xc(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0x10(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0x10(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0x12(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0x12(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0x14(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0x14(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0x1a(%rcx), %ecx
movq (%r12,%rax,8), %rdx
movswq 0x2a(%rdx), %rdx
movq (%r13,%rdx,8), %rdx
movw %cx, 0x1a(%rdx)
movq (%r12,%r15,8), %rcx
movswq 0x2a(%rcx), %rcx
movq (%r13,%rcx,8), %rcx
movzwl 0x1c(%rcx), %ecx
movq (%r12,%rax,8), %rax
movswq 0x2a(%rax), %rax
movq (%r13,%rax,8), %rax
movw %cx, 0x1c(%rax)
movq (%r12,%r15,8), %rax
andw $0x0, 0x26(%rax)
movq (%r12,%r15,8), %rax
andw $0x0, 0x28(%rax)
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d021