#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double log10(scalar_t__);
scalar_t__ pow(double, double);
void noise_sup(float *gain, float noise_gain, float max_noise, float max_atten,
               float nfact) {
  float gain_lev, suppress;
  if (noise_gain > max_noise)
    noise_gain = max_noise;
  gain_lev = *gain - (noise_gain + nfact);
  if (gain_lev > 0.001) {
    suppress = -10.0 * log10(1.0 - pow(10.0, -0.1 * gain_lev));
    if (suppress > max_atten)
      suppress = max_atten;
  } else
    suppress = max_atten;
  *gain -= suppress;
}


x86 assembly (clang, -O0):
<noise_sup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1159 <noise_sup+0x39>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  -0xc(%rbp),%xmm1
addss  -0x18(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1202 <noise_sup+0xe2>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe80(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe6c(%rip),%xmm0
call   1030 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe52(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1040 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    11fd <noise_sup+0xdd>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    120c <noise_sup+0xec>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noise_sup>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
minss  %xmm0,%xmm1
movss  (%rdi),%xmm0
addss  %xmm3,%xmm1
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
ucomisd 0xeb9(%rip),%xmm1
jbe    119e <noise_sup+0x7e>
mulsd  0xeb7(%rip),%xmm1
movsd  0xeb7(%rip),%xmm0
movss  %xmm2,0xc(%rsp)
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xea4(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1040 <log10@plt>
movss  0xc(%rsp),%xmm1
mulsd  0xe90(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jbe    11a1 <noise_sup+0x81>
movaps %xmm1,%xmm0
jmp    11a1 <noise_sup+0x81>
movaps %xmm2,%xmm0
movss  (%rbx),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @noise_sup(float* %0, float %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float* %0, float** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%13 = load float, float* %7
%14 = load float, float* %8
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %5
%17 = load float, float* %8
store float %17, float* %7
br label %18
18: ; preds = %16, %5
%19 = load float*, float** %6
%20 = load float, float* %19
%21 = load float, float* %7
%22 = load float, float* %10
%23 = fadd float %21, %22
%24 = fsub float %20, %23
store float %24, float* %11
%25 = load float, float* %11
%26 = fpext float %25 to double
%27 = fcmp ogt double %26, 1.000000e-03
br i1 %27, label %28, label %45
28: ; preds = %18
%29 = load float, float* %11
%30 = fpext float %29 to double
%31 = fmul double -1.000000e-01, %30
%32 = call i64 @pow(double 1.000000e+01, double %31)
%33 = sitofp i64 %32 to double
%34 = fsub double 1.000000e+00, %33
%35 = fptosi double %34 to i64
%36 = call double @log10(i64 %35)
%37 = fmul double -1.000000e+01, %36
%38 = fptrunc double %37 to float
store float %38, float* %12
%39 = load float, float* %12
%40 = load float, float* %9
%41 = fcmp ogt float %39, %40
br i1 %41, label %42, label %44
42: ; preds = %28
%43 = load float, float* %9
store float %43, float* %12
br label %44
44: ; preds = %42, %28
br label %47
45: ; preds = %18
%46 = load float, float* %9
store float %46, float* %12
br label %47
47: ; preds = %45, %44
%48 = load float, float* %12
%49 = load float*, float** %6
%50 = load float, float* %49
%51 = fsub float %50, %48
store float %51, float* %49
ret void
}

LLVM IR (-O2):
define void @noise_sup(float* nocapture %0, float %1, float %2, float %3, float %4) {
%6 = fcmp ogt float %1, %2
%7 = select i1 %6, float %2, float %1
%8 = load float, float* %0
%9 = fadd float %7, %4
%10 = fsub float %8, %9
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 1.000000e-03
br i1 %12, label %13, label %24
13: ; preds = %5
%14 = fmul double %11, -1.000000e-01
%15 = tail call i64 @pow(double 1.000000e+01, double %14)
%16 = sitofp i64 %15 to double
%17 = fsub double 1.000000e+00, %16
%18 = fptosi double %17 to i64
%19 = tail call double @log10(i64 %18)
%20 = fmul double %19, -1.000000e+01
%21 = fptrunc double %20 to float
%22 = fcmp ogt float %21, %3
br i1 %22, label %23, label %24
23: ; preds = %13
br label %24
24: ; preds = %5, %13, %23
%25 = phi float [ %3, %23 ], [ %21, %13 ], [ %3, %5 ]
%26 = load float, float* %0
%27 = fsub float %26, %25
store float %27, float* %0
ret void
}