// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/teksnd.c
// Function: updatevehiclesnds
void
updatevehiclesnds(int i, int sndx, int sndy)
{
     int dx, dy, dist, pan;
     if( !fxstarted ) {
          return;
     }
     if( (i < 0) || (i > MAXSOUNDS) ) {
          return;
     }

     dsound[i].x=sndx;
     dsound[i].y=sndy;

     /*
     dist=labs(posx[screenpeek]-sndx)+labs(posy[screenpeek]-sndy);
     if( dist < 1000L ) {
          vol = 0x7fff;
     }
     else if( dist > 9000L ) {
          vol = 0x0000;
     }
     else {
          vol = 36000L-(dist<<2);
     }
     if( (vol < 0) || (vol > 0x7FFF) ) {
          vol=0x7fff;
     }
     pan=((getangle(posx[screenpeek]-dsoundptr[i]->x,posy[screenpeek]-dsoundptr[i]->y)+(2047-ang[screenpeek]))&2047) >> 6;
     if( (pan < 0) || (pan > 35) )
          pan=13;
     */

     dx = klabs(posx[screenpeek]-sndx);
     dy = klabs(posy[screenpeek]-sndy);
     dist = ksqrt(dx*dx+dy*dy) >> 6;

     pan = 2048 + ang[screenpeek] - getangle(posx[screenpeek]-sndx,posy[screenpeek]-sndy);
     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 %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
cmpl $0x0, 0x24b038(%rip)    # 0x272220
jne 0x271ef
jmp 0x2732c
cmpl $0x0, -0x4(%rbp)
jl 0x271fb
cmpl $0x10, -0x4(%rbp)
jle 0x27200
jmp 0x2732c
movl -0x8(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x24b022(%rip), %rax    # 0x272230
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl -0xc(%rbp), %ecx
movslq -0x4(%rbp), %rdx
leaq 0x24b00a(%rip), %rax    # 0x272230
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
leaq 0x1065a7(%rip), %rax    # 0x12d7de
movswq (%rax), %rcx
leaq 0x10660e(%rip), %rax    # 0x12d850
movl (%rax,%rcx,4), %edi
subl -0x8(%rbp), %edi
callq 0x271a0
movl %eax, -0x10(%rbp)
leaq 0x106587(%rip), %rax    # 0x12d7de
movswq (%rax), %rcx
leaq 0x10662e(%rip), %rax    # 0x12d890
movl (%rax,%rcx,4), %edi
subl -0xc(%rbp), %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, -0x18(%rbp)
leaq 0x10654c(%rip), %rax    # 0x12d7de
movswq (%rax), %rcx
leaq 0x106593(%rip), %rax    # 0x12d830
movswl (%rax,%rcx,2), %eax
addl $0x800, %eax            # imm = 0x800
movl %eax, -0x20(%rbp)
leaq 0x10652e(%rip), %rax    # 0x12d7de
movswq (%rax), %rcx
leaq 0x106595(%rip), %rax    # 0x12d850
movl (%rax,%rcx,4), %edi
subl -0x8(%rbp), %edi
leaq 0x106516(%rip), %rax    # 0x12d7de
movswq (%rax), %rcx
leaq 0x1065bd(%rip), %rax    # 0x12d890
movl (%rax,%rcx,4), %esi
subl -0xc(%rbp), %esi
callq 0x69950
movl %eax, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0x7ff, %eax            # imm = 0x7FF
sarl $0x6, %eax
movl %eax, -0x1c(%rbp)
movslq -0x4(%rbp), %rcx
leaq 0x24af2f(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x2732c
movslq -0x4(%rbp), %rcx
leaq 0x24af18(%rip), %rax    # 0x272230
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %edi
movl -0x1c(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0xccbd0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)