// File: /workspace/github_c_makefile_star2_O3/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 0xb13b3(%rip), %rax     # 0xd1978
cmpb $0x0, 0x4(%rax)
je 0x205da
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edi, %ebx
movswl %bx, %edi
callq 0xf230
testl %eax, %eax
jne 0x205f6
leaq 0x6fffc(%rip), %rdi     # 0x905eb
xorl %eax, %eax
callq 0x2eb88
movswq %bx, %r15
leaq 0xc511f(%rip), %r12     # 0xe5720
movswq (%r12,%r15,2), %rax
leaq 0x1d8c23(%rip), %r13    # 0x1f9230
movq (%r13,%rax,8), %rax
movzwl 0x22(%rax), %ecx
cmpl $0x139c, %ecx           # imm = 0x139C
je 0x20649
cmpl $0x13a6, %ecx           # imm = 0x13A6
jne 0x205cb
cmpw $0x0, 0x24(%rax)
jne 0x205cb
leaq 0x6ffd2(%rip), %rdi     # 0x90606
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x14be7
leaq 0x54ed50(%rip), %rax    # 0x56f3a0
movzwl (%rax), %ecx
xorl %eax, %eax
cmpw $-0x1, %cx
je 0x2069b
leaq 0x55754e(%rip), %rbx    # 0x577bb0
leaq 0x110bc7(%rip), %r14    # 0x131230
movswq %cx, %rdx
movzwl (%rbx,%rdx,2), %ebp
movq (%r14,%rdx,8), %rdx
movzwl 0x28(%rdx), %edx
movswq (%r12,%r15,2), %rsi
movq (%r13,%rsi,8), %rsi
cmpw 0x24(%rsi), %dx
jne 0x20693
movswl %cx, %edi
callq 0x1fb3e
movb $0x1, %al
movl %ebp, %ecx
cmpw $-0x1, %bp
jne 0x20669
leaq 0x54ecfe(%rip), %rcx    # 0x56f3a0
movzwl 0x194(%rcx), %ebp
cmpw $-0x1, %bp
je 0x2075b
leaq 0x5574f6(%rip), %rdi    # 0x577bb0
leaq 0x110b6f(%rip), %r8     # 0x131230
movq %r15, (%rsp)
movswq %bp, %r14
movzwl (%rdi,%r14,2), %ebp
movq (%r8,%r14,8), %rcx
movzwl 0x28(%rcx), %edx
movswq (%r12,%r15,2), %rsi
movq (%r13,%rsi,8), %rsi
cmpw 0x24(%rsi), %dx
jne 0x20751
movq %r13, %r15
movq %r12, %r13
movq %rdi, %r12
movzwl 0x2a(%rcx), %ebx
cmpl $0x4000, %ebx           # imm = 0x4000
jb 0x20720
imulq $0x2c, %r14, %rax
leaq 0x40d42a(%rip), %rcx    # 0x42db30
movl (%rcx,%rax), %esi
movl 0x4(%rcx,%rax), %edx
leaq 0x6fdd9(%rip), %rdi     # 0x904ed
movl $0x12c, %ecx            # imm = 0x12C
xorl %eax, %eax
callq 0x2eb88
leaq 0x1b8b09(%rip), %rax    # 0x1d9230
movq (%rax,%r14,8), %rax
orw $0x4, 0x6(%rax)
movswl %bx, %esi
movl %r14d, %edi
callq 0x208a9
movb $0x1, %al
movq %r12, %rdi
movq %r13, %r12
movq %r15, %r13
movq (%rsp), %r15
leaq 0x110adf(%rip), %r8     # 0x131230
cmpw $-0x1, %bp
jne 0x206c5
leaq 0x54ec3e(%rip), %rcx    # 0x56f3a0
movzwl 0x196(%rcx), %ebp
cmpw $-0x1, %bp
je 0x207fb
leaq 0x557436(%rip), %r14    # 0x577bb0
leaq 0x110aaf(%rip), %r9     # 0x131230
movl %ebp, %ecx
movswq %bp, %rdx
movzwl (%r14,%rdx,2), %ebp
movq (%r9,%rdx,8), %rdx
movzwl 0x28(%rdx), %esi
movswq (%r12,%r15,2), %rdi
movq (%r13,%rdi,8), %rdi
cmpw 0x24(%rdi), %si
jne 0x207f5
movswq 0x2a(%rdx), %rbx
cmpq $-0x1, %rbx
je 0x207f5
leaq 0x1b8a7a(%rip), %rax    # 0x1d9230
movq (%rax,%rbx,8), %rax
andw $-0x41, 0x6(%rax)
movswl %cx, %edi
movl %ebx, %esi
movq %r12, %r13
movq %r15, %r12
movq %r9, %r15
callq 0x2096b
movq %r15, %r9
movq %r12, %r15
movq %r13, %r12
leaq 0x1d8a4e(%rip), %r13    # 0x1f9230
leaq 0x1b8a47(%rip), %rax    # 0x1d9230
movq (%rax,%rbx,8), %rax
orw $0x80, 0x6(%rax)
movb $0x1, %al
cmpw $-0x1, %bp
jne 0x20781
leaq 0x54eb9e(%rip), %rcx    # 0x56f3a0
movzwl 0x192(%rcx), %ecx
cmpw $-0x1, %cx
je 0x2088c
leaq 0x1b8a1a(%rip), %rbp    # 0x1d9230
movswq %cx, %rdx
leaq 0x55738f(%rip), %rsi    # 0x577bb0
movzwl (%rsi,%rdx,2), %ebx
leaq 0x110a04(%rip), %rsi    # 0x131230
movq (%rsi,%rdx,8), %rsi
movzwl 0x2a(%rsi), %edx
cmpq $0x3fff, %rdx           # imm = 0x3FFF
ja 0x2084a
movq (%rbp,%rdx,8), %rdi
cmpw $0xcb, 0x8(%rdi)
jne 0x20884
movswq %dx, %r14
movzwl 0x28(%rsi), %eax
movswq (%r12,%r15,2), %rsi
movq (%r13,%rsi,8), %rsi
cmpw 0x24(%rsi), %ax
jne 0x2086c
movq (%rbp,%r14,8), %rax
andw $-0x41, 0x6(%rax)
movswl %cx, %edi
movswl %dx, %esi
callq 0x2096b
movq (%rbp,%r14,8), %rax
orw $0x80, 0x6(%rax)
movb $0x1, %al
movl %ebx, %ecx
cmpw $-0x1, %bx
jne 0x20816
testb %al, %al
je 0x205cb
movswq (%r12,%r15,2), %rax
movq (%r13,%rax,8), %rax
movw $0x0, 0x24(%rax)
jmp 0x205cb