// File: essarrdee[P]mutantaliens/mutantaliens.cpp
// Function: make_noise(int, int, noise*)
void make_noise(int x,int y,noise* n)
{
for(std::vector<actor*>::iterator a = actors.begin(); a != actors.end(); ++a)
{
	if(!(*a)->dead && !(*a)->is_hologram)
	{
		int d2 = d22(x,y,(*a)->x,(*a)->y);
		float rel_vol = n->volume - 2*log((float)d2+1);
		float clarity = (rel_vol - (*a)->sound_threshold);
		float clarity2 = abs(clarity-ideal_clarity);
		if(clarity > 0)
		{
			(*a)->sound_threshold  = std::max((*a)->sound_threshold,rel_vol - ideal_clarity);
		}
		if((*a)->most_noticeable_sound < clarity)
		{
			int d = (int)ceil(sqrt((float)d2)/2);
			int xx, yy;
			(*a)->sound_threshold = rel_vol - ideal_clarity;
			if(clarity2 <= ideal_clarity/4)
			{
				xx = x; yy = y;
			}
			else if(clarity2 <= ideal_clarity/2)
			{
				xx = x-d/2 + rand()%(d+1);
				yy = y-d/2 + rand()%(d+1);
			}
			else if(clarity2 <= ideal_clarity)
			{
				xx = x-d + rand()%(2*d+1);
				yy = y-d + rand()%(2*d+1);
			}
			else
			{
				xx=-500;
				yy=-500;
			}
			react_to_noise(*a,n,xx,yy);
		}

		
	}
}
}

