// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tektag.c
// Function: checkmapsndfx
void
checkmapsndfx(short p)
{

     int       i,s;
     int       dist;
     unsigned  int      effect;
     struct    sectoreffect   *septr;

     s=cursectnum[p];
     septr=septrlist[s];

     for( i=0; i<totalmapsndfx; i++ ) {
          switch(mapsndfxptr[i]->type) {
          case MAP_SFX_AMBIENT:
               dist=abs(posx[p]-mapsndfxptr[i]->x)+abs(posy[p]-mapsndfxptr[i]->y);
               if( (dist > AMBUPDATEDIST) && (mapsndfxptr[i]->id!=-1) ) {
                    stopsound(mapsndfxptr[i]->id);
                    mapsndfxptr[i]->id=-1;
               }
               else if( (dist < AMBUPDATEDIST) && (mapsndfxptr[i]->id==-1) )  {
                    mapsndfxptr[i]->id=playsound(mapsndfxptr[i]->snum, mapsndfxptr[i]->x,mapsndfxptr[i]->y, mapsndfxptr[i]->loops, ST_AMBUPDATE);
               }
               break;
          case MAP_SFX_SECTOR:
               if((cursectnum[p] != ocursectnum[p]) && (cursectnum[p] == mapsndfxptr[i]->sector) ) {
                   mapsndfxptr[i]->id=playsound(mapsndfxptr[i]->snum, mapsndfxptr[i]->x,mapsndfxptr[i]->y, mapsndfxptr[i]->loops, ST_UNIQUE);
               }
               break;
          default:
               break;
          }
     }

     if( !Bstrncasecmp("SUBWAY",boardfilename,6) ) {
          if( ambsubloop == -1 ) {
               ambsubloop=playsound(S_SUBSTATIONLOOP, 0, 0, -1, ST_IMMEDIATE);
          }
     }
     else {
          if( ambsubloop != -1 ) {
               stopsound(ambsubloop);
               ambsubloop=-1;
          }
     }

     if( septr != NULL ) {
          effect=septr->sectorflags;
          if( (effect&flags32[SOUNDON]) != 0 ) {
               for( i=0; i<totalmapsndfx; i++ ) {
                    if( mapsndfxptr[i]->type == MAP_SFX_TOGGLED ) {
                         if( sectptr[mapsndfxptr[i]->sector]->hitag == septr->hi ) {
                              if( mapsndfxptr[i]->id == -1 ) {
                                   mapsndfxptr[i]->id=playsound(mapsndfxptr[i]->snum, mapsndfxptr[i]->x,mapsndfxptr[i]->y, mapsndfxptr[i]->loops,ST_UNIQUE | ST_IMMEDIATE);;
                              }
                         }
                    }
               }
          }
          if( (effect&flags32[SOUNDOFF]) != 0 ) {
               for( i=0; i<totalmapsndfx; i++ ) {
                    if( mapsndfxptr[i]->type == MAP_SFX_TOGGLED ) {
                         if( sectptr[mapsndfxptr[i]->sector]->hitag == septr->hi ) {
                              if( mapsndfxptr[i]->id != -1 ) {
                                   stopsound(mapsndfxptr[i]->id);
                                   mapsndfxptr[i]->id=-1;
                              }
                         }
                    }
               }
          }
     }

//     ambupdateclock=totalclock;
     ambupdateclock=lockclock;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movswq -0x2(%rbp), %rcx
leaq 0xeedc5(%rip), %rax     # 0x12e6e0
movswl (%rax,%rcx,2), %eax
movl %eax, -0xc(%rbp)
movslq -0xc(%rbp), %rcx
leaq 0x309b83(%rip), %rax    # 0x3494b0
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x2c9b5b(%rip), %eax    # 0x3094a0
jge 0x3fb75
movslq -0x8(%rbp), %rcx
leaq 0x32543a(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x14(%rax), %eax
movl %eax, -0x24(%rbp)
testl %eax, %eax
je 0x3f977
jmp 0x3f966
movl -0x24(%rbp), %eax
subl $0x1, %eax
je 0x3faac
jmp 0x3fb63
movswq -0x2(%rbp), %rcx
leaq 0xedecd(%rip), %rax     # 0x12d850
movl (%rax,%rcx,4), %eax
movslq -0x8(%rbp), %rdx
leaq 0x3253ff(%rip), %rcx    # 0x364d90
movq (%rcx,%rdx,8), %rcx
subl (%rcx), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movswq -0x2(%rbp), %rdx
leaq 0xedee6(%rip), %rcx     # 0x12d890
movl (%rcx,%rdx,4), %ecx
movslq -0x8(%rbp), %rsi
leaq 0x3253d8(%rip), %rdx    # 0x364d90
movq (%rdx,%rsi,8), %rdx
subl 0x4(%rdx), %ecx
movl %ecx, %edx
negl %edx
cmovnsl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x10(%rbp)
movslq -0x10(%rbp), %rax
cmpq $0xfa0, %rax            # imm = 0xFA0
jle 0x3fa1e
movslq -0x8(%rbp), %rcx
leaq 0x3253ae(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
cmpl $-0x1, 0x18(%rax)
je 0x3fa1e
movslq -0x8(%rbp), %rcx
leaq 0x325399(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x18(%rax), %edi
callq 0x27020
movslq -0x8(%rbp), %rcx
leaq 0x325382(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
jmp 0x3faa7
movslq -0x10(%rbp), %rax
cmpq $0xfa0, %rax            # imm = 0xFA0
jge 0x3faa5
movslq -0x8(%rbp), %rcx
leaq 0x32535b(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
cmpl $-0x1, 0x18(%rax)
jne 0x3faa5
movslq -0x8(%rbp), %rcx
leaq 0x325346(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %edi
movslq -0x8(%rbp), %rcx
leaq 0x325334(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movslq -0x8(%rbp), %rcx
leaq 0x325323(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x325311(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x10(%rax), %ecx
movl $0x60, %r8d
callq 0x26af0
movl %eax, %ecx
movslq -0x8(%rbp), %rdx
leaq 0x3252f2(%rip), %rax    # 0x364d90
movq (%rax,%rdx,8), %rax
movl %ecx, 0x18(%rax)
jmp 0x3faa7
jmp 0x3fb65
movswq -0x2(%rbp), %rcx
leaq 0xeec28(%rip), %rax     # 0x12e6e0
movswl (%rax,%rcx,2), %eax
movswq -0x2(%rbp), %rdx
leaq 0xeec78(%rip), %rcx     # 0x12e740
movswl (%rcx,%rdx,2), %ecx
cmpl %ecx, %eax
je 0x3fb61
movswq -0x2(%rbp), %rcx
leaq 0xeec00(%rip), %rax     # 0x12e6e0
movswl (%rax,%rcx,2), %eax
movslq -0x8(%rbp), %rdx
leaq 0x3252a1(%rip), %rcx    # 0x364d90
movq (%rcx,%rdx,8), %rcx
movswl 0x8(%rcx), %ecx
cmpl %ecx, %eax
jne 0x3fb61
movslq -0x8(%rbp), %rcx
leaq 0x32528a(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %edi
movslq -0x8(%rbp), %rcx
leaq 0x325278(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movslq -0x8(%rbp), %rcx
leaq 0x325267(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x325255(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x10(%rax), %ecx
movl $0x8, %r8d
callq 0x26af0
movl %eax, %ecx
movslq -0x8(%rbp), %rdx
leaq 0x325236(%rip), %rax    # 0x364d90
movq (%rax,%rdx,8), %rax
movl %ecx, 0x18(%rax)
jmp 0x3fb65
jmp 0x3fb65
jmp 0x3fb67
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x3f93c
leaq 0x9b014(%rip), %rdi     # 0xdab90
leaq 0xeec4d(%rip), %rsi     # 0x12e7d0
movl $0x6, %edx
callq 0x8d70
cmpl $0x0, %eax
jne 0x3fbbc
cmpl $-0x1, 0xdb38f(%rip)    # 0x11af28
jne 0x3fbba
movl $0x4a, %edi
xorl %edx, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x1, %r8d
movl %edx, %esi
callq 0x26af0
movl %eax, 0xdb36e(%rip)     # 0x11af28
jmp 0x3fbdc
cmpl $-0x1, 0xdb365(%rip)    # 0x11af28
je 0x3fbda
movl 0xdb35d(%rip), %edi     # 0x11af28
callq 0x27020
movl $0xffffffff, 0xdb34e(%rip) # imm = 0xFFFFFFFF
jmp 0x3fbdc
cmpq $0x0, -0x20(%rbp)
je 0x3fdb1
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
andl 0xdb2cb(%rip), %eax     # 0x11aec4
cmpl $0x0, %eax
je 0x3fcee
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x2c988e(%rip), %eax    # 0x3094a0
jge 0x3fcec
movslq -0x8(%rbp), %rcx
leaq 0x32516d(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
cmpl $0x2, 0x14(%rax)
jne 0x3fcdc
movslq -0x8(%rbp), %rcx
leaq 0x325154(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movswq 0x8(%rax), %rcx
leaq 0x202594(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movswl 0x24(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x3fcda
movslq -0x8(%rbp), %rcx
leaq 0x325128(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
cmpl $-0x1, 0x18(%rax)
jne 0x3fcd8
movslq -0x8(%rbp), %rcx
leaq 0x325113(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0xc(%rax), %edi
movslq -0x8(%rbp), %rcx
leaq 0x325101(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl (%rax), %esi
movslq -0x8(%rbp), %rcx
leaq 0x3250f0(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x4(%rax), %edx
movslq -0x8(%rbp), %rcx
leaq 0x3250de(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x10(%rax), %ecx
movl $0x9, %r8d
callq 0x26af0
movl %eax, %ecx
movslq -0x8(%rbp), %rdx
leaq 0x3250bf(%rip), %rax    # 0x364d90
movq (%rax,%rdx,8), %rax
movl %ecx, 0x18(%rax)
jmp 0x3fcda
jmp 0x3fcdc
jmp 0x3fcde
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x3fc09
jmp 0x3fcee
movl -0x14(%rbp), %eax
andl 0xdb1d1(%rip), %eax     # 0x11aec8
cmpl $0x0, %eax
je 0x3fdaf
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x2c9790(%rip), %eax    # 0x3094a0
jge 0x3fdad
movslq -0x8(%rbp), %rcx
leaq 0x32506f(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
cmpl $0x2, 0x14(%rax)
jne 0x3fd9d
movslq -0x8(%rbp), %rcx
leaq 0x32505a(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movswq 0x8(%rax), %rcx
leaq 0x20249a(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movswl 0x24(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x3fd9b
movslq -0x8(%rbp), %rcx
leaq 0x32502e(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
cmpl $-0x1, 0x18(%rax)
je 0x3fd99
movslq -0x8(%rbp), %rcx
leaq 0x325019(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl 0x18(%rax), %edi
callq 0x27020
movslq -0x8(%rbp), %rcx
leaq 0x325002(%rip), %rax    # 0x364d90
movq (%rax,%rcx,8), %rax
movl $0xffffffff, 0x18(%rax) # imm = 0xFFFFFFFF
jmp 0x3fd9b
jmp 0x3fd9d
jmp 0x3fd9f
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x3fd07
jmp 0x3fdaf
jmp 0x3fdb1
leaq 0xeda50(%rip), %rax     # 0x12d808
movl (%rax), %eax
movl %eax, 0x337d30(%rip)    # 0x377af0
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)