// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x10, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movb $0x0, -0x9(%rbp)
leaq 0xec13e(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x2dde8
jmp 0x2e1fd
movswl -0x2(%rbp), %edi
callq 0x11c50
cmpl $0x0, %eax
jne 0x2de04
leaq 0xac56e(%rip), %rdi     # 0xda36b
movb $0x0, %al
callq 0x44240
movswq -0x2(%rbp), %rcx
leaq 0x1008d0(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x2143c4(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movswl 0x22(%rax), %eax
cmpl $0x13a6, %eax           # imm = 0x13A6
jne 0x2de65
movswq -0x2(%rbp), %rcx
leaq 0x1008a9(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x21439d(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movw 0x24(%rax), %ax
testw %ax, %ax
jne 0x2de60
jmp 0x2de52
leaq 0xac52d(%rip), %rdi     # 0xda386
movb $0x0, %al
callq 0x1a150
jmp 0x2e1fd
movswq -0x2(%rbp), %rcx
leaq 0x10086f(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x214363(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movswl 0x22(%rax), %eax
cmpl $0x139c, %eax           # imm = 0x139C
je 0x2de91
jmp 0x2e1fd
leaq 0x58a4b8(%rip), %rax    # 0x5b8350
movw (%rax), %ax
movw %ax, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $-0x1, %eax
je 0x2df0b
movswq -0x4(%rbp), %rcx
leaq 0x592cac(%rip), %rax    # 0x5c0b60
movw (%rax,%rcx,2), %ax
movw %ax, -0x6(%rbp)
movswq -0x4(%rbp), %rcx
leaq 0x14c318(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x28(%rax), %eax
movswq -0x2(%rbp), %rdx
leaq 0x100804(%rip), %rcx    # 0x12e6e0
movswq (%rcx,%rdx,2), %rdx
leaq 0x2142f8(%rip), %rcx    # 0x2421e0
movq (%rcx,%rdx,8), %rcx
movswl 0x24(%rcx), %ecx
cmpl %ecx, %eax
jne 0x2df01
movswl -0x4(%rbp), %edi
callq 0x2ca20
movb $0x1, -0x9(%rbp)
movw -0x6(%rbp), %ax
movw %ax, -0x4(%rbp)
jmp 0x2de9f
leaq 0x58a43e(%rip), %rax    # 0x5b8350
movw 0x194(%rax), %ax
movw %ax, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $-0x1, %eax
je 0x2dfe6
movswq -0x4(%rbp), %rcx
leaq 0x592c2a(%rip), %rax    # 0x5c0b60
movw (%rax,%rcx,2), %ax
movw %ax, -0x6(%rbp)
movswq -0x4(%rbp), %rcx
leaq 0x14c296(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x28(%rax), %eax
movswq -0x2(%rbp), %rdx
leaq 0x100782(%rip), %rcx    # 0x12e6e0
movswq (%rcx,%rdx,2), %rdx
leaq 0x214276(%rip), %rcx    # 0x2421e0
movq (%rcx,%rdx,8), %rcx
movswl 0x24(%rcx), %ecx
cmpl %ecx, %eax
jne 0x2dfd9
movswq -0x4(%rbp), %rcx
leaq 0x14c25e(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw 0x2a(%rax), %ax
movw %ax, -0x8(%rbp)
movswl -0x8(%rbp), %edi
callq 0x2ae90
cmpl $0x0, %eax
jne 0x2dfaa
movswl -0x4(%rbp), %edi
movl $0x12c, %esi            # imm = 0x12C
callq 0x2b180
movswq -0x4(%rbp), %rcx
leaq 0x1f422a(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x4, %ecx
movw %cx, 0x6(%rax)
movw -0x4(%rbp), %ax
movswl %ax, %edi
movswl -0x8(%rbp), %esi
callq 0x2e210
movb $0x1, -0x9(%rbp)
movw -0x6(%rbp), %ax
movw %ax, -0x4(%rbp)
jmp 0x2df1d
leaq 0x58a363(%rip), %rax    # 0x5b8350
movw 0x196(%rax), %ax
movw %ax, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $-0x1, %eax
je 0x2e0cb
movswq -0x4(%rbp), %rcx
leaq 0x592b4f(%rip), %rax    # 0x5c0b60
movw (%rax,%rcx,2), %ax
movw %ax, -0x6(%rbp)
movswq -0x4(%rbp), %rcx
leaq 0x14c1bb(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x28(%rax), %eax
movswq -0x2(%rbp), %rdx
leaq 0x1006a7(%rip), %rcx    # 0x12e6e0
movswq (%rcx,%rdx,2), %rdx
leaq 0x21419b(%rip), %rcx    # 0x2421e0
movq (%rcx,%rdx,8), %rcx
movswl 0x24(%rcx), %ecx
cmpl %ecx, %eax
jne 0x2e0be
movswq -0x4(%rbp), %rcx
leaq 0x14c183(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw 0x2a(%rax), %ax
movw %ax, -0x8(%rbp)
cwtl
cmpl $-0x1, %eax
je 0x2e0bc
movswq -0x8(%rbp), %rcx
leaq 0x1f4165(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
andl $-0x41, %ecx
movw %cx, 0x6(%rax)
movw -0x4(%rbp), %ax
movswl %ax, %edi
movswl -0x8(%rbp), %esi
callq 0x2e390
movswq -0x8(%rbp), %rcx
leaq 0x1f413a(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x80, %ecx
movw %cx, 0x6(%rax)
movb $0x1, -0x9(%rbp)
jmp 0x2e0be
movw -0x6(%rbp), %ax
movw %ax, -0x4(%rbp)
jmp 0x2dff8
leaq 0x58a27e(%rip), %rax    # 0x5b8350
movw 0x192(%rax), %ax
movw %ax, -0x4(%rbp)
movswl -0x4(%rbp), %eax
cmpl $-0x1, %eax
je 0x2e1d5
movswq -0x4(%rbp), %rcx
leaq 0x592a6a(%rip), %rax    # 0x5c0b60
movw (%rax,%rcx,2), %ax
movw %ax, -0x6(%rbp)
movswq -0x4(%rbp), %rcx
leaq 0x14c0d6(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movw 0x2a(%rax), %ax
movw %ax, -0x8(%rbp)
movswl -0x8(%rbp), %edi
callq 0x2ae90
cmpl $0x0, %eax
je 0x2e143
movswq -0x8(%rbp), %rcx
leaq 0x1f40b0(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movswl 0x8(%rax), %eax
cmpl $0xcb, %eax
jne 0x2e1c8
movswq -0x4(%rbp), %rcx
leaq 0x14c091(%rip), %rax    # 0x17a1e0
movq (%rax,%rcx,8), %rax
movswl 0x28(%rax), %eax
movswq -0x2(%rbp), %rdx
leaq 0x10057d(%rip), %rcx    # 0x12e6e0
movswq (%rcx,%rdx,2), %rdx
leaq 0x214071(%rip), %rcx    # 0x2421e0
movq (%rcx,%rdx,8), %rcx
movswl 0x24(%rcx), %ecx
cmpl %ecx, %eax
jne 0x2e196
movswq -0x8(%rbp), %rcx
leaq 0x1f4059(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
andl $-0x41, %ecx
movw %cx, 0x6(%rax)
movw -0x4(%rbp), %ax
movswl %ax, %edi
movswl -0x8(%rbp), %esi
callq 0x2e390
movswq -0x8(%rbp), %rcx
leaq 0x1f402e(%rip), %rax    # 0x2221e0
movq (%rax,%rcx,8), %rax
movzwl 0x6(%rax), %ecx
orl $0x80, %ecx
movw %cx, 0x6(%rax)
movb $0x1, -0x9(%rbp)
movw -0x6(%rbp), %ax
movw %ax, -0x4(%rbp)
jmp 0x2e0dd
cmpb $0x0, -0x9(%rbp)
je 0x2e1fd
movswq -0x2(%rbp), %rcx
leaq 0x1004f9(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x213fed(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movw $0x0, 0x24(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)