// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/teksnd.c
// Function: updatesounds
void
updatesounds(int snum)
{
     int      dist=0L,pan=0L,dx,dy;
     int       i;

     if( (toggles[TOGGLE_SOUND] == 0) || !fxstarted )
          return;

     for( i=0; i<MAXSOUNDS; i++ ) {
          if( dsound[i].handle == NULL_HANDLE ) {
               continue;
          }
          if( (dsound[i].type&(ST_IMMEDIATE|ST_NOUPDATE|ST_VEHUPDATE)) != 0 ) {
               continue;
          }
          /*
          dist=klabs(posx[snum]-dsoundptr[i]->x)+labs(posy[snum]-dsoundptr[i]->y);
          if(dsoundptr[i]->type==ST_AMBUPDATE) {
               if( dist < AMBUPDATEDIST ) {
                    vol = (AMBUPDATEDIST<<3)-(dist<<3);
               }
               else {
                    vol=0;
               }
          }
          else {
               if(dist < 1500L)
                    vol = 0x7fff;
               else if(dist > 8500L)
                    vol = 0x1f00;
               else
                    vol = 39000L-(dist<<2);
          }
          */

          dx = klabs(posx[snum]-dsound[i].x);
          dy = klabs(posy[snum]-dsound[i].y);
          dist = ksqrt(dx*dx+dy*dy) >> 6;

          pan = 2048 + ang[snum] - getangle(posx[snum]-dsound[i].x,posy[snum]-dsound[i].y);
          pan = (pan & 2047) >> 6;

          if( dsound[i].handle != NULL_HANDLE )
               FX_Pan3D(dsound[i].handle,pan,dist);
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
leaq 0xf2c60(%rip), %rax     # 0x11a000
cmpl $0x0, 0xc(%rax)
je 0x273af
cmpl $0x0, 0x24ae73(%rip)    # 0x272220
jne 0x273b4
jmp 0x27537
movl $0x0, -0x18(%rbp)
cmpl $0x10, -0x18(%rbp)
jge 0x27537
movslq -0x18(%rbp), %rcx
leaq 0x24ae60(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
jne 0x273e1
jmp 0x27529
movslq -0x18(%rbp), %rcx
leaq 0x24ae44(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
andl $0x85, %eax
cmpl $0x0, %eax
je 0x27406
jmp 0x27529
movslq -0x4(%rbp), %rcx
leaq 0x10643f(%rip), %rax    # 0x12d850
movl (%rax,%rcx,4), %edi
movslq -0x18(%rbp), %rcx
leaq 0x24ae11(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subl 0xc(%rax), %edi
callq 0x271a0
movl %eax, -0x10(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x106454(%rip), %rax    # 0x12d890
movl (%rax,%rcx,4), %edi
movslq -0x18(%rbp), %rcx
leaq 0x24ade6(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subl 0x10(%rax), %edi
callq 0x271a0
movl %eax, -0x14(%rbp)
movl -0x10(%rbp), %edi
imull -0x10(%rbp), %edi
movl -0x14(%rbp), %eax
imull -0x14(%rbp), %eax
addl %eax, %edi
callq 0x69ab0
sarl $0x6, %eax
movl %eax, -0x8(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x1063ae(%rip), %rax    # 0x12d830
movswl (%rax,%rcx,2), %eax
addl $0x800, %eax            # imm = 0x800
movl %eax, -0x1c(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x1063b7(%rip), %rax    # 0x12d850
movl (%rax,%rcx,4), %edi
movslq -0x18(%rbp), %rcx
leaq 0x24ad89(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subl 0xc(%rax), %edi
movslq -0x4(%rbp), %rcx
leaq 0x1063d4(%rip), %rax    # 0x12d890
movl (%rax,%rcx,4), %esi
movslq -0x18(%rbp), %rcx
leaq 0x24ad66(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subl 0x10(%rax), %esi
callq 0x69950
movl %eax, %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
andl $0x7ff, %eax            # imm = 0x7FF
sarl $0x6, %eax
movl %eax, -0xc(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x24ad34(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x27527
movslq -0x18(%rbp), %rcx
leaq 0x24ad1d(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edi
movl -0xc(%rbp), %esi
movl -0x8(%rbp), %edx
callq 0xccbd0
jmp 0x27529
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x273bb
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)