// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/tekstat.c
// Function: sectortriggersprites
void
sectortriggersprites(short snum)
{
     short     i,nexti,ext;
     char      triggered=0;

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

     if( !validplayer(snum) ) {
          crashgame("sectrtrgrsprts: bad plrnum");
     }

     if( sectptr[cursectnum[snum]]->lotag == SECT_LOTAG_SHOWMESSAGE ) {
           switch( sectptr[cursectnum[snum]]->hitag ) {
           case 0:
                 showmessage("AREA IS OFF-LIMITS");
                 break;
           }
           return;
     }
     if( sectptr[cursectnum[snum]]->lotag != SECT_LOTAG_TRIGGERSPRITE ) {
          return;
     }

     i=headspritestat[INANIMATE];
     while (i != -1) {
          nexti=nextspritestat[i];
          if (sprptr[i]->hitag == sectptr[cursectnum[snum]]->hitag) {
               triggersprite(i);
               triggered=1;
          }
          i=nexti;
     }

     i=headspritestat[AMBUSH];
     while (i != -1) {
          nexti=nextspritestat[i];
          if( sprptr[i]->hitag == sectptr[cursectnum[snum]]->hitag ) {
               ext=sprptr[i]->extra;
               if( !validext(ext) ) {
                    noextcrashgame(i, 300);
               }
               sprXTptr[i]->aimask|=AI_JUSTSHOTAT;
               ambushyell(i, ext);
               triggered=1;
          }
          i=nexti;
     }

     i=headspritestat[GUARD];
     while (i != -1) {
          nexti=nextspritestat[i];
          if( sprptr[i]->hitag == sectptr[cursectnum[snum]]->hitag ) {
               if( (ext=sprptr[i]->extra) != -1 ) {
                    sprXTptr[ext]->aimask&=~AI_GAVEWARNING;
                    givewarning(i, ext);
                    sprXTptr[ext]->aimask|=AI_ENCROACHMENT;
                    triggered=1;
               }
          }
          i=nexti;
     }

     i=headspritestat[STANDING];   // check GUARDS who are standing
     while (i != -1) {
          nexti=nextspritestat[i];
          ext=sprptr[i]->extra;
          if( (!validext(ext)) || (sprXTptr[ext]->basestat == GUARD) ) {
               if( sprptr[i]->hitag == sectptr[cursectnum[snum]]->hitag )
                    sprXTptr[ext]->aimask&=~AI_GAVEWARNING;
                    givewarning(i, ext);
                    sprXTptr[ext]->aimask|=AI_ENCROACHMENT;
                    triggered=1;
          }
          i=nexti;
     }

     if( triggered ) {
          sectptr[cursectnum[snum]]->hitag=0;
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xa9161(%rip), %rax     # 0xc7978
cmpb $0x0, 0x4(%rax)
je 0x1e82c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %ebx
movswl %bx, %edi
callq 0xe2e0
testl %eax, %eax
jne 0x1e848
leaq 0x63d0e(%rip), %rdi     # 0x8254f
xorl %eax, %eax
callq 0x2acb8
movswq %bx, %r14
leaq 0xbcecd(%rip), %r8      # 0xdb720
movswq (%r8,%r14,2), %rax
leaq 0x1d09d1(%rip), %r12    # 0x1ef230
movq (%r12,%rax,8), %rax
movzwl 0x22(%rax), %ecx
cmpl $0x139c, %ecx           # imm = 0x139C
je 0x1e89a
cmpl $0x13a6, %ecx           # imm = 0x13A6
jne 0x1e81d
cmpw $0x0, 0x24(%rax)
jne 0x1e81d
leaq 0x63ce5(%rip), %rdi     # 0x8256a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1373a
leaq 0x546aff(%rip), %rax    # 0x5653a0
movzwl (%rax), %ebx
movb $0x1, %al
leaq 0x54f303(%rip), %r13    # 0x56dbb0
leaq 0x10897c(%rip), %rbp    # 0x127230
cmpw $-0x1, %bx
je 0x1e8f1
movl %ebx, %ecx
movswq %bx, %rdx
movzwl (%r13,%rdx,2), %ebx
movq (%rbp,%rdx,8), %rdx
movzwl 0x28(%rdx), %edx
movswq (%r8,%r14,2), %rsi
movq (%r12,%rsi,8), %rsi
cmpw 0x24(%rsi), %dx
jne 0x1e8b4
movswl %cx, %edi
callq 0x1de10
leaq 0xbce33(%rip), %r8      # 0xdb720
xorl %eax, %eax
jmp 0x1e8b4
leaq 0x546aa8(%rip), %rcx    # 0x5653a0
movzwl 0x194(%rcx), %ebx
leaq 0x1b092a(%rip), %r9     # 0x1cf230
cmpw $-0x1, %bx
je 0x1e98b
movl %ebx, %ecx
movswq %bx, %r15
movzwl (%r13,%r15,2), %ebx
movq (%rbp,%r15,8), %rdx
movzwl 0x28(%rdx), %esi
movswq (%r8,%r14,2), %rdi
movq (%r12,%rdi,8), %rdi
cmpw 0x24(%rdi), %si
jne 0x1e906
movswl %cx, %edi
movzwl 0x2a(%rdx), %ecx
cmpw $0x4000, %cx            # imm = 0x4000
jb 0x1e965
movl %edi, 0x4(%rsp)
movl 0x4(%rsp), %edi
movl $0x12c, %esi            # imm = 0x12C
movw %cx, 0x2(%rsp)
callq 0x1d148
movzwl 0x2(%rsp), %ecx
movl 0x4(%rsp), %edi
leaq 0x1b08cb(%rip), %r9     # 0x1cf230
movq (%r9,%r15,8), %rax
orw $0x4, 0x6(%rax)
movswl %cx, %esi
callq 0x1eaa0
leaq 0x1b08b3(%rip), %r9     # 0x1cf230
xorl %eax, %eax
leaq 0xbcd9a(%rip), %r8      # 0xdb720
jmp 0x1e906
leaq 0x546a0e(%rip), %rcx    # 0x5653a0
movzwl 0x196(%rcx), %r15d
cmpw $-0x1, %r15w
je 0x1ea00
movl %r15d, %ecx
movswq %r15w, %rdx
movzwl (%r13,%rdx,2), %r15d
movq (%rbp,%rdx,8), %rdx
movzwl 0x28(%rdx), %esi
movswq (%r8,%r14,2), %rdi
movq (%r12,%rdi,8), %rdi
cmpw 0x24(%rdi), %si
jne 0x1e99a
movswq 0x2a(%rdx), %rbx
cmpq $-0x1, %rbx
je 0x1e99a
movq (%r9,%rbx,8), %rax
andw $-0x41, 0x6(%rax)
movswl %cx, %edi
movl %ebx, %esi
callq 0x1eb5a
leaq 0x1b0845(%rip), %r9     # 0x1cf230
leaq 0xbcd2e(%rip), %r8      # 0xdb720
movq (%r9,%rbx,8), %rax
orw $0x80, 0x6(%rax)
xorl %eax, %eax
jmp 0x1e99a
leaq 0x546999(%rip), %rcx    # 0x5653a0
movzwl 0x192(%rcx), %ebx
cmpw $-0x1, %bx
je 0x1ea85
movl %ebx, %ecx
movswq %bx, %rdx
movzwl (%r13,%rdx,2), %ebx
movq (%rbp,%rdx,8), %rsi
movzwl 0x2a(%rsi), %edx
cmpq $0x3fff, %rdx           # imm = 0x3FFF
ja 0x1ea3e
movq (%r9,%rdx,8), %rdi
cmpw $0xcb, 0x8(%rdi)
jne 0x1ea0e
movswq %dx, %r15
movzwl 0x28(%rsi), %eax
movswq (%r8,%r14,2), %rsi
movq (%r12,%rsi,8), %rsi
cmpw 0x24(%rsi), %ax
jne 0x1ea5e
movq (%r9,%r15,8), %rax
andw $-0x41, 0x6(%rax)
movswl %cx, %edi
movswl %dx, %esi
callq 0x1eb5a
leaq 0x1b07c0(%rip), %r9     # 0x1cf230
movq (%r9,%r15,8), %rax
orw $0x80, 0x6(%rax)
xorl %eax, %eax
leaq 0xbcc9d(%rip), %r8      # 0xdb720
jmp 0x1ea0e
testb $0x1, %al
jne 0x1e81d
movswq (%r8,%r14,2), %rax
movq (%r12,%rax,8), %rax
andw $0x0, 0x24(%rax)
jmp 0x1e81d