// Assembly:
subq $0x78, %rsp
movl %edi, 0x74(%rsp)
movl %esi, 0x70(%rsp)
movq %rdx, 0x68(%rsp)
leaq 0xd0f18(%rip), %rdi     # 0xe0450
callq 0x20960
movq %rax, 0x60(%rsp)
leaq 0xd0f07(%rip), %rdi     # 0xe0450
callq 0x209d0
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x20990
testb $0x1, %al
jne 0xf56b
jmp 0xf88a
leaq 0x60(%rsp), %rdi
callq 0x20a00
movq (%rax), %rax
testb $0x1, 0x1c(%rax)
jne 0xf879
leaq 0x60(%rsp), %rdi
callq 0x20a00
movq (%rax), %rax
testb $0x1, 0x9(%rax)
jne 0xf879
movl 0x74(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x70(%rsp), %eax
movl %eax, 0x28(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x20a00
movq (%rax), %rax
movl 0x20(%rax), %eax
movl %eax, 0x2c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x20a00
movl 0x24(%rsp), %edi
movl 0x28(%rsp), %esi
movl 0x2c(%rsp), %edx
movq (%rax), %rax
movl 0x24(%rax), %ecx
callq 0x6610
movl %eax, 0x54(%rsp)
movq 0x68(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x30(%rsp)
cvtsi2ssl 0x54(%rsp), %xmm0
movss 0x1da15(%rip), %xmm1    # 0x2d014
addss %xmm1, %xmm0
callq 0x20a10
movaps %xmm0, %xmm1
movss 0x30(%rsp), %xmm0
addss %xmm1, %xmm1
subss %xmm1, %xmm0
movss %xmm0, 0x50(%rsp)
movss 0x50(%rsp), %xmm0
movss %xmm0, 0x34(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x20a00
movss 0x34(%rsp), %xmm0
movq (%rax), %rax
subss 0x3c(%rax), %xmm0
movss %xmm0, 0x4c(%rsp)
movss 0x4c(%rsp), %xmm0
movss 0x1d9e5(%rip), %xmm1    # 0x2d03c
subss %xmm1, %xmm0
callq 0x20a30
movss %xmm0, 0x48(%rsp)
movss 0x4c(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0xf6c9
leaq 0x60(%rsp), %rdi
callq 0x20a00
movq (%rax), %rdi
addq $0x3c, %rdi
movss 0x50(%rsp), %xmm0
movss 0x1d9a9(%rip), %xmm1    # 0x2d03c
subss %xmm1, %xmm0
movss %xmm0, 0x44(%rsp)
leaq 0x44(%rsp), %rsi
callq 0x20a50
movss (%rax), %xmm0
movss %xmm0, 0x20(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x20a00
movss 0x20(%rsp), %xmm0
movq (%rax), %rax
movss %xmm0, 0x3c(%rax)
leaq 0x60(%rsp), %rdi
callq 0x20a00
movq (%rax), %rax
movss 0x40(%rax), %xmm1
movss 0x4c(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jbe 0xf877
cvtsi2ssl 0x54(%rsp), %xmm0
callq 0x20a90
movss 0x1d93f(%rip), %xmm1    # 0x2d03c
divss %xmm1, %xmm0
callq 0x200a0
cvttss2si %xmm0, %eax
movl %eax, 0x40(%rsp)
movss 0x50(%rsp), %xmm0
movss 0x1d920(%rip), %xmm1    # 0x2d03c
subss %xmm1, %xmm0
movss %xmm0, 0x1c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x20a00
movss 0x1c(%rsp), %xmm0
movq (%rax), %rax
movss %xmm0, 0x3c(%rax)
movss 0x1d8ca(%rip), %xmm0    # 0x2d010
ucomiss 0x48(%rsp), %xmm0
jb 0xf762
movl 0x74(%rsp), %eax
movl %eax, 0x3c(%rsp)
movl 0x70(%rsp), %eax
movl %eax, 0x38(%rsp)
jmp 0xf858
movss 0x1d8aa(%rip), %xmm0    # 0x2d014
ucomiss 0x48(%rsp), %xmm0
jb 0xf7e5
movl 0x74(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x40(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0xc(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x10(%rsp)
callq 0x50b0
movl 0x40(%rsp), %ecx
addl $0x1, %ecx
cltd
idivl %ecx
movl 0x10(%rsp), %eax
addl %edx, %eax
movl %eax, 0x3c(%rsp)
movl 0x70(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x40(%rsp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl 0x14(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x18(%rsp)
callq 0x50b0
movl 0x40(%rsp), %ecx
addl $0x1, %ecx
cltd
idivl %ecx
movl 0x18(%rsp), %eax
addl %edx, %eax
movl %eax, 0x38(%rsp)
jmp 0xf856
movss 0x1d84f(%rip), %xmm0    # 0x2d03c
ucomiss 0x48(%rsp), %xmm0
jb 0xf844
movl 0x74(%rsp), %eax
subl 0x40(%rsp), %eax
movl %eax, 0x4(%rsp)
callq 0x50b0
movl 0x40(%rsp), %ecx
shll %ecx
addl $0x1, %ecx
cltd
idivl %ecx
movl 0x4(%rsp), %eax
addl %edx, %eax
movl %eax, 0x3c(%rsp)
movl 0x70(%rsp), %eax
subl 0x40(%rsp), %eax
movl %eax, 0x8(%rsp)
callq 0x50b0
movl 0x40(%rsp), %ecx
shll %ecx
addl $0x1, %ecx
cltd
idivl %ecx
movl 0x8(%rsp), %eax
addl %edx, %eax
movl %eax, 0x38(%rsp)
jmp 0xf854
movl $0xfffffe0c, 0x3c(%rsp) # imm = 0xFFFFFE0C
movl $0xfffffe0c, 0x38(%rsp) # imm = 0xFFFFFE0C
jmp 0xf856
jmp 0xf858
leaq 0x60(%rsp), %rdi
callq 0x20a00
movq (%rax), %rdi
movq 0x68(%rsp), %rsi
movl 0x3c(%rsp), %edx
movl 0x38(%rsp), %ecx
callq 0xf220
jmp 0xf879
jmp 0xf87b
leaq 0x60(%rsp), %rdi
callq 0x20ab0
jmp 0xf542
addq $0x78, %rsp
retq
nop