void I_smr(ltmin, spike, scale) double spike[32], scale[32], ltmin[32];
{
  int i;
  double max;
  for (i = 0; i < 32; i++) {
    max = 20 * log10(scale[i] * 32768) - 10;
    if (spike[i] > max)
      max = spike[i];
    max -= ltmin[i];
    ltmin[i] = max;
  }
}


x86 assembly (clang, -O0):
<I_smr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    11d1 <I_smr+0xc1>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  0xecb(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1030 <log10@plt>
movsd  0xea9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1196 <I_smr+0x86>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <I_smr+0x1b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I_smr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r14,%rbx,8),%xmm0
mulsd  0xec2(%rip),%xmm0
call   1030 <log10@plt>
mulsd  0xebd(%rip),%xmm0
addsd  0xebd(%rip),%xmm0
movsd  (%r15,%rbx,8),%xmm1
maxsd  %xmm0,%xmm1
subsd  (%r12,%rbx,8),%xmm1
movsd  %xmm1,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1130 <I_smr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @I_smr(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
store i32 0, i32* %7
br label %9
9: ; preds = %47, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %50
12: ; preds = %9
%13 = load double*, double** %6
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %13, i64 %15
%17 = load double, double* %16
%18 = fmul double %17, 3.276800e+04
%19 = call double @log10(double %18)
%20 = call double @llvm.fmuladd.f64(double 2.000000e+01, double %19, double -1.000000e+01)
store double %20, double* %8
%21 = load double*, double** %5
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double, double* %8
%27 = fcmp ogt double %25, %26
br i1 %27, label %28, label %34
28: ; preds = %12
%29 = load double*, double** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds double, double* %29, i64 %31
%33 = load double, double* %32
store double %33, double* %8
br label %34
34: ; preds = %28, %12
%35 = load double*, double** %4
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = load double, double* %8
%41 = fsub double %40, %39
store double %41, double* %8
%42 = load double, double* %8
%43 = load double*, double** %4
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
store double %42, double* %46
br label %47
47: ; preds = %34
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %9
50: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @I_smr(double* nocapture %0, double* nocapture %1, double* nocapture %2) {
br label %4
4: ; preds = %3, %4
%5 = phi i64 [ 0, %3 ], [ %18, %4 ]
%6 = getelementptr inbounds double, double* %2, i64 %5
%7 = load double, double* %6
%8 = fmul double %7, 3.276800e+04
%9 = tail call double @log10(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %9, double 2.000000e+01, double -1.000000e+01)
%11 = getelementptr inbounds double, double* %1, i64 %5
%12 = load double, double* %11
%13 = fcmp ogt double %12, %10
%14 = select i1 %13, double %12, double %10
%15 = getelementptr inbounds double, double* %0, i64 %5
%16 = load double, double* %15
%17 = fsub double %14, %16
store double %17, double* %15
%18 = add nuw nsw i64 %5, 1
%19 = icmp eq i64 %18, 32
br i1 %19, label %20, label %4
20: ; preds = %4
ret void
}