#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 */
float exp(int);
int /*<<< orphan*/ fabsf(float);
float fmaxf(float, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, float);
int scanf(char *, float *);
int main(void) {
  const float FADE_B1 = exp(-1 / 0.150 / 44100);
  float sample_value;
  float running_peak = 0;
  while (scanf("%f", &sample_value) == 1) {
    running_peak *= FADE_B1;
    running_peak = fmaxf(running_peak, fabsf(sample_value));
    printf("%f\n", running_peak);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1060 <exp@plt>
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xe86(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11d6 <main+0x86>
movss  -0x8(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <fabsf@plt>
movss  -0x14(%rbp),%xmm0
mov    %eax,%edi
call   1050 <fmaxf@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
jmp    1173 <main+0x23>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <exp@plt>
movss  %xmm0,0xc(%rsp)
lea    0xe93(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11e8 <main+0x98>
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xe77(%rip),%r14
lea    0xe6d(%rip),%r15
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm0
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x8(%rsp),%xmm0
call   1030 <fabsf@plt>
movss  0x4(%rsp),%xmm0
mov    %eax,%edi
call   1050 <fmaxf@plt>
mov    %r14,%rdi
movss  %xmm0,0x4(%rsp)
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     11a0 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
store i32 0, i32* %1
%5 = call float @exp(i32 0)
store float %5, float* %2
store float 0.000000e+00, float* %4
br label %6
6: ; preds = %9, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load float, float* %2
%11 = load float, float* %4
%12 = fmul float %11, %10
store float %12, float* %4
%13 = load float, float* %4
%14 = load float, float* %3
%15 = call i32 @fabsf(float %14)
%16 = call float @fmaxf(float %13, i32 %15)
store float %16, float* %4
%17 = load float, float* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %17)
br label %6
19: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = tail call float @exp(i32 0)
%3 = bitcast float* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %15
6: ; preds = %0, %6
%7 = phi float [ %11, %6 ], [ 0.000000e+00, %0 ]
%8 = fmul float %2, %7
%9 = load float, float* %1
%10 = call i32 @fabsf(float %9)
%11 = call float @fmaxf(float %8, i32 %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %11)
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%14 = icmp eq i32 %13, 1
br i1 %14, label %6, label %15
15: ; preds = %6, %0
ret i32 0
}